forge-terminal 0.4.0 → 0.4.2
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/README.md +40 -4
- package/dist/chunks/{about-credits-6D6B2JTS.js → about-credits-PFW4OXPX.js} +1 -1
- package/dist/chunks/args-ZMSJ3NBZ.js +3 -0
- package/dist/chunks/{available-HYL2YE56.js → available-GYIHVSRX.js} +1 -1
- package/dist/chunks/boot-M6TQUYUF.js +3 -0
- package/dist/chunks/{catalog-U7IF2BH2.js → catalog-YSMT3PXT.js} +1 -1
- package/dist/chunks/{check-INHBJOBB.js → check-KAR72Y4X.js} +1 -1
- package/dist/chunks/chunk-3UEQ2OX6.js +3 -0
- package/dist/chunks/{chunk-SS7HNRZ5.js → chunk-5B5XXH22.js} +1 -1
- package/dist/chunks/chunk-5IS7O673.js +6 -0
- package/dist/chunks/chunk-6FUVEO3A.js +78 -0
- package/dist/chunks/chunk-6L6C3GJU.js +3 -0
- package/dist/chunks/{chunk-5GJK5LP5.js → chunk-AAXBN572.js} +2 -2
- package/dist/chunks/chunk-BCNMRALN.js +66 -0
- package/dist/chunks/{chunk-6TERL22R.js → chunk-DERIWZAT.js} +1 -1
- package/dist/chunks/chunk-DOWMSJ6R.js +3 -0
- package/dist/chunks/chunk-DTX4OGMY.js +63 -0
- package/dist/chunks/chunk-EEQSUBBL.js +3 -0
- package/dist/chunks/{chunk-C2OZ5ERA.js → chunk-EX7KZBI6.js} +1 -1
- package/dist/chunks/chunk-EXLXSKRH.js +3 -0
- package/dist/chunks/{chunk-BLPVRO4J.js → chunk-FH3R2YYD.js} +1 -1
- package/dist/chunks/{chunk-CLQHW4EF.js → chunk-GJ2GZHRI.js} +1 -1
- package/dist/chunks/chunk-HZDYZ5RD.js +3 -0
- package/dist/chunks/chunk-I63TO22X.js +3 -0
- package/dist/chunks/{chunk-ILWGG424.js → chunk-IGF6ZFTM.js} +1 -1
- package/dist/chunks/{chunk-Z2LELLNV.js → chunk-IWFVEMDN.js} +1 -1
- package/dist/chunks/{chunk-4LTI6JHW.js → chunk-JFJ3ZJQL.js} +2 -2
- package/dist/chunks/{chunk-OVILZLVA.js → chunk-JSMGNA55.js} +1 -1
- package/dist/chunks/chunk-KAHWYWNT.js +3 -0
- package/dist/chunks/chunk-LDKF7KIZ.js +6 -0
- package/dist/chunks/chunk-LNB5D67B.js +3 -0
- package/dist/chunks/chunk-M66BUNYO.js +3 -0
- package/dist/chunks/{chunk-MHW4OOQW.js → chunk-MV7H3QQY.js} +2 -2
- package/dist/chunks/{chunk-SVDVVRVP.js → chunk-P6NXFZZP.js} +1 -1
- package/dist/chunks/chunk-QR6QHTC3.js +3 -0
- package/dist/chunks/chunk-SMBK6BTC.js +3 -0
- package/dist/chunks/chunk-TDW6KQH6.js +3 -0
- package/dist/chunks/chunk-TMQDQLY7.js +21 -0
- package/dist/chunks/chunk-Y2A3HTKQ.js +4 -0
- package/dist/chunks/chunk-YWKMG5WO.js +3 -0
- package/dist/chunks/{chunk-FKPXXNKX.js → chunk-YYB3TTGT.js} +1 -1
- package/dist/chunks/clip-command-LAVVAHHV.js +3 -0
- package/dist/chunks/colour-AJW2JR3S.js +3 -0
- package/dist/chunks/command-I5M275ZV.js +3 -0
- package/dist/chunks/config-command-TYNYVUMP.js +3 -0
- package/dist/chunks/entry-UWADO4ND.js +6 -0
- package/dist/chunks/execute-MUM63CAA.js +3 -0
- package/dist/chunks/extensions-ZKAAFA4J.js +3 -0
- package/dist/chunks/{extensions-command-AITZYSMM.js → extensions-command-73UGWB6L.js} +1 -1
- package/dist/chunks/ffmpeg-PF3VLTHK.js +3 -0
- package/dist/chunks/image-J4FT4ACZ.js +3 -0
- package/dist/chunks/install-2A5BGKQU.js +3 -0
- package/dist/chunks/install-V62EEK54.js +3 -0
- package/dist/chunks/launch-S5BW2LZU.js +5 -0
- package/dist/chunks/lock-KN7CF4YN.js +3 -0
- package/dist/chunks/manager-743RM57Z.js +4 -0
- package/dist/chunks/{paths-KTXPDCDD.js → paths-5XI5L4KW.js} +1 -1
- package/dist/chunks/pdf-compress-U2E3CNXG.js +3 -0
- package/dist/chunks/{preferences-AUFJSKMJ.js → preferences-4VETUGMN.js} +1 -1
- package/dist/chunks/preset-command-HORY7KZQ.js +3 -0
- package/dist/chunks/{run-4Z6CRNHJ.js → run-6BK4REXK.js} +1 -1
- package/dist/chunks/{server-RM4YA6UL.js → server-DPBVFUL7.js} +6 -6
- package/dist/chunks/{theme-LR72ACFF.js → theme-USWAYNEH.js} +1 -1
- package/dist/chunks/transcribe-command-YUSBCQEQ.js +3 -0
- package/dist/chunks/{update-command-2SHKIIQD.js → update-command-GMBG7BK6.js} +1 -1
- package/dist/chunks/{update-note-UH2TQPJ6.js → update-note-VYJKUIIX.js} +1 -1
- package/dist/chunks/watch-command-KULANTL2.js +3 -0
- package/dist/helpers/forge-transcribe +0 -0
- package/dist/index.js +15 -72
- package/package.json +7 -21
- package/dist/chunks/boot-IQ4NYHEG.js +0 -3
- package/dist/chunks/chunk-26NDEWOQ.js +0 -3
- package/dist/chunks/chunk-2CK4RFPI.js +0 -3
- package/dist/chunks/chunk-3A43GEIR.js +0 -4
- package/dist/chunks/chunk-6V6WEBUI.js +0 -66
- package/dist/chunks/chunk-6VOCIMXQ.js +0 -3
- package/dist/chunks/chunk-7ZI3PFFX.js +0 -3
- package/dist/chunks/chunk-BXJ2HTKI.js +0 -3
- package/dist/chunks/chunk-CBE73ZWA.js +0 -3
- package/dist/chunks/chunk-D6JPP65L.js +0 -3
- package/dist/chunks/chunk-DW2EJIUX.js +0 -3
- package/dist/chunks/chunk-FWMFN36F.js +0 -3
- package/dist/chunks/chunk-HBDVKP3X.js +0 -5
- package/dist/chunks/chunk-HCN4BH2H.js +0 -3
- package/dist/chunks/chunk-IMC5NRDC.js +0 -3
- package/dist/chunks/chunk-JBSYGB3F.js +0 -3
- package/dist/chunks/chunk-PGG2OTK6.js +0 -3
- package/dist/chunks/chunk-XNNTF6FW.js +0 -3
- package/dist/chunks/chunk-ZONIA7SX.js +0 -21
- package/dist/chunks/clip-command-Q6SLD4U4.js +0 -3
- package/dist/chunks/colour-JPG24QYI.js +0 -3
- package/dist/chunks/config-command-R7QOBYF4.js +0 -3
- package/dist/chunks/execute-B7UL5RCU.js +0 -3
- package/dist/chunks/extensions-UR4GS47P.js +0 -3
- package/dist/chunks/image-KWRJIHQQ.js +0 -3
- package/dist/chunks/install-WBAFPZ2Q.js +0 -3
- package/dist/chunks/launch-RM5ZVXSU.js +0 -4
- package/dist/chunks/lock-GOOLFLSO.js +0 -3
- package/dist/chunks/manager-KZJ7WC34.js +0 -4
- package/dist/chunks/pdf-compress-IMRFBLZF.js +0 -3
- package/dist/chunks/preset-command-AXYFLVYA.js +0 -3
- package/dist/chunks/restart-TL76JEPU.js +0 -3
- package/dist/chunks/transcribe-command-6YTLVSMW.js +0 -3
- package/dist/chunks/watch-command-NU7QY6QU.js +0 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{i as Ht}from"./chunk-6VOCIMXQ.js";import{E as Ot,d as Tt,e as gt}from"./chunk-DW2EJIUX.js";import{a as wt}from"./chunk-BXJ2HTKI.js";import{c as et,e as xe}from"./chunk-TMUK2DD3.js";var it=et((zs,Qt)=>{"use strict";var Ut="[^\\\\/]",xr="(?=.)",Kt="[^/]",yt="(?:\\/|$)",Xt="(?:^|\\/)",Rt=`\\.{1,2}${yt}`,Cr="(?!\\.)",$r=`(?!${Xt}${Rt})`,Lr=`(?!\\.{0,1}${yt})`,vr=`(?!${Rt})`,wr="[^.\\/]",Tr=`${Kt}*?`,Or="/",jt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:xr,QMARK:Kt,END_ANCHOR:yt,DOTS_SLASH:Rt,NO_DOT:Cr,NO_DOTS:$r,NO_DOT_SLASH:Lr,NO_DOTS_SLASH:vr,QMARK_NO_DOT:wr,STAR:Tr,START_ANCHOR:Xt,SEP:Or},Hr={...jt,SLASH_LITERAL:"[\\\\/]",QMARK:Ut,STAR:`${Ut}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Ir={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Qt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Ir,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Hr:jt}}});var ut=et(q=>{"use strict";var{REGEX_BACKSLASH:Pr,REGEX_REMOVE_BACKSLASH:kr,REGEX_SPECIAL_CHARS:Dr,REGEX_SPECIAL_CHARS_GLOBAL:Nr}=it();q.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);q.hasRegexChars=t=>Dr.test(t);q.isRegexChar=t=>t.length===1&&q.hasRegexChars(t);q.escapeRegex=t=>t.replace(Nr,"\\$1");q.toPosixSlashes=t=>t.replace(Pr,"/");q.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};q.removeBackslashes=t=>t.replace(kr,r=>r==="\\"?"":r);q.escapeLast=(t,r,e)=>{let s=t.lastIndexOf(r,e);return s===-1?t:t[s-1]==="\\"?q.escapeLast(t,r,s-1):`${t.slice(0,s)}\\${t.slice(s)}`};q.removePrefix=(t,r={})=>{let e=t;return e.startsWith("./")&&(e=e.slice(2),r.prefix="./"),e};q.wrapOutput=(t,r={},e={})=>{let s=e.contains?"":"^",n=e.contains?"":"$",o=`${s}(?:${t})${n}`;return r.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};q.basename=(t,{windows:r}={})=>{let e=t.split(r?/[\\/]/:"/"),s=e[e.length-1];return s===""?e[e.length-2]:s}});var re=et((Zs,ee)=>{"use strict";var zt=ut(),{CHAR_ASTERISK:St,CHAR_AT:Fr,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:Br,CHAR_DOT:_t,CHAR_EXCLAMATION_MARK:Et,CHAR_FORWARD_SLASH:te,CHAR_LEFT_CURLY_BRACE:bt,CHAR_LEFT_PARENTHESES:ft,CHAR_LEFT_SQUARE_BRACKET:Mr,CHAR_PLUS:Gr,CHAR_QUESTION_MARK:Yt,CHAR_RIGHT_CURLY_BRACE:Wr,CHAR_RIGHT_PARENTHESES:Zt,CHAR_RIGHT_SQUARE_BRACKET:qr}=it(),Vt=t=>t===te||t===rt,Jt=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Ur=(t,r)=>{let e=r||{},s=t.length-1,n=e.parts===!0||e.tokens===!0||e.scanToEnd===!0,o=[],i=[],l=[],h=t,d=-1,g=0,A=0,S=!1,x=!1,y=!1,C=!1,H=!1,G=!1,_=!1,B=!1,j=!1,I=!1,w=0,L,R,m={value:"",depth:0,isGlob:!1},u=()=>d>=s,M=()=>h.charCodeAt(d+1),D=()=>(L=R,h.charCodeAt(++d));for(;d<s;){R=D();let $;if(R===rt){_=m.backslashes=!0,R=D(),R===bt&&(G=!0);continue}if(G===!0||R===bt){for(w++;u()!==!0&&(R=D());){if(R===rt){_=m.backslashes=!0,D();continue}if(R===bt){w++;continue}if(G!==!0&&R===_t&&(R=D())===_t){if(S=m.isBrace=!0,y=m.isGlob=!0,I=!0,n===!0)continue;break}if(G!==!0&&R===Br){if(S=m.isBrace=!0,y=m.isGlob=!0,I=!0,n===!0)continue;break}if(R===Wr&&(w--,w===0)){G=!1,S=m.isBrace=!0,I=!0;break}}if(n===!0)continue;break}if(R===te){if(o.push(d),i.push(m),m={value:"",depth:0,isGlob:!1},I===!0)continue;if(L===_t&&d===g+1){g+=2;continue}A=d+1;continue}if(e.noext!==!0&&(R===Gr||R===Fr||R===St||R===Yt||R===Et)===!0&&M()===ft){if(y=m.isGlob=!0,C=m.isExtglob=!0,I=!0,R===Et&&d===g&&(j=!0),n===!0){let U=0;for(;u()!==!0&&(R=D());){if(R===rt){_=m.backslashes=!0,D();continue}if(R===ft){U++;continue}if(R===Zt&&--U===0){I=!0;break}}continue}break}if(R===St){if(L===St&&(H=m.isGlobstar=!0),y=m.isGlob=!0,I=!0,n===!0)continue;break}if(R===Yt){if(y=m.isGlob=!0,I=!0,n===!0)continue;break}if(R===Mr){for(;u()!==!0&&($=D());){if($===rt){_=m.backslashes=!0,D();continue}if($===qr){x=m.isBracket=!0,y=m.isGlob=!0,I=!0;break}}if(n===!0)continue;break}if(e.nonegate!==!0&&R===Et&&d===g){B=m.negated=!0,g++;continue}if(e.noparen!==!0&&R===ft){if(y=m.isGlob=!0,n===!0){let W=1;for(;u()!==!0&&(R=D());){if(R===rt){_=m.backslashes=!0,D();continue}if(R===ft){W++;continue}if(R===Zt&&--W===0){I=!0;break}}continue}break}if(y===!0){if(I=!0,n===!0)continue;break}}e.noext===!0&&(C=!1,y=!1);let P=h,c="",a="";g>0&&(c=h.slice(0,g),h=h.slice(g),A-=g),P&&y===!0&&A>0?(P=h.slice(0,A),a=h.slice(A)):y===!0?(P="",a=h):P=h,P&&P!==""&&P!=="/"&&P!==h&&Vt(P.charCodeAt(P.length-1))&&(P=P.slice(0,-1)),e.unescape===!0&&(a&&(a=zt.removeBackslashes(a)),P&&_===!0&&(P=zt.removeBackslashes(P)));let X={prefix:c,input:t,start:g,base:P,glob:a,isBrace:S,isBracket:x,isGlob:y,isExtglob:C,isGlobstar:H,negated:B,negatedExtglob:j};if(e.tokens===!0&&(X.maxDepth=0,Vt(R)||i.push(m),X.tokens=i),e.parts===!0||e.tokens===!0){let $;for(let N=0;N<o.length;N++){let J=$!==void 0?$+1:g,ot=o[N],Y=t.slice(J,ot);e.tokens&&(N===0&&g!==0?(i[N].isPrefix=!0,i[N].value=c):i[N].value=Y,Jt(i[N]),X.maxDepth+=i[N].depth),ot>=g&&(l.push(Y),$=ot)}let W=$!==void 0?$+1:g,U=t.slice(W);l.push(U),e.tokens&&$&&$+1<t.length&&(i[i.length-1].value=U,Jt(i[i.length-1]),X.maxDepth+=i[i.length-1].depth),X.slashes=o,X.parts=l}return X};ee.exports=Ur});var ie=et((Vs,oe)=>{"use strict";var at=it(),K=ut(),{MAX_LENGTH:ht,POSIX_REGEX_SOURCE:Kr,REGEX_NON_SPECIAL_CHARS:Xr,REGEX_SPECIAL_CHARS_BACKREF:jr,REPLACEMENTS:se}=at,Qr=(t,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...t,r);t.sort();let e=`[${t.join("-")}]`;try{new RegExp(e)}catch{return t.map(n=>K.escapeRegex(n)).join("..")}return e},st=(t,r)=>`Missing ${t}: "${r}" - use "\\\\${r}" to match literal characters`,ne=t=>{let r=[],e=0,s=0,n=0,o="",i=!1;for(let l of t){if(i===!0){o+=l,i=!1;continue}if(l==="\\"){o+=l,i=!0;continue}if(l==='"'){n=n===1?0:1,o+=l;continue}if(n===0){if(l==="[")e++;else if(l==="]"&&e>0)e--;else if(e===0){if(l==="(")s++;else if(l===")"&&s>0)s--;else if(l==="|"&&s===0){r.push(o),o="";continue}}}o+=l}return r.push(o),r},zr=t=>{let r=!1;for(let e of t){if(r===!0){r=!1;continue}if(e==="\\"){r=!0;continue}if(/[?*+@!()[\]{}]/.test(e))return!1}return!0},xt=t=>{let r=t.trim(),e=!0;for(;e===!0;)e=!1,/^@\([^\\()[\]{}|]+\)$/.test(r)&&(r=r.slice(2,-1),e=!0);if(zr(r))return r.replace(/\\(.)/g,"$1")},Yr=t=>{let r=t.map(xt).filter(Boolean);for(let e=0;e<r.length;e++)for(let s=e+1;s<r.length;s++){let n=r[e],o=r[s],i=n[0];if(!(!i||n!==i.repeat(n.length)||o!==i.repeat(o.length))&&(n===o||n.startsWith(o)||o.startsWith(n)))return!0}return!1},mt=(t,r=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let e=0,s=0,n=0,o=!1;for(let i=1;i<t.length;i++){let l=t[i];if(o===!0){o=!1;continue}if(l==="\\"){o=!0;continue}if(l==='"'){n=n===1?0:1;continue}if(n!==1){if(l==="["){e++;continue}if(l==="]"&&e>0){e--;continue}if(!(e>0)){if(l==="("){s++;continue}if(l===")"&&(s--,s===0))return r===!0&&i!==t.length-1?void 0:{type:t[0],body:t.slice(2,i),end:i}}}}},Zr=t=>`${t.length===1?K.escapeRegex(t[0]):`[${t.map(e=>K.escapeRegex(e)).join("")}]`}*`,Vr=t=>{let r=0,e=[];for(;r<t.length;){let s=mt(t.slice(r),!1);if(!s||s.type!=="*")return;let n=ne(s.body).map(i=>i.trim());if(n.length!==1)return;let o=xt(n[0]);if(!o||o.length!==1)return;e.push(o),r+=s.end+1}if(!(e.length<1))return e},Jr=t=>{let r=0,e=t.trim(),s=mt(e);for(;s;)r++,e=s.body.trim(),s=mt(e);return r},ts=(t,r)=>{if(r.maxExtglobRecursion===!1)return{risky:!1};let e=typeof r.maxExtglobRecursion=="number"?r.maxExtglobRecursion:at.DEFAULT_MAX_EXTGLOB_RECURSION,s=ne(t).map(l=>l.trim());if(s.length>1&&(s.some(l=>l==="")||s.some(l=>/^[*?]+$/.test(l))||Yr(s)))return{risky:!0};let n=[],o=!1,i=!0;for(let l of s){let h=Vr(l);if(h){o=!0,n.push(...h);continue}let d=xt(l);if(d&&d.length===1){n.push(d);continue}if(i=!1,Jr(l)>e)return{risky:!0}}return o?i?{risky:!0,safeOutput:Zr([...new Set(n)])}:{risky:!0}:{risky:!1}},Ct=(t,r)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=se[t]||t;let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);let o={type:"bos",value:"",output:e.prepend||""},i=[o],l=e.capture?"":"?:",h=at.globChars(e.windows),d=at.extglobChars(h),{DOT_LITERAL:g,PLUS_LITERAL:A,SLASH_LITERAL:S,ONE_CHAR:x,DOTS_SLASH:y,NO_DOT:C,NO_DOT_SLASH:H,NO_DOTS_SLASH:G,QMARK:_,QMARK_NO_DOT:B,STAR:j,START_ANCHOR:I}=h,w=f=>`(${l}(?:(?!${I}${f.dot?y:g}).)*?)`,L=e.dot?"":C,R=e.dot?_:B,m=e.bash===!0?w(e):j;e.capture&&(m=`(${m})`),typeof e.noext=="boolean"&&(e.noextglob=e.noext);let u={input:t,index:-1,start:0,dot:e.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=K.removePrefix(t,u),n=t.length;let M=[],D=[],P=[],c=o,a,X=()=>u.index===n-1,$=u.peek=(f=1)=>t[u.index+f],W=u.advance=()=>t[++u.index]||"",U=()=>t.slice(u.index+1),N=(f="",O=0)=>{u.consumed+=f,u.index+=O},J=f=>{u.output+=f.output!=null?f.output:f.value,N(f.value)},ot=()=>{let f=1;for(;$()==="!"&&($(2)!=="("||$(3)==="?");)W(),u.start++,f++;return f%2===0?!1:(u.negated=!0,u.start++,!0)},Y=f=>{u[f]++,P.push(f)},z=f=>{u[f]--,P.pop()},E=f=>{if(c.type==="globstar"){let O=u.braces>0&&(f.type==="comma"||f.type==="brace"),p=f.extglob===!0||M.length&&(f.type==="pipe"||f.type==="paren");f.type!=="slash"&&f.type!=="paren"&&!O&&!p&&(u.output=u.output.slice(0,-c.output.length),c.type="star",c.value="*",c.output=m,u.output+=c.output)}if(M.length&&f.type!=="paren"&&(M[M.length-1].inner+=f.value),(f.value||f.output)&&J(f),c&&c.type==="text"&&f.type==="text"){c.output=(c.output||c.value)+f.value,c.value+=f.value;return}f.prev=c,i.push(f),c=f},lt=(f,O)=>{let p={...d[O],conditions:1,inner:""};p.prev=c,p.parens=u.parens,p.output=u.output,p.startIndex=u.index,p.tokensIndex=i.length;let b=(e.capture?"(":"")+p.open;Y("parens"),E({type:f,value:O,output:u.output?"":x}),E({type:"paren",extglob:!0,value:W(),output:b}),M.push(p)},me=f=>{let O=t.slice(f.startIndex,u.index+1),p=t.slice(f.startIndex+2,u.index),b=ts(p,e);if((f.type==="plus"||f.type==="star")&&b.risky){let v=b.safeOutput?(f.output?"":x)+(e.capture?`(${b.safeOutput})`:b.safeOutput):void 0,Q=i[f.tokensIndex];Q.type="text",Q.value=O,Q.output=v||K.escapeRegex(O);for(let Z=f.tokensIndex+1;Z<i.length;Z++)i[Z].value="",i[Z].output="",delete i[Z].suffix;u.output=f.output+Q.output,u.backtrack=!0,E({type:"paren",extglob:!0,value:a,output:""}),z("parens");return}let T=f.close+(e.capture?")":""),F;if(f.type==="negate"){let v=m;if(f.inner&&f.inner.length>1&&f.inner.includes("/")&&(v=w(e)),(v!==m||X()||/^\)+$/.test(U()))&&(T=f.close=`)$))${v}`),f.inner.includes("*")&&(F=U())&&/^\.[^\\/.]+$/.test(F)){let Q=Ct(F,{...r,fastpaths:!1}).output;T=f.close=`)${Q})${v})`}f.prev.type==="bos"&&(u.negatedExtglob=!0)}E({type:"paren",extglob:!0,value:a,output:T}),z("parens")};if(e.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let f=!1,O=t.replace(jr,(p,b,T,F,v,Q)=>F==="\\"?(f=!0,p):F==="?"?b?b+F+(v?_.repeat(v.length):""):Q===0?R+(v?_.repeat(v.length):""):_.repeat(T.length):F==="."?g.repeat(T.length):F==="*"?b?b+F+(v?m:""):m:b?p:`\\${p}`);return f===!0&&(e.unescape===!0?O=O.replace(/\\/g,""):O=O.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),O===t&&e.contains===!0?(u.output=t,u):(u.output=K.wrapOutput(O,u,r),u)}for(;!X();){if(a=W(),a==="\0")continue;if(a==="\\"){let p=$();if(p==="/"&&e.bash!==!0||p==="."||p===";")continue;if(!p){a+="\\",E({type:"text",value:a});continue}let b=/^\\+/.exec(U()),T=0;if(b&&b[0].length>2&&(T=b[0].length,u.index+=T,T%2!==0&&(a+="\\")),e.unescape===!0?a=W():a+=W(),u.brackets===0){E({type:"text",value:a});continue}}if(u.brackets>0&&(a!=="]"||c.value==="["||c.value==="[^")){if(e.posix!==!1&&a===":"){let p=c.value.slice(1);if(p.includes("[")&&(c.posix=!0,p.includes(":"))){let b=c.value.lastIndexOf("["),T=c.value.slice(0,b),F=c.value.slice(b+2),v=Kr[F];if(v){c.value=T+v,u.backtrack=!0,W(),!o.output&&i.indexOf(c)===1&&(o.output=x);continue}}}(a==="["&&$()!==":"||a==="-"&&$()==="]")&&(a=`\\${a}`),a==="]"&&(c.value==="["||c.value==="[^")&&(a=`\\${a}`),e.posix===!0&&a==="!"&&c.value==="["&&(a="^"),c.value+=a,J({value:a});continue}if(u.quotes===1&&a!=='"'){a=K.escapeRegex(a),c.value+=a,J({value:a});continue}if(a==='"'){u.quotes=u.quotes===1?0:1,e.keepQuotes===!0&&E({type:"text",value:a});continue}if(a==="("){Y("parens"),E({type:"paren",value:a});continue}if(a===")"){if(u.parens===0&&e.strictBrackets===!0)throw new SyntaxError(st("opening","("));let p=M[M.length-1];if(p&&u.parens===p.parens+1){me(M.pop());continue}E({type:"paren",value:a,output:u.parens?")":"\\)"}),z("parens");continue}if(a==="["){if(e.nobracket===!0||!U().includes("]")){if(e.nobracket!==!0&&e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));a=`\\${a}`}else Y("brackets");E({type:"bracket",value:a});continue}if(a==="]"){if(e.nobracket===!0||c&&c.type==="bracket"&&c.value.length===1){E({type:"text",value:a,output:`\\${a}`});continue}if(u.brackets===0){if(e.strictBrackets===!0)throw new SyntaxError(st("opening","["));E({type:"text",value:a,output:`\\${a}`});continue}z("brackets");let p=c.value.slice(1);if(c.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(a=`/${a}`),c.value+=a,J({value:a}),e.literalBrackets===!1||K.hasRegexChars(p))continue;let b=K.escapeRegex(c.value);if(u.output=u.output.slice(0,-c.value.length),e.literalBrackets===!0){u.output+=b,c.value=b;continue}c.value=`(${l}${b}|${c.value})`,u.output+=c.value;continue}if(a==="{"&&e.nobrace!==!0){Y("braces");let p={type:"brace",value:a,output:"(",outputIndex:u.output.length,tokensIndex:u.tokens.length};D.push(p),E(p);continue}if(a==="}"){let p=D[D.length-1];if(e.nobrace===!0||!p){E({type:"text",value:a,output:a});continue}let b=")";if(p.dots===!0){let T=i.slice(),F=[];for(let v=T.length-1;v>=0&&(i.pop(),T[v].type!=="brace");v--)T[v].type!=="dots"&&F.unshift(T[v].value);b=Qr(F,e),u.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let T=u.output.slice(0,p.outputIndex),F=u.tokens.slice(p.tokensIndex);p.value=p.output="\\{",a=b="\\}",u.output=T;for(let v of F)u.output+=v.output||v.value}E({type:"brace",value:a,output:b}),z("braces"),D.pop();continue}if(a==="|"){M.length>0&&M[M.length-1].conditions++,E({type:"text",value:a});continue}if(a===","){let p=a,b=D[D.length-1];b&&P[P.length-1]==="braces"&&(b.comma=!0,p="|"),E({type:"comma",value:a,output:p});continue}if(a==="/"){if(c.type==="dot"&&u.index===u.start+1){u.start=u.index+1,u.consumed="",u.output="",i.pop(),c=o;continue}E({type:"slash",value:a,output:S});continue}if(a==="."){if(u.braces>0&&c.type==="dot"){c.value==="."&&(c.output=g);let p=D[D.length-1];c.type="dots",c.output+=a,c.value+=a,p.dots=!0;continue}if(u.braces+u.parens===0&&c.type!=="bos"&&c.type!=="slash"){E({type:"text",value:a,output:g});continue}E({type:"dot",value:a,output:g});continue}if(a==="?"){if(!(c&&c.value==="(")&&e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("qmark",a);continue}if(c&&c.type==="paren"){let b=$(),T=a;(c.value==="("&&!/[!=<:]/.test(b)||b==="<"&&!/<([!=]|\w+>)/.test(U()))&&(T=`\\${a}`),E({type:"text",value:a,output:T});continue}if(e.dot!==!0&&(c.type==="slash"||c.type==="bos")){E({type:"qmark",value:a,output:B});continue}E({type:"qmark",value:a,output:_});continue}if(a==="!"){if(e.noextglob!==!0&&$()==="("&&($(2)!=="?"||!/[!=<:]/.test($(3)))){lt("negate",a);continue}if(e.nonegate!==!0&&u.index===0){ot();continue}}if(a==="+"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("plus",a);continue}if(c&&c.value==="("||e.regex===!1){E({type:"plus",value:a,output:A});continue}if(c&&(c.type==="bracket"||c.type==="paren"||c.type==="brace")||u.parens>0){E({type:"plus",value:a});continue}E({type:"plus",value:A});continue}if(a==="@"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){E({type:"at",extglob:!0,value:a,output:""});continue}E({type:"text",value:a});continue}if(a!=="*"){(a==="$"||a==="^")&&(a=`\\${a}`);let p=Xr.exec(U());p&&(a+=p[0],u.index+=p[0].length),E({type:"text",value:a});continue}if(c&&(c.type==="globstar"||c.star===!0)){c.type="star",c.star=!0,c.value+=a,c.output=m,u.backtrack=!0,u.globstar=!0,N(a);continue}let f=U();if(e.noextglob!==!0&&/^\([^?]/.test(f)){lt("star",a);continue}if(c.type==="star"){if(e.noglobstar===!0){N(a);continue}let p=c.prev,b=p.prev,T=p.type==="slash"||p.type==="bos",F=b&&(b.type==="star"||b.type==="globstar");if(e.bash===!0&&(!T||f[0]&&f[0]!=="/")){E({type:"star",value:a,output:""});continue}let v=u.braces>0&&(p.type==="comma"||p.type==="brace"),Q=M.length&&(p.type==="pipe"||p.type==="paren");if(!T&&p.type!=="paren"&&!v&&!Q){E({type:"star",value:a,output:""});continue}for(;f.slice(0,3)==="/**";){let tt=t[u.index+4];if(tt&&tt!=="/")break;f=f.slice(3),N("/**",3)}let Z=X()||u.parens>0&&f===")".repeat(u.parens)&&!M.some(tt=>tt.type==="negate");if(p.type==="bos"&&X()){c.type="globstar",c.value+=a,c.output=w(e),u.output=c.output,u.globstar=!0,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!F&&Z){u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=w(e)+(e.strictSlashes?")":"|$)"),c.value+=a,u.globstar=!0,u.output+=p.output+c.output,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&f[0]==="/"){let tt=f[1]!==void 0?"|$":"";u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=`${w(e)}${S}|${S}${tt})`,c.value+=a,u.output+=p.output+c.output,u.globstar=!0,N(a+W()),E({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&f[0]==="/"){c.type="globstar",c.value+=a,c.output=`(?:^|${S}|${w(e)}${S})`,u.output=c.output,u.globstar=!0,N(a+W()),E({type:"slash",value:"/",output:""});continue}u.output=u.output.slice(0,-c.output.length),c.type="globstar",c.output=w(e),c.value+=a,u.output+=c.output,u.globstar=!0,N(a);continue}let O={type:"star",value:a,output:m};if(e.bash===!0){O.output=".*?",(c.type==="bos"||c.type==="slash")&&(O.output=L+O.output),E(O);continue}if(c&&(c.type==="bracket"||c.type==="paren")&&e.regex===!0){O.output=a,E(O);continue}(u.index===u.start||c.type==="slash"||c.type==="dot")&&(c.type==="dot"?(u.output+=H,c.output+=H):e.dot===!0?(u.output+=G,c.output+=G):(u.output+=L,c.output+=L),$()!=="*"&&(u.output+=x,c.output+=x)),E(O)}for(;u.brackets>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));u.output=K.escapeLast(u.output,"["),z("brackets")}for(;u.parens>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing",")"));u.output=K.escapeLast(u.output,"("),z("parens")}for(;u.braces>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","}"));u.output=K.escapeLast(u.output,"{"),z("braces")}if(e.strictSlashes!==!0&&(c.type==="star"||c.type==="bracket")&&E({type:"maybe_slash",value:"",output:`${S}?`}),u.backtrack===!0){u.output="";for(let f of u.tokens)u.output+=f.output!=null?f.output:f.value,f.suffix&&(u.output+=f.suffix)}return u};Ct.fastpaths=(t,r)=>{let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);t=se[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:i,ONE_CHAR:l,DOTS_SLASH:h,NO_DOT:d,NO_DOTS:g,NO_DOTS_SLASH:A,STAR:S,START_ANCHOR:x}=at.globChars(e.windows),y=e.dot?g:d,C=e.dot?A:d,H=e.capture?"":"?:",G={negated:!1,prefix:""},_=e.bash===!0?".*?":S;e.capture&&(_=`(${_})`);let B=L=>L.noglobstar===!0?_:`(${H}(?:(?!${x}${L.dot?h:o}).)*?)`,j=L=>{switch(L){case"*":return`${y}${l}${_}`;case".*":return`${o}${l}${_}`;case"*.*":return`${y}${_}${o}${l}${_}`;case"*/*":return`${y}${_}${i}${l}${C}${_}`;case"**":return y+B(e);case"**/*":return`(?:${y}${B(e)}${i})?${C}${l}${_}`;case"**/*.*":return`(?:${y}${B(e)}${i})?${C}${_}${o}${l}${_}`;case"**/.*":return`(?:${y}${B(e)}${i})?${o}${l}${_}`;default:{let R=/^(.*?)\.(\w+)$/.exec(L);if(!R)return;let m=j(R[1]);return m?m+o+R[2]:void 0}}},I=K.removePrefix(t,G),w=j(I);return w&&e.strictSlashes!==!0&&(w+=`${i}?`),w};oe.exports=Ct});var ce=et((Js,ae)=>{"use strict";var es=re(),$t=ie(),ue=ut(),rs=it(),ss=t=>t&&typeof t=="object"&&!Array.isArray(t),k=(t,r,e=!1)=>{if(Array.isArray(t)){let g=t.map(S=>k(S,r,e));return S=>{for(let x of g){let y=x(S);if(y)return y}return!1}}let s=ss(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!s)throw new TypeError("Expected pattern to be a non-empty string");let n=r||{},o=n.windows,i=s?k.compileRe(t,r):k.makeRe(t,r,!1,!0),l=i.state;delete i.state;let h=()=>!1;if(n.ignore){let g={...r,ignore:null,onMatch:null,onResult:null};h=k(n.ignore,g,e)}let d=(g,A=!1)=>{let{isMatch:S,match:x,output:y}=k.test(g,i,r,{glob:t,posix:o}),C={glob:t,state:l,regex:i,posix:o,input:g,output:y,match:x,isMatch:S};return typeof n.onResult=="function"&&n.onResult(C),S===!1?(C.isMatch=!1,A?C:!1):h(g)?(typeof n.onIgnore=="function"&&n.onIgnore(C),C.isMatch=!1,A?C:!1):(typeof n.onMatch=="function"&&n.onMatch(C),A?C:!0)};return e&&(d.state=l),d};k.test=(t,r,e,{glob:s,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=e||{},i=o.format||(n?ue.toPosixSlashes:null),l=t===s,h=l&&i?i(t):t;return l===!1&&(h=i?i(t):t,l=h===s),(l===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?l=k.matchBase(t,r,e,n):l=r.exec(h)),{isMatch:!!l,match:l,output:h}};k.matchBase=(t,r,e,s=e&&e.windows)=>(r instanceof RegExp?r:k.makeRe(r,e)).test(ue.basename(t,{windows:s}));k.isMatch=(t,r,e)=>k(r,e)(t);k.parse=(t,r)=>Array.isArray(t)?t.map(e=>k.parse(e,r)):$t(t,{...r,fastpaths:!1});k.scan=(t,r)=>es(t,r);k.compileRe=(t,r,e=!1,s=!1)=>{if(e===!0)return t.output;let n=r||{},o=n.contains?"":"^",i=n.contains?"":"$",l=`${o}(?:${t.output})${i}`;t&&t.negated===!0&&(l=`^(?!${l}).*$`);let h=k.toRegex(l,r);return s===!0&&(h.state=t),h};k.makeRe=(t,r={},e=!1,s=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(n.output=$t.fastpaths(t,r)),n.output||(n=$t(t,r)),k.compileRe(n,r,e,s)};k.toRegex=(t,r)=>{try{let e=r||{};return new RegExp(t,e.flags||(e.nocase?"i":""))}catch(e){if(r&&r.debug===!0)throw e;return/$^/}};k.constants=rs;ae.exports=k});var he=et((tn,fe)=>{"use strict";var le=ce(),ns=ut();function pe(t,r,e=!1){return r&&(r.windows===null||r.windows===void 0)&&(r={...r,windows:ns.isWindows()}),le(t,r,e)}Object.assign(pe,le);fe.exports=pe});import{existsSync as ks}from"node:fs";import{stat as Ds}from"node:fs/promises";import{resolve as Ee}from"node:path";import{readdir as os,readdirSync as is,realpath as us,realpathSync as as,stat as cs,statSync as ls}from"fs";import{isAbsolute as ps,posix as V,resolve as fs}from"path";import{fileURLToPath as hs}from"url";import{createRequire as Ce}from"module";import{basename as $e,dirname as dt,normalize as Le,relative as ve,resolve as we,sep as kt}from"path";import*as Te from"fs";var It=Ce(import.meta.url);function Oe(t){let r=Le(t);return r.length>1&&r[r.length-1]===kt&&(r=r.substring(0,r.length-1)),r}var He=/[\\/]/g;function Dt(t,r){return t.replace(He,r)}var Ie=/^[a-z]:[\\/]$/i;function Pe(t){return t==="/"||Ie.test(t)}function At(t,r){let{resolvePaths:e,normalizePath:s,pathSeparator:n}=r,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(e&&(t=we(t)),(s||o)&&(t=Oe(t)),t===".")return"";let i=t[t.length-1]!==n;return Dt(i?t+n:t,n)}function Nt(t,r){return r+t}function ke(t,r){return function(e,s){return s.startsWith(t)?s.slice(t.length)+e:Dt(ve(t,s),r.pathSeparator)+r.pathSeparator+e}}function De(t){return t}function Ne(t,r,e){return r+t+e}function Fe(t,r){let{relativePaths:e,includeBasePath:s}=r;return e&&t?ke(t,r):s?Nt:De}function Be(t){return function(r,e){e.push(r.substring(t.length)||".")}}function Me(t){return function(r,e,s){let n=r.substring(t.length)||".";s.every(o=>o(n,!0))&&e.push(n)}}var Ge=(t,r)=>{r.push(t||".")},We=(t,r,e)=>{let s=t||".";e.every(n=>n(s,!0))&&r.push(s)},qe=()=>{};function Ue(t,r){let{includeDirs:e,filters:s,relativePaths:n}=r;return e?n?s&&s.length?Me(t):Be(t):s&&s.length?We:Ge:qe}var Ke=(t,r,e,s)=>{s.every(n=>n(t,!1))&&e.files++},Xe=(t,r,e,s)=>{s.every(n=>n(t,!1))&&r.push(t)},je=(t,r,e,s)=>{e.files++},Qe=(t,r)=>{r.push(t)},ze=()=>{};function Ye(t){let{excludeFiles:r,filters:e,onlyCounts:s}=t;return r?ze:e&&e.length?s?Ke:Xe:s?je:Qe}var Ze=t=>t,Ve=()=>[""].slice(0,0);function Je(t){return t.group?Ve:Ze}var tr=(t,r,e)=>{t.push({directory:r,files:e,dir:r})},er=()=>{};function rr(t){return t.group?tr:er}var sr=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue(),n.realpath(t,(i,l)=>{if(i)return s.dequeue(o?null:i,r);n.stat(l,(h,d)=>{if(h)return s.dequeue(o?null:h,r);if(d.isDirectory()&&Ft(t,l,r))return s.dequeue(null,r);e(d,l),s.dequeue(null,r)})})},nr=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue();try{let i=n.realpathSync(t),l=n.statSync(i);if(l.isDirectory()&&Ft(t,i,r))return;e(l,i)}catch(i){if(!o)throw i}};function or(t,r){return!t.resolveSymlinks||t.excludeSymlinks?null:r?nr:sr}function Ft(t,r,e){if(e.options.useRealPaths)return ir(r,e);let s=dt(t),n=1;for(;s!==e.root&&n<2;){let o=e.symlinks.get(s);!!o&&(o===r||o.startsWith(r)||r.startsWith(o))?n++:s=dt(s)}return e.symlinks.set(t,r),n>1}function ir(t,r){return r.visited.includes(t+r.options.pathSeparator)}var ur=t=>t.counts,ar=t=>t.groups,cr=t=>t.paths,lr=t=>t.paths.slice(0,t.options.maxFiles),pr=(t,r,e)=>(pt(r,e,t.counts,t.options.suppressErrors),null),fr=(t,r,e)=>(pt(r,e,t.paths,t.options.suppressErrors),null),hr=(t,r,e)=>(pt(r,e,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),gr=(t,r,e)=>(pt(r,e,t.groups,t.options.suppressErrors),null);function pt(t,r,e,s){r(t&&!s?t:null,e)}function Ar(t,r){let{onlyCounts:e,group:s,maxFiles:n}=t;return e?r?ur:pr:s?r?ar:gr:n?r?lr:hr:r?cr:fr}var Bt={withFileTypes:!0},dr=(t,r,e,s,n)=>{if(t.queue.enqueue(),s<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(r),t.counts.directories++,o.readdir(r||".",Bt,(i,l=[])=>{n(l,e,s),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},yr=(t,r,e,s,n)=>{let{fs:o}=t;if(s<0)return;t.visited.push(r),t.counts.directories++;let i=[];try{i=o.readdirSync(r||".",Bt)}catch(l){if(!t.options.suppressErrors)throw l}n(i,e,s)};function Rr(t){return t?yr:dr}var Sr=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,r){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,r),t&&(r.controller.abort(),this.onQueueEmpty=void 0))}},_r=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},Er=class{aborted=!1;abort(){this.aborted=!0}},Mt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,r,e){this.isSynchronous=!e,this.callbackInvoker=Ar(r,this.isSynchronous),this.root=At(t,r),this.state={root:Pe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new _r,options:r,queue:new Sr((s,n)=>this.callbackInvoker(n,s,e)),symlinks:new Map,visited:[""].slice(0,0),controller:new Er,fs:r.fs||Te},this.joinPath=Fe(this.root,r),this.pushDirectory=Ue(this.root,r),this.pushFile=Ye(r),this.getArray=Je(r),this.groupFiles=rr(r),this.resolveSymlink=or(r,this.isSynchronous),this.walkDirectory=Rr(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,r,e)=>{let{paths:s,options:{filters:n,resolveSymlinks:o,excludeSymlinks:i,exclude:l,maxFiles:h,signal:d,useRealPaths:g,pathSeparator:A},controller:S}=this.state;if(S.aborted||d&&d.aborted||h&&s.length>h)return;let x=this.getArray(this.state.paths);for(let y=0;y<t.length;++y){let C=t[y];if(C.isFile()||C.isSymbolicLink()&&!o&&!i){let H=this.joinPath(C.name,r);this.pushFile(H,x,this.state.counts,n)}else if(C.isDirectory()){let H=Ne(C.name,r,this.state.options.pathSeparator);if(l&&l(C.name,H))continue;this.pushDirectory(H,s,n),this.walkDirectory(this.state,H,H,e-1,this.walk)}else if(this.resolveSymlink&&C.isSymbolicLink()){let H=Nt(C.name,r);this.resolveSymlink(H,this.state,(G,_)=>{if(G.isDirectory()){if(_=At(_,this.state.options),l&&l(C.name,g?_:H+A))return;this.walkDirectory(this.state,_,g?_:H+A,e-1,this.walk)}else{_=g?_:H;let B=$e(_),j=At(dt(_),this.state.options);_=this.joinPath(B,j),this.pushFile(_,x,this.state.counts,n)}})}}this.groupFiles(this.state.groups,r,x)}};function br(t,r){return new Promise((e,s)=>{Gt(t,r,(n,o)=>{if(n)return s(n);e(o)})})}function Gt(t,r,e){new Mt(t,r,e).start()}function mr(t,r){return new Mt(t,r).start()}var Pt=class{constructor(t,r){this.root=t,this.options=r}withPromise(){return br(this.root,this.options)}withCallback(t){Gt(this.root,this.options,t)}sync(){return mr(this.root,this.options)}},Wt=null;try{It.resolve("picomatch"),Wt=It("picomatch")}catch{}var qt=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:kt,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new Pt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,r){return this.options={...this.options,...r},new Pt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...r){let e=this.globFunction||Wt;if(!e)throw new Error("Please specify a glob function to use glob matching.");var s=this.globCache[t.join("\0")];return s||(s=e(t,...r),this.globCache[t.join("\0")]=s),this.options.filters.push(n=>s(n)),this}};var nt=xe(he(),1),gs=Array.isArray,ye=/\\/g,As=/^[A-Za-z]:$/,Re=process.platform==="win32",ds=/^(\/?\.\.)+$/;function ys(t,r={}){let e=t.length,s=Array(e),n=Array(e),o,i;for(o=0;o<e;o++){let l=Se(t[o]);s[o]=l;let h=l.length,d=Array(h);for(i=0;i<h;i++)d[i]=(0,nt.default)(l[i],r);n[o]=d}return l=>{let h=l.split("/");if(h[0]===".."&&ds.test(l))return!0;for(o=0;o<e;o++){let d=s[o],g=n[o],A=h.length,S=Math.min(A,d.length);for(i=0;i<S;){let x=d[i];if(x.includes("/"))return!0;if(!g[i](h[i]))break;if(!r.noglobstar&&x==="**")return!0;i++}if(i===A)return!0}return!1}}var Rs=/^[A-Z]:\/$/i,Ss=Re?t=>Rs.test(t):t=>t==="/";function ge(t,r,e){if(t===r||r.startsWith(`${t}/`)){if(e){let n=t.length+ +!Ss(t);return(o,i)=>o.slice(n,i?-1:void 0)||"."}let s=r.slice(t.length+1);return s?(n,o)=>{if(n===".")return s;let i=`${s}/${n}`;return o?i.slice(0,-1):i}:(n,o)=>o&&n!=="."?n.slice(0,-1):n}return e?s=>V.relative(t,s)||".":s=>V.relative(t,`${r}/${s}`)||"."}function _s(t,r){if(r.startsWith(`${t}/`)){let e=r.slice(t.length+1);return s=>`${e}/${s}`}return e=>{let s=V.relative(t,`${r}/${e}`);return e[e.length-1]==="/"&&s!==""?`${s}/`:s||"."}}function Ae(t){return t.replace(As,r=>`${r}/`)}var Es={parts:!0};function Se(t){var r;let e=nt.default.scan(t,Es);return!((r=e.parts)===null||r===void 0)&&r.length?e.parts:[t]}var bs=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,ms=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,xs=t=>t.replace(bs,"\\$&"),Cs=t=>t.replace(ms,"\\$&"),$s=Re?Cs:xs;function Ls(t,r){if(r?.caseSensitiveMatch===!1)return!0;let e=nt.default.scan(t);return e.isGlob||e.negated}function ct(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function _e(t){return typeof t=="string"?[t]:t??[]}var vs=/^(\/?\.\.)+/,ws=/\\(?=[()[\]{}!*+?@|])/g;function Lt(t,r,e,s){var n;let o=r.cwd,i=t;t[t.length-1]==="/"&&(i=t.slice(0,-1)),i[i.length-1]!=="*"&&r.expandDirectories&&(i+="/**");let l=$s(o);i=ps(i.replace(ws,""))?V.relative(l,i):V.normalize(i);let h=(n=vs.exec(i))===null||n===void 0?void 0:n[0],d=Se(i);if(h){let A=(h.length+1)/3,S=0,x=l.split("/");for(;S<A&&d[S+A]===x[x.length+S-A];)i=i.slice(0,(A-S-1)*3)+i.slice((A-S)*3+d[S+A].length+1)||".",S++;let y=V.join(o,h.slice(S*3));y[0]!=="."&&e.root.length>y.length&&(e.root=Ae(y),e.depthOffset=-A+S)}if(!s&&e.depthOffset>=0){var g;(g=e.commonPath)!==null&&g!==void 0||(e.commonPath=d);let A=[],S=Math.min(e.commonPath.length,d.length);for(let x=0;x<S;x++){let y=d[x];if(y==="**"&&!d[x+1]){A.pop();break}if(x===d.length-1||y!==e.commonPath[x]||Ls(y))break;A.push(y)}e.depthOffset=A.length,e.commonPath=A,e.root=Ae(A.length>0?V.join(o,...A):o)}return i}function Ts(t,r,e){let s=[],n=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&n.push(Lt(o,t,e,!0));for(let o of r)o&&(o[0]!=="!"||o[1]==="("?s.push(Lt(o,t,e,!1)):(o[1]!=="!"||o[2]==="(")&&n.push(Lt(o.slice(1),t,e,!0)));return{match:s,ignore:n}}function Os(t,r){let e=t.cwd,s={root:e,depthOffset:0},n=Ts(t,r,s);t.debug&&ct("internal processing patterns:",n);let{absolute:o,caseSensitiveMatch:i,debug:l,dot:h,followSymbolicLinks:d,onlyDirectories:g}=t,A=s.root.replace(ye,""),S={dot:h,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},x=(0,nt.default)(n.match,S),y=(0,nt.default)(n.ignore,S),C=ys(n.match,S),H=ge(e,A,o),G=o?H:ge(e,A,!0),_=(I,w)=>{let L=G(w,!0);return L!=="."&&!C(L)||y(L)},B;t.deep!==void 0&&(B=Math.round(t.deep-s.depthOffset));let j=new qt({filters:[l?(I,w)=>{let L=H(I,w),R=x(L)&&!y(L);return R&&ct(`matched ${L}`),R}:(I,w)=>{let L=H(I,w);return x(L)&&!y(L)}],exclude:l?(I,w)=>{let L=_(I,w);return ct(`${L?"skipped":"crawling"} ${w}`),L}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:d,excludeSymlinks:!d,excludeFiles:g,includeDirs:g||!t.onlyFiles,maxDepth:B,signal:t.signal}).crawl(A);return t.debug&&ct("internal properties:",{...s,root:A}),[j,e!==A&&!o&&_s(e,A)]}function Hs(t,r){if(r)for(let e=t.length-1;e>=0;e--)t[e]=r(t[e]);return t}var de={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Is(t){let r=Object.assign({},t);for(let e in de)r[e]===void 0&&Object.assign(r,{[e]:de[e]});return r.cwd=(r.cwd instanceof URL?hs(r.cwd):fs(r.cwd||process.cwd())).replace(ye,"/"),r.ignore=_e(r.ignore),r.fs&&(r.fs={readdir:r.fs.readdir||os,readdirSync:r.fs.readdirSync||is,realpath:r.fs.realpath||us,realpathSync:r.fs.realpathSync||as,stat:r.fs.stat||cs,statSync:r.fs.statSync||ls}),r.debug&&ct("globbing with options:",r),r}function Ps(t,r={}){var e;if(t&&r?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let s=gs(t)||typeof t=="string",n=_e((e=s?t:t.patterns)!==null&&e!==void 0?e:"**/*"),o=Is(s?r:t);return n.length>0?Os(o,n):[]}async function vt(t,r){let[e,s]=Ps(t,r);return e?Hs(await e.withPromise(),s):[]}var be=Object.values(wt).flatMap(t=>t.extensions).map(t=>t.slice(1));function Ns(t){return/[*?[\]{}]/.test(t)}async function Fs(t,r){let e=r?`**/*.{${be.join(",")}}`:`*.{${be.join(",")}}`;return(await vt([e],{cwd:t,absolute:!0,onlyFiles:!0,caseSensitiveMatch:!1})).sort()}async function Bs(t,r,e,s){let n=await Fs(t,r);if(n.length===0){e.push({path:t,error:Ot(t)});return}for(let o of n)await s(o,t,!1)}async function gn(t,r){let e=[],s=[],n=new Map,o=new Set,i=async(l,h,d)=>{let g=Ee(l);if(!o.has(g)){o.add(g);try{e.push(await Ht(g)),h&&n.set(g,h)}catch(A){if(Tt(A))s.push({path:g,error:A});else if(d)throw A}}};for(let l of t){let h=Ee(l);if(Ns(l)&&!ks(h)){let g=(r.platform??process.platform)==="win32"?l.replaceAll("\\","/"):l,A=await vt([g],{absolute:!0,onlyFiles:!0});A.length===0&&s.push({path:h,error:gt(h)});for(let S of A.sort())await i(S,void 0,!1);continue}let d;try{d=await Ds(h)}catch{s.push({path:h,error:gt(h)});continue}if(d.isDirectory()){await Bs(h,r.recursive,s,i);continue}await i(h,void 0,!0)}return{sources:e,failures:s,roots:n}}export{gn as a};
|
|
3
|
+
import{i as Ht}from"./chunk-6L6C3GJU.js";import{E as Ot,d as Tt,e as gt}from"./chunk-3UEQ2OX6.js";import{a as wt}from"./chunk-M66BUNYO.js";import{c as et,e as xe}from"./chunk-TMUK2DD3.js";var it=et((zs,Qt)=>{"use strict";var Ut="[^\\\\/]",xr="(?=.)",Kt="[^/]",yt="(?:\\/|$)",Xt="(?:^|\\/)",Rt=`\\.{1,2}${yt}`,Cr="(?!\\.)",$r=`(?!${Xt}${Rt})`,Lr=`(?!\\.{0,1}${yt})`,vr=`(?!${Rt})`,wr="[^.\\/]",Tr=`${Kt}*?`,Or="/",jt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:xr,QMARK:Kt,END_ANCHOR:yt,DOTS_SLASH:Rt,NO_DOT:Cr,NO_DOTS:$r,NO_DOT_SLASH:Lr,NO_DOTS_SLASH:vr,QMARK_NO_DOT:wr,STAR:Tr,START_ANCHOR:Xt,SEP:Or},Hr={...jt,SLASH_LITERAL:"[\\\\/]",QMARK:Ut,STAR:`${Ut}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Ir={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Qt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Ir,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Hr:jt}}});var ut=et(q=>{"use strict";var{REGEX_BACKSLASH:Pr,REGEX_REMOVE_BACKSLASH:kr,REGEX_SPECIAL_CHARS:Dr,REGEX_SPECIAL_CHARS_GLOBAL:Nr}=it();q.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);q.hasRegexChars=t=>Dr.test(t);q.isRegexChar=t=>t.length===1&&q.hasRegexChars(t);q.escapeRegex=t=>t.replace(Nr,"\\$1");q.toPosixSlashes=t=>t.replace(Pr,"/");q.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};q.removeBackslashes=t=>t.replace(kr,r=>r==="\\"?"":r);q.escapeLast=(t,r,e)=>{let s=t.lastIndexOf(r,e);return s===-1?t:t[s-1]==="\\"?q.escapeLast(t,r,s-1):`${t.slice(0,s)}\\${t.slice(s)}`};q.removePrefix=(t,r={})=>{let e=t;return e.startsWith("./")&&(e=e.slice(2),r.prefix="./"),e};q.wrapOutput=(t,r={},e={})=>{let s=e.contains?"":"^",n=e.contains?"":"$",o=`${s}(?:${t})${n}`;return r.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};q.basename=(t,{windows:r}={})=>{let e=t.split(r?/[\\/]/:"/"),s=e[e.length-1];return s===""?e[e.length-2]:s}});var re=et((Zs,ee)=>{"use strict";var zt=ut(),{CHAR_ASTERISK:St,CHAR_AT:Fr,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:Br,CHAR_DOT:_t,CHAR_EXCLAMATION_MARK:Et,CHAR_FORWARD_SLASH:te,CHAR_LEFT_CURLY_BRACE:bt,CHAR_LEFT_PARENTHESES:ft,CHAR_LEFT_SQUARE_BRACKET:Mr,CHAR_PLUS:Gr,CHAR_QUESTION_MARK:Yt,CHAR_RIGHT_CURLY_BRACE:Wr,CHAR_RIGHT_PARENTHESES:Zt,CHAR_RIGHT_SQUARE_BRACKET:qr}=it(),Vt=t=>t===te||t===rt,Jt=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Ur=(t,r)=>{let e=r||{},s=t.length-1,n=e.parts===!0||e.tokens===!0||e.scanToEnd===!0,o=[],i=[],l=[],h=t,d=-1,g=0,A=0,S=!1,x=!1,y=!1,C=!1,H=!1,G=!1,_=!1,B=!1,j=!1,I=!1,w=0,L,R,m={value:"",depth:0,isGlob:!1},u=()=>d>=s,M=()=>h.charCodeAt(d+1),D=()=>(L=R,h.charCodeAt(++d));for(;d<s;){R=D();let $;if(R===rt){_=m.backslashes=!0,R=D(),R===bt&&(G=!0);continue}if(G===!0||R===bt){for(w++;u()!==!0&&(R=D());){if(R===rt){_=m.backslashes=!0,D();continue}if(R===bt){w++;continue}if(G!==!0&&R===_t&&(R=D())===_t){if(S=m.isBrace=!0,y=m.isGlob=!0,I=!0,n===!0)continue;break}if(G!==!0&&R===Br){if(S=m.isBrace=!0,y=m.isGlob=!0,I=!0,n===!0)continue;break}if(R===Wr&&(w--,w===0)){G=!1,S=m.isBrace=!0,I=!0;break}}if(n===!0)continue;break}if(R===te){if(o.push(d),i.push(m),m={value:"",depth:0,isGlob:!1},I===!0)continue;if(L===_t&&d===g+1){g+=2;continue}A=d+1;continue}if(e.noext!==!0&&(R===Gr||R===Fr||R===St||R===Yt||R===Et)===!0&&M()===ft){if(y=m.isGlob=!0,C=m.isExtglob=!0,I=!0,R===Et&&d===g&&(j=!0),n===!0){let U=0;for(;u()!==!0&&(R=D());){if(R===rt){_=m.backslashes=!0,D();continue}if(R===ft){U++;continue}if(R===Zt&&--U===0){I=!0;break}}continue}break}if(R===St){if(L===St&&(H=m.isGlobstar=!0),y=m.isGlob=!0,I=!0,n===!0)continue;break}if(R===Yt){if(y=m.isGlob=!0,I=!0,n===!0)continue;break}if(R===Mr){for(;u()!==!0&&($=D());){if($===rt){_=m.backslashes=!0,D();continue}if($===qr){x=m.isBracket=!0,y=m.isGlob=!0,I=!0;break}}if(n===!0)continue;break}if(e.nonegate!==!0&&R===Et&&d===g){B=m.negated=!0,g++;continue}if(e.noparen!==!0&&R===ft){if(y=m.isGlob=!0,n===!0){let W=1;for(;u()!==!0&&(R=D());){if(R===rt){_=m.backslashes=!0,D();continue}if(R===ft){W++;continue}if(R===Zt&&--W===0){I=!0;break}}continue}break}if(y===!0){if(I=!0,n===!0)continue;break}}e.noext===!0&&(C=!1,y=!1);let P=h,c="",a="";g>0&&(c=h.slice(0,g),h=h.slice(g),A-=g),P&&y===!0&&A>0?(P=h.slice(0,A),a=h.slice(A)):y===!0?(P="",a=h):P=h,P&&P!==""&&P!=="/"&&P!==h&&Vt(P.charCodeAt(P.length-1))&&(P=P.slice(0,-1)),e.unescape===!0&&(a&&(a=zt.removeBackslashes(a)),P&&_===!0&&(P=zt.removeBackslashes(P)));let X={prefix:c,input:t,start:g,base:P,glob:a,isBrace:S,isBracket:x,isGlob:y,isExtglob:C,isGlobstar:H,negated:B,negatedExtglob:j};if(e.tokens===!0&&(X.maxDepth=0,Vt(R)||i.push(m),X.tokens=i),e.parts===!0||e.tokens===!0){let $;for(let N=0;N<o.length;N++){let J=$!==void 0?$+1:g,ot=o[N],Y=t.slice(J,ot);e.tokens&&(N===0&&g!==0?(i[N].isPrefix=!0,i[N].value=c):i[N].value=Y,Jt(i[N]),X.maxDepth+=i[N].depth),ot>=g&&(l.push(Y),$=ot)}let W=$!==void 0?$+1:g,U=t.slice(W);l.push(U),e.tokens&&$&&$+1<t.length&&(i[i.length-1].value=U,Jt(i[i.length-1]),X.maxDepth+=i[i.length-1].depth),X.slashes=o,X.parts=l}return X};ee.exports=Ur});var ie=et((Vs,oe)=>{"use strict";var at=it(),K=ut(),{MAX_LENGTH:ht,POSIX_REGEX_SOURCE:Kr,REGEX_NON_SPECIAL_CHARS:Xr,REGEX_SPECIAL_CHARS_BACKREF:jr,REPLACEMENTS:se}=at,Qr=(t,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...t,r);t.sort();let e=`[${t.join("-")}]`;try{new RegExp(e)}catch{return t.map(n=>K.escapeRegex(n)).join("..")}return e},st=(t,r)=>`Missing ${t}: "${r}" - use "\\\\${r}" to match literal characters`,ne=t=>{let r=[],e=0,s=0,n=0,o="",i=!1;for(let l of t){if(i===!0){o+=l,i=!1;continue}if(l==="\\"){o+=l,i=!0;continue}if(l==='"'){n=n===1?0:1,o+=l;continue}if(n===0){if(l==="[")e++;else if(l==="]"&&e>0)e--;else if(e===0){if(l==="(")s++;else if(l===")"&&s>0)s--;else if(l==="|"&&s===0){r.push(o),o="";continue}}}o+=l}return r.push(o),r},zr=t=>{let r=!1;for(let e of t){if(r===!0){r=!1;continue}if(e==="\\"){r=!0;continue}if(/[?*+@!()[\]{}]/.test(e))return!1}return!0},xt=t=>{let r=t.trim(),e=!0;for(;e===!0;)e=!1,/^@\([^\\()[\]{}|]+\)$/.test(r)&&(r=r.slice(2,-1),e=!0);if(zr(r))return r.replace(/\\(.)/g,"$1")},Yr=t=>{let r=t.map(xt).filter(Boolean);for(let e=0;e<r.length;e++)for(let s=e+1;s<r.length;s++){let n=r[e],o=r[s],i=n[0];if(!(!i||n!==i.repeat(n.length)||o!==i.repeat(o.length))&&(n===o||n.startsWith(o)||o.startsWith(n)))return!0}return!1},mt=(t,r=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let e=0,s=0,n=0,o=!1;for(let i=1;i<t.length;i++){let l=t[i];if(o===!0){o=!1;continue}if(l==="\\"){o=!0;continue}if(l==='"'){n=n===1?0:1;continue}if(n!==1){if(l==="["){e++;continue}if(l==="]"&&e>0){e--;continue}if(!(e>0)){if(l==="("){s++;continue}if(l===")"&&(s--,s===0))return r===!0&&i!==t.length-1?void 0:{type:t[0],body:t.slice(2,i),end:i}}}}},Zr=t=>`${t.length===1?K.escapeRegex(t[0]):`[${t.map(e=>K.escapeRegex(e)).join("")}]`}*`,Vr=t=>{let r=0,e=[];for(;r<t.length;){let s=mt(t.slice(r),!1);if(!s||s.type!=="*")return;let n=ne(s.body).map(i=>i.trim());if(n.length!==1)return;let o=xt(n[0]);if(!o||o.length!==1)return;e.push(o),r+=s.end+1}if(!(e.length<1))return e},Jr=t=>{let r=0,e=t.trim(),s=mt(e);for(;s;)r++,e=s.body.trim(),s=mt(e);return r},ts=(t,r)=>{if(r.maxExtglobRecursion===!1)return{risky:!1};let e=typeof r.maxExtglobRecursion=="number"?r.maxExtglobRecursion:at.DEFAULT_MAX_EXTGLOB_RECURSION,s=ne(t).map(l=>l.trim());if(s.length>1&&(s.some(l=>l==="")||s.some(l=>/^[*?]+$/.test(l))||Yr(s)))return{risky:!0};let n=[],o=!1,i=!0;for(let l of s){let h=Vr(l);if(h){o=!0,n.push(...h);continue}let d=xt(l);if(d&&d.length===1){n.push(d);continue}if(i=!1,Jr(l)>e)return{risky:!0}}return o?i?{risky:!0,safeOutput:Zr([...new Set(n)])}:{risky:!0}:{risky:!1}},Ct=(t,r)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=se[t]||t;let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);let o={type:"bos",value:"",output:e.prepend||""},i=[o],l=e.capture?"":"?:",h=at.globChars(e.windows),d=at.extglobChars(h),{DOT_LITERAL:g,PLUS_LITERAL:A,SLASH_LITERAL:S,ONE_CHAR:x,DOTS_SLASH:y,NO_DOT:C,NO_DOT_SLASH:H,NO_DOTS_SLASH:G,QMARK:_,QMARK_NO_DOT:B,STAR:j,START_ANCHOR:I}=h,w=f=>`(${l}(?:(?!${I}${f.dot?y:g}).)*?)`,L=e.dot?"":C,R=e.dot?_:B,m=e.bash===!0?w(e):j;e.capture&&(m=`(${m})`),typeof e.noext=="boolean"&&(e.noextglob=e.noext);let u={input:t,index:-1,start:0,dot:e.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=K.removePrefix(t,u),n=t.length;let M=[],D=[],P=[],c=o,a,X=()=>u.index===n-1,$=u.peek=(f=1)=>t[u.index+f],W=u.advance=()=>t[++u.index]||"",U=()=>t.slice(u.index+1),N=(f="",O=0)=>{u.consumed+=f,u.index+=O},J=f=>{u.output+=f.output!=null?f.output:f.value,N(f.value)},ot=()=>{let f=1;for(;$()==="!"&&($(2)!=="("||$(3)==="?");)W(),u.start++,f++;return f%2===0?!1:(u.negated=!0,u.start++,!0)},Y=f=>{u[f]++,P.push(f)},z=f=>{u[f]--,P.pop()},E=f=>{if(c.type==="globstar"){let O=u.braces>0&&(f.type==="comma"||f.type==="brace"),p=f.extglob===!0||M.length&&(f.type==="pipe"||f.type==="paren");f.type!=="slash"&&f.type!=="paren"&&!O&&!p&&(u.output=u.output.slice(0,-c.output.length),c.type="star",c.value="*",c.output=m,u.output+=c.output)}if(M.length&&f.type!=="paren"&&(M[M.length-1].inner+=f.value),(f.value||f.output)&&J(f),c&&c.type==="text"&&f.type==="text"){c.output=(c.output||c.value)+f.value,c.value+=f.value;return}f.prev=c,i.push(f),c=f},lt=(f,O)=>{let p={...d[O],conditions:1,inner:""};p.prev=c,p.parens=u.parens,p.output=u.output,p.startIndex=u.index,p.tokensIndex=i.length;let b=(e.capture?"(":"")+p.open;Y("parens"),E({type:f,value:O,output:u.output?"":x}),E({type:"paren",extglob:!0,value:W(),output:b}),M.push(p)},me=f=>{let O=t.slice(f.startIndex,u.index+1),p=t.slice(f.startIndex+2,u.index),b=ts(p,e);if((f.type==="plus"||f.type==="star")&&b.risky){let v=b.safeOutput?(f.output?"":x)+(e.capture?`(${b.safeOutput})`:b.safeOutput):void 0,Q=i[f.tokensIndex];Q.type="text",Q.value=O,Q.output=v||K.escapeRegex(O);for(let Z=f.tokensIndex+1;Z<i.length;Z++)i[Z].value="",i[Z].output="",delete i[Z].suffix;u.output=f.output+Q.output,u.backtrack=!0,E({type:"paren",extglob:!0,value:a,output:""}),z("parens");return}let T=f.close+(e.capture?")":""),F;if(f.type==="negate"){let v=m;if(f.inner&&f.inner.length>1&&f.inner.includes("/")&&(v=w(e)),(v!==m||X()||/^\)+$/.test(U()))&&(T=f.close=`)$))${v}`),f.inner.includes("*")&&(F=U())&&/^\.[^\\/.]+$/.test(F)){let Q=Ct(F,{...r,fastpaths:!1}).output;T=f.close=`)${Q})${v})`}f.prev.type==="bos"&&(u.negatedExtglob=!0)}E({type:"paren",extglob:!0,value:a,output:T}),z("parens")};if(e.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let f=!1,O=t.replace(jr,(p,b,T,F,v,Q)=>F==="\\"?(f=!0,p):F==="?"?b?b+F+(v?_.repeat(v.length):""):Q===0?R+(v?_.repeat(v.length):""):_.repeat(T.length):F==="."?g.repeat(T.length):F==="*"?b?b+F+(v?m:""):m:b?p:`\\${p}`);return f===!0&&(e.unescape===!0?O=O.replace(/\\/g,""):O=O.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),O===t&&e.contains===!0?(u.output=t,u):(u.output=K.wrapOutput(O,u,r),u)}for(;!X();){if(a=W(),a==="\0")continue;if(a==="\\"){let p=$();if(p==="/"&&e.bash!==!0||p==="."||p===";")continue;if(!p){a+="\\",E({type:"text",value:a});continue}let b=/^\\+/.exec(U()),T=0;if(b&&b[0].length>2&&(T=b[0].length,u.index+=T,T%2!==0&&(a+="\\")),e.unescape===!0?a=W():a+=W(),u.brackets===0){E({type:"text",value:a});continue}}if(u.brackets>0&&(a!=="]"||c.value==="["||c.value==="[^")){if(e.posix!==!1&&a===":"){let p=c.value.slice(1);if(p.includes("[")&&(c.posix=!0,p.includes(":"))){let b=c.value.lastIndexOf("["),T=c.value.slice(0,b),F=c.value.slice(b+2),v=Kr[F];if(v){c.value=T+v,u.backtrack=!0,W(),!o.output&&i.indexOf(c)===1&&(o.output=x);continue}}}(a==="["&&$()!==":"||a==="-"&&$()==="]")&&(a=`\\${a}`),a==="]"&&(c.value==="["||c.value==="[^")&&(a=`\\${a}`),e.posix===!0&&a==="!"&&c.value==="["&&(a="^"),c.value+=a,J({value:a});continue}if(u.quotes===1&&a!=='"'){a=K.escapeRegex(a),c.value+=a,J({value:a});continue}if(a==='"'){u.quotes=u.quotes===1?0:1,e.keepQuotes===!0&&E({type:"text",value:a});continue}if(a==="("){Y("parens"),E({type:"paren",value:a});continue}if(a===")"){if(u.parens===0&&e.strictBrackets===!0)throw new SyntaxError(st("opening","("));let p=M[M.length-1];if(p&&u.parens===p.parens+1){me(M.pop());continue}E({type:"paren",value:a,output:u.parens?")":"\\)"}),z("parens");continue}if(a==="["){if(e.nobracket===!0||!U().includes("]")){if(e.nobracket!==!0&&e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));a=`\\${a}`}else Y("brackets");E({type:"bracket",value:a});continue}if(a==="]"){if(e.nobracket===!0||c&&c.type==="bracket"&&c.value.length===1){E({type:"text",value:a,output:`\\${a}`});continue}if(u.brackets===0){if(e.strictBrackets===!0)throw new SyntaxError(st("opening","["));E({type:"text",value:a,output:`\\${a}`});continue}z("brackets");let p=c.value.slice(1);if(c.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(a=`/${a}`),c.value+=a,J({value:a}),e.literalBrackets===!1||K.hasRegexChars(p))continue;let b=K.escapeRegex(c.value);if(u.output=u.output.slice(0,-c.value.length),e.literalBrackets===!0){u.output+=b,c.value=b;continue}c.value=`(${l}${b}|${c.value})`,u.output+=c.value;continue}if(a==="{"&&e.nobrace!==!0){Y("braces");let p={type:"brace",value:a,output:"(",outputIndex:u.output.length,tokensIndex:u.tokens.length};D.push(p),E(p);continue}if(a==="}"){let p=D[D.length-1];if(e.nobrace===!0||!p){E({type:"text",value:a,output:a});continue}let b=")";if(p.dots===!0){let T=i.slice(),F=[];for(let v=T.length-1;v>=0&&(i.pop(),T[v].type!=="brace");v--)T[v].type!=="dots"&&F.unshift(T[v].value);b=Qr(F,e),u.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let T=u.output.slice(0,p.outputIndex),F=u.tokens.slice(p.tokensIndex);p.value=p.output="\\{",a=b="\\}",u.output=T;for(let v of F)u.output+=v.output||v.value}E({type:"brace",value:a,output:b}),z("braces"),D.pop();continue}if(a==="|"){M.length>0&&M[M.length-1].conditions++,E({type:"text",value:a});continue}if(a===","){let p=a,b=D[D.length-1];b&&P[P.length-1]==="braces"&&(b.comma=!0,p="|"),E({type:"comma",value:a,output:p});continue}if(a==="/"){if(c.type==="dot"&&u.index===u.start+1){u.start=u.index+1,u.consumed="",u.output="",i.pop(),c=o;continue}E({type:"slash",value:a,output:S});continue}if(a==="."){if(u.braces>0&&c.type==="dot"){c.value==="."&&(c.output=g);let p=D[D.length-1];c.type="dots",c.output+=a,c.value+=a,p.dots=!0;continue}if(u.braces+u.parens===0&&c.type!=="bos"&&c.type!=="slash"){E({type:"text",value:a,output:g});continue}E({type:"dot",value:a,output:g});continue}if(a==="?"){if(!(c&&c.value==="(")&&e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("qmark",a);continue}if(c&&c.type==="paren"){let b=$(),T=a;(c.value==="("&&!/[!=<:]/.test(b)||b==="<"&&!/<([!=]|\w+>)/.test(U()))&&(T=`\\${a}`),E({type:"text",value:a,output:T});continue}if(e.dot!==!0&&(c.type==="slash"||c.type==="bos")){E({type:"qmark",value:a,output:B});continue}E({type:"qmark",value:a,output:_});continue}if(a==="!"){if(e.noextglob!==!0&&$()==="("&&($(2)!=="?"||!/[!=<:]/.test($(3)))){lt("negate",a);continue}if(e.nonegate!==!0&&u.index===0){ot();continue}}if(a==="+"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("plus",a);continue}if(c&&c.value==="("||e.regex===!1){E({type:"plus",value:a,output:A});continue}if(c&&(c.type==="bracket"||c.type==="paren"||c.type==="brace")||u.parens>0){E({type:"plus",value:a});continue}E({type:"plus",value:A});continue}if(a==="@"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){E({type:"at",extglob:!0,value:a,output:""});continue}E({type:"text",value:a});continue}if(a!=="*"){(a==="$"||a==="^")&&(a=`\\${a}`);let p=Xr.exec(U());p&&(a+=p[0],u.index+=p[0].length),E({type:"text",value:a});continue}if(c&&(c.type==="globstar"||c.star===!0)){c.type="star",c.star=!0,c.value+=a,c.output=m,u.backtrack=!0,u.globstar=!0,N(a);continue}let f=U();if(e.noextglob!==!0&&/^\([^?]/.test(f)){lt("star",a);continue}if(c.type==="star"){if(e.noglobstar===!0){N(a);continue}let p=c.prev,b=p.prev,T=p.type==="slash"||p.type==="bos",F=b&&(b.type==="star"||b.type==="globstar");if(e.bash===!0&&(!T||f[0]&&f[0]!=="/")){E({type:"star",value:a,output:""});continue}let v=u.braces>0&&(p.type==="comma"||p.type==="brace"),Q=M.length&&(p.type==="pipe"||p.type==="paren");if(!T&&p.type!=="paren"&&!v&&!Q){E({type:"star",value:a,output:""});continue}for(;f.slice(0,3)==="/**";){let tt=t[u.index+4];if(tt&&tt!=="/")break;f=f.slice(3),N("/**",3)}let Z=X()||u.parens>0&&f===")".repeat(u.parens)&&!M.some(tt=>tt.type==="negate");if(p.type==="bos"&&X()){c.type="globstar",c.value+=a,c.output=w(e),u.output=c.output,u.globstar=!0,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!F&&Z){u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=w(e)+(e.strictSlashes?")":"|$)"),c.value+=a,u.globstar=!0,u.output+=p.output+c.output,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&f[0]==="/"){let tt=f[1]!==void 0?"|$":"";u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=`${w(e)}${S}|${S}${tt})`,c.value+=a,u.output+=p.output+c.output,u.globstar=!0,N(a+W()),E({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&f[0]==="/"){c.type="globstar",c.value+=a,c.output=`(?:^|${S}|${w(e)}${S})`,u.output=c.output,u.globstar=!0,N(a+W()),E({type:"slash",value:"/",output:""});continue}u.output=u.output.slice(0,-c.output.length),c.type="globstar",c.output=w(e),c.value+=a,u.output+=c.output,u.globstar=!0,N(a);continue}let O={type:"star",value:a,output:m};if(e.bash===!0){O.output=".*?",(c.type==="bos"||c.type==="slash")&&(O.output=L+O.output),E(O);continue}if(c&&(c.type==="bracket"||c.type==="paren")&&e.regex===!0){O.output=a,E(O);continue}(u.index===u.start||c.type==="slash"||c.type==="dot")&&(c.type==="dot"?(u.output+=H,c.output+=H):e.dot===!0?(u.output+=G,c.output+=G):(u.output+=L,c.output+=L),$()!=="*"&&(u.output+=x,c.output+=x)),E(O)}for(;u.brackets>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));u.output=K.escapeLast(u.output,"["),z("brackets")}for(;u.parens>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing",")"));u.output=K.escapeLast(u.output,"("),z("parens")}for(;u.braces>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","}"));u.output=K.escapeLast(u.output,"{"),z("braces")}if(e.strictSlashes!==!0&&(c.type==="star"||c.type==="bracket")&&E({type:"maybe_slash",value:"",output:`${S}?`}),u.backtrack===!0){u.output="";for(let f of u.tokens)u.output+=f.output!=null?f.output:f.value,f.suffix&&(u.output+=f.suffix)}return u};Ct.fastpaths=(t,r)=>{let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);t=se[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:i,ONE_CHAR:l,DOTS_SLASH:h,NO_DOT:d,NO_DOTS:g,NO_DOTS_SLASH:A,STAR:S,START_ANCHOR:x}=at.globChars(e.windows),y=e.dot?g:d,C=e.dot?A:d,H=e.capture?"":"?:",G={negated:!1,prefix:""},_=e.bash===!0?".*?":S;e.capture&&(_=`(${_})`);let B=L=>L.noglobstar===!0?_:`(${H}(?:(?!${x}${L.dot?h:o}).)*?)`,j=L=>{switch(L){case"*":return`${y}${l}${_}`;case".*":return`${o}${l}${_}`;case"*.*":return`${y}${_}${o}${l}${_}`;case"*/*":return`${y}${_}${i}${l}${C}${_}`;case"**":return y+B(e);case"**/*":return`(?:${y}${B(e)}${i})?${C}${l}${_}`;case"**/*.*":return`(?:${y}${B(e)}${i})?${C}${_}${o}${l}${_}`;case"**/.*":return`(?:${y}${B(e)}${i})?${o}${l}${_}`;default:{let R=/^(.*?)\.(\w+)$/.exec(L);if(!R)return;let m=j(R[1]);return m?m+o+R[2]:void 0}}},I=K.removePrefix(t,G),w=j(I);return w&&e.strictSlashes!==!0&&(w+=`${i}?`),w};oe.exports=Ct});var ce=et((Js,ae)=>{"use strict";var es=re(),$t=ie(),ue=ut(),rs=it(),ss=t=>t&&typeof t=="object"&&!Array.isArray(t),k=(t,r,e=!1)=>{if(Array.isArray(t)){let g=t.map(S=>k(S,r,e));return S=>{for(let x of g){let y=x(S);if(y)return y}return!1}}let s=ss(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!s)throw new TypeError("Expected pattern to be a non-empty string");let n=r||{},o=n.windows,i=s?k.compileRe(t,r):k.makeRe(t,r,!1,!0),l=i.state;delete i.state;let h=()=>!1;if(n.ignore){let g={...r,ignore:null,onMatch:null,onResult:null};h=k(n.ignore,g,e)}let d=(g,A=!1)=>{let{isMatch:S,match:x,output:y}=k.test(g,i,r,{glob:t,posix:o}),C={glob:t,state:l,regex:i,posix:o,input:g,output:y,match:x,isMatch:S};return typeof n.onResult=="function"&&n.onResult(C),S===!1?(C.isMatch=!1,A?C:!1):h(g)?(typeof n.onIgnore=="function"&&n.onIgnore(C),C.isMatch=!1,A?C:!1):(typeof n.onMatch=="function"&&n.onMatch(C),A?C:!0)};return e&&(d.state=l),d};k.test=(t,r,e,{glob:s,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=e||{},i=o.format||(n?ue.toPosixSlashes:null),l=t===s,h=l&&i?i(t):t;return l===!1&&(h=i?i(t):t,l=h===s),(l===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?l=k.matchBase(t,r,e,n):l=r.exec(h)),{isMatch:!!l,match:l,output:h}};k.matchBase=(t,r,e,s=e&&e.windows)=>(r instanceof RegExp?r:k.makeRe(r,e)).test(ue.basename(t,{windows:s}));k.isMatch=(t,r,e)=>k(r,e)(t);k.parse=(t,r)=>Array.isArray(t)?t.map(e=>k.parse(e,r)):$t(t,{...r,fastpaths:!1});k.scan=(t,r)=>es(t,r);k.compileRe=(t,r,e=!1,s=!1)=>{if(e===!0)return t.output;let n=r||{},o=n.contains?"":"^",i=n.contains?"":"$",l=`${o}(?:${t.output})${i}`;t&&t.negated===!0&&(l=`^(?!${l}).*$`);let h=k.toRegex(l,r);return s===!0&&(h.state=t),h};k.makeRe=(t,r={},e=!1,s=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(n.output=$t.fastpaths(t,r)),n.output||(n=$t(t,r)),k.compileRe(n,r,e,s)};k.toRegex=(t,r)=>{try{let e=r||{};return new RegExp(t,e.flags||(e.nocase?"i":""))}catch(e){if(r&&r.debug===!0)throw e;return/$^/}};k.constants=rs;ae.exports=k});var he=et((tn,fe)=>{"use strict";var le=ce(),ns=ut();function pe(t,r,e=!1){return r&&(r.windows===null||r.windows===void 0)&&(r={...r,windows:ns.isWindows()}),le(t,r,e)}Object.assign(pe,le);fe.exports=pe});import{existsSync as ks}from"node:fs";import{stat as Ds}from"node:fs/promises";import{resolve as Ee}from"node:path";import{readdir as os,readdirSync as is,realpath as us,realpathSync as as,stat as cs,statSync as ls}from"fs";import{isAbsolute as ps,posix as V,resolve as fs}from"path";import{fileURLToPath as hs}from"url";import{createRequire as Ce}from"module";import{basename as $e,dirname as dt,normalize as Le,relative as ve,resolve as we,sep as kt}from"path";import*as Te from"fs";var It=Ce(import.meta.url);function Oe(t){let r=Le(t);return r.length>1&&r[r.length-1]===kt&&(r=r.substring(0,r.length-1)),r}var He=/[\\/]/g;function Dt(t,r){return t.replace(He,r)}var Ie=/^[a-z]:[\\/]$/i;function Pe(t){return t==="/"||Ie.test(t)}function At(t,r){let{resolvePaths:e,normalizePath:s,pathSeparator:n}=r,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(e&&(t=we(t)),(s||o)&&(t=Oe(t)),t===".")return"";let i=t[t.length-1]!==n;return Dt(i?t+n:t,n)}function Nt(t,r){return r+t}function ke(t,r){return function(e,s){return s.startsWith(t)?s.slice(t.length)+e:Dt(ve(t,s),r.pathSeparator)+r.pathSeparator+e}}function De(t){return t}function Ne(t,r,e){return r+t+e}function Fe(t,r){let{relativePaths:e,includeBasePath:s}=r;return e&&t?ke(t,r):s?Nt:De}function Be(t){return function(r,e){e.push(r.substring(t.length)||".")}}function Me(t){return function(r,e,s){let n=r.substring(t.length)||".";s.every(o=>o(n,!0))&&e.push(n)}}var Ge=(t,r)=>{r.push(t||".")},We=(t,r,e)=>{let s=t||".";e.every(n=>n(s,!0))&&r.push(s)},qe=()=>{};function Ue(t,r){let{includeDirs:e,filters:s,relativePaths:n}=r;return e?n?s&&s.length?Me(t):Be(t):s&&s.length?We:Ge:qe}var Ke=(t,r,e,s)=>{s.every(n=>n(t,!1))&&e.files++},Xe=(t,r,e,s)=>{s.every(n=>n(t,!1))&&r.push(t)},je=(t,r,e,s)=>{e.files++},Qe=(t,r)=>{r.push(t)},ze=()=>{};function Ye(t){let{excludeFiles:r,filters:e,onlyCounts:s}=t;return r?ze:e&&e.length?s?Ke:Xe:s?je:Qe}var Ze=t=>t,Ve=()=>[""].slice(0,0);function Je(t){return t.group?Ve:Ze}var tr=(t,r,e)=>{t.push({directory:r,files:e,dir:r})},er=()=>{};function rr(t){return t.group?tr:er}var sr=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue(),n.realpath(t,(i,l)=>{if(i)return s.dequeue(o?null:i,r);n.stat(l,(h,d)=>{if(h)return s.dequeue(o?null:h,r);if(d.isDirectory()&&Ft(t,l,r))return s.dequeue(null,r);e(d,l),s.dequeue(null,r)})})},nr=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue();try{let i=n.realpathSync(t),l=n.statSync(i);if(l.isDirectory()&&Ft(t,i,r))return;e(l,i)}catch(i){if(!o)throw i}};function or(t,r){return!t.resolveSymlinks||t.excludeSymlinks?null:r?nr:sr}function Ft(t,r,e){if(e.options.useRealPaths)return ir(r,e);let s=dt(t),n=1;for(;s!==e.root&&n<2;){let o=e.symlinks.get(s);!!o&&(o===r||o.startsWith(r)||r.startsWith(o))?n++:s=dt(s)}return e.symlinks.set(t,r),n>1}function ir(t,r){return r.visited.includes(t+r.options.pathSeparator)}var ur=t=>t.counts,ar=t=>t.groups,cr=t=>t.paths,lr=t=>t.paths.slice(0,t.options.maxFiles),pr=(t,r,e)=>(pt(r,e,t.counts,t.options.suppressErrors),null),fr=(t,r,e)=>(pt(r,e,t.paths,t.options.suppressErrors),null),hr=(t,r,e)=>(pt(r,e,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),gr=(t,r,e)=>(pt(r,e,t.groups,t.options.suppressErrors),null);function pt(t,r,e,s){r(t&&!s?t:null,e)}function Ar(t,r){let{onlyCounts:e,group:s,maxFiles:n}=t;return e?r?ur:pr:s?r?ar:gr:n?r?lr:hr:r?cr:fr}var Bt={withFileTypes:!0},dr=(t,r,e,s,n)=>{if(t.queue.enqueue(),s<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(r),t.counts.directories++,o.readdir(r||".",Bt,(i,l=[])=>{n(l,e,s),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},yr=(t,r,e,s,n)=>{let{fs:o}=t;if(s<0)return;t.visited.push(r),t.counts.directories++;let i=[];try{i=o.readdirSync(r||".",Bt)}catch(l){if(!t.options.suppressErrors)throw l}n(i,e,s)};function Rr(t){return t?yr:dr}var Sr=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,r){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,r),t&&(r.controller.abort(),this.onQueueEmpty=void 0))}},_r=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},Er=class{aborted=!1;abort(){this.aborted=!0}},Mt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,r,e){this.isSynchronous=!e,this.callbackInvoker=Ar(r,this.isSynchronous),this.root=At(t,r),this.state={root:Pe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new _r,options:r,queue:new Sr((s,n)=>this.callbackInvoker(n,s,e)),symlinks:new Map,visited:[""].slice(0,0),controller:new Er,fs:r.fs||Te},this.joinPath=Fe(this.root,r),this.pushDirectory=Ue(this.root,r),this.pushFile=Ye(r),this.getArray=Je(r),this.groupFiles=rr(r),this.resolveSymlink=or(r,this.isSynchronous),this.walkDirectory=Rr(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,r,e)=>{let{paths:s,options:{filters:n,resolveSymlinks:o,excludeSymlinks:i,exclude:l,maxFiles:h,signal:d,useRealPaths:g,pathSeparator:A},controller:S}=this.state;if(S.aborted||d&&d.aborted||h&&s.length>h)return;let x=this.getArray(this.state.paths);for(let y=0;y<t.length;++y){let C=t[y];if(C.isFile()||C.isSymbolicLink()&&!o&&!i){let H=this.joinPath(C.name,r);this.pushFile(H,x,this.state.counts,n)}else if(C.isDirectory()){let H=Ne(C.name,r,this.state.options.pathSeparator);if(l&&l(C.name,H))continue;this.pushDirectory(H,s,n),this.walkDirectory(this.state,H,H,e-1,this.walk)}else if(this.resolveSymlink&&C.isSymbolicLink()){let H=Nt(C.name,r);this.resolveSymlink(H,this.state,(G,_)=>{if(G.isDirectory()){if(_=At(_,this.state.options),l&&l(C.name,g?_:H+A))return;this.walkDirectory(this.state,_,g?_:H+A,e-1,this.walk)}else{_=g?_:H;let B=$e(_),j=At(dt(_),this.state.options);_=this.joinPath(B,j),this.pushFile(_,x,this.state.counts,n)}})}}this.groupFiles(this.state.groups,r,x)}};function br(t,r){return new Promise((e,s)=>{Gt(t,r,(n,o)=>{if(n)return s(n);e(o)})})}function Gt(t,r,e){new Mt(t,r,e).start()}function mr(t,r){return new Mt(t,r).start()}var Pt=class{constructor(t,r){this.root=t,this.options=r}withPromise(){return br(this.root,this.options)}withCallback(t){Gt(this.root,this.options,t)}sync(){return mr(this.root,this.options)}},Wt=null;try{It.resolve("picomatch"),Wt=It("picomatch")}catch{}var qt=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:kt,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new Pt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,r){return this.options={...this.options,...r},new Pt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...r){let e=this.globFunction||Wt;if(!e)throw new Error("Please specify a glob function to use glob matching.");var s=this.globCache[t.join("\0")];return s||(s=e(t,...r),this.globCache[t.join("\0")]=s),this.options.filters.push(n=>s(n)),this}};var nt=xe(he(),1),gs=Array.isArray,ye=/\\/g,As=/^[A-Za-z]:$/,Re=process.platform==="win32",ds=/^(\/?\.\.)+$/;function ys(t,r={}){let e=t.length,s=Array(e),n=Array(e),o,i;for(o=0;o<e;o++){let l=Se(t[o]);s[o]=l;let h=l.length,d=Array(h);for(i=0;i<h;i++)d[i]=(0,nt.default)(l[i],r);n[o]=d}return l=>{let h=l.split("/");if(h[0]===".."&&ds.test(l))return!0;for(o=0;o<e;o++){let d=s[o],g=n[o],A=h.length,S=Math.min(A,d.length);for(i=0;i<S;){let x=d[i];if(x.includes("/"))return!0;if(!g[i](h[i]))break;if(!r.noglobstar&&x==="**")return!0;i++}if(i===A)return!0}return!1}}var Rs=/^[A-Z]:\/$/i,Ss=Re?t=>Rs.test(t):t=>t==="/";function ge(t,r,e){if(t===r||r.startsWith(`${t}/`)){if(e){let n=t.length+ +!Ss(t);return(o,i)=>o.slice(n,i?-1:void 0)||"."}let s=r.slice(t.length+1);return s?(n,o)=>{if(n===".")return s;let i=`${s}/${n}`;return o?i.slice(0,-1):i}:(n,o)=>o&&n!=="."?n.slice(0,-1):n}return e?s=>V.relative(t,s)||".":s=>V.relative(t,`${r}/${s}`)||"."}function _s(t,r){if(r.startsWith(`${t}/`)){let e=r.slice(t.length+1);return s=>`${e}/${s}`}return e=>{let s=V.relative(t,`${r}/${e}`);return e[e.length-1]==="/"&&s!==""?`${s}/`:s||"."}}function Ae(t){return t.replace(As,r=>`${r}/`)}var Es={parts:!0};function Se(t){var r;let e=nt.default.scan(t,Es);return!((r=e.parts)===null||r===void 0)&&r.length?e.parts:[t]}var bs=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,ms=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,xs=t=>t.replace(bs,"\\$&"),Cs=t=>t.replace(ms,"\\$&"),$s=Re?Cs:xs;function Ls(t,r){if(r?.caseSensitiveMatch===!1)return!0;let e=nt.default.scan(t);return e.isGlob||e.negated}function ct(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function _e(t){return typeof t=="string"?[t]:t??[]}var vs=/^(\/?\.\.)+/,ws=/\\(?=[()[\]{}!*+?@|])/g;function Lt(t,r,e,s){var n;let o=r.cwd,i=t;t[t.length-1]==="/"&&(i=t.slice(0,-1)),i[i.length-1]!=="*"&&r.expandDirectories&&(i+="/**");let l=$s(o);i=ps(i.replace(ws,""))?V.relative(l,i):V.normalize(i);let h=(n=vs.exec(i))===null||n===void 0?void 0:n[0],d=Se(i);if(h){let A=(h.length+1)/3,S=0,x=l.split("/");for(;S<A&&d[S+A]===x[x.length+S-A];)i=i.slice(0,(A-S-1)*3)+i.slice((A-S)*3+d[S+A].length+1)||".",S++;let y=V.join(o,h.slice(S*3));y[0]!=="."&&e.root.length>y.length&&(e.root=Ae(y),e.depthOffset=-A+S)}if(!s&&e.depthOffset>=0){var g;(g=e.commonPath)!==null&&g!==void 0||(e.commonPath=d);let A=[],S=Math.min(e.commonPath.length,d.length);for(let x=0;x<S;x++){let y=d[x];if(y==="**"&&!d[x+1]){A.pop();break}if(x===d.length-1||y!==e.commonPath[x]||Ls(y))break;A.push(y)}e.depthOffset=A.length,e.commonPath=A,e.root=Ae(A.length>0?V.join(o,...A):o)}return i}function Ts(t,r,e){let s=[],n=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&n.push(Lt(o,t,e,!0));for(let o of r)o&&(o[0]!=="!"||o[1]==="("?s.push(Lt(o,t,e,!1)):(o[1]!=="!"||o[2]==="(")&&n.push(Lt(o.slice(1),t,e,!0)));return{match:s,ignore:n}}function Os(t,r){let e=t.cwd,s={root:e,depthOffset:0},n=Ts(t,r,s);t.debug&&ct("internal processing patterns:",n);let{absolute:o,caseSensitiveMatch:i,debug:l,dot:h,followSymbolicLinks:d,onlyDirectories:g}=t,A=s.root.replace(ye,""),S={dot:h,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},x=(0,nt.default)(n.match,S),y=(0,nt.default)(n.ignore,S),C=ys(n.match,S),H=ge(e,A,o),G=o?H:ge(e,A,!0),_=(I,w)=>{let L=G(w,!0);return L!=="."&&!C(L)||y(L)},B;t.deep!==void 0&&(B=Math.round(t.deep-s.depthOffset));let j=new qt({filters:[l?(I,w)=>{let L=H(I,w),R=x(L)&&!y(L);return R&&ct(`matched ${L}`),R}:(I,w)=>{let L=H(I,w);return x(L)&&!y(L)}],exclude:l?(I,w)=>{let L=_(I,w);return ct(`${L?"skipped":"crawling"} ${w}`),L}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:d,excludeSymlinks:!d,excludeFiles:g,includeDirs:g||!t.onlyFiles,maxDepth:B,signal:t.signal}).crawl(A);return t.debug&&ct("internal properties:",{...s,root:A}),[j,e!==A&&!o&&_s(e,A)]}function Hs(t,r){if(r)for(let e=t.length-1;e>=0;e--)t[e]=r(t[e]);return t}var de={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Is(t){let r=Object.assign({},t);for(let e in de)r[e]===void 0&&Object.assign(r,{[e]:de[e]});return r.cwd=(r.cwd instanceof URL?hs(r.cwd):fs(r.cwd||process.cwd())).replace(ye,"/"),r.ignore=_e(r.ignore),r.fs&&(r.fs={readdir:r.fs.readdir||os,readdirSync:r.fs.readdirSync||is,realpath:r.fs.realpath||us,realpathSync:r.fs.realpathSync||as,stat:r.fs.stat||cs,statSync:r.fs.statSync||ls}),r.debug&&ct("globbing with options:",r),r}function Ps(t,r={}){var e;if(t&&r?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let s=gs(t)||typeof t=="string",n=_e((e=s?t:t.patterns)!==null&&e!==void 0?e:"**/*"),o=Is(s?r:t);return n.length>0?Os(o,n):[]}async function vt(t,r){let[e,s]=Ps(t,r);return e?Hs(await e.withPromise(),s):[]}var be=Object.values(wt).flatMap(t=>t.extensions).map(t=>t.slice(1));function Ns(t){return/[*?[\]{}]/.test(t)}async function Fs(t,r){let e=r?`**/*.{${be.join(",")}}`:`*.{${be.join(",")}}`;return(await vt([e],{cwd:t,absolute:!0,onlyFiles:!0,caseSensitiveMatch:!1})).sort()}async function Bs(t,r,e,s){let n=await Fs(t,r);if(n.length===0){e.push({path:t,error:Ot(t)});return}for(let o of n)await s(o,t,!1)}async function gn(t,r){let e=[],s=[],n=new Map,o=new Set,i=async(l,h,d)=>{let g=Ee(l);if(!o.has(g)){o.add(g);try{e.push(await Ht(g)),h&&n.set(g,h)}catch(A){if(Tt(A))s.push({path:g,error:A});else if(d)throw A}}};for(let l of t){let h=Ee(l);if(Ns(l)&&!ks(h)){let g=(r.platform??process.platform)==="win32"?l.replaceAll("\\","/"):l,A=await vt([g],{absolute:!0,onlyFiles:!0});A.length===0&&s.push({path:h,error:gt(h)});for(let S of A.sort())await i(S,void 0,!1);continue}let d;try{d=await Ds(h)}catch{s.push({path:h,error:gt(h)});continue}if(d.isDirectory()){await Bs(h,r.recursive,s,i);continue}await i(h,void 0,!0)}return{sources:e,failures:s,roots:n}}export{gn as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{i as F}from"./chunk-LNB5D67B.js";import{a as y}from"./chunk-QR6QHTC3.js";import{i as h}from"./chunk-6L6C3GJU.js";import{b as g}from"./chunk-EXLXSKRH.js";import{d as b}from"./chunk-3UEQ2OX6.js";import{a as u}from"./chunk-M66BUNYO.js";import{existsSync as I}from"node:fs";import{open as k,readdir as w,stat as K}from"node:fs/promises";import{basename as A,dirname as j,extname as S,join as v,resolve as R}from"node:path";function M(e){return e.startsWith(".")||/\.(crdownload|part|download|tmp)$/i.test(e)}function O(e){return e.kind==="image"?"images":e.format==="pdf"?"pdfs":"documents"}var $=new Set(Object.values(u).flatMap(e=>e.extensions));async function E(e){let r=await k(e,"r"),n=Buffer.alloc(4096),i=0;try{i=(await r.read(n,0,n.length,0)).bytesRead}finally{await r.close()}let t=n.subarray(0,i),o=(c,a)=>t.subarray(c,c+a).toString("latin1");return o(4,4)==="ftyp"?/^(M4A |M4B |M4P )$/.test(o(8,4))?"audio":"video":t[0]===26&&t[1]===69&&t[2]===223&&t[3]===163?"video":o(0,4)==="RIFF"?o(8,4)==="WAVE"?"audio":o(8,3)==="AVI"?"video":"other":t[0]===0&&t[1]===0&&t[2]===1&&(t[3]===186||t[3]===179)?"video":o(0,3)==="ID3"||o(0,4)==="fLaC"||o(0,4)==="OggS"||o(0,4)==="FORM"&&/^AIF[FC]$/.test(o(8,4))||t[0]===255&&t[1]!==void 0&&(t[1]&224)===224?"audio":i>0&&!t.includes(0)&&N(t)?"text":"other"}function N(e){try{return new TextDecoder("utf-8",{fatal:!0}).decode(e,{stream:!0}),!0}catch{return!1}}var x=["images","pdfs","documents","videos","audio","other"];function q(e,r){if(e==="videos"||e==="audio")return"not yet supported";if(e==="other")return r.every(n=>n==="text")?r.length===1?"a text file":"text files":"not supported"}async function G(e){let r=R(e),n=await w(r,{withFileTypes:!0}),i=[],t=[],o=new Map,c=[],a=0;for(let f of n.sort((d,s)=>d.name.localeCompare(s.name))){if(!f.isFile()||M(f.name))continue;let d=v(r,f.name);c.push(d);let s=await D(d);if(s.kind==="source")i.push(s.source),a+=s.source.bytes;else if(s.kind==="failed")t.push(s.failure),a+=s.bytes;else{let p=s.kind,m=o.get(p)??{bytes:0,sniffed:[]};m.bytes+=s.bytes,m.sniffed.push(s.sniffed),o.set(p,m),a+=s.bytes}}let l=[];for(let f of x){let d=i.filter(s=>O(s)===f);d.length>0&&l.push({id:f,count:d.length,bytes:d.reduce((s,p)=>s+p.bytes,0),sources:d})}l.sort((f,d)=>d.count-f.count);for(let f of x){let d=o.get(f);if(!d)continue;let s=q(f,d.sniffed);l.push({id:f,count:d.sniffed.length,bytes:d.bytes,sources:[],...s===void 0?{}:{why:s}})}return{dir:r,sources:i,failures:t,kinds:l,bytes:a,paths:c}}async function D(e){let r=()=>K(e).then(n=>n.size,()=>0);try{let n=await h(e);if(n.kind==="media"){let i=u[n.format].media==="video";return{kind:i?"videos":"audio",sniffed:i?"video":"audio",bytes:n.bytes}}return{kind:"source",source:n}}catch(n){let i=await r(),t=await E(e).catch(()=>"other");if(t==="video"||t==="audio")return{kind:t==="video"?"videos":"audio",sniffed:t,bytes:i};if($.has(S(e).toLowerCase())){let o=b(n)?n:void 0;if(o)return{kind:"failed",failure:{path:e,error:o},bytes:i}}return{kind:"other",sniffed:t,bytes:i}}}function T(e){let r=new Set(e.flatMap(n=>y(n).filter(i=>i!==n.format)));return Object.keys(u).filter(n=>r.has(n))}function H(e,r){let n=T(e),i=e[0],t=i?.kind==="image"?"webp":i?.format==="pdf"?"png":void 0,o=t&&n.includes(t)?t:n[0];if(o)return B(e,o,r)}function B(e,r,n){let i={target:r};return u[r].lossy&&(i.quality=n),e.some(t=>t.kind==="document"&&t.format==="pdf")&&(r==="png"||r==="jpeg")&&(i.dpi=150),i}function Q(e,r,n,i){if(e.format===r.target)return{left:`already ${u[r.target].label}`};if(!y(e).includes(r.target))return{left:`can\u2019t become ${u[r.target].label}`};let[t]=F.plan([e],{target:r.target,...r.quality===void 0?{}:{quality:r.quality},...r.dpi===void 0?{}:{dpi:String(r.dpi)},pages:"all",...i===void 0?{}:{destination:i}});if(t?.op!=="convert")return{left:"not supported"};if(t.outputs.some(o=>I(o)&&!n.has(o)))return{left:"already converted"};t.outputs=t.outputs.map(o=>C(o,n));for(let o of t.outputs)n.add(o);return{job:t}}function C(e,r){if(!r.has(e))return e;let n=S(e),i=A(e,n);for(let t=1;;t++){let o=v(j(e),g(i,` (${t})${n}`));if(!r.has(o)&&!I(o))return o}}export{M as a,O as b,E as c,G as d,D as e,T as f,H as g,B as h,Q as i};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a as B}from"./chunk-U5TEGDGH.js";import{a as K,b as Y}from"./chunk-HZDYZ5RD.js";import{h as W}from"./chunk-QR6QHTC3.js";import{b as J}from"./chunk-EEQSUBBL.js";import{a as D}from"./chunk-YYB3TTGT.js";import{l as L,n as U}from"./chunk-KAHWYWNT.js";import{F as d,I as H}from"./chunk-3UEQ2OX6.js";import{d as R}from"./chunk-J7FLFHQJ.js";import{a as X}from"./chunk-MV7H3QQY.js";import{b as z}from"./chunk-M66BUNYO.js";var x=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},v=class extends x{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var E=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new v(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function V(s){let e=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+e+">":"["+e+"]"}import{EventEmitter as ae}from"node:events";import G from"node:child_process";import C from"node:path";import F from"node:fs";import m from"node:process";import{stripVTControlCharacters as ue}from"node:util";import{stripVTControlCharacters as re}from"node:util";var T=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((i,r)=>i.name().localeCompare(r.name())),t}compareOptions(e,t){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),r=n.long&&e._findOption(n.long);!i&&!r?t.push(n):n.long&&!r?t.push(e.createOption(n.long,n.description)):n.short&&!i&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(r=>!r.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>V(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,""]}groupItems(e,t,n){let i=new Map;return e.forEach(r=>{let o=n(r);i.has(o)||i.set(o,[])}),t.forEach(r=>{let o=n(r);i.has(o)||i.set(o,[]),i.get(o).push(r)}),i}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth??80;function r(c,p){return t.formatItem(c,n,p,t)}let o=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],u=t.commandDescription(e);u.length>0&&(o=o.concat([t.boxWrap(t.styleCommandDescription(u),i),""]));let l=t.visibleArguments(e).map(c=>r(t.styleArgumentTerm(t.argumentTerm(c)),t.styleArgumentDescription(t.argumentDescription(c))));if(o=o.concat(this.formatItemList("Arguments:",l,t)),this.groupItems(e.options,t.visibleOptions(e),c=>c.helpGroupHeading??"Options:").forEach((c,p)=>{let O=c.map(_=>r(t.styleOptionTerm(t.optionTerm(_)),t.styleOptionDescription(t.optionDescription(_))));o=o.concat(this.formatItemList(p,O,t))}),t.showGlobalOptions){let c=t.visibleGlobalOptions(e).map(p=>r(t.styleOptionTerm(t.optionTerm(p)),t.styleOptionDescription(t.optionDescription(p))));o=o.concat(this.formatItemList("Global Options:",c,t))}return this.groupItems(e.commands,t.visibleCommands(e),c=>c.helpGroup()||"Commands:").forEach((c,p)=>{let O=c.map(_=>r(t.styleSubcommandTerm(t.subcommandTerm(_)),t.styleSubcommandDescription(t.subcommandDescription(_))));o=o.concat(this.formatItemList(p,O,t))}),o.join(`
|
|
4
|
+
`)}displayWidth(e){return re(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,i){let o=" ".repeat(2);if(!n)return o+e;let u=e.padEnd(t+e.length-i.displayWidth(e)),l=2,a=(this.helpWidth??80)-t-l-2,c;return a<this.minWidthToWrap||i.preformatted(n)?c=n:c=i.boxWrap(n,a).replace(/\n/g,`
|
|
5
|
+
`+" ".repeat(t+l)),o+u+" ".repeat(l)+c.replace(/\n/g,`
|
|
6
|
+
${o}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,r=[];return n.forEach(o=>{let u=o.match(i);if(u===null){r.push("");return}let l=[u.shift()],h=this.displayWidth(l[0]);u.forEach(a=>{let c=this.displayWidth(a);if(h+c<=t){l.push(a),h+=c;return}r.push(l.join(""));let p=a.trimStart();l=[p],h=this.displayWidth(p)}),r.push(l.join(""))}),r.join(`
|
|
7
|
+
`)}};var A=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=oe(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new v(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,n):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Q(this.name().replace(/^no-/,"")):Q(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},N=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,r=i!==void 0?i:!1;return t.negate===(r===e)}};function Q(s){return s.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function oe(s){let e,t,n=/^-[^-]$/,i=/^--[^-]/,r=s.split(/[ |,]+/).concat("guard");if(n.test(r[0])&&(e=r.shift()),i.test(r[0])&&(t=r.shift()),!e&&n.test(r[0])&&(e=r.shift()),!e&&i.test(r[0])&&(e=t,t=r.shift()),r[0].startsWith("-")){let o=r[0],u=`option creation failed due to '${o}' in option flags '${s}'`;throw/^-[^-][^-]/.test(o)?new Error(`${u}
|
|
8
|
+
- a short flag is a single dash and a single character
|
|
9
|
+
- either use a single dash and a single character (for a short flag)
|
|
10
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(o)?new Error(`${u}
|
|
11
|
+
- too many short flags`):i.test(o)?new Error(`${u}
|
|
12
|
+
- too many long flags`):new Error(`${u}
|
|
13
|
+
- unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${s}'.`);return{shortFlag:e,longFlag:t}}function se(s,e){if(Math.abs(s.length-e.length)>3)return Math.max(s.length,e.length);let t=[];for(let n=0;n<=s.length;n++)t[n]=[n];for(let n=0;n<=e.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=s.length;i++){let r;s[i-1]===e[n-1]?r=0:r=1,t[i][n]=Math.min(t[i-1][n]+1,t[i][n-1]+1,t[i-1][n-1]+r),i>1&&n>1&&s[i-1]===e[n-2]&&s[i-2]===e[n-1]&&(t[i][n]=Math.min(t[i][n],t[i-2][n-2]+1))}return t[s.length][e.length]}function q(s,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=s.startsWith("--");t&&(s=s.slice(2),e=e.map(o=>o.slice(2)));let n=[],i=3,r=.4;return e.forEach(o=>{if(o.length<=1)return;let u=se(s,o),l=Math.max(s.length,o.length);(l-u)/l>r&&(u<i?(i=u,n=[o]):u===i&&n.push(o))}),n.sort((o,u)=>o.localeCompare(u)),t&&(n=n.map(o=>`--${o}`)),n.length>1?`
|
|
14
|
+
(Did you mean one of ${n.join(", ")}?)`:n.length===1?`
|
|
15
|
+
(Did you mean ${n[0]}?)`:""}var $=class s extends ae{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:t=>m.stdout.write(t),writeErr:t=>m.stderr.write(t),outputError:(t,n)=>n(t),getOutHelpWidth:()=>m.stdout.isTTY?m.stdout.columns:void 0,getErrHelpWidth:()=>m.stderr.isTTY?m.stderr.columns:void 0,getOutHasColors:()=>ee()??(m.stdout.isTTY&&m.stdout.hasColors?.()),getErrHasColors:()=>ee()??(m.stderr.isTTY&&m.stderr.hasColors?.()),stripColor:t=>ue(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let i=t,r=n;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,o,u]=e.match(/([^ ]+) *(.*)/),l=this.createCommand(o);return i&&(l.description(i),l._executableHandler=!0),r.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(r.noHelp||r.hidden),l._executableFile=r.executableFile||null,u&&l.arguments(u),this._registerCommand(l),l.parent=this,l.copyInheritedSettings(this),i?this:l}createCommand(e){return new s(e)}createHelp(){return Object.assign(new T,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
16
|
+
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new E(e,t)}argument(e,t,n,i){let r=this.createArgument(e,t);return typeof n=="function"?r.default(i).argParser(n):r.default(n),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,i,r]=n.match(/([^ ]+) *(.*)/),o=t??"display help for command",u=this.createCommand(i);return u.helpOption(!1),r&&u.arguments(r),o&&u.description(o),this._addImplicitHelpCommand=!0,this._helpCommand=u,(e||t)&&this._initCommandGroup(u),this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
17
|
+
Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new x(e,t,n)),m.exit(e)}action(e){let t=n=>{let i=this.registeredArguments.length,r=n.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new A(e,t)}_callParseArg(e,t,n,i){try{return e.parseArg(t,n)}catch(r){if(r.code==="commander.invalidArgument"){let o=`${i} ${r.message}`;this.error(o,{exitCode:r.exitCode,code:r.code})}throw r}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
|
|
18
|
+
- already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),n=t(e).find(i=>this._findCommand(i));if(n){let i=t(this._findCommand(n)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(r,o,u)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let l=this.getOptionValue(n);r!==null&&e.parseArg?r=this._callParseArg(e,r,l,o):r!==null&&e.variadic&&(r=e._collectValue(r,l)),r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(n,r,u)};return this.on("option:"+t,r=>{let o=`error: option '${e.flags}' argument '${r}' is invalid.`;i(r,o,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let o=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;i(r,o,"env")}),this}_optionEx(e,t,n,i,r){if(typeof t=="object"&&t instanceof A)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(t,n);if(o.makeOptionMandatory(!!e.mandatory),typeof i=="function")o.default(r).argParser(i);else if(i instanceof RegExp){let u=i;i=(l,h)=>{let a=u.exec(l);return a?a[0]:h},o.default(r).argParser(i)}else o.default(i);return this.addOption(o)}option(e,t,n,i){return this._optionEx({},e,t,n,i)}requiredOption(e,t,n,i){return this._optionEx({mandatory:!0},e,t,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){m.versions?.electron&&(t.from="electron");let i=m.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(t.from="eval")}e===void 0&&(e=m.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":m.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?(this.options.filter(e=>e.negate&&e.defaultValue===void 0&&this.getOptionValue(e.attributeName())===void 0).forEach(e=>{let t=e.long.replace(/^--no-/,"--");this._findOption(t)||this.setOptionValueWithSource(e.attributeName(),!0,"default")}),this.saveStateBeforeParse()):this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
19
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,n){if(F.existsSync(e))return;let i=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",r=`'${e}' does not exist
|
|
20
|
+
- if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
21
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
22
|
+
- ${i}`;throw new Error(r)}_executeSubCommand(e,t){t=t.slice();let n=[".js",".ts",".tsx",".mjs",".cjs"];function i(a,c){let p=C.resolve(a,c);if(F.existsSync(p))return p;if(n.includes(C.extname(c)))return;let O=n.find(_=>F.existsSync(`${p}${_}`));if(O)return`${p}${O}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=e._executableFile||`${this._name}-${e._name}`,o=this._executableDir||"";if(this._scriptPath){let a;try{a=F.realpathSync(this._scriptPath)}catch{a=this._scriptPath}o=C.resolve(C.dirname(a),o)}if(o){let a=i(o,r);if(!a&&!e._executableFile&&this._scriptPath){let c=C.basename(this._scriptPath,C.extname(this._scriptPath));c!==this._name&&(a=i(o,`${c}-${e._name}`))}r=a||r}let u=n.includes(C.extname(r)),l;m.platform!=="win32"?u?(t.unshift(r),t=Z(m.execArgv).concat(t),l=G.spawn(m.argv[0],t,{stdio:"inherit"})):l=G.spawn(r,t,{stdio:"inherit"}):(this._checkForMissingExecutable(r,o,e._name),t.unshift(r),t=Z(m.execArgv).concat(t),l=G.spawn(m.execPath,t,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(c=>{m.on(c,()=>{l.killed===!1&&l.exitCode===null&&l.kill(c)})});let h=this._exitCallback;l.on("close",a=>{a=a??1,h?h(new x(a,"commander.executeSubCommandAsync","(close)")):m.exit(a)}),l.on("error",a=>{if(a.code==="ENOENT")this._checkForMissingExecutable(r,o,e._name);else if(a.code==="EACCES")throw new Error(`'${r}' not executable`);if(!h)m.exit(1);else{let c=new x(1,"commander.executeSubCommandAsync","(error)");c.nestedError=a,h(c)}}),this.runningCommand=l}_dispatchSubcommand(e,t,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(n));else return i._parseCommand(t,n)}),r}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,r)=>{let o=i;if(i!==null&&n.parseArg){let u=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;o=this._callParseArg(n,i,r,u)}return o};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,i)=>{let r=n.defaultValue;n.variadic?i<this.args.length?(r=this.args.slice(i),n.parseArg&&(r=r.reduce((o,u)=>e(n,u,o),n.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],n.parseArg&&(r=e(n,r,n.defaultValue))),t[i]=r}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(o=>{i.push({hookedCommand:r,callback:o})})}),t==="postAction"&&i.reverse(),i.forEach(r=>{n=this._chainOrCall(n,()=>r.callback(r.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(r=>{i=this._chainOrCall(i,()=>r(this,t))}),i}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(r,e,t)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent?.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(r=>n.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],i=t;function r(a){return a.length>1&&a[0]==="-"}let o=a=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(a)?!this._getCommandAndAncestors().some(c=>c.options.map(p=>p.short).some(p=>/^-\d$/.test(p))):!1,u=null,l=null,h=0;for(;h<e.length||l;){let a=l??e[h++];if(l=null,a==="--"){i===n&&i.push(a),i.push(...e.slice(h));break}if(u&&(!r(a)||o(a))){this.emit(`option:${u.name()}`,a);continue}if(u=null,r(a)){let c=this._findOption(a);if(c){if(c.required){let p=e[h++];p===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,p)}else if(c.optional){let p=null;h<e.length&&(!r(e[h])||o(e[h]))&&(p=e[h++]),this.emit(`option:${c.name()}`,p)}else this.emit(`option:${c.name()}`);u=c.variadic?c:null;continue}}if(a.length>2&&a[0]==="-"&&a[1]!=="-"){let c=this._findOption(`-${a[1]}`);if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${c.name()}`,a.slice(2)):(this.emit(`option:${c.name()}`),l=`-${a.slice(2)}`);continue}}if(/^--[^=]+=/.test(a)){let c=a.indexOf("="),p=this._findOption(a.slice(0,c));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,a.slice(c+1));continue}}if(i===t&&r(a)&&!(this.commands.length===0&&o(a))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(a)){t.push(a),n.push(...e.slice(h));break}else if(this._getHelpCommand()&&a===this._getHelpCommand().name()){t.push(a,...e.slice(h));break}else if(this._defaultCommandName){n.push(a,...e.slice(h));break}}if(this._passThroughOptions){i.push(a,...e.slice(h));break}i.push(a)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let i=this.options[n].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
23
|
+
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
24
|
+
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
25
|
+
`),this.outputHelp({error:!0}));let n=t||{},i=n.exitCode||1,r=n.code||"commander.error";this._exit(i,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in m.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,m.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new N(this.options),t=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let n=o=>{let u=o.attributeName(),l=this.getOptionValue(u),h=this.options.find(c=>c.negate&&u===c.attributeName()),a=this.options.find(c=>!c.negate&&u===c.attributeName());return h&&(h.presetArg===void 0&&l===!1||h.presetArg!==void 0&&l===h.presetArg)?h:a||o},i=o=>{let u=n(o),l=u.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${u.envVar}'`:`option '${u.flags}'`},r=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{let o=r.createHelp().visibleOptions(r).filter(u=>u.long).map(u=>u.long);i=i.concat(o),r=r.parent}while(r&&!r._enablePositionalOptions);t=q(e,i)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?"":"s",i=e.length,r=this.parent?` for '${this.name()}'`:"",o=e.join(", "),u=`error: too many arguments${r}. Expected ${t} argument${n} but got ${i}: ${o}.`;this.error(u,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),t=q(e,i)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let i=this.createOption(t,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
26
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(n=>V(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=C.basename(e,C.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let i=t.formatHelp(this,t);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let t=!!e.error,n,i,r;return t?(n=u=>this._outputConfiguration.writeErr(u),i=this._outputConfiguration.getErrHasColors(),r=this._outputConfiguration.getErrHelpWidth()):(n=u=>this._outputConfiguration.writeOut(u),i=this._outputConfiguration.getOutHasColors(),r=this._outputConfiguration.getOutHelpWidth()),{error:t,write:u=>(i||(u=this._outputConfiguration.stripColor(u)),n(u)),hasColors:i,helpWidth:r}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(o=>o.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let r=this.helpInformation({error:n.error});if(t&&(r=t(r),typeof r!="string"&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(o=>o.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(m.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
27
|
+
Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,r=>{let o;typeof t=="function"?o=t({error:r.error,command:r.command}):o=t,o&&r.write(`${o}
|
|
28
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Z(s){return s.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",i="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:n=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],n=r[3],i=r[4]),t&&i!=="0"?`${t}=${n}:${parseInt(i)+1}`:e})}function ee(){if(m.env.NO_COLOR||m.env.FORCE_COLOR==="0"||m.env.FORCE_COLOR==="false")return!1;if(m.env.FORCE_COLOR||m.env.CLICOLOR_FORCE!==void 0)return!0}var Xe=new $;function le(s){let[,e,t,...n]=s;if(e===void 0||e==="list")return{kind:"config",action:"list"};if(e==="path")return{kind:"config",action:"path"};if(e==="set"){if(t===void 0||!D.includes(t))throw d(`Unknown config setting ${t??"(none)"}.`,`Try one of: ${D.join(", ")}.`);let i=n.join(" ");if(i.length===0)throw d(`forge config set ${t} needs a value.`);return{kind:"config",action:"set",key:t,value:i}}throw d(`Unknown config action ${e}.`,"Try: forge config list, forge config set <setting> <value>, or forge config path.")}var he={jpg:"jpeg",tif:"tiff",heif:"heic"};function I(s){let e=s.toLowerCase().replace(/^\./,""),t=z(he[e]??e);if(!t)throw d(`${s} is not a format Forge knows.`,"Run forge --formats to see what is available.");return t.id}function P(s,e,t,n,i){let r=Number(String(e).replace(/k$/i,""));if(!Number.isFinite(r)||r<t||r>n)throw d(`${s} takes ${t} to ${n}, not ${e}.`,`For example ${s} ${i}.`);return r}function ce(s){let e={};if(s.cut!==void 0){let t=J(String(s.cut));if(!t)throw d(`--cut takes a start and an end, the end after the start, not ${s.cut}.`,"For example --cut 0:03.2-0:41, or --cut 0:10- to keep from 0:10 to the end.");e.cut=t.end===void 0?{start:t.start}:{start:t.start,end:t.end}}return s.mute&&(e.mute=!0),s.speed!==void 0&&(e.speed=P("--speed",s.speed,.25,4,"2")),s.fps!==void 0&&(e.fps=P("--fps",s.fps,1,120,"30")),s.bitrate!==void 0&&(e.bitrate=Math.round(P("--bitrate",s.bitrate,32,320,"128k"))),s.loudness!==void 0&&(e.loudness=P("--loudness",s.loudness,-70,-5,"-16")),Object.keys(e).length?e:void 0}function S(s){let e=Number(s);if(!Number.isInteger(e)||e<1||e>100)throw d(`Quality must be a whole number between 1 and 100, not ${s}.`);return e}function te(s,e){let t=/^\d+$/.test(String(e))?Number(e):Number.NaN;if(!Number.isInteger(t)||t<1)throw d(`${s} takes a whole number of pixels, at least 1, not ${e}.`);return t}function de(s){let e=String(s),t=/^\d+(\.\d+)?%?$/.test(e)?Number.parseFloat(e):Number.NaN;if(!(t>=1&&t<=W))throw d(`--resize takes a percent from 1 to ${W}, not ${s}.`,"Try --resize 50% to halve, or --width 1200 for an exact width.");return t}function j(s){let e=Number(s);if(!Number.isInteger(e)||e<1)throw d(`Concurrency must be a positive whole number, not ${s}.`);return e}var pe=`
|
|
29
|
+
Exit codes:
|
|
30
|
+
0 every input succeeded
|
|
31
|
+
1 the command was understood, and at least one input failed or was refused
|
|
32
|
+
2 the command itself was invalid: an unknown flag, a missing argument, contradictory flags`,fe=`
|
|
33
|
+
Other commands:
|
|
34
|
+
forge probe <files...> what each file is and what Forge can do with it
|
|
35
|
+
forge palette <image> an image's main colours (--json, --svg, --inside <hex>)
|
|
36
|
+
forge scale <colour> 50\u2013950 from one colour, with it at 500 (--json, --svg)
|
|
37
|
+
forge clip compress the copied image and put it back (--to, --quality,
|
|
38
|
+
--max-size, --save [folder], --undo)
|
|
39
|
+
forge transcribe <file | link>
|
|
40
|
+
a video or audio file, or a YouTube link, into Markdown
|
|
41
|
+
(--to all | notes | transcript, --detail brief | standard | detailed,
|
|
42
|
+
--language <id>, -o <path>, --force)
|
|
43
|
+
forge watch <folder> --to <format>
|
|
44
|
+
convert the folder, then every file added to it, until ctrl-c
|
|
45
|
+
(--quality, --dpi, -o <folder>, --new-only, --json)
|
|
46
|
+
forge config [list | path | set <setting> <value>]
|
|
47
|
+
forge extensions [add | remove <id>] optional extras, such as boost and remove-background
|
|
48
|
+
forge update install a newer Forge, if there is one
|
|
49
|
+
forge uninstall take Forge out of the right-click menu, then remove it
|
|
50
|
+
forge mcp run as a local MCP server over stdio, for AI agents`;function M(s){let e=R(String(s));if(e===void 0)throw d(`${s} is not a size.`,"Try a number with a unit, for example 500kb, 2mb or 1.5mb.");return e}function me(s){let e=s.slice(1).filter(n=>n!=="--json"),t=e.find(n=>n.startsWith("-"));if(t!==void 0)throw d(`forge probe takes files, not ${t}.`,"Try: forge probe photo.jpg --json");if(e.length===0)throw d("No files given.","Name a file, for example: forge probe scan.pdf --json");return{kind:"probe",inputs:e}}function ge(s){let e={kind:"clip",undo:!1,debug:!1},t=s.slice(1),n=(i,r)=>{let o=t[r+1];if(o===void 0||o.startsWith("-"))throw d(`${i} needs a value.`);return o};for(let i=0;i<t.length;i++){let r=t[i];if(r!=="--json")if(r==="--debug")e.debug=!0;else if(r==="--undo")e.undo=!0;else if(r==="--to"||r==="-t")e.target=I(n(r,i++));else if(r==="--quality"||r==="-q")e.quality=S(n(r,i++));else if(r==="--max-size")e.maxBytes=M(n(r,i++));else if(r==="--save"){let o=t[i+1];e.save=o===void 0||o.startsWith("-")?!0:t[++i]}else throw r.startsWith("-")?d(`forge clip does not take ${r}.`,"Try: forge --help"):d(`forge clip takes no files: it reads the clipboard, not ${r}.`,`To compress a file, try: forge ${r} --quality 80`)}if(e.undo&&Object.keys(e).some(i=>!["kind","undo","debug"].includes(i)))throw d("--undo takes no other flag.","Try: forge clip --undo");if(e.quality!==void 0&&e.maxBytes!==void 0)throw d("Use either --quality or --max-size, not both.","They are two ways of asking for the same thing, and Forge will not guess which wins.");return e}function be(s){let e=s.slice(1),t=[],n={kind:"transcribe",input:"",notes:!0,transcript:!0,detail:Y,force:!1,debug:!1},i=(l,h)=>{let a=e[h+1];if(a===void 0||a.startsWith("-"))throw d(`${l} needs a value.`);return a},r="Try: forge transcribe talk.mp4";for(let l=0;l<e.length;l++){let h=e[l];if(h==="--debug")n.debug=!0;else if(h==="--force"||h==="-f")n.force=!0;else if(h==="--language"||h==="-l")n.language=i(h,l++);else if(h==="--output"||h==="-o")n.output=i(h,l++);else if(h==="--detail"){let a=i(h,l++).toLowerCase();if(!K.includes(a))throw d(`forge transcribe writes notes in brief, standard or detailed, not ${a}.`,"Try: forge transcribe talk.mp4 --detail brief");n.detail=a}else if(h==="--to"||h==="-t"){let a=i(h,l++).toLowerCase();if(a!=="all"&&a!=="notes"&&a!=="transcript")throw d(`forge transcribe makes all, notes or a transcript, not ${a}.`,"Try: forge transcribe talk.mp4 --to transcript");n.notes=a!=="transcript",n.transcript=a!=="notes"}else{if(h.startsWith("-"))throw d(`forge transcribe does not take ${h}.`,r);t.push(h)}}let[o,...u]=t;if(o===void 0)throw d("forge transcribe needs a file or a link.",r);if(u.length>0)throw d("forge transcribe takes one file or link at a time.",r);return{...n,input:o}}function _e(s){let e=s.slice(1),t=[],n,i={kind:"watch",newOnly:!1,debug:!1},r={},o=(h,a)=>{let c=e[a+1];if(c===void 0||c.startsWith("-"))throw d(`${h} needs a value.`);return c};for(let h=0;h<e.length;h++){let a=e[h];if(a!=="--json")if(a==="--debug")i.debug=!0;else if(a==="--new-only")i.newOnly=!0;else if(a==="--to"||a==="-t")n=I(o(a,h++));else if(a==="--quality"||a==="-q")r.quality=S(o(a,h++));else if(a==="--output"||a==="-o")r.output=o(a,h++);else if(a==="--dpi"){let c=o(a,h++),p=Number(c);if(!Number.isInteger(p)||p<36||p>600)throw H(c);r.dpi=p}else{if(a.startsWith("-"))throw d(`forge watch does not take ${a}.`,"Try: forge watch ./images --to webp");t.push(a)}}let[u,...l]=t;if(u===void 0)throw d("forge watch needs a folder.","Try: forge watch ./images --to webp");if(l.length>0)throw d("forge watch watches one folder at a time.",`Try: forge watch ${u} --to webp`);if(n===void 0)throw d("forge watch needs a format to convert to.",`Try: forge watch ${u} --to webp`);return{kind:"watch",folder:u,target:n,...r.quality===void 0?{}:{quality:r.quality},...r.dpi===void 0?{}:{dpi:r.dpi},...r.output===void 0?{}:{output:r.output},newOnly:i.newOnly,debug:i.debug}}function we(s){let e=s.slice(1).filter(o=>o!=="--json"),t=e.find(o=>o.startsWith("-"));if(t!==void 0)throw d(`forge extensions does not take ${t}.`,"Try: forge extensions, forge extensions add <id>, or forge extensions remove <id>.");let[n,i,...r]=e;if(n===void 0)return{kind:"extensions",action:"list"};if(n!=="add"&&n!=="remove")throw d(`Unknown extensions action ${n}.`,"Try: forge extensions, forge extensions add <id>, or forge extensions remove <id>.");if(i===void 0||r.length>0)throw d(`forge extensions ${n} takes exactly one extension.`,`Try: forge extensions ${n} boost`);return{kind:"extensions",action:n,id:i}}function ne(s){if(s===void 0)throw d("No colour given.","Try: forge scale 6579FD \u2014 or quote it, '#6579FD', because an unquoted # starts a comment in the shell.");let e=B(s)?.rgb;if(!e)throw d(`${s} is not a colour.`,"Try a hex code (6579FD), rgb(), hsl(), oklch() or a colour name, quoted: 'rgb(101 121 253)'.");return e}var ye={palette:`Usage: forge palette <image> [--json] [--svg] [--inside <hex>]
|
|
51
|
+
|
|
52
|
+
An image's main colours, most of the image first.
|
|
53
|
+
--json one JSON document: palette.colours[] with hex, rgb, oklch, share
|
|
54
|
+
--svg a card of swatches; pipe to pbcopy and paste into Figma
|
|
55
|
+
--inside <hex> the shades of the palette colour nearest <hex>
|
|
56
|
+
`,scale:`Usage: forge scale <colour> [--json] [--svg]
|
|
57
|
+
|
|
58
|
+
50\u2013950 built in OKLCH, with <colour> at 500. Pass the hex without #, or quote it.
|
|
59
|
+
--json one JSON document: scale.steps[] with hex, oklch, white, black
|
|
60
|
+
--svg a card of swatches; pipe to pbcopy and paste into Figma
|
|
61
|
+
`};function Oe(s){let[e,...t]=s;if(t.includes("--help")||t.includes("-h"))throw process.stdout.write(ye[e==="scale"?"scale":"palette"]),new x(0,"commander.helpDisplayed","(outputHelp)");let n=t.filter(l=>l!=="--json"&&l!=="--svg"),i=t.includes("--svg"),r=n.indexOf("--inside"),o=r===-1?void 0:n[r+1];r!==-1&&n.splice(r,2);let u=n.find(l=>l.startsWith("-"));if(u!==void 0)throw d(`forge ${e} does not take ${u}.`,`Try: forge ${e} --help`);if(e==="scale"){if(r!==-1)throw d("--inside is for forge palette.","Try: forge palette photo.jpg --inside F26E69");if(n.length>1)throw d("forge scale takes one colour.","Try: forge scale 6579FD");return{kind:"scale",colour:ne(n[0]),svg:i}}if(n.length!==1)throw d(n.length===0?"No image given.":"forge palette takes one image.","Try: forge palette photo.jpg");return{kind:"palette",input:n[0],svg:i,...r===-1?{}:{inside:ne(o)}}}function ct(s){let e=s.indexOf("--");return(e===-1?s:s.slice(0,e)).includes("--json")}function xe(s){let e=s.indexOf("--"),t=e===-1?s:s.slice(0,e),n=e===-1?[]:s.slice(e),i=[],r;for(let o=0;o<t.length;o++){let u=t[o],l=u.startsWith("--boost=")?u.slice(8):void 0;if(u!=="--boost"&&l===void 0){i.push(u);continue}let h=l;if(h===void 0&&/^\d+$/.test(t[o+1]??"")&&(h=t[++o]),h!==void 0&&h!=="2"&&h!=="3"&&h!=="4")throw d(`--boost takes 2, 3 or 4, not ${h}.`,"Try --boost, --boost 2, --boost 3 or --boost 4.");r=h==="4"?4:h==="3"?3:2}return{rest:[...i,...n],...r===void 0?{}:{scale:r}}}function dt(s){let e=s;if(e[0]==="clip"||e[0]==="watch"||e[0]==="transcribe"||e[0]==="config"||e[0]==="probe"||e[0]==="extensions"||e[0]==="palette"||e[0]==="scale"||e[0]==="update"||e[0]==="uninstall")return Ce(e);let t=xe(e);return ke(t.rest,t.scale)}function Ce(s){if(s[0]==="update"){let e=s.slice(1).filter(t=>t!=="--json");if(e.length>0)throw d(`forge update takes nothing else, got: ${e.join(" ")}.`,"Try: forge update");return{kind:"update"}}if(s[0]==="uninstall"){let e=s.slice(1);if(e.length>0)throw d(`forge uninstall takes nothing else, got: ${e.join(" ")}.`,"Try: forge uninstall");return{kind:"uninstall"}}return s[0]==="clip"?ge(s):s[0]==="watch"?_e(s):s[0]==="transcribe"?be(s):s[0]==="config"?le(s.filter(e=>e!=="--json")):s[0]==="probe"?me(s):s[0]==="palette"||s[0]==="scale"?Oe(s):we(s)}function ke(s,e){let t=new $().name("forge").description("Convert \u2014 transform your files from the terminal").argument("[inputs...]","files, folders or globs").option("-t, --to <format>","target format").option("-o, --output <path>","output file or directory").option("-q, --quality <n>","quality for lossy formats, 1-100").option("--background <colour>","fill colour when flattening transparency","#ffffff").option("--keep-metadata","preserve EXIF and GPS data",!1).option("--recursive","descend into subfolders",!1).option("--force","allow overwriting existing files",!1).option("--max-size <size>","compress until the file fits, e.g. 500kb").option("--concurrency <n>","how many files to convert at once").option("--debug","show underlying errors",!1).option("--formats","list supported formats",!1).option("--merge","combine several PDFs into one").option("--split <mode>","every-page | every=N | at=N,N").option("--extract <pages>","keep only these pages, e.g. 3-7,12").option("--delete <pages>","drop these pages").option("--rotate <degrees>","90, 180 or 270").option("--separate","with --extract, write one file per page").option("--sharpen","sharpen at the same size; needs the boost extension").option("--boost [2|3|4]","sharpen and enlarge 2x (default), 3x or 4x; needs the boost extension").option("--trim","cut transparent or solid-colour edges; keeps the format").option("--crop <W:H>","cut to a shape, e.g. 1:1, 4:5, 16:9; keeps the subject").option("--resize <percent>","resize to a percent of the size, 1-200, e.g. 50%").option("--width <px>","resize to this width; the height follows").option("--height <px>","resize to this height; the width follows").option("--remove-bg","cut out the subject; needs the remove-background extension").option("--cut <start-end>","video or audio: keep from start to end, e.g. 0:03.2-0:41").option("--mute","video: take the sound out").option("--speed <x>","video or audio: play faster or slower, 0.25-4").option("--fps <n>","video: frames per second").option("--bitrate <kbps>","audio: bitrate, e.g. 128k").option("--loudness <LUFS>","audio: even out loudness to this level, e.g. -16").option("--preset <name>","run a preset saved from Done, e.g. --preset blog").option("--pages <ranges>","with --to, which pages to render, e.g. 3-7,12").option("--dpi <n>","rasterisation resolution, 36-600","150").option("--password-stdin","read an encrypted PDF's password from stdin").option("--json","print one JSON document on stdout instead of text").helpOption("-h, --help","show this help").version(X,"-V, --version","show the version").addHelpText("after",`${fe}
|
|
62
|
+
${pe}`).configureOutput({outputError:()=>{}}).exitOverride().allowExcessArguments(!1);try{t.parse(s,{from:"user"})}catch(f){if(f instanceof x&&f.code!=="commander.helpDisplayed"&&f.code!=="commander.version"){let[g="",...b]=f.message.replace(/^error: /,"").split(`
|
|
63
|
+
`),w=b.join(" ").trim().replace(/^\((.*)\)\.?$/,"$1");throw d(`${g.charAt(0).toUpperCase()}${g.slice(1).replace(/\.$/,"")}.`,w||"Run forge --help to see what Forge accepts.")}throw f}let n=t.opts(),i=t.args;if(n.formats)return{kind:"formats"};let r=ce(n);if(r!==void 0&&n.trim)throw d("--trim cuts the empty edges of an image.","To keep part of a video or audio file, use --cut, for example --cut 0:03-0:41.");if(n.preset!==void 0){let f=[["to","--to"],["quality","--quality"],["maxSize","--max-size"],["merge","--merge"],["split","--split"],["extract","--extract"],["delete","--delete"],["rotate","--rotate"],["sharpen","--sharpen"],["trim","--trim"],["crop","--crop"],["resize","--resize"],["width","--width"],["height","--height"],["removeBg","--remove-bg"],["pages","--pages"]].filter(([g])=>n[g]!==void 0&&n[g]!==!1).map(([,g])=>g);if(e!==void 0&&f.push("--boost"),f.length>0)throw d(`--preset already says what to do \u2014 leave out ${f.join(" and ")}.`,"Run the preset alone, or change it from Done with \u2192 continue editing.");return{kind:"preset",inputs:i,name:String(n.preset),...n.output===void 0?{}:{output:String(n.output)},force:n.force===!0,recursive:n.recursive===!0,debug:n.debug===!0}}if(n.pages!==void 0&&n.to===void 0)throw d("--pages needs --to: it chooses which pages to render.");let o=["merge","split","extract","delete","rotate"].filter(f=>n[f]!==void 0);if(o.length>1)throw d(`Use one operation at a time \u2014 got ${o.map(f=>`--${f}`).join(" and ")}.`);let u=[...n.sharpen?["--sharpen"]:[],...e!==void 0?["--boost"]:[],...n.removeBg?["--remove-bg"]:[]],l=[...n.resize!==void 0?["--resize"]:[],...n.width!==void 0?["--width"]:[],...n.height!==void 0?["--height"]:[]],h=r!==void 0&&!n.to&&n.quality===void 0&&n.maxSize===void 0;if(n.trim||n.crop!==void 0||l.length>0||h){if(l.length>1)throw d(`Use one of --resize, --width and --height \u2014 got ${l.join(" and ")}.`);let f=n.crop!==void 0?"--crop":l[0]??(n.trim?"--trim":"--cut"),g=[...n.crop!==void 0&&n.trim?["--trim"]:[],...u,...n.maxSize!==void 0?["--max-size"]:[],...n.pages!==void 0?["--pages"]:[],...o.map(ie=>`--${ie}`)][0];if(g!==void 0)throw d(`${f} cannot be combined with ${g}.`,g!=="--max-size"?"Run them one after the other.":f==="--crop"?"Crop first, then compress the result: forge photo-cropped-1x1.jpg --max-size 500kb":"Resize first, then compress the result: forge photo-1200x900.jpg --max-size 500kb");let b=n.crop!==void 0?{aspect:L(String(n.crop))}:void 0,w=n.resize!==void 0?{percent:de(n.resize)}:n.width!==void 0?{width:te("--width",n.width)}:n.height!==void 0?{height:te("--height",n.height)}:void 0;if(i.length===0)throw d("No files given.","Name an image, for example: forge photo.jpg --resize 50%");let k={background:String(n.background),keepMetadata:!!n.keepMetadata};n.quality!==void 0&&(k.quality=S(String(n.quality)));let y={kind:"edit",inputs:i,trim:!!n.trim,options:k,force:!!n.force,recursive:!!n.recursive,debug:!!n.debug};return b!==void 0&&(y.crop=b),w!==void 0&&(y.resize=w),r!==void 0&&(y.media=r),n.to&&(y.target=I(String(n.to))),n.output!==void 0&&(y.output=String(n.output)),n.concurrency!==void 0&&(y.concurrency=j(String(n.concurrency))),y}let a=n.sharpen?1:e,c=a!==void 0?"boost":n.removeBg?"remove-background":null;if(c!==null){if(u.length>1)throw d(`Use one operation at a time \u2014 got ${u.join(" and ")}.`);let f=u[0];if(o.length>0)throw d(`${f} cannot be combined with --${o[0]}.`);if(n.maxSize!==void 0||n.pages!==void 0)throw d(`${f} cannot be combined with ${n.maxSize!==void 0?"--max-size":"--pages"}.`);if(i.length===0)throw d("No files given.",`Name an image, for example: forge photo.jpg ${f}`);let g=n.to?I(String(n.to)):"png";if(c==="remove-background"){let k=U(g);if(k)throw k}let b={background:String(n.background),keepMetadata:!!n.keepMetadata};n.quality!==void 0&&(b.quality=S(String(n.quality)));let w={kind:"extension-op",op:c,inputs:i,target:g,options:b,force:!!n.force,recursive:!!n.recursive,debug:!!n.debug};return a!==void 0&&(w.scale=a),n.output!==void 0&&(w.output=String(n.output)),n.concurrency!==void 0&&(w.concurrency=j(String(n.concurrency))),w}if(o.length===1){let f=o[0];if(i.length===0)throw d("No files given.",`Name a PDF, for example: forge doc.pdf --${f}`);if(n.separate&&f!=="extract")throw d(`--separate only applies to --extract, not --${f}.`);if(n.output!==void 0)throw d(`--output does not apply to --${f}.`,"Page operations name their own outputs, beside the source. Rename the result afterwards.");let g={kind:"pageop",action:f,inputs:i,force:!!n.force,debug:!!n.debug};if(f==="rotate"){let b=Number(n.rotate);if(!Number.isInteger(b)||b%90!==0||b===0||b>=360)throw d(`--rotate takes a multiple of 90 below 360, not "${n.rotate}".`);g.rotate=b}if((f==="extract"||f==="delete")&&(g.pages=String(n[f]),f==="extract"&&n.separate&&(g.separate=!0)),f==="split"){let b=String(n.split),w=b.match(/^every=(\d+)$/),k=b.match(/^at=([\d,\s]+)$/);if(b==="every-page")g.split={mode:"every-page"};else if(w?.[1]!==void 0){let y=Number(w[1]);if(!Number.isInteger(y)||y<1)throw d(`--split every=N takes a whole number of pages, at least 1, not "${w[1]}".`);g.split={mode:"every-n",n:y}}else if(k?.[1])g.split={mode:"points",after:k[1].split(",").map(y=>Number(y.trim()))};else throw d(`--split takes every-page, every=N or at=N,N \u2014 not "${b}".`)}return g}if(i.length===0&&!n.to&&n.quality===void 0&&n.maxSize===void 0)return{kind:"shell"};if(n.quality!==void 0&&n.maxSize!==void 0)throw d("Use either --quality or --max-size, not both.","They are two ways of asking for the same thing, and Forge will not guess which wins.");if(!n.to&&(n.quality!==void 0||n.maxSize!==void 0)){if(i.length===0)throw d("No files given.","Name a file, for example: forge photo.jpg --max-size 500kb");let f={background:String(n.background),keepMetadata:!!n.keepMetadata};r!==void 0&&(f.media=r);let g={kind:"compress",inputs:i,options:f,force:!!n.force,recursive:!!n.recursive,debug:!!n.debug};if(n.quality!==void 0&&(g.quality=S(String(n.quality))),n.maxSize!==void 0&&(g.maxBytes=M(n.maxSize)),n.output!==void 0&&(g.output=String(n.output)),t.getOptionValueSource("dpi")==="cli"){let b=Number(n.dpi);if(!Number.isInteger(b)||b<36||b>600)throw H(n.dpi);g.dpi=b}return n.concurrency!==void 0&&(g.concurrency=j(String(n.concurrency))),g}if(!n.to)throw d("No target format given.","Add --to <format>, for example: forge photo.jpg --to webp");if(i.length===0)throw d("No files given.","Name a file, a folder or a glob, for example: forge photo.jpg --to webp");let p={background:String(n.background),keepMetadata:!!n.keepMetadata};n.quality!==void 0&&(p.quality=S(String(n.quality))),r!==void 0&&(p.media=r);let O=Number(n.dpi);if(!Number.isInteger(O)||O<36||O>600)throw H(n.dpi);let _={kind:"convert",inputs:i,target:I(String(n.to)),options:p,force:!!n.force,recursive:!!n.recursive,debug:!!n.debug,dpi:O,passwordStdin:!!n.passwordStdin};return n.output!==void 0&&(_.output=String(n.output)),n.pages!==void 0&&(_.pages=String(n.pages)),n.maxSize!==void 0&&(_.maxBytes=M(n.maxSize)),n.concurrency!==void 0&&(_.concurrency=j(String(n.concurrency))),_}export{pe as a,fe as b,ct as c,dt as d};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
function f(n){let t=n.trim().split(":");if(t.length===0||t.length>3)return;let e=0;for(let[o,i]of t.entries()){if(!(o===t.length-1?/^\d+(\.\d+)?$/:/^\d+$/).test(i))return;let u=Number(i);if(o>0&&u>=60)return;e=e*60+u}return e}function R(n){let t=n.indexOf("-");if(t<0)return;let e=f(n.slice(0,t)),o=n.slice(t+1).trim(),i=o===""?void 0:f(o);if(!(e===void 0||o!==""&&i===void 0)&&!(i!==void 0&&i<=e))return{start:e,end:i}}var s=n=>String(n).padStart(2,"0");function A(n){let t=Math.round(n*10),e=t%600/10,o=Math.floor(t/600)%60,i=Math.floor(t/36e3),d=e.toFixed(1).padStart(4,"0");return i>0?`${i}:${s(o)}:${d}`:`${o}:${d}`}function _(n){let t=Math.round(n),e=t%60,o=Math.floor(t/60)%60,i=Math.floor(t/3600);return i>0?`${i}:${s(o)}:${s(e)}`:`${o}:${s(e)}`}var S=[1,5,10,30,60,300,600,1800];function K(n){return S.filter((t,e)=>e===0||t<=n/4)}function P(n){return n<60?`${n} s`:`${n/60} min`}var w=[1920,1280,854],O=[30,24],E=15,M=64,$=32,x=32,r=n=>Math.max(2,Math.round(n/2)*2);function a(n,t){let e=n.width>=n.height,o=e?n.width:n.height;if(t>=o)return{width:r(n.width-1),height:r(n.height-1)};let i=t/o;return e?{width:r(t),height:r(n.height*i)}:{width:r(n.width*i),height:r(t)}}function c(n){let t=Math.max(n.width,n.height),e=[t,...w.filter(u=>u<t)],o=n.hasAudio?M:0,i=[];for(let u of e){let{width:p,height:l}=a(n,u),g=[...new Set([n.fps,...O].filter(h=>h<=n.fps))];for(let h of g)i.push({width:p,height:l,fps:h,audioKbps:o})}let d=a(n,e[e.length-1]??t);return i.push({...d,fps:Math.min(E,n.fps),audioKbps:n.hasAudio?x:0}),i}var m=n=>n.width*n.height*n.fps*.02/1e3;function b(n){let t=c(n),e=t[t.length-1];return e?Math.ceil((m(e)+e.audioKbps)*1e3/8/.98*n.duration):0}function v(n){let t=n.targetBytes*8/n.duration/1e3*.98;for(let e of c(n)){let o=t-e.audioKbps;if(o>=m(e))return{...e,videoKbps:Math.floor(o)}}return{floor:b(n)}}function z(n,t={}){let e=n.audio!==void 0&&t.mute!==!0;return n.video&&!t.soundOnly?b({duration:n.duration,width:n.video.width,height:n.video.height,fps:n.video.fps,hasAudio:e}):Math.ceil($*1e3/8/.98*n.duration)}export{f as a,R as b,A as c,_ as d,K as e,P as f,v as g,z as h};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a}from"./chunk-HON4OV7M.js";import{b as c}from"./chunk-
|
|
3
|
+
import{a}from"./chunk-HON4OV7M.js";import{b as c}from"./chunk-5B5XXH22.js";import{access as x,readFile as p}from"node:fs/promises";import{join as n,sep as y}from"node:path";function g(){return n(a(),"forge","extensions")}var E=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;async function v(e){if(c(e)!==void 0)try{let u=n(g(),e),t=(await p(n(u,"current"),"utf8")).trim();if(!E.test(t))return;let r=n(u,t),i=JSON.parse(await p(n(r,"manifest.json"),"utf8"));if(typeof i!="object"||i===null)return;let{id:m,version:l,entry:o,kind:s,files:d}=i;if(m!==e||l!==t||s!=="node"&&s!=="exec"||typeof o!="string"||typeof d!="object"||d===null||!(o in d))return;let f=n(r,o);return f.startsWith(`${r}${y}`)?(await x(f),{id:e,version:t,dir:r,entry:f,kind:s}):void 0}catch{return}}export{g as a,E as b,v as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{c as x}from"./chunk-M66BUNYO.js";import{existsSync as l,statSync as h}from"node:fs";import{basename as f,dirname as E,extname as a,isAbsolute as F,join as o,relative as R,resolve as s,sep as k}from"node:path";function y(t){return t.endsWith("/")||t.endsWith(k)||l(t)&&h(t).isDirectory()?!0:a(t)===""}var O=255;function b(t,r){return r==="darwin"||r==="win32"?t.length:Buffer.byteLength(t)}function c(t,r,e=process.platform){if(b(t+r,e)<=O)return t+r;let n="";for(let i of t){if(b(n+i+r,e)>O)break;n+=i}return n+r}function j(t,r){if(s(t)===s(r))return!0;try{let e=h(t),n=h(r);return e.dev===n.dev&&e.ino===n.ino}catch{return!1}}function A(t,r){let e=f(t),n=a(e),i=n?e.slice(0,-n.length):e;return c(i,x(r))}function S(t,r,e){if(!e)return t;let n=R(s(e),r);return!n||n.startsWith("..")?t:o(t,n)}function L(t){let r=s(t.sourcePath),e=A(r,t.target);if(!t.output)return o(s(r,".."),e);let n=F(t.output)?t.output:s(t.output);return y(t.output)?o(S(n,s(r,".."),t.sourceRoot),e):s(n)}function D(t){let r=L(t);if(t.output&&!y(t.output))return r;let e=a(r);return o(s(r,".."),c(f(r,e),`-${t.suffix}${e}`))}function J(t){if(!l(t))return t;let r=s(t,".."),e=f(t),n=a(e),i=n?e.slice(0,-n.length):e;for(let u=1;u<1e4;u++){let g=o(r,c(i,` (${u})${n}`));if(!l(g))return g}throw new Error(`no free name beside ${e}`)}function p(t){let r=s(t,".."),e=f(t),n=a(e);return{dir:r,stem:n?e.slice(0,-n.length):e,ext:n||".pdf"}}function w(t,r){let{dir:e,stem:n,ext:i}=p(s(t));return o(e,c(n,`-${r}${i}`))}function T(t,r){let{dir:e,stem:n,ext:i}=p(s(t)),u=String(r).length;return Array.from({length:r},(g,m)=>o(e,c(n,`-${String(m+1).padStart(u,"0")}${i}`)))}function z(t,r,e,n,i){let{stem:u}=p(s(t)),g=n?S(s(n),s(t,".."),i):s(t,".."),m=x(e),P=String(Math.max(1,...r.map(d=>d+1))).length,I=r.map(d=>o(g,c(u,`-${String(d+1).padStart(P,"0")}${m}`))),[$,...v]=I;if($===void 0)throw new Error("rasterOutputPaths requires at least one selected page");return[$,...v]}function B(t,r,e){if(!e)return[w(t,"extract")];let{dir:n,stem:i,ext:u}=p(s(t));return r.map(g=>o(n,c(i,`-p${g+1}${u}`)))}function C(t){let r=s(t[0]??"merged.pdf");if(new Set(t.map(n=>s(n,".."))).size===1){let n=s(r,"..");return o(n,c(f(n),"-merged.pdf"))}return w(r,"merged")}function N(t,r,e){let n=r?t.map(u=>o(r,f(u))):t,[i]=n;return!e||n.length!==1||i===void 0?n:[o(E(i),`${e}${a(i)}`)]}function G(t,r,e){return N([t],r,e)[0]??t}export{y as a,c as b,j as c,L as d,D as e,J as f,w as g,T as h,z as i,B as j,C as k,N as l,G as m};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as $,h as lt,i as D}from"./chunk-
|
|
3
|
+
import{a as $,h as lt,i as D}from"./chunk-IWFVEMDN.js";import{b as x,c as R,d as H,f as v,g as P,h as X}from"./chunk-QVACE4IE.js";import{i as it}from"./chunk-6L6C3GJU.js";import{D as at,E as st,v as ot}from"./chunk-KAHWYWNT.js";import{d as tt,m as et,o as nt,u as rt}from"./chunk-3UEQ2OX6.js";import{a as Z}from"./chunk-M66BUNYO.js";var xt=[[15,"rose"],[45,"red"],[70,"orange"],[95,"amber"],[120,"yellow"],[140,"lime"],[165,"green"],[185,"teal"],[215,"cyan"],[250,"sky"],[280,"blue"],[295,"indigo"],[315,"violet"],[340,"purple"],[355,"pink"],[360,"rose"]];function w(t){let{C:e,h:n}=v(R(t));return e<.03?"grey":_(n)}function _(t){let e=(t%360+360)%360;return(xt.find(([n])=>e<n)??[360,"rose"])[1]}var Tt=["full","mono","analogous","opposite","split","triad","pastel"],ct={full:"Full set",mono:"Monochromatic",analogous:"Analogous",opposite:"Complementary",split:"Split complementary",triad:"Triadic",pastel:"Pastel"},B={brightness:0,saturation:0,hue:0,contrast:0},At=t=>!!(t.brightness||t.saturation||t.hue||t.contrast),G=[{name:"red",hex:{r:251,g:44,b:54},role:"danger"},{name:"orange",hex:{r:255,g:105,b:0}},{name:"yellow",hex:{r:239,g:177,b:0},role:"warning"},{name:"green",hex:{r:0,g:201,b:80},role:"success"},{name:"teal",hex:{r:0,g:187,b:167}},{name:"blue",hex:{r:43,g:127,b:255},role:"info"},{name:"purple",hex:{r:173,g:70,b:255}},{name:"pink",hex:{r:246,g:51,b:154}}],$t={analogous:[-30,0,30],opposite:[0,180],split:[0,150,210],triad:[0,120,240]},wt=.553,yt=.024,b=t=>v(R(t)),C=(t,e,n)=>H(P({L:t,C:Math.max(0,e),h:(n+360)%360})),K=(t,e)=>(t-e+540)%360-180;function ht(t,e,n){let r=P({L:t,C:e,h:n}),a=R(H(r));return Math.hypot(a.L-r.L,a.a-r.a,a.b-r.b)<.003}function L(t,e){let n=0,r=.4;for(let a=0;a<30;a++){let o=(n+r)/2;ht(t,o,e)?n=o:r=o}return n}function W({L:t,C:e,h:n}){let r=L(t,n);return r>0?Math.min(1,e/r):0}var A=(t,e)=>e>=0?t+(.98-t)*(e/100):t+(t-.05)*(e/100),q=(t,e,n)=>n>=0?t+(Math.max(t,e)-t)*(n/100):t*(1+n/100);function T(t,e){if(!(e.brightness||e.saturation||e.hue))return t;let{L:n,C:r,h:a}=b(t),o=A(n,e.brightness),i=(a+e.hue+360)%360,l=q(r,L(o,i),e.saturation);for(let s=0;s<40&&l>0&&!ht(o,l,i);s++)l-=.005;return C(o,l,i)}function k(t,e,n,r){let a=A(t,r.brightness),o=(n+r.hue+360)%360,i=L(a,o);return C(a,Math.min(i,q(e,i,r.saturation)),o)}function Y(t,e,n){if(!e)return t;let r=b(t[n].rgb).L;return t.map((a,o)=>{if(o===n)return a;let i=b(a.rgb),l=Math.max(.02,Math.min(.995,r+(i.L-r)*(1+e/100))),s=C(l,Math.min(i.C,L(l,i.h)),i.h);return{...a,rgb:s,hex:x(s)}})}function Et(t,e,n,r){return Y(t(T(e,n)),n.contrast,r)}function ut(t,e){let n=b(t),r=G.map(s=>b(s.hex)),a=0;r.forEach((s,c)=>{Math.abs(K(n.h,s.h))<Math.abs(K(n.h,r[a].h))&&(a=c)});let o=r[a],i=Math.max(-10,Math.min(10,K(n.h,o.h)/2)),l=W(n);return G.map((s,c)=>{if(c===a)return{name:s.name,role:s.role,rgb:T(t,e),yours:!0};let h=r[c],p=n.L>=o.L?h.L+(n.L-o.L)*(1-h.L)/(1-o.L):h.L*n.L/o.L,f=A(p,e.brightness),g=(h.h+i+e.hue+360)%360,d=L(f,g),u=Math.min(1,W(h)),S=Math.min(d,q(l*u*d,d,e.saturation));return{name:s.name,role:s.role,rgb:C(f,S,g),yours:!1}})}function St(t,e,n){let r=b(t),a=w(t);if(e==="mono")return[{name:a,rgb:T(t,n),yours:!0},{name:`${a} soft`,rgb:k(r.L,r.C*.5,r.h,n),yours:!1},{name:`${a} dusty`,rgb:k(r.L,r.C*.22,r.h,n),yours:!1}];if(e==="pastel")return ut(t,B).map((l,s)=>{let c=b(l.rgb),h=c.C<.01?b(G[s].hex).h:c.h;return{...l,rgb:k(.86,Math.min(.1,L(.86,h))*.85,h,n)}});let o=W(r);return($t[e]??[0]).map(l=>{if(l===0)return{name:a,rgb:T(t,n),yours:!0};let s=(r.h+l+360)%360,c=o*L(r.L,s);return{name:o>0?_(s):w(k(r.L,c,s,B)),rgb:k(r.L,c,s,n),yours:!1}}).sort((l,s)=>Number(s.yours)-Number(l.yours))}function Lt(t,e,n){let r=b(t).h+e.hue,a=Math.max(0,yt*(1+e.saturation/100));return D(C(A(wt,e.brightness),a,r),n)}function Ot(t,e,n=B,r=$){let a=lt(r);return{rows:(e==="full"?ut(t,n):St(t,e,n)).map(({name:l,role:s,rgb:c,yours:h})=>({name:l,...s?{role:s}:{},steps:Y(D(c,r),n.contrast,a),yours:h})),neutral:Y(Lt(t,n,r),n.contrast,a)}}var M=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),E=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"colour",y='font-family="Inter"',O=t=>`${t[0]?.toUpperCase()??""}${t.slice(1)}`;function mt(t){let e=t==="dark";return{ink:e?"#FAFAFA":"#111111",grey:e?"#A1A1AA":"#71717A",edge:e?"#FFFFFF":"#000000",paper:e?"#18181B":"#FFFFFF"}}var Mt=`<defs><pattern id="checker" width="16" height="16" patternUnits="userSpaceOnUse"><rect width="16" height="16" fill="#FFFFFF"/><rect width="8" height="8" fill="#E5E5E5"/><rect x="8" y="8" width="8" height="8" fill="#E5E5E5"/></pattern></defs>
|
|
4
4
|
`;function I(t,e,n,r="light"){let{ink:a,grey:o,edge:i,paper:l}=mt(r),s=n.length>8?64:104,c=10,h=48+n.length*s+Math.max(0,n.length-1)*c,p=84+s+56,f=s>80?12:10,g=`<text id="title" x="24" y="38" ${y} font-size="15" font-weight="600" fill="${a}">${M(t)}</text><text id="subtitle" x="24" y="58" ${y} font-size="12" fill="${o}">${M(e)}</text>`,d=n.map((u,S)=>`<g id="${E(u.id)}" transform="translate(${24+S*(s+c)} 80)">`+(u.alpha===void 0?"":`<rect id="checker" width="${s}" height="${s}" rx="${f}" fill="url(#checker)"/>`)+`<rect id="swatch" width="${s}" height="${s}" rx="${f}" fill="${u.hex}"`+(u.alpha===void 0?"":` fill-opacity="${u.alpha.toFixed(3)}"`)+` stroke="${i}" stroke-opacity="0.08"/><text id="name" x="1" y="${s+22}" ${y} font-size="13" font-weight="600" fill="${a}">${M(u.name)}</text><text id="value" x="1" y="${s+40}" ${y} font-size="11" fill="${o}">${M(u.value)}</text></g>`).join(`
|
|
5
5
|
`);return`<svg xmlns="http://www.w3.org/2000/svg" width="${h}" height="${p}" viewBox="0 0 ${h} ${p}">
|
|
6
6
|
`+(n.some(u=>u.alpha!==void 0)?Mt:"")+`<g id="${E(t)}">
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as m}from"./chunk-
|
|
3
|
+
import{a as m}from"./chunk-EX7KZBI6.js";import{U as l}from"./chunk-3UEQ2OX6.js";import{randomBytes as h}from"node:crypto";import{link as y,mkdir as p,readdir as x,readFile as P,rename as E,rm as c,stat as L,writeFile as S}from"node:fs/promises";import{join as u}from"node:path";var b=720*60*1e3,k=600*1e3,M=200,F=600*1e3;function a(){return u(m(),".locks")}function f(t){return u(a(),`${t}.lock`)}function v(t){if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(n){return n.code==="EPERM"}}async function s(t){try{let n=JSON.parse(await P(t,"utf8"));return typeof n.pid!="number"||typeof n.token!="string"?void 0:n}catch{return}}async function d(t,n){if(n===void 0||!v(n.pid))return!0;let e=await L(t).catch(()=>{});return e!==void 0&&Date.now()-e.mtimeMs>b}async function D(t){let n=`${t}.stale-${h(4).toString("hex")}`;try{await E(t,n)}catch{return}let e=await s(n);e!==void 0&&!await d(n,e)&&await y(n,t).catch(()=>{}),await c(n,{force:!0})}async function A(){let t=await x(a()).catch(()=>[]);for(let n of t){if(!/\.lock\.(stale-)?[0-9a-f]+$/.test(n))continue;let e=u(a(),n),i=await L(e).catch(()=>{});i&&Date.now()-i.mtimeMs>F&&await c(e,{force:!0})}}async function g(t,n){await p(a(),{recursive:!0});let e=f(t),i={pid:process.pid,token:h(8).toString("hex"),at:Date.now(),...n!==void 0?{what:n}:{}},r=`${e}.${i.token}`;await S(r,JSON.stringify(i),{flag:"wx"});try{for(let o=0;o<2;o++){try{return await y(r,e),i}catch(w){if(w.code!=="EEXIST")throw w}if(!await d(e,await s(e)))return;await D(e)}return}finally{await c(r,{force:!0})}}async function T(t,n){let e=f(t);(await s(e))?.token===n.token&&await c(e,{force:!0})}async function _(t){let n=f(t),e=await s(n);if(!(e===void 0||await d(n,e)))return{pid:e.pid,...e.what!==void 0?{what:e.what}:{}}}async function H(t,n,e={}){let i=Date.now()+(e.waitMs??k);await p(a(),{recursive:!0}),await A();let r=await g(t,e.what);for(r===void 0&&(e.waitMs??k)>0&&e.onWait?.();r===void 0;){if(e.signal?.aborted)throw e.signal.reason??new Error("aborted");if(Date.now()>=i)throw l(t,await _(t),e.action??"run");await new Promise(o=>setTimeout(o,M)),r=await g(t,e.what)}try{return await n()}finally{await T(t,r)}}export{k as a,_ as b,H as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{b as v,d as a,e as $,g as B,i as Q}from"./chunk-LNB5D67B.js";import{a as S}from"./chunk-BZXDNDPG.js";import{a as J,j as E,l as I,m as N}from"./chunk-QR6QHTC3.js";import{a as q,b as k,d as C}from"./chunk-6L6C3GJU.js";import{d as M,k as T,s as y}from"./chunk-KAHWYWNT.js";import{b as R,e as d,g as f,h as F,j,k as D,l as g,m as s}from"./chunk-EXLXSKRH.js";import{F as l,t as w}from"./chunk-3UEQ2OX6.js";import{a as u,c as P}from"./chunk-M66BUNYO.js";var b=t=>t.length>0&&t.every(e=>e.kind==="image")?t:void 0;function Pt(t,e){let n=J(t);return n.includes(e)?void 0:w(t,e,n)}function _(t){return{target:t.target??"png",background:typeof t.background=="string"?t.background:"#ffffff",keepMetadata:t.keepMetadata===!0,...typeof t.output=="string"?{output:t.output}:{},...t.roots instanceof Map?{roots:t.roots}:{},...typeof t.quality=="number"?{quality:t.quality}:{}}}var G=()=>({kind:"select",id:"target",label:"Save as",default:"png",choices:[{value:"png",label:"PNG",hint:u.png.hint}]}),pt=t=>t===1?"sharp":`${t}x`,ut=t=>t===1||t===3||t===4?t:2,X={id:"boost",label:"Boost resolution",verb:"Boosting",hint:"sharper, at its size or at 2\xD7, 3\xD7 or 4\xD7",requires:"boost",appliesTo:t=>b(t)!==void 0,unavailable:()=>"images only",options:()=>[{kind:"select",id:"scale",label:"Scale",default:"2",choices:[{value:"1",label:"Sharpen",hint:"the same size, sharper"},{value:"2",label:"2\xD7",hint:"twice the width and height"},{value:"3",label:"3\xD7",hint:"three times the width and height"},{value:"4",label:"4\xD7",hint:"four times the width and height"}]},G()],plan(t,e){let n=b(t);if(!n)return[];let o=_(e),r=ut(Number(e.scale??2));return n.map(i=>({op:"boost",sources:[i],outputs:[d({sourcePath:i.path,target:o.target,suffix:pt(r),...o.output===void 0?{}:{output:o.output},...o.roots?.get(i.path)===void 0?{}:{sourceRoot:o.roots.get(i.path)}})],scale:r,target:o.target,options:{background:o.background,keepMetadata:o.keepMetadata,...o.quality===void 0?{}:{quality:o.quality}}}))}},H={id:"remove-background",label:"Remove background",verb:"Removing",hint:"cut out the subject",requires:"remove-background",appliesTo:t=>b(t)!==void 0,unavailable:()=>"images only",options:()=>[G()],plan(t,e){let n=b(t);if(!n)return[];let o=_(e);return n.map(r=>({op:"remove-background",sources:[r],outputs:[d({sourcePath:r.path,target:o.target,suffix:"cutout",...o.output===void 0?{}:{output:o.output},...o.roots?.get(r.path)===void 0?{}:{sourceRoot:o.roots.get(r.path)}})],target:o.target,options:{background:o.background,keepMetadata:o.keepMetadata,...o.quality===void 0?{}:{quality:o.quality}}}))}};import{dirname as ct}from"node:path";var mt=t=>u[t.format].media==="video",dt=t=>t.length===1&&t[0]?.kind==="image"?t[0]:void 0,lt=t=>t.length===1&&t[0]?.kind==="document"?t[0]:void 0,ft="-small",c={min:30,max:100,step:35},gt=t=>{let e=Math.ceil((t-c.min)/c.step);return Math.min(c.max,c.min+Math.max(0,e)*c.step)},U={id:"compress",label:"Compress",verb:"Compressing",hint:"make it smaller",appliesTo:t=>{if(t.length===1&&t[0]?.kind==="media")return!0;let e=dt(t);if(e!==void 0){let o=u[e.format];return o.lossy||o.quantisable===!0}return(lt(t)?.images?.compressible??0)>0},options(t,e,n){let o=t[0];if(!o)return[];let r=[{kind:"select",id:"mode",label:`Compress ${S(o.path)??"this file"}`,choices:[o.kind==="media"?{value:"quality",label:"By quality"}:{value:"quality",label:"By quality",hint:"pick a level, see the result"},{value:"size",label:"To a target size",hint:"smallest quality that fits"}],default:"quality"}];if(e.mode==="quality"&&o.kind==="media"&&!mt(o))r.push({kind:"slider",id:"bitrate",label:"Quality",min:32,max:320,step:32,default:96});else if(e.mode==="quality"){let i=o.kind==="image"&&u[o.format].quantisable===!0;r.push(i?{kind:"slider",id:"quality",label:"Quality",...c,default:gt(n.quality),points:!0}:{kind:"slider",id:"quality",label:"Quality",min:1,max:100,step:5,default:n.quality})}else if(e.mode==="size")r.push({kind:"text",id:"size",label:"Target size",placeholder:"e.g. 500kb or 2mb"});else return r;return r.push(v(o,n)),r},plan(t,e){let n=e.mode;if(n!=="quality"&&n!=="size")throw l(`compressAction.plan() needs a mode of "quality" or "size", got ${JSON.stringify(n)}.`,"This is a caller bug, not a user-facing condition: walk options() before calling plan().");let o=t[0];if(!o)return[];let r=(S(o.path)??"file").replace(/\.[^.]+$/,""),i=typeof e.destination=="string"?e.destination:ct(o.path),p=o.kind==="media"?$(o.format):o.format,st=`${i}/${R(r,`${ft}${P(p)}`)}`,z=o.kind==="media"?B(e):void 0;return[{op:"convert",sources:[o],target:p,outputs:[st],options:{background:"#ffffff",keepMetadata:!1,...n==="quality"&&typeof e.quality=="number"?{quality:e.quality}:{},compress:{dither:e.dither===!0},...z?{media:z}:{}}}]}};function bt(t,e){if(e.crop){let n=T(e.crop.aspect);if(!e.resize)return n;let o=e.crop.box??M(t,e.crop.aspect);return`${n}-${I(y(o,e.resize))}`}return e.trim&&e.resize?`trimmed-${N(e.resize)}`:e.resize?I(y(t,e.resize)):"trimmed"}function ht(t,e){if(e.trim&&e.crop)throw new Error("planEdit cannot trim and crop the same image");return t.map(n=>{let o=e.target??E(n),r={background:e.background,keepMetadata:e.keepMetadata,...e.quality===void 0?{}:{quality:e.quality},...e.trim?{trim:!0}:{},...e.resize?{resize:e.resize}:{},...e.crop?{crop:e.crop}:{}},i=e.roots?.get(n.path),p=d({sourcePath:n.path,target:o,suffix:bt(n,e),...e.output===void 0?{}:{output:e.output},...i===void 0?{}:{sourceRoot:i}});return{op:"convert",sources:[n],outputs:[s(p,a(e.destination),a(e.name))],target:o,options:r}})}var x=t=>t.length>0&&t.every(e=>e.kind==="image")?t:void 0,yt=t=>typeof t=="object"&&t!==null&&("percent"in t||"width"in t||"height"in t),K=t=>typeof t=="object"&&t!==null&&"aspect"in t&&typeof t.aspect=="object"&&t.aspect!==null&&"w"in t.aspect&&"h"in t.aspect;function A(t,e,n,o){return{id:t,label:e,verb:n,hint:o,appliesTo:r=>x(r)?.every(i=>t==="resize"||i.frames<=1)===!0,unavailable:r=>x(r)?"animated":"images only",options:()=>[],plan(r,i){let p=x(r);return p?t==="crop"&&!K(i.crop)?[]:ht(p,{trim:t==="trim"||i.trim===!0,...yt(i.resize)?{resize:i.resize}:{},...K(i.crop)?{crop:i.crop}:{},...typeof i.target=="string"?{target:i.target}:{},...typeof i.output=="string"?{output:i.output}:{},...i.roots instanceof Map?{roots:i.roots}:{},destination:i.destination,name:i.name,background:typeof i.background=="string"?i.background:"#ffffff",keepMetadata:i.keepMetadata===!0,...typeof i.quality=="number"?{quality:i.quality}:{}}):[]}}}var L=A("trim","Trim edges","Trimming edges","cut empty borders"),V=A("resize","Resize","Resizing","smaller or larger"),W=A("crop","Crop to shape","Cropping","change the shape");var h=t=>t.length===1&&t[0]?.kind==="document"&&t[0].format==="pdf"?t[0]:void 0,Y={id:"split",label:"Split",verb:"Splitting",hint:"into several files",appliesTo:t=>(h(t)?.pages??0)>1,unavailable:t=>h(t)===void 0?"one PDF at a time":"only one page",options(t){let e=h(t);return e?[{kind:"select",id:"mode",label:"How",default:"every-page",choices:[{value:"every-page",label:"Every page",hint:`${e.pages} files`},{value:"every-n",label:"Every N pages",hint:"ask how many"},{value:"points",label:"At points I choose",hint:"grid"}]}]:[]},plan(t,e){let n=h(t);if(!n)return[];let o=Array.isArray(e.cuts)?e.cuts:[],r=C(o,n.pages).length,i=g(F(n.path,r),a(e.destination),a(e.name));return[{op:"split",sources:[n],outputs:i,cuts:o}]}};function Xt(t){return Array.from({length:Math.max(0,t-1)},(e,n)=>n)}function Ht(t,e){if(!Number.isInteger(e)||e<1)throw l("Splitting every N pages needs N to be a whole number, at least 1.");let n=[];for(let o=e;o<t;o+=e)n.push(o-1);return n}var m=t=>t.length===1&&t[0]?.kind==="document"&&t[0].format==="pdf"?t[0]:void 0;function Z(t,e){return Array.isArray(e.pages)?k(e.pages):typeof e.pages=="string"?k(q(e.pages,t.pages)):[]}var tt=t=>({kind:"text",id:"pages",label:"Pages",placeholder:`1-${t.pages}`}),et={id:"extract",label:"Extract",verb:"Extracting",hint:"keep only some pages",appliesTo:t=>m(t)!==void 0,unavailable:()=>"one PDF at a time",options:t=>{let e=m(t);return e?[tt(e),{kind:"select",id:"separate",label:"Output",default:"one",choices:[{value:"one",label:"One file",hint:"all selected pages together"},{value:"many",label:"Separate files",hint:"one per page"}]}]:[]},plan(t,e){let n=m(t);if(!n)return[];let o=Z(n,e),r=e.separate==="many";return[{op:"extract",sources:[n],outputs:g(j(n.path,o,r),a(e.destination),a(e.name)),pages:o,separate:r}]}},ot={id:"delete",label:"Delete",verb:"Deleting",hint:"drop some pages",appliesTo:t=>m(t)!==void 0,unavailable:()=>"one PDF at a time",options:t=>{let e=m(t);return e?[tt(e)]:[]},plan(t,e){let n=m(t);return n?[{op:"delete",sources:[n],outputs:[s(f(n.path,"trimmed"),a(e.destination),a(e.name))],pages:Z(n,e)}]:[]}};var O=t=>t.filter(e=>e.kind==="document"&&e.format==="pdf"),nt={id:"merge",label:"Merge",verb:"Merging",hint:"several files into one",appliesTo:t=>O(t).length>=2&&O(t).length===t.length,unavailable:t=>O(t).length!==t.length?"PDFs only":"needs 2+ files",options:()=>[],plan(t,e){let n=s(D(t.map(o=>o.path)),a(e.destination),a(e.name));return[{op:"merge",sources:t,outputs:[n]}]}};var it=t=>t.length===1&&t[0]?.kind==="document"&&t[0].format==="pdf"?t[0]:void 0,rt={id:"rotate",label:"Rotate",verb:"Rotating",hint:"turn pages",appliesTo:t=>it(t)!==void 0,unavailable:()=>"one PDF at a time",options:()=>[{kind:"select",id:"degrees",label:"Turn",default:"90",choices:[{value:"90",label:"90\xB0 right",hint:"a quarter turn"},{value:"180",label:"180\xB0",hint:"upside down"},{value:"270",label:"90\xB0 left",hint:"a quarter turn back"}]}],plan(t,e){let n=it(t);if(!n)return[];let r=Number(e.degrees??90)/90%4||1;return[{op:"rotate",sources:[n],outputs:[s(f(n.path,"rotated"),a(e.destination),a(e.name))],turns:r}]}};var at=[Q,U,nt,Y,et,ot,rt,L,V,W],de=at.filter(t=>!["convert","compress","trim","resize","crop"].includes(t.id)),kt=[X,H];function le(t,e=new Set){return[...at,...kt.filter(n=>n.requires&&e.has(n.requires))].filter(n=>n.appliesTo(t))}function fe(t,e){return t.appliesTo(e)?void 0:t.unavailable?.(e)}export{Pt as a,X as b,H as c,U as d,ht as e,L as f,V as g,W as h,rt as i,Y as j,Xt as k,Ht as l,at as m,de as n,le as o,fe as p};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{d as f}from"./chunk-
|
|
3
|
+
import{d as f}from"./chunk-AAXBN572.js";import{randomBytes as g}from"node:crypto";import{mkdir as N,readFile as b,rename as x,rm as y,writeFile as k}from"node:fs/promises";import{dirname as l,join as E}from"node:path";var A="https://registry.npmjs.org/forge-terminal/latest",C=1440*60*1e3,R=3e3,O=/^(\d+)\.(\d+)\.(\d+)$/;function a(t){let e=O.exec(t);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:void 0}function P(t,e){let n=a(t),o=a(e);if(!n||!o)return!1;for(let r=0;r<3;r++)if(n[r]!==o[r])return n[r]>o[r];return!1}function D(t,e=process.env){return!(t.updateCheck===!1||e.CI!==void 0&&e.CI!==""&&e.CI!=="false"||e.FORGE_NO_UPDATE_CHECK!==void 0&&e.FORGE_NO_UPDATE_CHECK!=="")}var S=20,_=22,T=200;function U(t){let e=t.codePointAt(0)??0;return e>=32&&(e<127||e>159)}var d=(t,e)=>typeof t=="string"?[...t].filter(U).join("").trim().slice(0,e):"";function p(t){if(!Array.isArray(t))return;let e=t.map(n=>{let{title:o,text:r}=typeof n=="object"&&n!==null?n:{};return{title:d(o,_),text:d(r,T)}}).filter(n=>n.title!==""&&n.text!=="").slice(0,S);return e.length>0?e:void 0}function h(){return E(l(f()),"update-check.json")}async function c(){try{let t=JSON.parse(await b(h(),"utf8"));if(typeof t!="object"||t===null)return;let{checkedAt:e,latest:n,notifiedAt:o,whatsNew:r}=t;if(typeof e!="number")return;let s=typeof n=="string"&&a(n)!==void 0,i=s?p(r):void 0;return{checkedAt:e,...s?{latest:n}:{},...typeof o=="number"?{notifiedAt:o}:{},...i?{whatsNew:i}:{}}}catch{return}}async function F(t){let e=h();await N(l(e),{recursive:!0});let n=`${e}.${g(4).toString("hex")}.tmp`;try{await k(n,`${JSON.stringify(t)}
|
|
4
4
|
`),await x(n,e)}catch(o){throw await y(n,{force:!0}).catch(()=>{}),o}}function L(t,e=Date.now()){return t===void 0?!0:t.checkedAt>e||e-t.checkedAt>C}async function $(t={}){return(await w(t))?.version}async function w(t){let e=t.fetchImpl??fetch,n=AbortSignal.timeout(t.timeoutMs??R),o=t.signal?AbortSignal.any([t.signal,n]):n;try{let r=await e(A,{signal:o,headers:{accept:"application/json"}});if(!r.ok)return;let s=await r.json(),{version:i,whatsNew:m}=s??{};if(typeof i!="string"||!a(i))return;let u=p(m);return u?{version:i,whatsNew:u}:{version:i}}catch{return}}async function G(t={}){let e=await w(t),n=await c(),o=e??(n?.latest!==void 0?n:void 0),r=e?.version??n?.latest,s={checkedAt:t.now??Date.now(),...r!==void 0?{latest:r}:{},...n?.notifiedAt!==void 0?{notifiedAt:n.notifiedAt}:{},...o?.whatsNew!==void 0?{whatsNew:o.whatsNew}:{}};return await F(s).catch(()=>{}),e?.version}async function H(t){let e=await c();return e?.latest===t?e.whatsNew??[]:[]}async function J(t){let e=(await c())?.latest;return e!==void 0&&P(e,t)?e:void 0}export{A as a,C as b,P as c,D as d,S as e,_ as f,T as g,h,c as i,F as j,L as k,$ as l,G as m,H as n,J as o};
|