forge-terminal 0.5.9 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +18 -12
  2. package/dist/chunks/{about-credits-32BUKO4K.js → about-credits-XL2AIGQ7.js} +1 -1
  3. package/dist/chunks/args-PS5SVBZY.js +3 -0
  4. package/dist/chunks/boot-QRKC4QBA.js +3 -0
  5. package/dist/chunks/check-HOITNMJX.js +3 -0
  6. package/dist/chunks/{chunk-6RCS3KBP.js → chunk-2JU3YZQU.js} +1 -1
  7. package/dist/chunks/{chunk-Q6KQWJ4J.js → chunk-2L66A2X6.js} +1 -1
  8. package/dist/chunks/chunk-2OSM4W4D.js +3 -0
  9. package/dist/chunks/{chunk-GVVQP3LF.js → chunk-3HG7RXC2.js} +1 -1
  10. package/dist/chunks/chunk-3IX3QA76.js +3 -0
  11. package/dist/chunks/chunk-3SVHRKQH.js +6 -0
  12. package/dist/chunks/chunk-4MZV4SRU.js +4 -0
  13. package/dist/chunks/chunk-4NDZTK22.js +3 -0
  14. package/dist/chunks/{chunk-7XFLG32B.js → chunk-5FJT4BNY.js} +1 -1
  15. package/dist/chunks/chunk-5XJCMMCM.js +3 -0
  16. package/dist/chunks/chunk-65Y7YCZZ.js +3 -0
  17. package/dist/chunks/{chunk-WBW6G4N6.js → chunk-6HUYBVQA.js} +1 -1
  18. package/dist/chunks/chunk-BSFBZBAI.js +16 -0
  19. package/dist/chunks/chunk-BWJNZT75.js +6 -0
  20. package/dist/chunks/{chunk-WE6KP4FR.js → chunk-BYUOU2Q2.js} +1 -1
  21. package/dist/chunks/chunk-CCNRNCRU.js +3 -0
  22. package/dist/chunks/chunk-ECA4PW5T.js +3 -0
  23. package/dist/chunks/chunk-EIPMQFIF.js +3 -0
  24. package/dist/chunks/chunk-EJWTYDBJ.js +3 -0
  25. package/dist/chunks/chunk-EYOO35US.js +3 -0
  26. package/dist/chunks/chunk-FGR6QCG5.js +3 -0
  27. package/dist/chunks/chunk-FWVE3GNA.js +3 -0
  28. package/dist/chunks/{chunk-ILQDMVJR.js → chunk-FXA45V4B.js} +1 -1
  29. package/dist/chunks/chunk-G6L5NIJ5.js +19 -0
  30. package/dist/chunks/chunk-GIG4I2IC.js +23 -0
  31. package/dist/chunks/chunk-HXKLYK3M.js +7 -0
  32. package/dist/chunks/chunk-I2LPGKUU.js +3 -0
  33. package/dist/chunks/chunk-JD3RB6IV.js +66 -0
  34. package/dist/chunks/{chunk-W53XNVNH.js → chunk-JUA63KQK.js} +1 -1
  35. package/dist/chunks/{chunk-4KGC5ZBZ.js → chunk-NLM2SP3F.js} +1 -1
  36. package/dist/chunks/chunk-NMGQGYVM.js +3 -0
  37. package/dist/chunks/chunk-NUCGWLOY.js +8 -0
  38. package/dist/chunks/{chunk-SM735FG7.js → chunk-NUTTDNTG.js} +1 -1
  39. package/dist/chunks/chunk-PA7AG2NK.js +55 -0
  40. package/dist/chunks/{chunk-3374PCO5.js → chunk-PISCJKIG.js} +1 -1
  41. package/dist/chunks/chunk-PON65UTS.js +3 -0
  42. package/dist/chunks/chunk-QIMSNTKL.js +3 -0
  43. package/dist/chunks/{chunk-4MJEEEFA.js → chunk-QO4JUY6B.js} +1 -1
  44. package/dist/chunks/chunk-QPUKPSPZ.js +3 -0
  45. package/dist/chunks/{chunk-YRXJDFP3.js → chunk-S7BZPV5T.js} +1 -1
  46. package/dist/chunks/chunk-SFN3LBB6.js +3 -0
  47. package/dist/chunks/{chunk-OXDRJO4V.js → chunk-TNIPRV6K.js} +1 -1
  48. package/dist/chunks/{chunk-SZRSAL64.js → chunk-UEAZTRTL.js} +1 -1
  49. package/dist/chunks/chunk-UI4EUC3S.js +3 -0
  50. package/dist/chunks/chunk-UN5DSJE2.js +3 -0
  51. package/dist/chunks/chunk-UUTBDIFR.js +3 -0
  52. package/dist/chunks/chunk-WID72ZII.js +4 -0
  53. package/dist/chunks/chunk-X2YUHPOU.js +4 -0
  54. package/dist/chunks/chunk-X4QI2EYV.js +3 -0
  55. package/dist/chunks/chunk-YBA6DJQ4.js +3 -0
  56. package/dist/chunks/chunk-YJZEHJ6U.js +3 -0
  57. package/dist/chunks/chunk-YYZYZWF5.js +80 -0
  58. package/dist/chunks/clip-command-4ON3Q57W.js +3 -0
  59. package/dist/chunks/clipboard-W67Q22JG.js +3 -0
  60. package/dist/chunks/colour-2BGK2BFR.js +3 -0
  61. package/dist/chunks/command-ZX3L5VFO.js +3 -0
  62. package/dist/chunks/config-command-VEGQPXVB.js +3 -0
  63. package/dist/chunks/continue-editing-LTMIEFRD.js +3 -0
  64. package/dist/chunks/decoded-SK6W44WW.js +3 -0
  65. package/dist/chunks/{entry-BZYPZONY.js → entry-3R2GK3IW.js} +2 -2
  66. package/dist/chunks/execute-TC3QZ6GL.js +3 -0
  67. package/dist/chunks/extensions-3SG2LW7R.js +3 -0
  68. package/dist/chunks/{extensions-command-JZSOQJEV.js → extensions-command-RNAPQYWV.js} +1 -1
  69. package/dist/chunks/ffmpeg-G4TRWUTV.js +3 -0
  70. package/dist/chunks/image-67XO45NW.js +3 -0
  71. package/dist/chunks/install-UN3YGSJW.js +3 -0
  72. package/dist/chunks/{install-KGFOAQCU.js → install-X7EEH5CQ.js} +1 -1
  73. package/dist/chunks/launch-EGFNGHLN.js +18 -0
  74. package/dist/chunks/lock-5ZO5PCZP.js +3 -0
  75. package/dist/chunks/manager-272REVNF.js +4 -0
  76. package/dist/chunks/{needed-DYERJ72M.js → needed-7IUPDEJB.js} +1 -1
  77. package/dist/chunks/notify-UD7FQAWX.js +3 -0
  78. package/dist/chunks/{own-2QGMHSKL.js → own-5BD5BVE7.js} +1 -1
  79. package/dist/chunks/pdfium-MHPBLZY5.js +3 -0
  80. package/dist/chunks/preferences-E2CH2YSG.js +3 -0
  81. package/dist/chunks/preset-command-5I3NZ2OP.js +3 -0
  82. package/dist/chunks/registry-DWFV4GBG.js +3 -0
  83. package/dist/chunks/{run-GUFPETHF.js → run-3DX3SROY.js} +1 -1
  84. package/dist/chunks/{server-PIXRL5PA.js → server-TF32DQEO.js} +32 -28
  85. package/dist/chunks/signals-QSXY3F2A.js +3 -0
  86. package/dist/chunks/text-layer-PFIDCTEL.js +5 -0
  87. package/dist/chunks/theme-4Y66DDAO.js +3 -0
  88. package/dist/chunks/transcribe-HH5P3PV4.js +3 -0
  89. package/dist/chunks/transcribe-command-VY5HYNXV.js +3 -0
  90. package/dist/chunks/update-command-6VVDG75Y.js +3 -0
  91. package/dist/chunks/update-note-XV2T2NNG.js +3 -0
  92. package/dist/chunks/watch-command-BMSMGIHK.js +3 -0
  93. package/dist/helpers/forge-transcribe +0 -0
  94. package/dist/index.js +16 -15
  95. package/package.json +19 -3
  96. package/dist/chunks/args-ZVZQR23M.js +0 -3
  97. package/dist/chunks/boot-2YFTQOMG.js +0 -3
  98. package/dist/chunks/check-B6NP7BEM.js +0 -3
  99. package/dist/chunks/chunk-4RNVZQRC.js +0 -3
  100. package/dist/chunks/chunk-6KUWZQGG.js +0 -3
  101. package/dist/chunks/chunk-6MWJO3GB.js +0 -4
  102. package/dist/chunks/chunk-6PEIZZNE.js +0 -3
  103. package/dist/chunks/chunk-7FW7JX74.js +0 -36
  104. package/dist/chunks/chunk-7XDMC7FL.js +0 -72
  105. package/dist/chunks/chunk-AR3M2PLK.js +0 -3
  106. package/dist/chunks/chunk-ASLKQXZ2.js +0 -3
  107. package/dist/chunks/chunk-BKLPRILS.js +0 -3
  108. package/dist/chunks/chunk-FAUL5L2W.js +0 -3
  109. package/dist/chunks/chunk-FBVRKMAF.js +0 -3
  110. package/dist/chunks/chunk-GHYODKA3.js +0 -3
  111. package/dist/chunks/chunk-H3DIRJFE.js +0 -3
  112. package/dist/chunks/chunk-HTA25PO2.js +0 -3
  113. package/dist/chunks/chunk-J7FLFHQJ.js +0 -3
  114. package/dist/chunks/chunk-K253E723.js +0 -3
  115. package/dist/chunks/chunk-KH5DHZ2U.js +0 -8
  116. package/dist/chunks/chunk-L44NRTP4.js +0 -3
  117. package/dist/chunks/chunk-N32JL4UI.js +0 -3
  118. package/dist/chunks/chunk-N6RCLJE6.js +0 -4
  119. package/dist/chunks/chunk-NDYMC3HY.js +0 -66
  120. package/dist/chunks/chunk-NMECUMJD.js +0 -7
  121. package/dist/chunks/chunk-OQBIYNGK.js +0 -6
  122. package/dist/chunks/chunk-QQV7CCAY.js +0 -3
  123. package/dist/chunks/chunk-RCWFUBTG.js +0 -3
  124. package/dist/chunks/chunk-TFGK7IRZ.js +0 -19
  125. package/dist/chunks/chunk-TGC24JEW.js +0 -4
  126. package/dist/chunks/chunk-TLHUFIXD.js +0 -3
  127. package/dist/chunks/chunk-V6GWPR2A.js +0 -3
  128. package/dist/chunks/chunk-VJMOZPHW.js +0 -3
  129. package/dist/chunks/chunk-YPAFAG4W.js +0 -6
  130. package/dist/chunks/chunk-ZBMJTIYR.js +0 -3
  131. package/dist/chunks/chunk-ZX5FDZZW.js +0 -55
  132. package/dist/chunks/clip-command-MDSM6KJP.js +0 -3
  133. package/dist/chunks/clipboard-IZJTBTSW.js +0 -3
  134. package/dist/chunks/colour-2MYODUDY.js +0 -3
  135. package/dist/chunks/command-GAGAD65W.js +0 -3
  136. package/dist/chunks/config-command-CKPJXJEE.js +0 -3
  137. package/dist/chunks/continue-editing-M6WESEVB.js +0 -3
  138. package/dist/chunks/decoded-XWKU23RG.js +0 -3
  139. package/dist/chunks/execute-7M6WA4W7.js +0 -3
  140. package/dist/chunks/extensions-E3OUBT36.js +0 -3
  141. package/dist/chunks/ffmpeg-KDZEPLNA.js +0 -3
  142. package/dist/chunks/image-R5C3AWHT.js +0 -3
  143. package/dist/chunks/install-MFYGS5TG.js +0 -3
  144. package/dist/chunks/launch-VNW4YQ4Z.js +0 -17
  145. package/dist/chunks/lock-BG3CLOHA.js +0 -3
  146. package/dist/chunks/manager-L753MI7U.js +0 -4
  147. package/dist/chunks/notify-NQNNOBFC.js +0 -3
  148. package/dist/chunks/pdfium-77L526HZ.js +0 -3
  149. package/dist/chunks/preferences-3P4V2EDX.js +0 -3
  150. package/dist/chunks/preset-command-UNMXHW5A.js +0 -3
  151. package/dist/chunks/registry-RS7LQ3UA.js +0 -3
  152. package/dist/chunks/text-layer-LHZNDMPZ.js +0 -3
  153. package/dist/chunks/theme-P3ZE2ZYB.js +0 -3
  154. package/dist/chunks/transcribe-KXQXEVBJ.js +0 -3
  155. package/dist/chunks/transcribe-command-JHWN4RWU.js +0 -3
  156. package/dist/chunks/update-command-DWEBUFT5.js +0 -3
  157. package/dist/chunks/update-note-CY3LCBCJ.js +0 -3
  158. package/dist/chunks/watch-command-QGVXM23I.js +0 -3
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as Ht,c as kt}from"./chunk-ECA4PW5T.js";import{j as It}from"./chunk-NMGQGYVM.js";import{L as Ot,a as wt,f as Tt,g as gt}from"./chunk-CCNRNCRU.js";import{c as et,e as $e}from"./chunk-TMUK2DD3.js";var it=et((Vs,Yt)=>{"use strict";var Xt="[^\\\\/]",$r="(?=.)",jt="[^/]",yt="(?:\\/|$)",Qt="(?:^|\\/)",Rt=`\\.{1,2}${yt}`,vr="(?!\\.)",Lr=`(?!${Qt}${Rt})`,wr=`(?!\\.{0,1}${yt})`,Tr=`(?!${Rt})`,Or="[^.\\/]",Hr=`${jt}*?`,kr="/",zt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:$r,QMARK:jt,END_ANCHOR:yt,DOTS_SLASH:Rt,NO_DOT:vr,NO_DOTS:Lr,NO_DOT_SLASH:wr,NO_DOTS_SLASH:Tr,QMARK_NO_DOT:Or,STAR:Hr,START_ANCHOR:Qt,SEP:kr},Ir={...zt,SLASH_LITERAL:"[\\\\/]",QMARK:Xt,STAR:`${Xt}*?`,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:"\\"},Pr={__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"};Yt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Pr,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?Ir:zt}}});var ut=et(q=>{"use strict";var{REGEX_BACKSLASH:Dr,REGEX_REMOVE_BACKSLASH:Nr,REGEX_SPECIAL_CHARS:Fr,REGEX_SPECIAL_CHARS_GLOBAL:Br}=it();q.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);q.hasRegexChars=t=>Fr.test(t);q.isRegexChar=t=>t.length===1&&q.hasRegexChars(t);q.escapeRegex=t=>t.replace(Br,"\\$1");q.toPosixSlashes=t=>t.replace(Dr,"/");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(Nr,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 ne=et((tn,se)=>{"use strict";var Zt=ut(),{CHAR_ASTERISK:St,CHAR_AT:Mr,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:Gr,CHAR_DOT:_t,CHAR_EXCLAMATION_MARK:Et,CHAR_FORWARD_SLASH:re,CHAR_LEFT_CURLY_BRACE:bt,CHAR_LEFT_PARENTHESES:ft,CHAR_LEFT_SQUARE_BRACKET:Wr,CHAR_PLUS:qr,CHAR_QUESTION_MARK:Vt,CHAR_RIGHT_CURLY_BRACE:Ur,CHAR_RIGHT_PARENTHESES:Jt,CHAR_RIGHT_SQUARE_BRACKET:Kr}=it(),te=t=>t===re||t===rt,ee=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Xr=(t,r)=>{let e=r||{},s=t.length-1,n=e.parts===!0||e.tokens===!0||e.scanToEnd===!0,o=[],i=[],l=[],g=t,y=-1,S=0,R=0,h=!1,d=!1,A=!1,x=!1,L=!1,B=!1,E=!1,M=!1,j=!1,k=!1,T=0,v,_,C={value:"",depth:0,isGlob:!1},u=()=>y>=s,G=()=>g.charCodeAt(y+1),D=()=>(v=_,g.charCodeAt(++y));for(;y<s;){_=D();let $;if(_===rt){E=C.backslashes=!0,_=D(),_===bt&&(B=!0);continue}if(B===!0||_===bt){for(T++;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===bt){T++;continue}if(B!==!0&&_===_t&&(_=D())===_t){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(B!==!0&&_===Gr){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Ur&&(T--,T===0)){B=!1,h=C.isBrace=!0,k=!0;break}}if(n===!0)continue;break}if(_===re){if(o.push(y),i.push(C),C={value:"",depth:0,isGlob:!1},k===!0)continue;if(v===_t&&y===S+1){S+=2;continue}R=y+1;continue}if(e.noext!==!0&&(_===qr||_===Mr||_===St||_===Vt||_===Et)===!0&&G()===ft){if(A=C.isGlob=!0,x=C.isExtglob=!0,k=!0,_===Et&&y===S&&(j=!0),n===!0){let U=0;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){U++;continue}if(_===Jt&&--U===0){k=!0;break}}continue}break}if(_===St){if(v===St&&(L=C.isGlobstar=!0),A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Vt){if(A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Wr){for(;u()!==!0&&($=D());){if($===rt){E=C.backslashes=!0,D();continue}if($===Kr){d=C.isBracket=!0,A=C.isGlob=!0,k=!0;break}}if(n===!0)continue;break}if(e.nonegate!==!0&&_===Et&&y===S){M=C.negated=!0,S++;continue}if(e.noparen!==!0&&_===ft){if(A=C.isGlob=!0,n===!0){let W=1;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){W++;continue}if(_===Jt&&--W===0){k=!0;break}}continue}break}if(A===!0){if(k=!0,n===!0)continue;break}}e.noext===!0&&(x=!1,A=!1);let I=g,c="",a="";S>0&&(c=g.slice(0,S),g=g.slice(S),R-=S),I&&A===!0&&R>0?(I=g.slice(0,R),a=g.slice(R)):A===!0?(I="",a=g):I=g,I&&I!==""&&I!=="/"&&I!==g&&te(I.charCodeAt(I.length-1))&&(I=I.slice(0,-1)),e.unescape===!0&&(a&&(a=Zt.removeBackslashes(a)),I&&E===!0&&(I=Zt.removeBackslashes(I)));let X={prefix:c,input:t,start:S,base:I,glob:a,isBrace:h,isBracket:d,isGlob:A,isExtglob:x,isGlobstar:L,negated:M,negatedExtglob:j};if(e.tokens===!0&&(X.maxDepth=0,te(_)||i.push(C),X.tokens=i),e.parts===!0||e.tokens===!0){let $;for(let N=0;N<o.length;N++){let J=$!==void 0?$+1:S,ot=o[N],Y=t.slice(J,ot);e.tokens&&(N===0&&S!==0?(i[N].isPrefix=!0,i[N].value=c):i[N].value=Y,ee(i[N]),X.maxDepth+=i[N].depth),ot>=S&&(l.push(Y),$=ot)}let W=$!==void 0?$+1:S,U=t.slice(W);l.push(U),e.tokens&&$&&$+1<t.length&&(i[i.length-1].value=U,ee(i[i.length-1]),X.maxDepth+=i[i.length-1].depth),X.slashes=o,X.parts=l}return X};se.exports=Xr});var ae=et((en,ue)=>{"use strict";var at=it(),K=ut(),{MAX_LENGTH:ht,POSIX_REGEX_SOURCE:jr,REGEX_NON_SPECIAL_CHARS:Qr,REGEX_SPECIAL_CHARS_BACKREF:zr,REPLACEMENTS:oe}=at,Yr=(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`,ie=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")},Vr=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}}}}},Jr=t=>`${t.length===1?K.escapeRegex(t[0]):`[${t.map(e=>K.escapeRegex(e)).join("")}]`}*`,ts=t=>{let r=0,e=[];for(;r<t.length;){let s=mt(t.slice(r),!1);if(!s||s.type!=="*")return;let n=ie(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},es=t=>{let r=0,e=t.trim(),s=mt(e);for(;s;)r++,e=s.body.trim(),s=mt(e);return r},rs=(t,r)=>{if(r.maxExtglobRecursion===!1)return{risky:!1};let e=typeof r.maxExtglobRecursion=="number"?r.maxExtglobRecursion:at.DEFAULT_MAX_EXTGLOB_RECURSION,s=ie(t).map(l=>l.trim());if(s.length>1&&(s.some(l=>l==="")||s.some(l=>/^[*?]+$/.test(l))||Vr(s)))return{risky:!0};let n=[],o=!1,i=!0;for(let l of s){let g=ts(l);if(g){o=!0,n.push(...g);continue}let y=xt(l);if(y&&y.length===1){n.push(y);continue}if(i=!1,es(l)>e)return{risky:!0}}return o?i?{risky:!0,safeOutput:Jr([...new Set(n)])}:{risky:!0}:{risky:!1}},Ct=(t,r)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=oe[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?"":"?:",g=at.globChars(e.windows),y=at.extglobChars(g),{DOT_LITERAL:S,PLUS_LITERAL:R,SLASH_LITERAL:h,ONE_CHAR:d,DOTS_SLASH:A,NO_DOT:x,NO_DOT_SLASH:L,NO_DOTS_SLASH:B,QMARK:E,QMARK_NO_DOT:M,STAR:j,START_ANCHOR:k}=g,T=f=>`(${l}(?:(?!${k}${f.dot?A:S}).)*?)`,v=e.dot?"":x,_=e.dot?E:M,C=e.bash===!0?T(e):j;e.capture&&(C=`(${C})`),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 G=[],D=[],I=[],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="",H=0)=>{u.consumed+=f,u.index+=H},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]++,I.push(f)},z=f=>{u[f]--,I.pop()},b=f=>{if(c.type==="globstar"){let H=u.braces>0&&(f.type==="comma"||f.type==="brace"),p=f.extglob===!0||G.length&&(f.type==="pipe"||f.type==="paren");f.type!=="slash"&&f.type!=="paren"&&!H&&!p&&(u.output=u.output.slice(0,-c.output.length),c.type="star",c.value="*",c.output=C,u.output+=c.output)}if(G.length&&f.type!=="paren"&&(G[G.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,H)=>{let p={...y[H],conditions:1,inner:""};p.prev=c,p.parens=u.parens,p.output=u.output,p.startIndex=u.index,p.tokensIndex=i.length;let m=(e.capture?"(":"")+p.open;Y("parens"),b({type:f,value:H,output:u.output?"":d}),b({type:"paren",extglob:!0,value:W(),output:m}),G.push(p)},Ce=f=>{let H=t.slice(f.startIndex,u.index+1),p=t.slice(f.startIndex+2,u.index),m=rs(p,e);if((f.type==="plus"||f.type==="star")&&m.risky){let w=m.safeOutput?(f.output?"":d)+(e.capture?`(${m.safeOutput})`:m.safeOutput):void 0,Q=i[f.tokensIndex];Q.type="text",Q.value=H,Q.output=w||K.escapeRegex(H);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,b({type:"paren",extglob:!0,value:a,output:""}),z("parens");return}let O=f.close+(e.capture?")":""),F;if(f.type==="negate"){let w=C;if(f.inner&&f.inner.length>1&&f.inner.includes("/")&&(w=T(e)),(w!==C||X()||/^\)+$/.test(U()))&&(O=f.close=`)$))${w}`),f.inner.includes("*")&&(F=U())&&/^\.[^\\/.]+$/.test(F)){let Q=Ct(F,{...r,fastpaths:!1}).output;O=f.close=`)${Q})${w})`}f.prev.type==="bos"&&(u.negatedExtglob=!0)}b({type:"paren",extglob:!0,value:a,output:O}),z("parens")};if(e.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let f=!1,H=t.replace(zr,(p,m,O,F,w,Q)=>F==="\\"?(f=!0,p):F==="?"?m?m+F+(w?E.repeat(w.length):""):Q===0?_+(w?E.repeat(w.length):""):E.repeat(O.length):F==="."?S.repeat(O.length):F==="*"?m?m+F+(w?C:""):C:m?p:`\\${p}`);return f===!0&&(e.unescape===!0?H=H.replace(/\\/g,""):H=H.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),H===t&&e.contains===!0?(u.output=t,u):(u.output=K.wrapOutput(H,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+="\\",b({type:"text",value:a});continue}let m=/^\\+/.exec(U()),O=0;if(m&&m[0].length>2&&(O=m[0].length,u.index+=O,O%2!==0&&(a+="\\")),e.unescape===!0?a=W():a+=W(),u.brackets===0){b({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 m=c.value.lastIndexOf("["),O=c.value.slice(0,m),F=c.value.slice(m+2),w=jr[F];if(w){c.value=O+w,u.backtrack=!0,W(),!o.output&&i.indexOf(c)===1&&(o.output=d);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&&b({type:"text",value:a});continue}if(a==="("){Y("parens"),b({type:"paren",value:a});continue}if(a===")"){if(u.parens===0&&e.strictBrackets===!0)throw new SyntaxError(st("opening","("));let p=G[G.length-1];if(p&&u.parens===p.parens+1){Ce(G.pop());continue}b({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");b({type:"bracket",value:a});continue}if(a==="]"){if(e.nobracket===!0||c&&c.type==="bracket"&&c.value.length===1){b({type:"text",value:a,output:`\\${a}`});continue}if(u.brackets===0){if(e.strictBrackets===!0)throw new SyntaxError(st("opening","["));b({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 m=K.escapeRegex(c.value);if(u.output=u.output.slice(0,-c.value.length),e.literalBrackets===!0){u.output+=m,c.value=m;continue}c.value=`(${l}${m}|${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),b(p);continue}if(a==="}"){let p=D[D.length-1];if(e.nobrace===!0||!p){b({type:"text",value:a,output:a});continue}let m=")";if(p.dots===!0){let O=i.slice(),F=[];for(let w=O.length-1;w>=0&&(i.pop(),O[w].type!=="brace");w--)O[w].type!=="dots"&&F.unshift(O[w].value);m=Yr(F,e),u.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let O=u.output.slice(0,p.outputIndex),F=u.tokens.slice(p.tokensIndex);p.value=p.output="\\{",a=m="\\}",u.output=O;for(let w of F)u.output+=w.output||w.value}b({type:"brace",value:a,output:m}),z("braces"),D.pop();continue}if(a==="|"){G.length>0&&G[G.length-1].conditions++,b({type:"text",value:a});continue}if(a===","){let p=a,m=D[D.length-1];m&&I[I.length-1]==="braces"&&(m.comma=!0,p="|"),b({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}b({type:"slash",value:a,output:h});continue}if(a==="."){if(u.braces>0&&c.type==="dot"){c.value==="."&&(c.output=S);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"){b({type:"text",value:a,output:S});continue}b({type:"dot",value:a,output:S});continue}if(a==="?"){if(!(c&&c.value==="(")&&e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("qmark",a);continue}if(c&&c.type==="paren"){let m=$(),O=a;(c.value==="("&&!/[!=<:]/.test(m)||m==="<"&&!/<([!=]|\w+>)/.test(U()))&&(O=`\\${a}`),b({type:"text",value:a,output:O});continue}if(e.dot!==!0&&(c.type==="slash"||c.type==="bos")){b({type:"qmark",value:a,output:M});continue}b({type:"qmark",value:a,output:E});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){b({type:"plus",value:a,output:R});continue}if(c&&(c.type==="bracket"||c.type==="paren"||c.type==="brace")||u.parens>0){b({type:"plus",value:a});continue}b({type:"plus",value:R});continue}if(a==="@"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){b({type:"at",extglob:!0,value:a,output:""});continue}b({type:"text",value:a});continue}if(a!=="*"){(a==="$"||a==="^")&&(a=`\\${a}`);let p=Qr.exec(U());p&&(a+=p[0],u.index+=p[0].length),b({type:"text",value:a});continue}if(c&&(c.type==="globstar"||c.star===!0)){c.type="star",c.star=!0,c.value+=a,c.output=C,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,m=p.prev,O=p.type==="slash"||p.type==="bos",F=m&&(m.type==="star"||m.type==="globstar");if(e.bash===!0&&(!O||f[0]&&f[0]!=="/")){b({type:"star",value:a,output:""});continue}let w=u.braces>0&&(p.type==="comma"||p.type==="brace"),Q=G.length&&(p.type==="pipe"||p.type==="paren");if(!O&&p.type!=="paren"&&!w&&!Q){b({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)&&!G.some(tt=>tt.type==="negate");if(p.type==="bos"&&X()){c.type="globstar",c.value+=a,c.output=T(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=T(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=`${T(e)}${h}|${h}${tt})`,c.value+=a,u.output+=p.output+c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&f[0]==="/"){c.type="globstar",c.value+=a,c.output=`(?:^|${h}|${T(e)}${h})`,u.output=c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}u.output=u.output.slice(0,-c.output.length),c.type="globstar",c.output=T(e),c.value+=a,u.output+=c.output,u.globstar=!0,N(a);continue}let H={type:"star",value:a,output:C};if(e.bash===!0){H.output=".*?",(c.type==="bos"||c.type==="slash")&&(H.output=v+H.output),b(H);continue}if(c&&(c.type==="bracket"||c.type==="paren")&&e.regex===!0){H.output=a,b(H);continue}(u.index===u.start||c.type==="slash"||c.type==="dot")&&(c.type==="dot"?(u.output+=L,c.output+=L):e.dot===!0?(u.output+=B,c.output+=B):(u.output+=v,c.output+=v),$()!=="*"&&(u.output+=d,c.output+=d)),b(H)}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")&&b({type:"maybe_slash",value:"",output:`${h}?`}),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=oe[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:i,ONE_CHAR:l,DOTS_SLASH:g,NO_DOT:y,NO_DOTS:S,NO_DOTS_SLASH:R,STAR:h,START_ANCHOR:d}=at.globChars(e.windows),A=e.dot?S:y,x=e.dot?R:y,L=e.capture?"":"?:",B={negated:!1,prefix:""},E=e.bash===!0?".*?":h;e.capture&&(E=`(${E})`);let M=v=>v.noglobstar===!0?E:`(${L}(?:(?!${d}${v.dot?g:o}).)*?)`,j=v=>{switch(v){case"*":return`${A}${l}${E}`;case".*":return`${o}${l}${E}`;case"*.*":return`${A}${E}${o}${l}${E}`;case"*/*":return`${A}${E}${i}${l}${x}${E}`;case"**":return A+M(e);case"**/*":return`(?:${A}${M(e)}${i})?${x}${l}${E}`;case"**/*.*":return`(?:${A}${M(e)}${i})?${x}${E}${o}${l}${E}`;case"**/.*":return`(?:${A}${M(e)}${i})?${o}${l}${E}`;default:{let _=/^(.*?)\.(\w+)$/.exec(v);if(!_)return;let C=j(_[1]);return C?C+o+_[2]:void 0}}},k=K.removePrefix(t,B),T=j(k);return T&&e.strictSlashes!==!0&&(T+=`${i}?`),T};ue.exports=Ct});var pe=et((rn,le)=>{"use strict";var ss=ne(),$t=ae(),ce=ut(),ns=it(),os=t=>t&&typeof t=="object"&&!Array.isArray(t),P=(t,r,e=!1)=>{if(Array.isArray(t)){let S=t.map(h=>P(h,r,e));return h=>{for(let d of S){let A=d(h);if(A)return A}return!1}}let s=os(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?P.compileRe(t,r):P.makeRe(t,r,!1,!0),l=i.state;delete i.state;let g=()=>!1;if(n.ignore){let S={...r,ignore:null,onMatch:null,onResult:null};g=P(n.ignore,S,e)}let y=(S,R=!1)=>{let{isMatch:h,match:d,output:A}=P.test(S,i,r,{glob:t,posix:o}),x={glob:t,state:l,regex:i,posix:o,input:S,output:A,match:d,isMatch:h};return typeof n.onResult=="function"&&n.onResult(x),h===!1?(x.isMatch=!1,R?x:!1):g(S)?(typeof n.onIgnore=="function"&&n.onIgnore(x),x.isMatch=!1,R?x:!1):(typeof n.onMatch=="function"&&n.onMatch(x),R?x:!0)};return e&&(y.state=l),y};P.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?ce.toPosixSlashes:null),l=t===s,g=l&&i?i(t):t;return l===!1&&(g=i?i(t):t,l=g===s),(l===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?l=P.matchBase(t,r,e,n):l=r.exec(g)),{isMatch:!!l,match:l,output:g}};P.matchBase=(t,r,e,s=e&&e.windows)=>(r instanceof RegExp?r:P.makeRe(r,e)).test(ce.basename(t,{windows:s}));P.isMatch=(t,r,e)=>P(r,e)(t);P.parse=(t,r)=>Array.isArray(t)?t.map(e=>P.parse(e,r)):$t(t,{...r,fastpaths:!1});P.scan=(t,r)=>ss(t,r);P.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 g=P.toRegex(l,r);return s===!0&&(g.state=t),g};P.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)),P.compileRe(n,r,e,s)};P.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/$^/}};P.constants=ns;le.exports=P});var de=et((sn,ge)=>{"use strict";var fe=pe(),is=ut();function he(t,r,e=!1){return r&&(r.windows===null||r.windows===void 0)&&(r={...r,windows:is.isWindows()}),fe(t,r,e)}Object.assign(he,fe);ge.exports=he});import{existsSync as Ns}from"node:fs";import{stat as Fs}from"node:fs/promises";import{resolve as me}from"node:path";import{readdir as us,readdirSync as as,realpath as cs,realpathSync as ls,stat as ps,statSync as fs}from"fs";import{isAbsolute as hs,posix as V,resolve as gs}from"path";import{fileURLToPath as ds}from"url";import{createRequire as ve}from"module";import{basename as Le,dirname as At,normalize as we,relative as Te,resolve as Oe,sep as Nt}from"path";import*as He from"fs";var Pt=ve(import.meta.url);function ke(t){let r=we(t);return r.length>1&&r[r.length-1]===Nt&&(r=r.substring(0,r.length-1)),r}var Ie=/[\\/]/g;function Ft(t,r){return t.replace(Ie,r)}var Pe=/^[a-z]:[\\/]$/i;function De(t){return t==="/"||Pe.test(t)}function dt(t,r){let{resolvePaths:e,normalizePath:s,pathSeparator:n}=r,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(e&&(t=Oe(t)),(s||o)&&(t=ke(t)),t===".")return"";let i=t[t.length-1]!==n;return Ft(i?t+n:t,n)}function Bt(t,r){return r+t}function Ne(t,r){return function(e,s){return s.startsWith(t)?s.slice(t.length)+e:Ft(Te(t,s),r.pathSeparator)+r.pathSeparator+e}}function Fe(t){return t}function Be(t,r,e){return r+t+e}function Me(t,r){let{relativePaths:e,includeBasePath:s}=r;return e&&t?Ne(t,r):s?Bt:Fe}function Ge(t){return function(r,e){e.push(r.substring(t.length)||".")}}function We(t){return function(r,e,s){let n=r.substring(t.length)||".";s.every(o=>o(n,!0))&&e.push(n)}}var qe=(t,r)=>{r.push(t||".")},Ue=(t,r,e)=>{let s=t||".";e.every(n=>n(s,!0))&&r.push(s)},Ke=()=>{};function Xe(t,r){let{includeDirs:e,filters:s,relativePaths:n}=r;return e?n?s&&s.length?We(t):Ge(t):s&&s.length?Ue:qe:Ke}var je=(t,r,e,s)=>{s.every(n=>n(t,!1))&&e.files++},Qe=(t,r,e,s)=>{s.every(n=>n(t,!1))&&r.push(t)},ze=(t,r,e,s)=>{e.files++},Ye=(t,r)=>{r.push(t)},Ze=()=>{};function Ve(t){let{excludeFiles:r,filters:e,onlyCounts:s}=t;return r?Ze:e&&e.length?s?je:Qe:s?ze:Ye}var Je=t=>t,tr=()=>[""].slice(0,0);function er(t){return t.group?tr:Je}var rr=(t,r,e)=>{t.push({directory:r,files:e,dir:r})},sr=()=>{};function nr(t){return t.group?rr:sr}var or=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,(g,y)=>{if(g)return s.dequeue(o?null:g,r);if(y.isDirectory()&&Mt(t,l,r))return s.dequeue(null,r);e(y,l),s.dequeue(null,r)})})},ir=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()&&Mt(t,i,r))return;e(l,i)}catch(i){if(!o)throw i}};function ur(t,r){return!t.resolveSymlinks||t.excludeSymlinks?null:r?ir:or}function Mt(t,r,e){if(e.options.useRealPaths)return ar(r,e);let s=At(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=At(s)}return e.symlinks.set(t,r),n>1}function ar(t,r){return r.visited.includes(t+r.options.pathSeparator)}var cr=t=>t.counts,lr=t=>t.groups,pr=t=>t.paths,fr=t=>t.paths.slice(0,t.options.maxFiles),hr=(t,r,e)=>(pt(r,e,t.counts,t.options.suppressErrors),null),gr=(t,r,e)=>(pt(r,e,t.paths,t.options.suppressErrors),null),dr=(t,r,e)=>(pt(r,e,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Ar=(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 yr(t,r){let{onlyCounts:e,group:s,maxFiles:n}=t;return e?r?cr:hr:s?r?lr:Ar:n?r?fr:dr:r?pr:gr}var Gt={withFileTypes:!0},Rr=(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||".",Gt,(i,l=[])=>{n(l,e,s),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},Sr=(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||".",Gt)}catch(l){if(!t.options.suppressErrors)throw l}n(i,e,s)};function _r(t){return t?Sr:Rr}var Er=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))}},br=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}},mr=class{aborted=!1;abort(){this.aborted=!0}},Wt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,r,e){this.isSynchronous=!e,this.callbackInvoker=yr(r,this.isSynchronous),this.root=dt(t,r),this.state={root:De(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new br,options:r,queue:new Er((s,n)=>this.callbackInvoker(n,s,e)),symlinks:new Map,visited:[""].slice(0,0),controller:new mr,fs:r.fs||He},this.joinPath=Me(this.root,r),this.pushDirectory=Xe(this.root,r),this.pushFile=Ve(r),this.getArray=er(r),this.groupFiles=nr(r),this.resolveSymlink=ur(r,this.isSynchronous),this.walkDirectory=_r(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:g,signal:y,useRealPaths:S,pathSeparator:R},controller:h}=this.state;if(h.aborted||y&&y.aborted||g&&s.length>g)return;let d=this.getArray(this.state.paths);for(let A=0;A<t.length;++A){let x=t[A];if(x.isFile()||x.isSymbolicLink()&&!o&&!i){let L=this.joinPath(x.name,r);this.pushFile(L,d,this.state.counts,n)}else if(x.isDirectory()){let L=Be(x.name,r,this.state.options.pathSeparator);if(l&&l(x.name,L))continue;this.pushDirectory(L,s,n),this.walkDirectory(this.state,L,L,e-1,this.walk)}else if(this.resolveSymlink&&x.isSymbolicLink()){let L=Bt(x.name,r);this.resolveSymlink(L,this.state,(B,E)=>{if(B.isDirectory()){if(E=dt(E,this.state.options),l&&l(x.name,S?E:L+R))return;this.walkDirectory(this.state,E,S?E:L+R,e-1,this.walk)}else{E=S?E:L;let M=Le(E),j=dt(At(E),this.state.options);E=this.joinPath(M,j),this.pushFile(E,d,this.state.counts,n)}})}}this.groupFiles(this.state.groups,r,d)}};function xr(t,r){return new Promise((e,s)=>{qt(t,r,(n,o)=>{if(n)return s(n);e(o)})})}function qt(t,r,e){new Wt(t,r,e).start()}function Cr(t,r){return new Wt(t,r).start()}var Dt=class{constructor(t,r){this.root=t,this.options=r}withPromise(){return xr(this.root,this.options)}withCallback(t){qt(this.root,this.options,t)}sync(){return Cr(this.root,this.options)}},Ut=null;try{Pt.resolve("picomatch"),Ut=Pt("picomatch")}catch{}var Kt=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Nt,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 Dt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,r){return this.options={...this.options,...r},new Dt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...r){let e=this.globFunction||Ut;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=$e(de(),1),As=Array.isArray,Se=/\\/g,ys=/^[A-Za-z]:$/,_e=process.platform==="win32",Rs=/^(\/?\.\.)+$/;function Ss(t,r={}){let e=t.length,s=Array(e),n=Array(e),o,i;for(o=0;o<e;o++){let l=Ee(t[o]);s[o]=l;let g=l.length,y=Array(g);for(i=0;i<g;i++)y[i]=(0,nt.default)(l[i],r);n[o]=y}return l=>{let g=l.split("/");if(g[0]===".."&&Rs.test(l))return!0;for(o=0;o<e;o++){let y=s[o],S=n[o],R=g.length,h=Math.min(R,y.length);for(i=0;i<h;){let d=y[i];if(d.includes("/"))return!0;if(!S[i](g[i]))break;if(!r.noglobstar&&d==="**")return!0;i++}if(i===R)return!0}return!1}}var _s=/^[A-Z]:\/$/i,Es=_e?t=>_s.test(t):t=>t==="/";function Ae(t,r,e){if(t===r||r.startsWith(`${t}/`)){if(e){let n=t.length+ +!Es(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 bs(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 ye(t){return t.replace(ys,r=>`${r}/`)}var ms={parts:!0};function Ee(t){var r;let e=nt.default.scan(t,ms);return!((r=e.parts)===null||r===void 0)&&r.length?e.parts:[t]}var xs=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Cs=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,$s=t=>t.replace(xs,"\\$&"),vs=t=>t.replace(Cs,"\\$&"),Ls=_e?vs:$s;function ws(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 be(t){return typeof t=="string"?[t]:t??[]}var Ts=/^(\/?\.\.)+/,Os=/\\(?=[()[\]{}!*+?@|])/g;function vt(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=Ls(o);i=hs(i.replace(Os,""))?V.relative(l,i):V.normalize(i);let g=(n=Ts.exec(i))===null||n===void 0?void 0:n[0],y=Ee(i);if(g){let R=(g.length+1)/3,h=0,d=l.split("/");for(;h<R&&y[h+R]===d[d.length+h-R];)i=i.slice(0,(R-h-1)*3)+i.slice((R-h)*3+y[h+R].length+1)||".",h++;let A=V.join(o,g.slice(h*3));A[0]!=="."&&e.root.length>A.length&&(e.root=ye(A),e.depthOffset=-R+h)}if(!s&&e.depthOffset>=0){var S;(S=e.commonPath)!==null&&S!==void 0||(e.commonPath=y);let R=[],h=Math.min(e.commonPath.length,y.length);for(let d=0;d<h;d++){let A=y[d];if(A==="**"&&!y[d+1]){R.pop();break}if(d===y.length-1||A!==e.commonPath[d]||ws(A))break;R.push(A)}e.depthOffset=R.length,e.commonPath=R,e.root=ye(R.length>0?V.join(o,...R):o)}return i}function Hs(t,r,e){let s=[],n=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&n.push(vt(o,t,e,!0));for(let o of r)o&&(o[0]!=="!"||o[1]==="("?s.push(vt(o,t,e,!1)):(o[1]!=="!"||o[2]==="(")&&n.push(vt(o.slice(1),t,e,!0)));return{match:s,ignore:n}}function ks(t,r){let e=t.cwd,s={root:e,depthOffset:0},n=Hs(t,r,s);t.debug&&ct("internal processing patterns:",n);let{absolute:o,caseSensitiveMatch:i,debug:l,dot:g,followSymbolicLinks:y,onlyDirectories:S}=t,R=s.root.replace(Se,""),h={dot:g,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},d=(0,nt.default)(n.match,h),A=(0,nt.default)(n.ignore,h),x=Ss(n.match,h),L=Ae(e,R,o),B=o?L:Ae(e,R,!0),E=(k,T)=>{let v=B(T,!0);return v!=="."&&!x(v)||A(v)},M;t.deep!==void 0&&(M=Math.round(t.deep-s.depthOffset));let j=new Kt({filters:[l?(k,T)=>{let v=L(k,T),_=d(v)&&!A(v);return _&&ct(`matched ${v}`),_}:(k,T)=>{let v=L(k,T);return d(v)&&!A(v)}],exclude:l?(k,T)=>{let v=E(k,T);return ct(`${v?"skipped":"crawling"} ${T}`),v}:E,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:y,excludeSymlinks:!y,excludeFiles:S,includeDirs:S||!t.onlyFiles,maxDepth:M,signal:t.signal}).crawl(R);return t.debug&&ct("internal properties:",{...s,root:R}),[j,e!==R&&!o&&bs(e,R)]}function Is(t,r){if(r)for(let e=t.length-1;e>=0;e--)t[e]=r(t[e]);return t}var Re={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Ps(t){let r=Object.assign({},t);for(let e in Re)r[e]===void 0&&Object.assign(r,{[e]:Re[e]});return r.cwd=(r.cwd instanceof URL?ds(r.cwd):gs(r.cwd||process.cwd())).replace(Se,"/"),r.ignore=be(r.ignore),r.fs&&(r.fs={readdir:r.fs.readdir||us,readdirSync:r.fs.readdirSync||as,realpath:r.fs.realpath||cs,realpathSync:r.fs.realpathSync||ls,stat:r.fs.stat||ps,statSync:r.fs.statSync||fs}),r.debug&&ct("globbing with options:",r),r}function Ds(t,r={}){var e;if(t&&r?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let s=As(t)||typeof t=="string",n=be((e=s?t:t.patterns)!==null&&e!==void 0?e:"**/*"),o=Ps(s?r:t);return n.length>0?ks(o,n):[]}async function Lt(t,r){let[e,s]=Ds(t,r);return e?Is(await e.withPromise(),s):[]}var xe=Object.values(wt).flatMap(t=>t.extensions).map(t=>t.slice(1));function Bs(t){return/[*?[\]{}]/.test(t)}async function Ms(t,r){let e=r?`**/*.{${xe.join(",")}}`:`*.{${xe.join(",")}}`;return(await Lt([e],{cwd:t,absolute:!0,onlyFiles:!0,caseSensitiveMatch:!1})).sort()}async function Gs(t){let r=[];return await kt(t,Ht(),async(e,s)=>{try{r[s]={ok:!0,source:await It(e)}}catch(n){r[s]={ok:!1,error:n}}}),r}async function Ws(t,r,e,s){let n=await Ms(t,r);if(n.length===0){e({path:t,error:Ot(t)});return}for(let o of n)s(o,t,!1)}async function Rn(t,r){let e=[],s=[],n=new Map,o=new Set,i=[],l=(h,d,A)=>{let x=me(h);o.has(x)||(o.add(x),i.push({path:x,root:d,explicit:A}))},g=h=>{i.push({failure:h})};for(let h of t){let d=me(h);if(Bs(h)&&!Ns(d)){let x=(r.platform??process.platform)==="win32"?h.replaceAll("\\","/"):h,L=await Lt([x],{absolute:!0,onlyFiles:!0});L.length===0&&g({path:d,error:gt(d)});for(let B of L.sort())l(B,void 0,!1);continue}let A;try{A=await Fs(d)}catch{g({path:d,error:gt(d)});continue}if(A.isDirectory()){await Ws(d,r.recursive,g,l);continue}l(d,void 0,!0)}let y=i.filter(h=>"path"in h),S=await Gs(y.map(h=>h.path)),R=0;for(let h of i){if("failure"in h){s.push(h.failure);continue}let d=S[R++];if(d.ok)e.push(d.source),h.root&&n.set(h.path,h.root);else if(Tt(d.error))s.push({path:h.path,error:d.error});else if(h.explicit)throw d.error}return{sources:e,failures:s,roots:n}}export{Rn as a};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as b,c as F}from"./chunk-ECA4PW5T.js";import{a as y}from"./chunk-PISCJKIG.js";import{j as h}from"./chunk-NMGQGYVM.js";import{a as c,e as m,f as p}from"./chunk-CCNRNCRU.js";import{open as w,readdir as x,stat as k}from"node:fs/promises";import{extname as S,join as v,resolve as K}from"node:path";function A(e){return e.startsWith(".")||/\.(crdownload|part|download|tmp)$/i.test(e)}function R(e){return e.kind==="image"?"images":e.format==="pdf"?"pdfs":"documents"}var O=new Set(Object.values(c).flatMap(e=>e.extensions));async function M(e){let i=await w(e,"r"),t=Buffer.alloc(4096),r=0;try{r=(await i.read(t,0,t.length,0)).bytesRead}finally{await i.close()}let n=t.subarray(0,r),o=(s,f)=>n.subarray(s,s+f).toString("latin1");return o(4,4)==="ftyp"?/^(M4A |M4B |M4P )$/.test(o(8,4))?"audio":"video":n[0]===26&&n[1]===69&&n[2]===223&&n[3]===163?"video":o(0,4)==="RIFF"?o(8,4)==="WAVE"?"audio":o(8,3)==="AVI"?"video":"other":n[0]===0&&n[1]===0&&n[2]===1&&(n[3]===186||n[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))||n[0]===255&&n[1]!==void 0&&(n[1]&224)===224?"audio":r>0&&!n.includes(0)&&j(n)?"text":"other"}function j(e){try{return new TextDecoder("utf-8",{fatal:!0}).decode(e,{stream:!0}),!0}catch{return!1}}var I=["images","pdfs","documents","videos","audio","other"];function E(e,i){if(e==="videos"||e==="audio")return"not yet supported";if(e==="other")return i.every(t=>t==="text")?i.length===1?"a text file":"text files":"not supported"}async function W(e){let i=K(e),t=await x(i,{withFileTypes:!0}),r=[],n=[],o=new Map,s=[],f=0;for(let d of t.sort((u,a)=>u.name.localeCompare(a.name)))!d.isFile()||A(d.name)||s.push(v(i,d.name));for(let d of await C(s))if(d.kind==="source")r.push(d.source),f+=d.source.bytes;else if(d.kind==="failed")n.push(d.failure),f+=d.bytes;else{let u=d.kind,a=o.get(u)??{bytes:0,sniffed:[]};a.bytes+=d.bytes,a.sniffed.push(d.sniffed),o.set(u,a),f+=d.bytes}let l=g(r);for(let d of I){let u=o.get(d);if(!u)continue;let a=E(d,u.sniffed);l.push({id:d,count:u.sniffed.length,bytes:u.bytes,sources:[],...a===void 0?{}:{why:a}})}return{dir:i,sources:r,failures:n,kinds:l,bytes:f,paths:s}}async function C(e){let i=[];return await F(e,b(),async(t,r)=>{try{i[r]={read:await D(t)}}catch(n){i[r]={error:n}}}),i.map(t=>{if("error"in t)throw t.error;return t.read})}function g(e){let i=[];for(let t of I){let r=e.filter(n=>R(n)===t);r.length>0&&i.push({id:t,count:r.length,bytes:r.reduce((n,o)=>n+o.bytes,0),sources:r})}return i.sort((t,r)=>r.count-t.count)}function _(e,i=[]){let t=e.filter(o=>o.kind==="media"),r=e.filter(o=>o.kind!=="media"),n=g(r);for(let o of["videos","audio"]){let s=t.filter(f=>c[f.format].media==="video"==(o==="videos"));if(s.length>0){let f=s.reduce((l,d)=>l+d.bytes,0);n.push({id:o,count:s.length,bytes:f,sources:[],why:"one at a time"})}}return{dir:"",sources:r,failures:i,kinds:n,bytes:e.reduce((o,s)=>o+s.bytes,0),paths:e.map(o=>o.path)}}async function D(e){let i=()=>k(e).then(t=>t.size,()=>0);try{let t=await h(e);if(t.kind==="media"){let r=c[t.format].media==="video";return{kind:r?"videos":"audio",sniffed:r?"video":"audio",bytes:t.bytes}}return{kind:"source",source:t}}catch(t){let r=await i(),n=await M(e).catch(()=>"other");if(n==="video"||n==="audio")return{kind:n==="video"?"videos":"audio",sniffed:n,bytes:r};if(O.has(S(e).toLowerCase())){let o=p(t)?t:void 0;if(o)return{kind:"failed",failure:{path:e,error:o},bytes:r}}return{kind:"other",sniffed:n,bytes:r}}}function N(e){let i=t=>e.every(r=>r.format===t||y(r).includes(t))&&e.some(r=>r.format!==t);return Object.keys(c).filter(i)}function Q(e,i){let t=N(e),r=e[0],n=r?.kind==="image"?"webp":r?.format==="pdf"?"png":void 0,o=n&&t.includes(n)?n:t[0];if(o)return P(e,o,i)}function P(e,i,t){let r={target:i};return c[i].lossy&&(r.quality=m(i,t)),e.some(n=>n.kind==="document"&&n.format==="pdf")&&(i==="png"||i==="jpeg")&&(r.dpi=150),r}export{A as a,R as b,M as c,W as d,_ as e,D as f,N as g,Q as h,P as i};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as w,b as I,d as k,e as m}from"./chunk-JUA63KQK.js";import{a as $,c as O}from"./chunk-NUTTDNTG.js";import{b as h,d as P,e as R}from"./chunk-X2YUHPOU.js";import{f as x}from"./chunk-YJ6XLDRA.js";import{a as l}from"./chunk-WID72ZII.js";import{j as B}from"./chunk-NMGQGYVM.js";import{a as c,la as g,ma as C,oa as v}from"./chunk-CCNRNCRU.js";import{a as f}from"./chunk-FGR6QCG5.js";import{b as p}from"./chunk-VLVNA4T3.js";import{dirname as S,join as q}from"node:path";async function T(t){if(t.fallback!==void 0)return t.fallback;let{loadPreferences:r,expandTilde:e}=await import("./preferences-E2CH2YSG.js");return e((await r()).prefs.defaultOutput)}function F(t){if(t.pasteboard)return t.pasteboard;if(!$())throw C();return O()}function E(t,r,e,o){let a=q(r.outDir,`Copied image${c[o].extensions[0]}`),s={inputs:[r.source],output:a,force:!1,recursive:!1,debug:t.debug},n={background:"#ffffff",keepMetadata:!1,...t.quality===void 0?{}:{quality:t.quality}};return o===e?{kind:"compress",...s,options:n,...t.quality===void 0?{}:{quality:t.quality},...t.maxBytes===void 0?{}:{maxBytes:t.maxBytes}}:{kind:"convert",...s,target:o,options:n,...t.maxBytes===void 0?{}:{maxBytes:t.maxBytes}}}async function J(t,r={}){let e=r.clip??{},o=F(e),a=await w(o,e.root);if(!a)throw g((await o.peek()).text?"text":"nothing");let s=await B(a.source),n=t.target??s.format,b=E(t,a,s.format,n),i=await P(b,r),y=i.results[0];if(!y||i.failures.length>0)return{report:i,status:"failed"};let u=y.job.outputs[0],d={report:i,output:u,source:{format:s.format,bytes:s.bytes},target:n};if(await I(o,a,u,n)==="changed")return{...d,status:"changed",saved:await m(u,await T(e))};if(t.save===void 0)return{...d,status:"placed"};let j=t.save===!0?await T(e):t.save,{expandTilde:D}=await import("./preferences-E2CH2YSG.js");return{...d,status:"placed",saved:await m(u,D(j))}}function N(t){let r=t.target===t.source.format?"":` as ${c[t.target].label}`,e=` ${f(t.source.bytes)} \u2192 ${f(t.report.outputBytes)} \xB7 ${h(t.source.bytes,t.report.outputBytes)}`;if(t.status==="changed"){let a=t.target===t.source.format?"compressed":"converted";return[`\u2713 Copied image \u2192 ${p(t.saved)}${r}`,e,"","\u26A0 Clipboard changed"," The file you uploaded is no longer in the clipboard.",` The ${a} image is saved to ${p(S(t.saved))}.`]}let o=t.saved===void 0?"":` + ${p(t.saved)}`;return[`\u2713 Copied image \u2192 clipboard${r}${o}`,e]}async function U(t){if(!await k(F(t),t.root))throw v()}async function Z(t,r){if(t.undo)return await U(r.clip??{}),{exitCode:0,stdout:r.json?[JSON.stringify({forge:l,ok:!0,clipboard:"restored"})]:["\u2713 The original is back on the clipboard"],stderr:[]};let e=await J(t,r);if(e.status==="failed")return R(e.report,r);if(r.json){let o={...x(l,e.report),clipboard:e.status,...e.saved===void 0?{}:{saved:e.saved}};return{exitCode:0,stdout:[JSON.stringify(o)],stderr:[]}}return{exitCode:0,stdout:N(e),stderr:[]}}export{J as a,N as b,U as c,Z as d};
@@ -0,0 +1,80 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{b as L}from"./chunk-QPUKPSPZ.js";import{a as se,b as ae}from"./chunk-HZDYZ5RD.js";import{j as ee,k as te}from"./chunk-EYOO35US.js";import{a as j}from"./chunk-WID72ZII.js";import{b as re}from"./chunk-EEQSUBBL.js";import{a as z}from"./chunk-2OSM4W4D.js";import{a as ie}from"./chunk-FWVE3GNA.js";import{m as ne}from"./chunk-QO4JUY6B.js";import{a as oe}from"./chunk-UN5DSJE2.js";import{d as F}from"./chunk-4MZV4SRU.js";import{a as Z}from"./chunk-NUCGWLOY.js";import{P as h,Q as v,R as Q,W as P,b as Y,c as K}from"./chunk-CCNRNCRU.js";import{e as X}from"./chunk-FGR6QCG5.js";import{extname as Oe}from"node:path";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}},A=class extends x{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var I=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 A(`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 W(s){let e=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+e+">":"["+e+"]"}import{EventEmitter as xe}from"node:events";import U from"node:child_process";import C from"node:path";import q from"node:fs";import m from"node:process";import{stripVTControlCharacters as ye}from"node:util";import{stripVTControlCharacters as be}from"node:util";var H=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,o)=>i.name().localeCompare(o.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),o=n.long&&e._findOption(n.long);!i&&!o?t.push(n):n.long&&!o?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(o=>!o.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=>W(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(o=>{let r=n(o);i.has(r)||i.set(r,[])}),t.forEach(o=>{let r=n(o);i.has(r)||i.set(r,[]),i.get(r).push(o)}),i}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth??80;function o(c,p){return t.formatItem(c,n,p,t)}let r=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],u=t.commandDescription(e);u.length>0&&(r=r.concat([t.boxWrap(t.styleCommandDescription(u),i),""]));let d=t.visibleArguments(e).map(c=>o(t.styleArgumentTerm(t.argumentTerm(c)),t.styleArgumentDescription(t.argumentDescription(c))));if(r=r.concat(this.formatItemList("Arguments:",d,t)),this.groupItems(e.options,t.visibleOptions(e),c=>c.helpGroupHeading??"Options:").forEach((c,p)=>{let y=c.map(O=>o(t.styleOptionTerm(t.optionTerm(O)),t.styleOptionDescription(t.optionDescription(O))));r=r.concat(this.formatItemList(p,y,t))}),t.showGlobalOptions){let c=t.visibleGlobalOptions(e).map(p=>o(t.styleOptionTerm(t.optionTerm(p)),t.styleOptionDescription(t.optionDescription(p))));r=r.concat(this.formatItemList("Global Options:",c,t))}return this.groupItems(e.commands,t.visibleCommands(e),c=>c.helpGroup()||"Commands:").forEach((c,p)=>{let y=c.map(O=>o(t.styleSubcommandTerm(t.subcommandTerm(O)),t.styleSubcommandDescription(t.subcommandDescription(O))));r=r.concat(this.formatItemList(p,y,t))}),r.join(`
4
+ `)}displayWidth(e){return be(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 r=" ".repeat(2);if(!n)return r+e;let u=e.padEnd(t+e.length-i.displayWidth(e)),d=2,a=(this.helpWidth??80)-t-d-2,c;return a<this.minWidthToWrap||i.preformatted(n)?c=n:c=i.boxWrap(n,a).replace(/\n/g,`
5
+ `+" ".repeat(t+d)),r+u+" ".repeat(d)+c.replace(/\n/g,`
6
+ ${r}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,o=[];return n.forEach(r=>{let u=r.match(i);if(u===null){o.push("");return}let d=[u.shift()],l=this.displayWidth(d[0]);u.forEach(a=>{let c=this.displayWidth(a);if(l+c<=t){d.push(a),l+=c;return}o.push(d.join(""));let p=a.trimStart();d=[p],l=this.displayWidth(p)}),o.push(d.join(""))}),o.join(`
7
+ `)}};var $=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=_e(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 A(`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?ue(this.name().replace(/^no-/,"")):ue(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}},D=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,o=i!==void 0?i:!1;return t.negate===(o===e)}};function ue(s){return s.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function _e(s){let e,t,n=/^-[^-]$/,i=/^--[^-]/,o=s.split(/[ |,]+/).concat("guard");if(n.test(o[0])&&(e=o.shift()),i.test(o[0])&&(t=o.shift()),!e&&n.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=t,t=o.shift()),o[0].startsWith("-")){let r=o[0],u=`option creation failed due to '${r}' in option flags '${s}'`;throw/^-[^-][^-]/.test(r)?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(r)?new Error(`${u}
11
+ - too many short flags`):i.test(r)?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 we(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 o;s[i-1]===e[n-1]?o=0:o=1,t[i][n]=Math.min(t[i-1][n]+1,t[i][n-1]+1,t[i-1][n-1]+o),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 R(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(r=>r.slice(2)));let n=[],i=3,o=.4;return e.forEach(r=>{if(r.length<=1)return;let u=we(s,r),d=Math.max(s.length,r.length);(d-u)/d>o&&(u<i?(i=u,n=[r]):u===i&&n.push(r))}),n.sort((r,u)=>r.localeCompare(u)),t&&(n=n.map(r=>`--${r}`)),n.length>1?`
14
+ (Did you mean one of ${n.join(", ")}?)`:n.length===1?`
15
+ (Did you mean ${n[0]}?)`:""}var S=class s extends xe{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:()=>de()??(m.stdout.isTTY&&m.stdout.hasColors?.()),getErrHasColors:()=>de()??(m.stderr.isTTY&&m.stderr.hasColors?.()),stripColor:t=>ye(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,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,r,u]=e.match(/([^ ]+) *(.*)/),d=this.createCommand(r);return i&&(d.description(i),d._executableHandler=!0),o.isDefault&&(this._defaultCommandName=d._name),d._hidden=!!(o.noHelp||o.hidden),d._executableFile=o.executableFile||null,u&&d.arguments(u),this._registerCommand(d),d.parent=this,d.copyInheritedSettings(this),i?this:d}createCommand(e){return new s(e)}createHelp(){return Object.assign(new H,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 I(e,t)}argument(e,t,n,i){let o=this.createArgument(e,t);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),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,o]=n.match(/([^ ]+) *(.*)/),r=t??"display help for command",u=this.createCommand(i);return u.helpOption(!1),o&&u.arguments(o),r&&u.description(r),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,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=t,this}createOption(e,t){return new $(e,t)}_callParseArg(e,t,n,i){try{return e.parseArg(t,n)}catch(o){if(o.code==="commander.invalidArgument"){let r=`${i} ${o.message}`;this.error(r,{exitCode:o.exitCode,code:o.code})}throw o}}_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("|"),o=t(e).join("|");throw new Error(`cannot add command '${o}' 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=(o,r,u)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let d=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,d,r):o!==null&&e.variadic&&(o=e._collectValue(o,d)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,u)};return this.on("option:"+t,o=>{let r=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,r,"cli")}),e.envVar&&this.on("optionEnv:"+t,o=>{let r=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,r,"env")}),this}_optionEx(e,t,n,i,o){if(typeof t=="object"&&t instanceof $)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let r=this.createOption(t,n);if(r.makeOptionMandatory(!!e.mandatory),typeof i=="function")r.default(o).argParser(i);else if(i instanceof RegExp){let u=i;i=(d,l)=>{let a=u.exec(d);return a?a[0]:l},r.default(o).argParser(i)}else r.default(i);return this.addOption(r)}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(q.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",o=`'${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(o)}_executeSubCommand(e,t){t=t.slice();let n=[".js",".ts",".tsx",".mjs",".cjs"];function i(a,c){let p=C.resolve(a,c);if(q.existsSync(p))return p;if(n.includes(C.extname(c)))return;let y=n.find(O=>q.existsSync(`${p}${O}`));if(y)return`${p}${y}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,r=this._executableDir||"";if(this._scriptPath){let a;try{a=q.realpathSync(this._scriptPath)}catch{a=this._scriptPath}r=C.resolve(C.dirname(a),r)}if(r){let a=i(r,o);if(!a&&!e._executableFile&&this._scriptPath){let c=C.basename(this._scriptPath,C.extname(this._scriptPath));c!==this._name&&(a=i(r,`${c}-${e._name}`))}o=a||o}let u=n.includes(C.extname(o)),d;m.platform!=="win32"?u?(t.unshift(o),t=le(m.execArgv).concat(t),d=U.spawn(m.argv[0],t,{stdio:"inherit"})):d=U.spawn(o,t,{stdio:"inherit"}):(this._checkForMissingExecutable(o,r,e._name),t.unshift(o),t=le(m.execArgv).concat(t),d=U.spawn(m.execPath,t,{stdio:"inherit"})),d.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(c=>{m.on(c,()=>{d.killed===!1&&d.exitCode===null&&d.kill(c)})});let l=this._exitCallback;d.on("close",a=>{a=a??1,l?l(new x(a,"commander.executeSubCommandAsync","(close)")):m.exit(a)}),d.on("error",a=>{if(a.code==="ENOENT")this._checkForMissingExecutable(o,r,e._name);else if(a.code==="EACCES")throw new Error(`'${o}' not executable`);if(!l)m.exit(1);else{let c=new x(1,"commander.executeSubCommandAsync","(error)");c.nestedError=a,l(c)}}),this.runningCommand=d}_dispatchSubcommand(e,t,n){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(n));else return i._parseCommand(t,n)}),o}_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,o)=>{let r=i;if(i!==null&&n.parseArg){let u=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;r=this._callParseArg(n,i,o,u)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?i<this.args.length?(o=this.args.slice(i),n.parseArg&&(o=o.reduce((r,u)=>e(n,u,r),n.defaultValue))):o===void 0&&(o=[]):i<this.args.length&&(o=this.args[i],n.parseArg&&(o=e(n,o,n.defaultValue))),t[i]=o}),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(o=>o._lifeCycleHooks[t]!==void 0).forEach(o=>{o._lifeCycleHooks[t].forEach(r=>{i.push({hookedCommand:o,callback:r})})}),t==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(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])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let r;return r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent&&(r=this._chainOrCall(r,()=>{this.parent.emit(o,e,t)})),r=this._chainOrCallHooks(r,"postAction"),r}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,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(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],i=t;function o(a){return a.length>1&&a[0]==="-"}let r=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,d=null,l=0;for(;l<e.length||d;){let a=d??e[l++];if(d=null,a==="--"){i===n&&i.push(a),i.push(...e.slice(l));break}if(u&&(!o(a)||r(a))){this.emit(`option:${u.name()}`,a);continue}if(u=null,o(a)){let c=this._findOption(a);if(c){if(c.required){let p=e[l++];p===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,p)}else if(c.optional){let p=null;l<e.length&&(!o(e[l])||r(e[l]))&&(p=e[l++]),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()}`),d=`-${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&&o(a)&&!(this.commands.length===0&&r(a))&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(a)){t.push(a),n.push(...e.slice(l));break}else if(this._getHelpCommand()&&a===this._getHelpCommand().name()){t.push(a,...e.slice(l));break}else if(this._defaultCommandName){n.push(a,...e.slice(l));break}}if(this._passThroughOptions){i.push(a,...e.slice(l));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,o=n.code||"commander.error";this._exit(i,o,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 D(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=r=>{let u=r.attributeName(),d=this.getOptionValue(u),l=this.options.find(c=>c.negate&&u===c.attributeName()),a=this.options.find(c=>!c.negate&&u===c.attributeName());return l&&(l.presetArg===void 0&&d===!1||l.presetArg!==void 0&&d===l.presetArg)?l:a||r},i=r=>{let u=n(r),d=u.attributeName();return this.getOptionValueSource(d)==="env"?`environment variable '${u.envVar}'`:`option '${u.flags}'`},o=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let r=o.createHelp().visibleOptions(o).filter(u=>u.long).map(u=>u.long);i=i.concat(r),o=o.parent}while(o&&!o._enablePositionalOptions);t=R(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,o=this.parent?` for '${this.name()}'`:"",r=e.join(", "),u=`error: too many arguments${o}. Expected ${t} argument${n} but got ${i}: ${r}.`;this.error(u,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),t=R(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=>W(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,o;return t?(n=u=>this._outputConfiguration.writeErr(u),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(n=u=>this._outputConfiguration.writeOut(u),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:t,write:u=>(i||(u=this._outputConfiguration.stripColor(u)),n(u)),hasColors:i,helpWidth:o}}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(r=>r.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:n.error});if(t&&(o=t(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(r=>r.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,o=>{let r;typeof t=="function"?r=t({error:o.error,command:o.command}):r=t,r&&o.write(`${r}
28
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function le(s){return s.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk)?)$/))!==null?t=o[1]:(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=o[1],n=o[3],i=o[4]),t&&i!=="0"?`${t}=${n}:${parseInt(i)+1}`:e})}function de(){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 ft=new S;function Ce(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||!z.includes(t))throw h(`Unknown config setting ${t??"(none)"}.`,`Try one of: ${z.join(", ")}.`);let i=n.join(" ");if(i.length===0)throw h(`forge config set ${t} needs a value.`);return{kind:"config",action:"set",key:t,value:i}}throw h(`Unknown config action ${e}.`,"Try: forge config list, forge config set <setting> <value>, or forge config path.")}var ke={jpg:"jpeg",tif:"tiff",heif:"heic"};function V(s){let e=s.toLowerCase().replace(/^\./,""),t=Y(ke[e]??e);if(!t)throw h(`${s} is not a format Forge knows.`,"Run forge --formats to see what is available.");return t.id}function G(s,e,t,n,i){let o=Number(String(e).replace(/k$/i,""));if(!Number.isFinite(o)||o<t||o>n)throw h(`${s} takes ${t} to ${n}, not ${e}.`,`For example ${s} ${i}.`);return o}function ve(s){let e={};if(s.cut!==void 0){let t=re(String(s.cut));if(!t)throw h(`--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=G("--speed",s.speed,.25,4,"2")),s.fps!==void 0&&(e.fps=G("--fps",s.fps,1,120,"30")),s.bitrate!==void 0&&(e.bitrate=Math.round(G("--bitrate",s.bitrate,32,320,"128k"))),s.loudness!==void 0&&(e.loudness=G("--loudness",s.loudness,-70,-5,"-16")),s.cleanAudio&&(e.cleanup=!0,e.loudness??=-16),Object.keys(e).length?e:void 0}function E(s){let e=Number(s);if(!Number.isInteger(e)||e<1||e>100)throw h(`Quality must be a whole number between 1 and 100, not ${s}.`);return e}function ce(s,e){let t=/^\d+$/.test(String(e))?Number(e):Number.NaN;if(!Number.isInteger(t)||t<1)throw h(`${s} takes a whole number of pixels, at least 1, not ${e}.`);return t}function Ae(s){let e=String(s),t=/^\d+(\.\d+)?%?$/.test(e)?Number.parseFloat(e):Number.NaN;if(!(t>=1&&t<=L))throw h(`--resize takes a percent from 1 to ${L}, not ${s}.`,"Try --resize 50% to halve, or --width 1200 for an exact width.");return t}function M(s){let e=Number(s);if(!Number.isInteger(e)||e<1)throw h(`Concurrency must be a positive whole number, not ${s}.`);return e}var $e=`
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`,he=`
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 card <file> named colours as a card to paste into Figma
38
+ (--svg, --json, --title <text>; - reads stdin)
39
+ forge clip compress the copied image and put it back (--to, --quality,
40
+ --max-size, --save [folder], --undo)
41
+ forge transcribe <file | link>
42
+ a video or audio file, or a YouTube link, into notes
43
+ (--to all | notes | transcript, --detail brief | standard | detailed,
44
+ --format md | docx | pdf | txt, --language <id>, -o <path>, --force)
45
+ forge watch <folder> --to <format>
46
+ convert the folder, then every file added to it, until ctrl-c
47
+ (--quality, --dpi, -o <folder>, --new-only, --json)
48
+ forge config [list | path | set <setting> <value>]
49
+ forge extensions [list | add <id> | remove <id>]
50
+ optional extras, such as boost and remove-background
51
+ forge menu [install | remove]
52
+ the right-click menu, by hand
53
+ forge update install a newer Forge, if there is one
54
+ forge uninstall take Forge out of the right-click menu, then remove it
55
+ forge mcp run as a local MCP server over stdio, for AI agents`;function fe(s=process.platform){if(s==="darwin")return he;let e=s==="win32"?"boost and whisper":"whisper and heic";return he.replace("a video or audio file, or a YouTube link, into notes","a video or audio file, or a YouTube link, into a transcript").replace("optional extras, such as boost and remove-background",`optional extras, such as ${e}`)}function J(s){let e=X(String(s));if(e===void 0)throw h(`${s} is not a size.`,"Try a number with a unit, for example 500kb, 2mb or 1.5mb.");return e}function Se(s){let e=s.slice(1).filter(n=>n!=="--json"),t=e.find(n=>n.startsWith("-"));if(t!==void 0)throw h(`forge probe takes files, not ${t}.`,"Try: forge probe photo.jpg --json");if(e.length===0)throw v("Pass a file, for example: forge probe scan.pdf --json");return{kind:"probe",inputs:e}}function Ee(s){let e={kind:"clip",undo:!1,debug:!1},t=s.slice(1),n=(i,o)=>{let r=t[o+1];if(r===void 0||r.startsWith("-"))throw h(`${i} needs a value.`);return r};for(let i=0;i<t.length;i++){let o=t[i];if(o!=="--json")if(o==="--debug")e.debug=!0;else if(o==="--undo")e.undo=!0;else if(o==="--to"||o==="-t")e.target=V(n(o,i++));else if(o==="--quality"||o==="-q")e.quality=E(n(o,i++));else if(o==="--max-size")e.maxBytes=J(n(o,i++));else if(o==="--save"){let r=t[i+1];e.save=r===void 0||r.startsWith("-")?!0:t[++i]}else throw o.startsWith("-")?h(`forge clip does not take ${o}.`,"Try: forge --help"):h(`forge clip takes no files: it reads the clipboard, not ${o}.`,`To compress a file, try: forge ${o} --quality 80`)}if(e.undo&&Object.keys(e).some(i=>!["kind","undo","debug"].includes(i)))throw h("--undo takes no other flag.","Try: forge clip --undo");if(e.quality!==void 0&&e.maxBytes!==void 0)throw h("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 Te(s){let e=s.slice(1),t=[],n={kind:"transcribe",input:"",notes:!0,transcript:!0,detail:ae,force:!1,debug:!1},i=(d,l)=>{let a=e[l+1];if(a===void 0||a.startsWith("-"))throw h(`${d} needs a value.`);return a},o="Try: forge transcribe talk.mp4";for(let d=0;d<e.length;d++){let l=e[d];if(l==="--debug")n.debug=!0;else if(l==="--force"||l==="-f")n.force=!0;else if(l==="--language"||l==="-l")n.language=i(l,d++);else if(l==="--output"||l==="-o")n.output=F(i(l,d++));else if(l==="--detail"){let a=i(l,d++).toLowerCase();if(!se.includes(a))throw h(`forge transcribe writes notes in brief, standard or detailed, not ${a}.`,"Try: forge transcribe talk.mp4 --detail brief");n.detail=a}else if(l==="--format"){let a=i(l,d++).toLowerCase(),c=Z.find(p=>p.id===a||p.label.toLowerCase()===a);if(c===void 0)throw h(`forge transcribe writes md, docx, pdf or txt, not ${a}.`,"Try: forge transcribe talk.mp4 --format pdf");n.format=c.id}else if(l==="--to"||l==="-t"){let a=i(l,d++).toLowerCase();if(a!=="all"&&a!=="notes"&&a!=="transcript")throw h(`forge transcribe makes all, notes or a transcript, not ${a}.`,"Try: forge transcribe talk.mp4 --to transcript");n.to=a,n.notes=a!=="transcript",n.transcript=a!=="notes"}else{if(l.startsWith("-"))throw h(`forge transcribe does not take ${l}.`,o);t.push(l)}}let[r,...u]=t;if(r===void 0)throw h("forge transcribe needs a file or a link.",o);if(u.length>0)throw h("forge transcribe takes one file or link at a time.",o);return{...n,input:r}}function Ie(s){let e=s.slice(1),t=[],n,i={kind:"watch",newOnly:!1,debug:!1},o={},r=(l,a)=>{let c=e[a+1];if(c===void 0||c.startsWith("-"))throw h(`${l} needs a value.`);return c};for(let l=0;l<e.length;l++){let a=e[l];if(a!=="--json")if(a==="--debug")i.debug=!0;else if(a==="--new-only")i.newOnly=!0;else if(a==="--to"||a==="-t")n=V(r(a,l++));else if(a==="--quality"||a==="-q")o.quality=E(r(a,l++));else if(a==="--output"||a==="-o")o.output=F(r(a,l++));else if(a==="--dpi"){let c=r(a,l++),p=Number(c);if(!Number.isInteger(p)||p<36||p>600)throw P(c);o.dpi=p}else{if(a.startsWith("-"))throw h(`forge watch does not take ${a}.`,"Try: forge watch ./images --to webp");t.push(a)}}let[u,...d]=t;if(u===void 0)throw h("forge watch needs a folder.","Try: forge watch ./images --to webp");if(d.length>0)throw h("forge watch watches one folder at a time.",`Try: forge watch ${u} --to webp`);if(n===void 0)throw h("forge watch needs a format to convert to.",`Try: forge watch ${u} --to webp`);return{kind:"watch",folder:u,target:n,...o.quality===void 0?{}:{quality:o.quality},...o.dpi===void 0?{}:{dpi:o.dpi},...o.output===void 0?{}:{output:o.output},newOnly:i.newOnly,debug:i.debug}}function He(s){let e=s.slice(1).filter(r=>r!=="--json"),t=e.find(r=>r.startsWith("-"));if(t!==void 0)throw h(`forge extensions does not take ${t}.`,"Try: forge extensions, forge extensions add <id>, or forge extensions remove <id>.");let[n,i,...o]=e;if(n===void 0||n==="list"&&i===void 0)return{kind:"extensions",action:"list"};if(n!=="add"&&n!=="remove")throw h(`Unknown extensions action ${n}.`,"Try: forge extensions, forge extensions add <id>, or forge extensions remove <id>.");if(i===void 0||o.length>0)throw h(`forge extensions ${n} takes exactly one extension.`,`Try: forge extensions ${n} boost`);return{kind:"extensions",action:n,id:i}}function pe(s){if(s===void 0)throw h("No colour given.","Try: forge scale 6579FD \u2014 or quote it, '#6579FD', because an unquoted # starts a comment in the shell.");let e=ee(s)?.rgb;if(!e)throw h(`${s} is not a colour.`,"Try a hex code (6579FD), rgb(), hsl(), oklch() or a colour name, quoted: 'rgb(101 121 253)'.");return e}function Ve(s,e=process.platform,t=process.env){let o=e==="linux"&&!t.WAYLAND_DISPLAY&&!!t.DISPLAY?" --svg a card of swatches; pipe to xclip -sel c, paste into Figma":` --svg a card of swatches; pipe to ${e==="win32"?"clip":e==="linux"?"wl-copy":"pbcopy"} and paste into Figma`;return s==="card"?`Usage: forge card <file> [--json] [--svg] [--title <text>]
56
+
57
+ Named colours from design tokens, a CSV, CSS variables or one a line
58
+ (bg #F8F1E6). - reads them from stdin.
59
+ --json one JSON document: card.colours[] with name and hex
60
+ ${o}
61
+ --title <text> the card's heading; the file's name if not given
62
+ `:s==="scale"?`Usage: forge scale <colour> [--json] [--svg]
63
+
64
+ 50\u2013950 built in OKLCH, with <colour> at 500. Pass the hex without #, or quote it.
65
+ --json one JSON document: scale.steps[] with hex, oklch, white, black
66
+ ${o}
67
+ `:`Usage: forge palette <image> [--json] [--svg] [--inside <hex>]
68
+
69
+ An image's main colours, most of the image first.
70
+ --json one JSON document: palette.colours[] with hex, rgb, oklch, share
71
+ ${o}
72
+ --inside <hex> the shades of the palette colour nearest <hex>
73
+ `}var me=["clip","watch","transcribe","config","probe","extensions","palette","scale","card","update","uninstall","menu","mcp"];function Ne(s,e=process.platform){let[t,...n]=s;if(!me.includes(t??""))return;let i=n.indexOf("--"),o=i===-1?n:n.slice(0,i);if(!o.includes("--help")&&!o.includes("-h"))return;if(t==="palette"||t==="scale"||t==="card")return Ve(t,e);let r=fe(e).split(`
74
+ `),u=r.findIndex(l=>l.startsWith(` forge ${t} `)||l===` forge ${t}`),d=[r[u]];for(let l of r.slice(u+1)){if(!l.startsWith(" "))break;d.push(l)}return`Usage:
75
+ ${d.join(`
76
+ `)}
77
+ `}function Pe(s){let[e,...t]=s;if(e==="card")return Fe(t);let n=t.filter(d=>d!=="--json"&&d!=="--svg"),i=t.includes("--svg"),o=n.indexOf("--inside"),r=o===-1?void 0:n[o+1];o!==-1&&n.splice(o,2);let u=n.find(d=>d.startsWith("-"));if(u!==void 0)throw h(`forge ${e} does not take ${u}.`,`Try: forge ${e} --help`);if(e==="scale"){if(o!==-1)throw h("--inside is for forge palette.","Try: forge palette photo.jpg --inside F26E69");if(n.length>1)throw h("forge scale takes one colour.","Try: forge scale 6579FD");return{kind:"scale",colour:pe(n[0]),svg:i}}if(n.length!==1)throw h(n.length===0?"No image given.":"forge palette takes one image.","Try: forge palette photo.jpg");return{kind:"palette",input:n[0],svg:i,...o===-1?{}:{inside:pe(r)}}}function Fe(s){let e=s.filter(r=>r!=="--json"&&r!=="--svg"),t=s.includes("--svg"),n=e.indexOf("--title"),i=n===-1?void 0:e[n+1];if(n!==-1){if(i===void 0||i.trim()==="")throw h("--title needs the heading.","Try: forge card palette.csv --title 'Cream blue'");e.splice(n,2)}let o=e.find(r=>r.startsWith("-")&&r!=="-");if(o!==void 0)throw h(`forge card does not take ${o}.`,"Try: forge card --help");if(e.length!==1)throw h(e.length===0?"No file given.":"forge card takes one file.","Try: forge card palette.csv --svg");return{kind:"card",input:e[0],svg:t,...i===void 0?{}:{title:i}}}function je(s){let e=s.indexOf("--");return(e===-1?s:s.slice(0,e)).includes("--json")}function We(s){let e=s.indexOf("--"),t=e===-1?s:s.slice(0,e),n=e===-1?[]:s.slice(e),i=[],o;for(let r=0;r<t.length;r++){let u=t[r],d=u.startsWith("--boost=")?u.slice(8):void 0;if(u!=="--boost"&&d===void 0){i.push(u);continue}let l=d;if(l===void 0&&/^\d+$/.test(t[r+1]??"")&&(l=t[++r]),l!==void 0&&l!=="2"&&l!=="3"&&l!=="4")throw h(`--boost takes 2, 3 or 4, not ${l}.`,"Try --boost, --boost 2, --boost 3 or --boost 4.");o=l==="4"?4:l==="3"?3:2}return{rest:[...i,...n],...o===void 0?{}:{scale:o}}}function Ht(s){let e=s;if(me.includes(e[0]??"")){let i=Ne(e);if(i!==void 0)throw process.stdout.write(i),new x(0,"commander.helpDisplayed","(outputHelp)");return qe(e)}let t=e.includes("--")?e.slice(0,e.indexOf("--")):e;if(je(e)&&(t.includes("--version")||t.includes("-V")))throw process.stdout.write(`${JSON.stringify({forge:j,ok:!0})}
78
+ `),new x(0,"commander.version",j);let n=We(De(e));return Ge(n.rest,n.scale)}function De(s){let e=s.indexOf("--"),t=e===-1?s:s.slice(0,e),n=e===-1?[]:s.slice(e);return[...t.flatMap(i=>{let o=/^(-[toq])=(.*)$/s.exec(i);return o?[o[1],o[2]]:[i]}),...n]}function qe(s){if(s[0]==="update"){let e=s.slice(1).filter(t=>t!=="--json");if(e.length>0)throw h(`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 h(`forge uninstall takes nothing else, got: ${e.join(" ")}.`,"Try: forge uninstall");return{kind:"uninstall"}}return s[0]==="clip"?Ee(s):s[0]==="watch"?Ie(s):s[0]==="transcribe"?Te(s):s[0]==="config"?Ce(s.filter(e=>e!=="--json")):s[0]==="probe"?Se(s):s[0]==="palette"||s[0]==="scale"||s[0]==="card"?Pe(s):He(s)}function Ge(s,e){let t=new S().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; its extension sets the format").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 or images 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("--clean-audio","video or audio: take out rumble and hiss, then even the level").option("--preset <name>","run a preset saved from Done, e.g. --preset blog").option("--pages <ranges>","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(j,"-V, --version","show the version").addHelpText("after",`${fe()}
79
+ ${$e}`).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(`
80
+ `),_=b.join(" ").trim().replace(/^\((.*)\)\.?$/,"$1");throw h(`${g.charAt(0).toUpperCase()}${g.slice(1).replace(/\.$/,"")}.`,_||"Run forge --help to see what Forge accepts.")}throw f}let n=t.opts(),i=t.args;if(n.output==="-")throw h("-o needs a file or folder, not -.");n.output!==void 0&&(n.output=F(String(n.output)));let o=n.output===void 0||oe(String(n.output))?void 0:K(Oe(String(n.output)))[0]?.id;if(n.formats)return{kind:"formats"};let r=ve(n);if(r!==void 0&&n.trim)throw h("--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=new Set(["preset","output","force","recursive","debug","json"]),g=t.options.filter(b=>!f.has(b.attributeName())).filter(b=>t.getOptionValueSource(b.attributeName())==="cli").map(b=>b.long??b.flags);if(e!==void 0&&g.push("--boost"),g.length>0)throw h(`--preset sets these options. Drop ${g.join(" and ")}.`,"Run the preset alone, or change it from Done with \u2192 continue editing.");if(i.length===0)throw v("Pass a file, for example: forge photo.jpg --preset blog");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}}let u=te(String(n.background));if(u===void 0)throw Q(String(n.background));if(n.pages!==void 0&&n.to===void 0&&o===void 0)throw h("--pages needs --to: it chooses which pages to render.");let d=["merge","split","extract","delete","rotate"].filter(f=>n[f]!==void 0);if(d.length>1)throw h(`Use one operation at a time \u2014 got ${d.map(f=>`--${f}`).join(" and ")}.`);let l=[...n.sharpen?["--sharpen"]:[],...e!==void 0?["--boost"]:[],...n.removeBg?["--remove-bg"]:[]],a=[...n.resize!==void 0?["--resize"]:[],...n.width!==void 0?["--width"]:[],...n.height!==void 0?["--height"]:[]],c=r!==void 0&&!n.to&&n.quality===void 0&&n.maxSize===void 0;if(n.trim||n.crop!==void 0||a.length>0||c){if(a.length>1)throw h(`Use one of --resize, --width and --height \u2014 got ${a.join(" and ")}.`);let f=n.crop!==void 0?"--crop":a[0]??(n.trim?"--trim":"--cut"),g=[...n.crop!==void 0&&n.trim?["--trim"]:[],...l,...n.maxSize!==void 0?["--max-size"]:[],...n.pages!==void 0?["--pages"]:[],...d.map(ge=>`--${ge}`)][0];if(g!==void 0)throw h(`${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:ne(String(n.crop))}:void 0,_=n.resize!==void 0?{percent:Ae(n.resize)}:n.width!==void 0?{width:ce("--width",n.width)}:n.height!==void 0?{height:ce("--height",n.height)}:void 0;if(i.length===0)throw v("Pass an image, for example: forge photo.jpg --resize 50%");let k={background:u,keepMetadata:!!n.keepMetadata};n.quality!==void 0&&(k.quality=E(String(n.quality)));let w={kind:"edit",inputs:i,trim:!!n.trim,options:k,force:!!n.force,recursive:!!n.recursive,debug:!!n.debug};return b!==void 0&&(w.crop=b),_!==void 0&&(w.resize=_),r!==void 0&&(w.media=r),n.to&&(w.target=V(String(n.to))),n.output!==void 0&&(w.output=String(n.output)),n.concurrency!==void 0&&(w.concurrency=M(String(n.concurrency))),w}let p=n.sharpen?1:e,y=p!==void 0?"boost":n.removeBg?"remove-background":null;if(y!==null){if(l.length>1)throw h(`Use one operation at a time \u2014 got ${l.join(" and ")}.`);let f=l[0];if(d.length>0)throw h(`${f} cannot be combined with --${d[0]}.`);if(n.maxSize!==void 0||n.pages!==void 0)throw h(`${f} cannot be combined with ${n.maxSize!==void 0?"--max-size":"--pages"}.`);if(i.length===0)throw v(`Pass an image, for example: forge photo.jpg ${f}`);let g=n.to?V(String(n.to)):void 0;if(y==="remove-background"&&g!==void 0){let k=ie(g);if(k)throw k}let b={background:u,keepMetadata:!!n.keepMetadata};n.quality!==void 0&&(b.quality=E(String(n.quality)));let _={kind:"extension-op",op:y,inputs:i,...g===void 0?{}:{target:g},options:b,force:!!n.force,recursive:!!n.recursive,debug:!!n.debug};return p!==void 0&&(_.scale=p),n.output!==void 0&&(_.output=String(n.output)),n.concurrency!==void 0&&(_.concurrency=M(String(n.concurrency))),_}if(d.length===1){let f=d[0];if(i.length===0)throw v(`Pass a PDF, for example: forge doc.pdf --${f}`);if(n.separate&&f!=="extract")throw h(`--separate only applies to --extract, not --${f}.`);if(n.output!==void 0)throw h(`--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 h(`--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),_=b.match(/^every=(\d+)$/),k=b.match(/^at=(\s*\d+(?:\s*,\s*\d+)*\s*)$/);if(b==="every-page")g.split={mode:"every-page"};else if(_?.[1]!==void 0){let w=Number(_[1]);if(!Number.isInteger(w)||w<1)throw h(`--split every=N takes a whole number of pages, at least 1, not '${_[1]}'.`);g.split={mode:"every-n",n:w}}else if(k?.[1])g.split={mode:"points",after:k[1].split(",").map(w=>Number(w.trim()))};else throw h(`--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 h("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 v("Pass a file, for example: forge photo.jpg --max-size 500kb");let f={background:u,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=E(String(n.quality))),n.maxSize!==void 0&&(g.maxBytes=J(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 P(n.dpi);g.dpi=b}return n.concurrency!==void 0&&(g.concurrency=M(String(n.concurrency))),g}let O=n.to?V(String(n.to)):o;if(O===void 0)throw h("No target format given.","Add --to <format>, for example: forge photo.jpg --to webp");if(i.length===0)throw v("Pass a file, a folder or a glob, for example: forge photo.jpg --to webp");let B={background:u,keepMetadata:!!n.keepMetadata};n.quality!==void 0&&(B.quality=E(String(n.quality))),r!==void 0&&(B.media=r);let N=Number(n.dpi);if(!Number.isInteger(N)||N<36||N>600)throw P(n.dpi);let T={kind:"convert",inputs:i,target:O,options:B,force:!!n.force,recursive:!!n.recursive,debug:!!n.debug,dpi:N,passwordStdin:!!n.passwordStdin};return n.output!==void 0&&(T.output=String(n.output)),n.pages!==void 0&&(T.pages=String(n.pages)),n.maxSize!==void 0&&(T.maxBytes=J(n.maxSize)),n.concurrency!==void 0&&(T.concurrency=M(String(n.concurrency))),T}export{$e as a,he as b,fe as c,Ve as d,Ne as e,je as f,Ht as g};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a,b,c,d}from"./chunk-YJZEHJ6U.js";import"./chunk-JUA63KQK.js";import"./chunk-NUTTDNTG.js";import"./chunk-X2YUHPOU.js";import"./chunk-EJWTYDBJ.js";import"./chunk-UI4EUC3S.js";import"./chunk-2L66A2X6.js";import"./chunk-6RMRWBMB.js";import"./chunk-X4QI2EYV.js";import"./chunk-QIMSNTKL.js";import"./chunk-ECA4PW5T.js";import"./chunk-QPUKPSPZ.js";import"./chunk-PISCJKIG.js";import"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import"./chunk-WID72ZII.js";import"./chunk-O7DK3GJT.js";import"./chunk-65Y7YCZZ.js";import"./chunk-NMGQGYVM.js";import"./chunk-EEQSUBBL.js";import"./chunk-BSFBZBAI.js";import"./chunk-BWJNZT75.js";import"./chunk-3IX3QA76.js";import"./chunk-PON65UTS.js";import"./chunk-FWVE3GNA.js";import"./chunk-QO4JUY6B.js";import"./chunk-UN5DSJE2.js";import"./chunk-6HUYBVQA.js";import"./chunk-KXKQDFHX.js";import"./chunk-4MZV4SRU.js";import"./chunk-BYUOU2Q2.js";import"./chunk-NUCGWLOY.js";import"./chunk-I2LPGKUU.js";import"./chunk-HON4OV7M.js";import"./chunk-CCNRNCRU.js";import"./chunk-FGR6QCG5.js";import"./chunk-VLVNA4T3.js";import"./chunk-TMUK2DD3.js";export{b as clipLines,a as runClip,d as runClipCommand,c as runUndo};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a,b,c}from"./chunk-TNIPRV6K.js";import"./chunk-NUTTDNTG.js";import"./chunk-UN5DSJE2.js";import"./chunk-CCNRNCRU.js";import"./chunk-FGR6QCG5.js";import"./chunk-VLVNA4T3.js";import"./chunk-TMUK2DD3.js";export{a as copy,c as linuxText,b as paste};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as K}from"./chunk-4NDZTK22.js";import{g as V,h as _,i as M}from"./chunk-G6L5NIJ5.js";import{b as v,c as U}from"./chunk-POM7FXIV.js";import{i as B,l as Y,m as q,o as z}from"./chunk-5FJT4BNY.js";import{b as $,c as W,h as D,i as O,j as x}from"./chunk-EYOO35US.js";import{a as F,b as G,c as H}from"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import{a as w}from"./chunk-WID72ZII.js";import"./chunk-NMGQGYVM.js";import"./chunk-EEQSUBBL.js";import"./chunk-BSFBZBAI.js";import"./chunk-BWJNZT75.js";import"./chunk-3IX3QA76.js";import"./chunk-PON65UTS.js";import"./chunk-FWVE3GNA.js";import"./chunk-QO4JUY6B.js";import"./chunk-UN5DSJE2.js";import"./chunk-6HUYBVQA.js";import"./chunk-KXKQDFHX.js";import"./chunk-I2LPGKUU.js";import{g as N,h as P,i as I,m as L,q as A,r as J,s as T}from"./chunk-CCNRNCRU.js";import"./chunk-FGR6QCG5.js";import{c as k}from"./chunk-VLVNA4T3.js";import"./chunk-TMUK2DD3.js";import{readFile as at}from"node:fs/promises";import{basename as lt,resolve as tt}from"node:path";function h(t,e){let o=x(e);if(!o)return;let r=o.alpha!==void 0&&o.alpha<1?o.alpha:void 0;return{name:t,hex:$(o.rgb),...r===void 0?{}:{alpha:r}}}function S(t){return/^\s*(#|(rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\s*\()/i.test(t)}function Q(t){let e=t.replace(/^/,"").trim();if(e==="")return{colours:[],bad:[]};if(e.startsWith("{")||e.startsWith("["))try{return ot(JSON.parse(e))}catch{}return ut(e.split(/\r?\n/))}var g=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),et=["hex","colour","color","value","$value"];function ot(t){let e={colours:[],bad:[]};if(Array.isArray(t)){for(let c of t){if(!g(c))continue;let p=typeof c.name=="string"?c.name:void 0,f=et.find(d=>typeof c[d]=="string");if(!p||!f)continue;let l=c[f],m=h(p,l);m?e.colours.push(m):e.bad.push(`${p}: ${l}`)}return e}if(!g(t))return e;let o=Object.keys(t).filter(c=>!c.startsWith("$")),r=o.length===1?t[o[0]]:void 0,n=c=>"$value"in c?c.$value:c.value,s=c=>"$value"in c||typeof c.value=="string",u=g(r)&&!s(r)?r:t,a=(c,p=0)=>{let f=/^\{(.+)\}$/.exec(c.trim());if(!f||p>8)return c;let l=t;for(let d of f[1].split("."))l=g(l)?l[d]:void 0;let m=g(l)&&s(l)?n(l):void 0;return typeof m=="string"?a(m,p+1):typeof l=="string"?a(l,p+1):c},i=(c,p,f)=>{let l=c.$type??f;for(let[m,d]of Object.entries(c)){if(m.startsWith("$"))continue;let y=[...p,m].join("/");if(g(d)&&s(d)){let C=d.$type??d.type??l,b=n(d);if(typeof b!="string")continue;let E=a(b),R=h(y,E);R?e.colours.push(R):(C==="color"||S(E))&&e.bad.push(`${y}: ${b}`)}else if(g(d))i(d,[...p,m],l);else if(typeof d=="string"){let C=a(d),b=h(y,C);b?e.colours.push(b):S(C)&&e.bad.push(`${y}: ${d}`)}}};return i(u,[]),e}function X(t){let e=[],o="",r=!1;for(let n=0;n<t.length;n++){let s=t[n];r?s==='"'&&t[n+1]==='"'?(o+='"',n++):s==='"'?r=!1:o+=s:s==='"'?r=!0:s===","?(e.push(o.trim()),o=""):o+=s}return e.push(o.trim()),e}var rt=["name","token","label"],nt=["hex","colour","color","value","rgb"];function st(t,e,o){let r={colours:[],bad:[]};for(let n of t){if(n.trim()==="")continue;let s=X(n),u=s[e]??"",a=s[o]??"",i=u?h(u,a):void 0;i?r.colours.push(i):r.bad.push(n.trim())}return r}function it(t){let e=t.replace(/^[-*•]\s+/,"").replace(/[;,]$/,"").trim();for(let n of[" ",":","=",","]){let s=e.indexOf(n);if(s<=0)continue;let u=h(e.slice(0,s).trim(),e.slice(s+1).trim());if(u?.name)return u}let o=h("",e);if(o)return{...o,name:o.hex};let r=e.split(/\s+/);for(let n=1;n<r.length;n++){let s=h(r.slice(0,n).join(" "),r.slice(n).join(" "));if(s)return s}for(let n=r.length-1;n>=1;n--){let s=h(r.slice(n).join(" "),r.slice(0,n).join(" "));if(s)return s}}function ct(t){let e=t.split(/\s+/)[0];if(x(e))return!0;let o=/^#([0-9a-z]{1,8})$/i.exec(e);if(!o)return!1;let r=o[1];return/^[0-9a-f]+$/i.test(r)||[3,4,6,8].includes(r.length)||/\d/.test(r)}function ut(t){let e=X(t[0]??"").map(a=>a.toLowerCase()),o=e.findIndex(a=>rt.includes(a)),r=e.findIndex(a=>nt.includes(a));if(e.length>1&&o!==-1&&r!==-1)return st(t.slice(1),o,r);let n=t.some(a=>/^\s*--[\w-]+\s*:/.test(a)),s={colours:[],bad:[]},u=!1;for(let a of t){let i=a.replace(/\/\*.*?\*\//g,"");if(u){let f=i.indexOf("*/");if(f===-1)continue;i=i.slice(f+2),u=!1}let c=i.indexOf("/*");if(c!==-1&&(i=i.slice(0,c),u=!0),i=i.trim(),i===""||i.startsWith("//"))continue;if(n){let f=/^--([\w-]+)\s*:\s*(.+?)\s*;?$/.exec(i);if(!f)continue;let l=h(f[1],f[2]);l?s.colours.push(l):S(f[2])&&s.bad.push(`--${f[1]}: ${f[2]}`);continue}if(i.startsWith("#")&&!ct(i))continue;let p=it(i);p?s.colours.push(p):s.bad.push(i)}return s}var j=({r:t,g:e,b:o},r)=>r?`\x1B[38;2;${t};${e};${o}m\u2588\u2588\x1B[39m `:"";function ft(t,e){let o=W(e),r,n=Number.POSITIVE_INFINITY;for(let s of t){let u=(s.centre.L-o.L)**2+(s.centre.a-o.a)**2+(s.centre.b-o.b)**2;u<n&&(n=u,r=s)}return r}async function pt(t){let{pixels:e}=await K(t.input),o=Y(e);if(o.length===0)throw A(t.input);let r=t.inside?ft(o,t.inside):void 0,n=r?q(e,r):o,s=G(w,{source:tt(t.input),...r?{inside:r.hex}:{},colours:n.map(a=>({hex:a.hex,rgb:D(a.rgb),oklch:O(a.rgb),share:a.share}))});return{groups:n,...r?{parent:r}:{},doc:s,svg:()=>_(k(t.input),n,"light",r?.hex)}}async function It(t,e){let{groups:o,doc:r,svg:n}=await pt(t);if(t.svg)return{exitCode:0,stdout:[n()],stderr:[]};if(e.json)return{exitCode:0,stdout:[JSON.stringify(r)],stderr:[]};let s=z(o.map(u=>u.share));return{exitCode:0,stdout:o.map((u,a)=>`${j(u.rgb,e.colour)}${u.hex} ${String(s[a]).padStart(3)}%`),stderr:[]}}async function Lt(t,e){let o=B(t.colour);if(t.svg)return{exitCode:0,stdout:[M(t.colour,o)],stderr:[]};let r=o.map(n=>({...n,...U(n.rgb)}));if(e.json){let n=H(w,{reference:$(t.colour),steps:r.map(s=>({step:s.step,hex:s.hex,oklch:O(s.rgb),white:s.white,black:s.black}))});return{exitCode:0,stdout:[JSON.stringify(n)],stderr:[]}}return{exitCode:0,stdout:r.map(n=>`${String(n.step).padStart(4)} ${j(n.rgb,e.colour)}${n.hex} white ${n.white.toFixed(1)} ${v(n.white)} \xB7 black ${n.black.toFixed(1)} ${v(n.black)}`),stderr:[]}}async function dt(){let t=[];for await(let e of process.stdin)t.push(Buffer.from(e));return Buffer.concat(t).toString("utf8")}async function mt(t){try{return await at(t,"utf8")}catch(e){let o=e.code;throw o==="ENOENT"||o==="ENOTDIR"?N(t):o==="EISDIR"?P(t):o==="EACCES"||o==="EPERM"?I(t):L(t,e)}}var Z=t=>t.alpha===void 0?t.hex:`${t.hex} ${Math.round(t.alpha*100)}%`;async function At(t,e,o=dt){let r=t.input==="-",n=r?await o():await mt(t.input),s=r?"the text from stdin":k(t.input),{colours:u,bad:a}=Q(n);if(a.length>0)throw T(s,a);if(u.length===0)throw J(s);if(t.svg){let i=t.title??(r?"Colours":lt(t.input).replace(/\..*$/,"")||"Colours"),c=u.length,p=u.map(l=>({id:l.name,name:l.name,value:Z(l),hex:l.hex,...l.alpha===void 0?{}:{alpha:l.alpha}}));return{exitCode:0,stdout:[V(i,`${c} colour${c===1?"":"s"}`,p,"light",{perRow:8})],stderr:[]}}if(e.json){let i=F(w,{source:r?"-":tt(t.input),colours:u});return{exitCode:0,stdout:[JSON.stringify(i)],stderr:[]}}return{exitCode:0,stdout:u.map(i=>{let c=x(i.hex)?.rgb??{r:0,g:0,b:0};return`${j(c,e.colour)}${Z(i)} ${i.name}`}),stderr:[]}}export{pt as readPalette,At as runCard,It as runPalette,Lt as runScale};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a}from"./chunk-BYUOU2Q2.js";import{P as i}from"./chunk-CCNRNCRU.js";import"./chunk-FGR6QCG5.js";import"./chunk-VLVNA4T3.js";import"./chunk-TMUK2DD3.js";var d=["open","convert","compress","sharpen","open-file","preset"];function m(t){let[e,n,...r]=t,o=n==="open-pdf"?"open-file":n;if(e==="install"||e==="remove"){if(n!==void 0)throw i(`forge menu ${e} takes nothing else, got: ${t.slice(1).join(" ")}.`,`Try: forge menu ${e}`);return{kind:e}}if(e==="run"||e==="open"){if(!d.includes(o))throw i(`No menu action called "${o??""}".`);if(o==="preset"){let[s,...c]=r;if(e!=="run"||s===void 0||!a(s))throw i(`No preset called "${s??""}".`);return{kind:"run",action:o,preset:s,paths:c}}return{kind:e,action:o,paths:r}}throw i(`No menu command called "${e??""}".`)}function u(t,e,n=!1){switch(t){case"convert":return{paths:e,mode:"convert",advance:!0};case"compress":return{paths:e,mode:"compress",advance:!0};case"open-file":return{paths:e,mode:n?"pdf":"convert",advance:!1};default:return{paths:[],mode:"convert",advance:!1}}}async function h(t,e){let[n]=e;return u(t,e,t==="open-file"&&n!==void 0&&await l(n))}async function l(t){let{open:e}=await import("node:fs/promises");try{let n=await e(t,"r");try{let r=Buffer.alloc(1024),{bytesRead:o}=await n.read(r,0,r.length,0);return r.subarray(0,o).includes("%PDF-")}finally{await n.close()}}catch{return!1}}export{u as openedFor,h as openedForClick,m as parseMenuArgs};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a,b}from"./chunk-2OSM4W4D.js";import"./chunk-4MZV4SRU.js";import"./chunk-BYUOU2Q2.js";import"./chunk-NUCGWLOY.js";import"./chunk-I2LPGKUU.js";import"./chunk-HON4OV7M.js";import"./chunk-CCNRNCRU.js";import"./chunk-FGR6QCG5.js";import"./chunk-VLVNA4T3.js";import"./chunk-TMUK2DD3.js";export{a as CONFIG_KEYS,b as runConfig};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a,b,c,d,e}from"./chunk-FXA45V4B.js";import"./chunk-QO4JUY6B.js";import"./chunk-CCNRNCRU.js";import"./chunk-FGR6QCG5.js";import"./chunk-VLVNA4T3.js";import"./chunk-TMUK2DD3.js";export{a as OPS,d as chainLabels,e as reasonsFor,c as stepLabel,b as withStep};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{g as a,h as b,i as c,j as d}from"./chunk-6HUYBVQA.js";import"./chunk-KXKQDFHX.js";import"./chunk-CCNRNCRU.js";import"./chunk-FGR6QCG5.js";import"./chunk-VLVNA4T3.js";import"./chunk-TMUK2DD3.js";export{b as clearDecodedCacheForTests,a as decodedInput,c as idleDecodedCacheForTests,d as limitDecodedCacheForTests};
@@ -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 $,b as R,d as g,e as F,f as m,g as G}from"./chunk-6RCS3KBP.js";import{H as k,a as N,i as I,j as O}from"./chunk-ZX5FDZZW.js";import"./chunk-6RMRWBMB.js";import{c as b}from"./chunk-MF3KKEFB.js";import"./chunk-I25E2XDH.js";import{c as S}from"./chunk-N72E43Z3.js";import{a as T,b as v,c as _,d as A,e as D}from"./chunk-4KGC5ZBZ.js";import{a as P}from"./chunk-HON4OV7M.js";import{f as E}from"./chunk-V6GWPR2A.js";import{a as y}from"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";import{spawn as ee}from"node:child_process";import{homedir as Te}from"node:os";import{join as M,resolve as ve}from"node:path";import{appendFileSync as te,mkdirSync as C,readFileSync as ne,renameSync as re,rmSync as x,statSync as L}from"node:fs";import{join as j}from"node:path";var ie={quiet:500,cap:3e3,poll:50},oe=15e3,X=e=>new Promise(n=>setTimeout(n,e));async function H(e,n,t,r=ie){C(e,{recursive:!0});let i=j(e,`${n}.spool`),o=j(e,`${n}.lock`),s=p=>{try{return ne(p,"utf8").split(`
3
+ import{a as T,b as v,c as _,d as A,e as D}from"./chunk-NLM2SP3F.js";import{a as $,b as R,d as g,e as F,f as m,g as G}from"./chunk-2JU3YZQU.js";import{H as k,a as N,i as I,j as O}from"./chunk-PA7AG2NK.js";import"./chunk-6RMRWBMB.js";import{c as b}from"./chunk-MF3KKEFB.js";import"./chunk-I25E2XDH.js";import{c as S}from"./chunk-N72E43Z3.js";import{f as E}from"./chunk-UN5DSJE2.js";import"./chunk-I2LPGKUU.js";import{a as P}from"./chunk-HON4OV7M.js";import{f as y}from"./chunk-CCNRNCRU.js";import"./chunk-FGR6QCG5.js";import"./chunk-VLVNA4T3.js";import"./chunk-TMUK2DD3.js";import{spawn as ee}from"node:child_process";import{homedir as Te}from"node:os";import{join as M,resolve as ve}from"node:path";import{appendFileSync as te,mkdirSync as C,readFileSync as ne,renameSync as re,rmSync as x,statSync as L}from"node:fs";import{join as j}from"node:path";var ie={quiet:500,cap:3e3,poll:50},oe=15e3,X=e=>new Promise(n=>setTimeout(n,e));async function H(e,n,t,r=ie){C(e,{recursive:!0});let i=j(e,`${n}.spool`),o=j(e,`${n}.lock`),s=p=>{try{return ne(p,"utf8").split(`
4
4
  `).filter(Boolean)}catch{return[]}},u=()=>{try{return L(i).size}catch{return 0}};for(te(i,`${t}
5
- `);;){try{C(o)}catch{try{Date.now()-L(o).mtimeMs>oe&&x(o,{recursive:!0,force:!0})}catch{}if(await X(r.poll),!s(i).includes(t))return null;continue}try{let p=Date.now(),l=u(),c=Date.now();for(;Date.now()-c<r.quiet&&Date.now()-p<r.cap;){await X(r.poll);let d=u();d!==l&&(l=d,c=Date.now())}let a=`${i}.${process.pid}.${Date.now()}`;try{re(i,a)}catch{return[t]}let f=[...new Set(s(a))];return x(a,{force:!0}),f}finally{x(o,{recursive:!0,force:!0})}}}import{realpathSync as se}from"node:fs";import{delimiter as ae,join as ue}from"node:path";function U(e,n,t=process.platform){let r=s=>{try{return se(s)}catch{return}},i=r(e)??e,o=t==="win32"?"node.exe":"node";for(let s of(n??"").split(ae)){if(s==="")continue;let u=ue(s,o);if(u!==e&&r(u)===i)return u}return e}import{basename as w,dirname as ce,extname as le,join as fe}from"node:path";var q={"gnome-terminal":["--"],konsole:["-e"],"xfce4-terminal":["-x"],kitty:[],alacritty:["-e"],wezterm:["start","--"],ghostty:["-e"],xterm:["-e"],"x-terminal-emulator":["-e"],"xdg-terminal-exec":[]},pe=["xdg-terminal-exec","x-terminal-emulator","gnome-terminal","konsole","xfce4-terminal","kitty","alacritty","wezterm","ghostty","xterm"];function B(e,n,t){let i=[...e!==void 0&&e in q?[e]:[],...pe].find(t);return i===void 0?void 0:[i,[...q[i]??[],...n]]}function me(e,n,t){if(t==="linux")return B(e,n,()=>!0)??["xterm",["-e",...n]];if(t==="win32")return e==="wt"?["wt.exe",["-w","new",...n]]:["conhost.exe",n];if(e==="ghostty")return["/usr/bin/open",["-na","Ghostty","--args","-e",...n]];let r=`exec ${n.map(N).join(" ")}`;return["/usr/bin/osascript",[...["on run argv",...e==="iTerm.app"?['tell application "iTerm"',"create window with default profile","tell current session of current window to write text (item 1 of argv)","activate","end tell"]:['if application "Terminal" is running then','tell application "Terminal" to do script (item 1 of argv)',"else",'tell application "Terminal" to do script (item 1 of argv) in window 1',"end if",'tell application "Terminal" to activate'],"end run"].flatMap(o=>["-e",o]),r]]}function W(e){let n=w(e,le(e));return E(fe(ce(e),`${n}-sharp.png`))}function de(e){let n=e.flatMap(o=>"output"in o?[o.output]:[]),t=e.flatMap(o=>"error"in o?[o]:[]),[r]=t;if(r===void 0)return{title:n.length===1?w(n[0]):`${n.length} files`,body:"Sharpened"};let i=r.input?w(r.input):"file";return e.length===1?{title:`${i} not sharpened`,body:r.error}:{title:`${n.length} of ${e.length} files sharpened`,body:`${i}: ${r.error}`}}function ge(e,n){let t=n.flatMap(s=>"output"in s?[s]:[]),r=n.flatMap(s=>"error"in s?[s]:[]),[i]=r;if(i===void 0){let s=t[0]?.chain??[];return{title:t.length===1?w(t[0]?.output??""):`${t.length} files`,body:[e,...s.length>0?[s.join(" \u2500\u25B8 ")]:[]].join(" \xB7 ")}}let o=i.input?w(i.input):"file";return n.length===1?{title:`${e} didn\u2019t finish`,body:`${o}: ${i.error}`}:{title:`${e} finished ${t.length} of ${n.length} files`,body:`${o}: ${i.error}`}}async function z(e,n,t,r){if(e==="preset"){if(r===void 0||t.runPreset===void 0)return;let u=[];for(let a of n){let f=await t.runPreset(r,a);u.push("error"in f?{input:a,...f}:f)}let{title:p,body:l}=ge(r,u);await t.notify(p,l);let c=u.flatMap(a=>"output"in a?[a.output]:[]).at(-1);c!==void 0&&await t.reveal(c);return}if(e==="sharpen"){let u=[];for(let f of n){let d=await t.sharpen(f);u.push("error"in d?{input:f,...d}:d)}let{title:p,body:l}=de(u);await t.notify(p,l);let a=u.flatMap(f=>"output"in f?[f.output]:[]).at(-1);a!==void 0&&await t.reveal(a);return}let i=e==="open"?[]:n,o=[...t.self,"menu","open",e,...i],s=t.platform==="linux"?B(t.terminal,o,t.has??(()=>!0)):me(t.terminal,o,t.platform);if(s===void 0)return t.notify(he,we);await t.launch(...s)}var he="Forge could not open",we="No terminal was found to open it in.";import{mkdirSync as ye,readFileSync as Me,writeFileSync as Pe}from"node:fs";import{join as Re}from"node:path";async function J(e,n){if(!n.global||!F(e.platform))return;let t=R(e);if(n.enabled===!1){t!==void 0&&await m(e);return}if(!(t!==void 0&&$(t,e))&&(await g(e),t===void 0))return e.platform==="darwin"?"Added Forge to Finder\u2019s Quick Actions":"Added Forge to the right-click menu"}async function K(e){let n=R(e);if(n===void 0)return;let{xdgConfigHome:t,...r}=e;await g({...r,...n,presets:e.presets??[]})}var V=e=>Re(e.menuDir,"terminal"),xe=new Set(["Apple_Terminal","iTerm.app","ghostty"]),Ee={WezTerm:"wezterm",ghostty:"ghostty",kitty:"kitty"};function be(e){if(e.TERM_PROGRAM)return Ee[e.TERM_PROGRAM];if(!e.TMUX){if(e.KITTY_WINDOW_ID)return"kitty";if(e.ALACRITTY_WINDOW_ID||e.ALACRITTY_SOCKET)return"alacritty";if(e.KONSOLE_VERSION)return"konsole";if(e.GNOME_TERMINAL_SCREEN||e.GNOME_TERMINAL_SERVICE)return"gnome-terminal";if(e.XTERM_VERSION)return"xterm"}}function Y(e,n){let t=e.platform==="win32"?n.WT_SESSION?"wt":"console":e.platform==="linux"?be(n):xe.has(n.TERM_PROGRAM??"")?n.TERM_PROGRAM:void 0;if(t)try{ye(e.menuDir,{recursive:!0}),Pe(V(e),t)}catch{}}function Q(e){try{return Me(V(e),"utf8").trim()||void 0}catch{return}}import{rmSync as Se}from"node:fs";async function Z(e,n){await m(e),n.out("\u2713 Removed Forge from the right-click menu");let{code:t,output:r}=await n.npm(["uninstall","--global","forge-terminal"]);return t!==0?(n.out(`\u2715 npm could not uninstall forge-terminal: ${D(r)}`),1):(n.out("\u2713 Uninstalled forge-terminal"),Se(n.forgeDir,{recursive:!0,force:!0}),n.out("\u2713 Deleted Forge\u2019s settings"),0)}var _e=()=>M(P(),"forge","menu");async function Ae(){try{let{loadPreferences:e}=await import("./preferences-3P4V2EDX.js"),{prefs:n}=await e();return(n.presets??[]).filter(t=>t.quickAction).map(t=>t.name)}catch{return[]}}async function h(e){return{platform:process.platform,home:Te(),menuDir:_e(),node:U(process.execPath,process.env.PATH),execArgv:process.execArgv,forge:v(process.argv[1])??"",...process.env.XDG_CONFIG_HOME?{xdgConfigHome:process.env.XDG_CONFIG_HOME}:{},...process.env.XDG_DATA_HOME?{xdgDataHome:process.env.XDG_DATA_HOME}:{},...process.env.XDG_CONFIG_DIRS?{xdgConfigDirs:process.env.XDG_CONFIG_DIRS}:{},...process.env.PATH?{path:process.env.PATH}:{},version:e,sharpen:await b("boost")!==void 0,presets:await Ae(),run:G}}async function mt(e){if(process.env.FORGE_NO_MENU)return;let n=await h(e);Y(n,process.env);let{loadPreferences:t}=await import("./preferences-3P4V2EDX.js"),{prefs:r}=await t();return J(n,{global:T(n.forge,n.platform),enabled:r.rightClickMenu!==!1})}async function dt(){let{isInstalled:e}=await import("./install-KGFOAQCU.js");return e(await h(""))}async function gt(e){let{VERSION:n}=await import("./theme-P3ZE2ZYB.js"),{savePreferences:t}=await import("./preferences-3P4V2EDX.js"),r=await h(n);e?await g(r):await m(r),await t({rightClickMenu:e})}async function ht(){if(!process.env.FORGE_NO_MENU)try{await K(await h(""))}catch{}}async function De(e){let{parseArgs:n}=await import("./args-ZVZQR23M.js"),{runIntent:t}=await import("./execute-7M6WA4W7.js"),r=n([e,"--sharpen","--output",W(e)]),i=await t(r),o=i.results[0]?.job.outputs[0];if(o!==void 0)return{output:o};let s=i.failures[0]?.error;return{error:y(s)?s.detail:"It could not be sharpened."}}async function Ne(e,n){let{runPresetCommand:t}=await import("./preset-command-UNMXHW5A.js"),{loadPreferences:r}=await import("./preferences-3P4V2EDX.js"),{chainLabels:i}=await import("./continue-editing-M6WESEVB.js");try{let o=await t({kind:"preset",inputs:[n],name:e,force:!1,recursive:!1,debug:!1,keepBoth:!0}),s=o.results[0],u=s?.job.outputs[0];if(s!==void 0&&u!==void 0){let{prefs:l}=await r(),c=l.presets?.find(f=>f.name===e)?.steps,a=s.job.sources[0]?.format;return{output:u,chain:c&&a?i(a,c):[]}}let p=o.failures[0]?.error;return{error:y(p)?p.detail:"It could not be made."}}catch(o){return{error:y(o)?o.detail:"It could not be made."}}}var Ie=(e,n)=>new Promise(t=>{let r=ee(e,n,{detached:!0,stdio:"ignore"});r.on("error",()=>t()),r.unref(),t()});async function wt(e,n){let t=await h(n);if(e.kind==="install")return await g(t),0;if(e.kind==="remove")return await m(t),0;if(e.kind!=="run")return 2;let r=e.paths.map(i=>ve(i));if(t.platform==="win32"&&r.length===1){let i=e.preset===void 0?e.action:`preset-${e.preset}`,o=await H(M(t.menuDir,"spool"),i,r[0]);if(o===null)return 0;r=o}return await z(e.action,r,{platform:t.platform,self:[t.node,...t.execArgv,t.forge],terminal:Q(t),launch:Ie,sharpen:De,runPreset:Ne,notify:(i,o)=>k(i,o,t.platform,{icon:M(t.menuDir,O({paint:"forge"}))}),has:i=>I(i,t.path),reveal:async i=>{await S(i,t.platform)}},e.preset),0}async function yt(e,n){let t=await h(e),r=i=>new Promise(o=>{let s=t.platform==="win32"?A(t.node):void 0,[u,p]=s!==void 0?[t.node,[s,...i]]:[_(t.node),i],l="",c=ee(u,p,{stdio:["ignore","pipe","pipe"]});c.stdout.setEncoding("utf8").on("data",a=>{l+=a}),c.stderr.setEncoding("utf8").on("data",a=>{l+=a}),c.on("error",a=>o({code:null,output:`${l}
5
+ `);;){try{C(o)}catch{try{Date.now()-L(o).mtimeMs>oe&&x(o,{recursive:!0,force:!0})}catch{}if(await X(r.poll),!s(i).includes(t))return null;continue}try{let p=Date.now(),l=u(),c=Date.now();for(;Date.now()-c<r.quiet&&Date.now()-p<r.cap;){await X(r.poll);let d=u();d!==l&&(l=d,c=Date.now())}let a=`${i}.${process.pid}.${Date.now()}`;try{re(i,a)}catch{return[t]}let f=[...new Set(s(a))];return x(a,{force:!0}),f}finally{x(o,{recursive:!0,force:!0})}}}import{realpathSync as se}from"node:fs";import{delimiter as ae,join as ue}from"node:path";function U(e,n,t=process.platform){let r=s=>{try{return se(s)}catch{return}},i=r(e)??e,o=t==="win32"?"node.exe":"node";for(let s of(n??"").split(ae)){if(s==="")continue;let u=ue(s,o);if(u!==e&&r(u)===i)return u}return e}import{basename as w,dirname as ce,extname as le,join as fe}from"node:path";var q={"gnome-terminal":["--"],konsole:["-e"],"xfce4-terminal":["-x"],kitty:[],alacritty:["-e"],wezterm:["start","--"],ghostty:["-e"],xterm:["-e"],"x-terminal-emulator":["-e"],"xdg-terminal-exec":[]},pe=["xdg-terminal-exec","x-terminal-emulator","gnome-terminal","konsole","xfce4-terminal","kitty","alacritty","wezterm","ghostty","xterm"];function B(e,n,t){let i=[...e!==void 0&&e in q?[e]:[],...pe].find(t);return i===void 0?void 0:[i,[...q[i]??[],...n]]}function me(e,n,t){if(t==="linux")return B(e,n,()=>!0)??["xterm",["-e",...n]];if(t==="win32")return e==="wt"?["wt.exe",["-w","new",...n]]:["conhost.exe",n];if(e==="ghostty")return["/usr/bin/open",["-na","Ghostty","--args","-e",...n]];let r=`exec ${n.map(N).join(" ")}`;return["/usr/bin/osascript",[...["on run argv",...e==="iTerm.app"?['tell application "iTerm"',"create window with default profile","tell current session of current window to write text (item 1 of argv)","activate","end tell"]:['if application "Terminal" is running then','tell application "Terminal" to do script (item 1 of argv)',"else",'tell application "Terminal" to do script (item 1 of argv) in window 1',"end if",'tell application "Terminal" to activate'],"end run"].flatMap(o=>["-e",o]),r]]}function W(e){let n=w(e,le(e));return E(fe(ce(e),`${n}-sharp.png`))}function de(e){let n=e.flatMap(o=>"output"in o?[o.output]:[]),t=e.flatMap(o=>"error"in o?[o]:[]),[r]=t;if(r===void 0)return{title:n.length===1?w(n[0]):`${n.length} files`,body:"Sharpened"};let i=r.input?w(r.input):"file";return e.length===1?{title:`${i} not sharpened`,body:r.error}:{title:`${n.length} of ${e.length} files sharpened`,body:`${i}: ${r.error}`}}function ge(e,n){let t=n.flatMap(s=>"output"in s?[s]:[]),r=n.flatMap(s=>"error"in s?[s]:[]),[i]=r;if(i===void 0){let s=t[0]?.chain??[];return{title:t.length===1?w(t[0]?.output??""):`${t.length} files`,body:[e,...s.length>0?[s.join(" \u2500\u25B8 ")]:[]].join(" \xB7 ")}}let o=i.input?w(i.input):"file";return n.length===1?{title:`${e} didn\u2019t finish`,body:`${o}: ${i.error}`}:{title:`${e} finished ${t.length} of ${n.length} files`,body:`${o}: ${i.error}`}}async function z(e,n,t,r){if(e==="preset"){if(r===void 0||t.runPreset===void 0)return;let u=[];for(let a of n){let f=await t.runPreset(r,a);u.push("error"in f?{input:a,...f}:f)}let{title:p,body:l}=ge(r,u);await t.notify(p,l);let c=u.flatMap(a=>"output"in a?[a.output]:[]).at(-1);c!==void 0&&await t.reveal(c);return}if(e==="sharpen"){let u=[];for(let f of n){let d=await t.sharpen(f);u.push("error"in d?{input:f,...d}:d)}let{title:p,body:l}=de(u);await t.notify(p,l);let a=u.flatMap(f=>"output"in f?[f.output]:[]).at(-1);a!==void 0&&await t.reveal(a);return}let i=e==="open"?[]:n,o=[...t.self,"menu","open",e,...i],s=t.platform==="linux"?B(t.terminal,o,t.has??(()=>!0)):me(t.terminal,o,t.platform);if(s===void 0)return t.notify(he,we);await t.launch(...s)}var he="Forge could not open",we="No terminal was found to open it in.";import{mkdirSync as ye,readFileSync as Me,writeFileSync as Pe}from"node:fs";import{join as Re}from"node:path";async function J(e,n){if(!n.global||!F(e.platform))return;let t=R(e);if(n.enabled===!1){t!==void 0&&await m(e);return}if(!(t!==void 0&&$(t,e))&&(await g(e),t===void 0))return e.platform==="darwin"?"Added Forge to Finder\u2019s Quick Actions":"Added Forge to the right-click menu"}async function K(e){let n=R(e);if(n===void 0)return;let{xdgConfigHome:t,...r}=e;await g({...r,...n,presets:e.presets??[]})}var V=e=>Re(e.menuDir,"terminal"),xe=new Set(["Apple_Terminal","iTerm.app","ghostty"]),Ee={WezTerm:"wezterm",ghostty:"ghostty",kitty:"kitty"};function be(e){if(e.TERM_PROGRAM)return Ee[e.TERM_PROGRAM];if(!e.TMUX){if(e.KITTY_WINDOW_ID)return"kitty";if(e.ALACRITTY_WINDOW_ID||e.ALACRITTY_SOCKET)return"alacritty";if(e.KONSOLE_VERSION)return"konsole";if(e.GNOME_TERMINAL_SCREEN||e.GNOME_TERMINAL_SERVICE)return"gnome-terminal";if(e.XTERM_VERSION)return"xterm"}}function Y(e,n){let t=e.platform==="win32"?n.WT_SESSION?"wt":"console":e.platform==="linux"?be(n):xe.has(n.TERM_PROGRAM??"")?n.TERM_PROGRAM:void 0;if(t)try{ye(e.menuDir,{recursive:!0}),Pe(V(e),t)}catch{}}function Q(e){try{return Me(V(e),"utf8").trim()||void 0}catch{return}}import{rmSync as Se}from"node:fs";async function Z(e,n){await m(e),n.out("\u2713 Removed Forge from the right-click menu");let{code:t,output:r}=await n.npm(["uninstall","--global","forge-terminal"]);return t!==0?(n.out(`\u2715 npm could not uninstall forge-terminal: ${D(r)}`),1):(n.out("\u2713 Uninstalled forge-terminal"),Se(n.forgeDir,{recursive:!0,force:!0}),n.out("\u2713 Deleted Forge\u2019s settings"),0)}var _e=()=>M(P(),"forge","menu");async function Ae(){try{let{loadPreferences:e}=await import("./preferences-E2CH2YSG.js"),{prefs:n}=await e();return(n.presets??[]).filter(t=>t.quickAction).map(t=>t.name)}catch{return[]}}async function h(e){return{platform:process.platform,home:Te(),menuDir:_e(),node:U(process.execPath,process.env.PATH),execArgv:process.execArgv,forge:v(process.argv[1])??"",...process.env.XDG_CONFIG_HOME?{xdgConfigHome:process.env.XDG_CONFIG_HOME}:{},...process.env.XDG_DATA_HOME?{xdgDataHome:process.env.XDG_DATA_HOME}:{},...process.env.XDG_CONFIG_DIRS?{xdgConfigDirs:process.env.XDG_CONFIG_DIRS}:{},...process.env.PATH?{path:process.env.PATH}:{},version:e,sharpen:await b("boost")!==void 0,presets:await Ae(),run:G}}async function mt(e){if(process.env.FORGE_NO_MENU)return;let n=await h(e);Y(n,process.env);let{loadPreferences:t}=await import("./preferences-E2CH2YSG.js"),{prefs:r}=await t();return J(n,{global:T(n.forge,n.platform),enabled:r.rightClickMenu!==!1})}async function dt(){let{isInstalled:e}=await import("./install-X7EEH5CQ.js");return e(await h(""))}async function gt(e){let{VERSION:n}=await import("./theme-4Y66DDAO.js"),{savePreferences:t}=await import("./preferences-E2CH2YSG.js"),r=await h(n);e?await g(r):await m(r),await t({rightClickMenu:e})}async function ht(){if(!process.env.FORGE_NO_MENU)try{await K(await h(""))}catch{}}async function De(e){let{parseArgs:n}=await import("./args-PS5SVBZY.js"),{runIntent:t}=await import("./execute-TC3QZ6GL.js"),r=n([e,"--sharpen","--output",W(e)]),i=await t(r),o=i.results[0]?.job.outputs[0];if(o!==void 0)return{output:o};let s=i.failures[0]?.error;return{error:y(s)?s.detail:"It could not be sharpened."}}async function Ne(e,n){let{runPresetCommand:t}=await import("./preset-command-5I3NZ2OP.js"),{loadPreferences:r}=await import("./preferences-E2CH2YSG.js"),{chainLabels:i}=await import("./continue-editing-LTMIEFRD.js");try{let o=await t({kind:"preset",inputs:[n],name:e,force:!1,recursive:!1,debug:!1,keepBoth:!0}),s=o.results[0],u=s?.job.outputs[0];if(s!==void 0&&u!==void 0){let{prefs:l}=await r(),c=l.presets?.find(f=>f.name===e)?.steps,a=s.job.sources[0]?.format;return{output:u,chain:c&&a?i(a,c):[]}}let p=o.failures[0]?.error;return{error:y(p)?p.detail:"It could not be made."}}catch(o){return{error:y(o)?o.detail:"It could not be made."}}}var Ie=(e,n)=>new Promise(t=>{let r=ee(e,n,{detached:!0,stdio:"ignore"});r.on("error",()=>t()),r.unref(),t()});async function wt(e,n){let t=await h(n);if(e.kind==="install")return await g(t),0;if(e.kind==="remove")return await m(t),0;if(e.kind!=="run")return 2;let r=e.paths.map(i=>ve(i));if(t.platform==="win32"&&r.length===1){let i=e.preset===void 0?e.action:`preset-${e.preset}`,o=await H(M(t.menuDir,"spool"),i,r[0]);if(o===null)return 0;r=o}return await z(e.action,r,{platform:t.platform,self:[t.node,...t.execArgv,t.forge],terminal:Q(t),launch:Ie,sharpen:De,runPreset:Ne,notify:(i,o)=>k(i,o,t.platform,{icon:M(t.menuDir,O({paint:"forge"}))}),has:i=>I(i,t.path),reveal:async i=>{await S(i,t.platform)}},e.preset),0}async function yt(e,n){let t=await h(e),r=i=>new Promise(o=>{let s=t.platform==="win32"?A(t.node):void 0,[u,p]=s!==void 0?[t.node,[s,...i]]:[_(t.node),i],l="",c=ee(u,p,{stdio:["ignore","pipe","pipe"]});c.stdout.setEncoding("utf8").on("data",a=>{l+=a}),c.stderr.setEncoding("utf8").on("data",a=>{l+=a}),c.on("error",a=>o({code:null,output:`${l}
6
6
  ${a.message}`})),c.on("close",a=>o({code:a,output:l}))});return Z(t,{forgeDir:M(P(),"forge"),npm:r,out:n})}export{mt as menuAtStart,dt as menuIsOn,h as realMenuEnv,ht as resyncMenu,wt as runMenuCommand,yt as runUninstall,gt as switchMenu};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{c as a,d as b,e as c,f as d}from"./chunk-X2YUHPOU.js";import"./chunk-EJWTYDBJ.js";import"./chunk-UI4EUC3S.js";import"./chunk-2L66A2X6.js";import"./chunk-6RMRWBMB.js";import"./chunk-X4QI2EYV.js";import"./chunk-QIMSNTKL.js";import"./chunk-ECA4PW5T.js";import"./chunk-QPUKPSPZ.js";import"./chunk-PISCJKIG.js";import"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import"./chunk-WID72ZII.js";import"./chunk-O7DK3GJT.js";import"./chunk-65Y7YCZZ.js";import"./chunk-NMGQGYVM.js";import"./chunk-EEQSUBBL.js";import"./chunk-BSFBZBAI.js";import"./chunk-BWJNZT75.js";import"./chunk-3IX3QA76.js";import"./chunk-PON65UTS.js";import"./chunk-FWVE3GNA.js";import"./chunk-QO4JUY6B.js";import"./chunk-UN5DSJE2.js";import"./chunk-6HUYBVQA.js";import"./chunk-KXKQDFHX.js";import"./chunk-4MZV4SRU.js";import"./chunk-BYUOU2Q2.js";import"./chunk-NUCGWLOY.js";import"./chunk-I2LPGKUU.js";import"./chunk-HON4OV7M.js";import"./chunk-CCNRNCRU.js";import"./chunk-FGR6QCG5.js";import"./chunk-VLVNA4T3.js";import"./chunk-TMUK2DD3.js";export{d as execute,a as exitCodeFor,c as renderRun,b as runIntent};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{Tb as a,Ub as b,Vb as c,Wb as d,Xb as e}from"./chunk-JD3RB6IV.js";import"./chunk-2L66A2X6.js";import"./chunk-POM7FXIV.js";import"./chunk-5FJT4BNY.js";import"./chunk-I25E2XDH.js";import"./chunk-IBPGC4N2.js";import"./chunk-EYOO35US.js";import"./chunk-WID72ZII.js";import"./chunk-EEQSUBBL.js";import"./chunk-4MZV4SRU.js";import"./chunk-BYUOU2Q2.js";import"./chunk-NUCGWLOY.js";import"./chunk-I2LPGKUU.js";import"./chunk-HON4OV7M.js";import"./chunk-CCNRNCRU.js";import"./chunk-FGR6QCG5.js";import"./chunk-VLVNA4T3.js";import"./chunk-TMUK2DD3.js";export{e as ExtensionsFlow,c as byteCount,b as extensionCredits,d as extensionsChip,a as realManager};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{f as d}from"./chunk-I25E2XDH.js";import{a as c}from"./chunk-J7FLFHQJ.js";import"./chunk-TMUK2DD3.js";function y(e){let t=Object.entries(e.assets).find(([n])=>n.startsWith(`${process.platform}-`));return d(e)?.version??t?.[1]?.version??""}function x(e){return{id:e.entry.id,title:e.entry.title,summary:e.entry.summary,version:y(e.entry),licence:e.entry.licence,installed:e.installed??null,updateAvailable:e.updateAvailable,supported:e.supported,...e.reason!==void 0?{reason:e.reason}:{},...e.downloadBytes!==void 0?{downloadBytes:e.downloadBytes}:{}}}function E(e){return e.supported?e.installed===void 0?`not installed${e.downloadBytes?`, ${c(e.downloadBytes)} download`:""}`:e.updateAvailable?`installed ${e.installed}, update to ${d(e.entry)?.version} available`:`installed ${e.installed}`:`not available: ${e.reason??"unsupported here"}`}function v(e){let t=Math.max(...e.map(n=>n.entry.id.length));return e.flatMap((n,a)=>[...a>0?[""]:[],`${n.entry.id.padEnd(t)} ${n.entry.summary}`,`${" ".repeat(t)} ${E(n)}`,`${" ".repeat(t)} ${n.entry.licence}`])}async function w(e,t={}){let{installExtension:n,listExtensions:a,removeExtension:p}=await import("./manager-L753MI7U.js"),i,s;if(e.action==="add"&&e.id!==void 0){let o=(await a()).find(f=>f.entry.id===e.id),l=o?.installed!==void 0&&!o.updateAvailable,u=await n(e.id,{onProgress:t.onDownload});i={id:e.id,action:l?"unchanged":"added"},s=l?`${e.id} ${u.version} is already installed`:`Installed ${e.id} ${u.version}`}else if(e.action==="remove"&&e.id!==void 0){let o=await p(e.id);i={id:e.id,action:o?"removed":"unchanged"},s=o?`Removed ${e.id}`:`${e.id} was not installed`}let{hideUnneeded:m}=await import("./needed-DYERJ72M.js"),r=await m(await a());return{stdout:s===void 0?v(r):[s],data:{extensions:r.map(x),...i?{changed:i}:{}}}}export{w as runExtensions,x as toExtensionJson};
3
+ import{f as d}from"./chunk-I25E2XDH.js";import{a as c}from"./chunk-FGR6QCG5.js";import"./chunk-TMUK2DD3.js";function y(e){let t=Object.entries(e.assets).find(([n])=>n.startsWith(`${process.platform}-`));return d(e)?.version??t?.[1]?.version??""}function x(e){return{id:e.entry.id,title:e.entry.title,summary:e.entry.summary,version:y(e.entry),licence:e.entry.licence,installed:e.installed??null,updateAvailable:e.updateAvailable,supported:e.supported,...e.reason!==void 0?{reason:e.reason}:{},...e.downloadBytes!==void 0?{downloadBytes:e.downloadBytes}:{}}}function E(e){return e.supported?e.installed===void 0?`not installed${e.downloadBytes?`, ${c(e.downloadBytes)} download`:""}`:e.updateAvailable?`installed ${e.installed}, update to ${d(e.entry)?.version} available`:`installed ${e.installed}`:`not available: ${e.reason??"unsupported here"}`}function v(e){let t=Math.max(...e.map(n=>n.entry.id.length));return e.flatMap((n,a)=>[...a>0?[""]:[],`${n.entry.id.padEnd(t)} ${n.entry.summary}`,`${" ".repeat(t)} ${E(n)}`,`${" ".repeat(t)} ${n.entry.licence}`])}async function w(e,t={}){let{installExtension:n,listExtensions:a,removeExtension:p}=await import("./manager-272REVNF.js"),i,s;if(e.action==="add"&&e.id!==void 0){let o=(await a()).find(f=>f.entry.id===e.id),l=o?.installed!==void 0&&!o.updateAvailable,u=await n(e.id,{onProgress:t.onDownload});i={id:e.id,action:l?"unchanged":"added"},s=l?`${e.id} ${u.version} is already installed`:`Installed ${e.id} ${u.version}`}else if(e.action==="remove"&&e.id!==void 0){let o=await p(e.id);i={id:e.id,action:o?"removed":"unchanged"},s=o?`Removed ${e.id}`:`${e.id} was not installed`}let{hideUnneeded:m}=await import("./needed-7IUPDEJB.js"),r=await m(await a());return{stdout:s===void 0?v(r):[s],data:{extensions:r.map(x),...i?{changed:i}:{}}}}export{w as runExtensions,x as toExtensionJson};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-BWJNZT75.js";import"./chunk-PON65UTS.js";import"./chunk-TMUK2DD3.js";export{a as ffmpegCandidates,c as findFfmpeg,e as forceFfmpegForTests,j as frameAt,g as keyframeAtOrBefore,d as knownFfmpeg,f as probeMedia,h as readKeyframes,b as readNames,k as readProgress,l as runFfmpeg,i as soundLevels};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h}from"./chunk-FWVE3GNA.js";import"./chunk-QO4JUY6B.js";import"./chunk-UN5DSJE2.js";import"./chunk-6HUYBVQA.js";import"./chunk-KXKQDFHX.js";import"./chunk-CCNRNCRU.js";import"./chunk-FGR6QCG5.js";import"./chunk-VLVNA4T3.js";import"./chunk-TMUK2DD3.js";export{c as decodeToPng,a as encode,d as encodeToBuffer,g as guessCrop,h as imageEngine,f as loadCropView,e as measureImage,b as writeAtomic};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a,b,c,d,e,f}from"./chunk-NLM2SP3F.js";import"./chunk-CCNRNCRU.js";import"./chunk-FGR6QCG5.js";import"./chunk-VLVNA4T3.js";import"./chunk-TMUK2DD3.js";export{f as installUpdate,a as installedGlobally,e as lastWords,c as npmBeside,d as npmCliBeside,b as runningScript};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{a,b,c,d,e,f,g}from"./chunk-6RCS3KBP.js";import"./chunk-ZX5FDZZW.js";import"./chunk-6RMRWBMB.js";import"./chunk-V6GWPR2A.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{e as hasMenu,d as installMenu,c as isInstalled,b as readState,f as removeMenu,g as runProgram,a as stateMatches};
3
+ import{a,b,c,d,e,f,g}from"./chunk-2JU3YZQU.js";import"./chunk-PA7AG2NK.js";import"./chunk-6RMRWBMB.js";import"./chunk-UN5DSJE2.js";import"./chunk-I2LPGKUU.js";import"./chunk-CCNRNCRU.js";import"./chunk-FGR6QCG5.js";import"./chunk-VLVNA4T3.js";import"./chunk-TMUK2DD3.js";export{e as hasMenu,d as installMenu,c as isInstalled,b as readState,f as removeMenu,g as runProgram,a as stateMatches};