forge-terminal 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -4
- package/dist/chunks/{about-credits-6D6B2JTS.js → about-credits-GRSA5RLZ.js} +1 -1
- package/dist/chunks/args-VJZHLGIY.js +3 -0
- package/dist/chunks/{available-HYL2YE56.js → available-GYIHVSRX.js} +1 -1
- package/dist/chunks/boot-HVIAAJMY.js +3 -0
- package/dist/chunks/{catalog-U7IF2BH2.js → catalog-YSMT3PXT.js} +1 -1
- package/dist/chunks/{check-INHBJOBB.js → check-KAR72Y4X.js} +1 -1
- package/dist/chunks/chunk-3UEQ2OX6.js +3 -0
- package/dist/chunks/{chunk-SS7HNRZ5.js → chunk-5B5XXH22.js} +1 -1
- package/dist/chunks/chunk-5IS7O673.js +6 -0
- package/dist/chunks/chunk-6FUVEO3A.js +78 -0
- package/dist/chunks/chunk-6L6C3GJU.js +3 -0
- package/dist/chunks/{chunk-5GJK5LP5.js → chunk-AAXBN572.js} +2 -2
- package/dist/chunks/chunk-CKUIRXDS.js +4 -0
- package/dist/chunks/{chunk-6TERL22R.js → chunk-DERIWZAT.js} +1 -1
- package/dist/chunks/chunk-DOWMSJ6R.js +3 -0
- package/dist/chunks/chunk-EEQSUBBL.js +3 -0
- package/dist/chunks/{chunk-MHW4OOQW.js → chunk-EGIKV2GZ.js} +2 -2
- package/dist/chunks/{chunk-C2OZ5ERA.js → chunk-EX7KZBI6.js} +1 -1
- package/dist/chunks/chunk-EXLXSKRH.js +3 -0
- package/dist/chunks/{chunk-BLPVRO4J.js → chunk-FH3R2YYD.js} +1 -1
- package/dist/chunks/{chunk-SVDVVRVP.js → chunk-FHORNIVW.js} +1 -1
- package/dist/chunks/{chunk-CLQHW4EF.js → chunk-GJ2GZHRI.js} +1 -1
- package/dist/chunks/chunk-HZDYZ5RD.js +3 -0
- package/dist/chunks/chunk-I63TO22X.js +3 -0
- package/dist/chunks/{chunk-ILWGG424.js → chunk-IGF6ZFTM.js} +1 -1
- package/dist/chunks/{chunk-Z2LELLNV.js → chunk-IWFVEMDN.js} +1 -1
- package/dist/chunks/{chunk-4LTI6JHW.js → chunk-JFJ3ZJQL.js} +2 -2
- package/dist/chunks/{chunk-OVILZLVA.js → chunk-JSMGNA55.js} +1 -1
- package/dist/chunks/chunk-KAHWYWNT.js +3 -0
- package/dist/chunks/chunk-LDKF7KIZ.js +6 -0
- package/dist/chunks/chunk-LNB5D67B.js +3 -0
- package/dist/chunks/chunk-M66BUNYO.js +3 -0
- package/dist/chunks/chunk-MKVBI37R.js +63 -0
- package/dist/chunks/chunk-QR6QHTC3.js +3 -0
- package/dist/chunks/chunk-SMBK6BTC.js +3 -0
- package/dist/chunks/chunk-TDW6KQH6.js +3 -0
- package/dist/chunks/chunk-TMQDQLY7.js +21 -0
- package/dist/chunks/chunk-VGS5Z5RD.js +66 -0
- package/dist/chunks/chunk-YWKMG5WO.js +3 -0
- package/dist/chunks/{chunk-FKPXXNKX.js → chunk-YYB3TTGT.js} +1 -1
- package/dist/chunks/clip-command-264DPO6I.js +3 -0
- package/dist/chunks/colour-4NH6H4HA.js +3 -0
- package/dist/chunks/command-I5M275ZV.js +3 -0
- package/dist/chunks/config-command-TYNYVUMP.js +3 -0
- package/dist/chunks/entry-26YSXWT4.js +6 -0
- package/dist/chunks/execute-GSC2NMDW.js +3 -0
- package/dist/chunks/extensions-ADGECS5U.js +3 -0
- package/dist/chunks/{extensions-command-AITZYSMM.js → extensions-command-TGOF36YW.js} +1 -1
- package/dist/chunks/ffmpeg-PF3VLTHK.js +3 -0
- package/dist/chunks/image-J4FT4ACZ.js +3 -0
- package/dist/chunks/install-2A5BGKQU.js +3 -0
- package/dist/chunks/install-V62EEK54.js +3 -0
- package/dist/chunks/launch-KBYCYAZR.js +5 -0
- package/dist/chunks/lock-KN7CF4YN.js +3 -0
- package/dist/chunks/manager-J7377NNA.js +4 -0
- package/dist/chunks/{paths-KTXPDCDD.js → paths-5XI5L4KW.js} +1 -1
- package/dist/chunks/pdf-compress-U2E3CNXG.js +3 -0
- package/dist/chunks/{preferences-AUFJSKMJ.js → preferences-4VETUGMN.js} +1 -1
- package/dist/chunks/preset-command-HORY7KZQ.js +3 -0
- package/dist/chunks/{run-4Z6CRNHJ.js → run-6BK4REXK.js} +1 -1
- package/dist/chunks/{server-RM4YA6UL.js → server-OAJFUZDM.js} +6 -6
- package/dist/chunks/{theme-LR72ACFF.js → theme-WGCMV4T4.js} +1 -1
- package/dist/chunks/transcribe-command-YUSBCQEQ.js +3 -0
- package/dist/chunks/{update-command-2SHKIIQD.js → update-command-GMBG7BK6.js} +1 -1
- package/dist/chunks/{update-note-UH2TQPJ6.js → update-note-6YGNGYUB.js} +1 -1
- package/dist/chunks/watch-command-HOG4TM3X.js +3 -0
- package/dist/helpers/forge-transcribe +0 -0
- package/dist/index.js +15 -72
- package/package.json +11 -17
- package/dist/chunks/boot-IQ4NYHEG.js +0 -3
- package/dist/chunks/chunk-26NDEWOQ.js +0 -3
- package/dist/chunks/chunk-2CK4RFPI.js +0 -3
- package/dist/chunks/chunk-3A43GEIR.js +0 -4
- package/dist/chunks/chunk-6V6WEBUI.js +0 -66
- package/dist/chunks/chunk-6VOCIMXQ.js +0 -3
- package/dist/chunks/chunk-7ZI3PFFX.js +0 -3
- package/dist/chunks/chunk-BXJ2HTKI.js +0 -3
- package/dist/chunks/chunk-CBE73ZWA.js +0 -3
- package/dist/chunks/chunk-D6JPP65L.js +0 -3
- package/dist/chunks/chunk-DW2EJIUX.js +0 -3
- package/dist/chunks/chunk-FWMFN36F.js +0 -3
- package/dist/chunks/chunk-HBDVKP3X.js +0 -5
- package/dist/chunks/chunk-HCN4BH2H.js +0 -3
- package/dist/chunks/chunk-IMC5NRDC.js +0 -3
- package/dist/chunks/chunk-JBSYGB3F.js +0 -3
- package/dist/chunks/chunk-PGG2OTK6.js +0 -3
- package/dist/chunks/chunk-XNNTF6FW.js +0 -3
- package/dist/chunks/chunk-ZONIA7SX.js +0 -21
- package/dist/chunks/clip-command-Q6SLD4U4.js +0 -3
- package/dist/chunks/colour-JPG24QYI.js +0 -3
- package/dist/chunks/config-command-R7QOBYF4.js +0 -3
- package/dist/chunks/execute-B7UL5RCU.js +0 -3
- package/dist/chunks/extensions-UR4GS47P.js +0 -3
- package/dist/chunks/image-KWRJIHQQ.js +0 -3
- package/dist/chunks/install-WBAFPZ2Q.js +0 -3
- package/dist/chunks/launch-RM5ZVXSU.js +0 -4
- package/dist/chunks/lock-GOOLFLSO.js +0 -3
- package/dist/chunks/manager-KZJ7WC34.js +0 -4
- package/dist/chunks/pdf-compress-IMRFBLZF.js +0 -3
- package/dist/chunks/preset-command-AXYFLVYA.js +0 -3
- package/dist/chunks/restart-TL76JEPU.js +0 -3
- package/dist/chunks/transcribe-command-6YTLVSMW.js +0 -3
- package/dist/chunks/watch-command-NU7QY6QU.js +0 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{i as Ht}from"./chunk-6VOCIMXQ.js";import{E as Ot,d as Tt,e as gt}from"./chunk-DW2EJIUX.js";import{a as wt}from"./chunk-BXJ2HTKI.js";import{c as et,e as xe}from"./chunk-TMUK2DD3.js";var it=et((zs,Qt)=>{"use strict";var Ut="[^\\\\/]",xr="(?=.)",Kt="[^/]",yt="(?:\\/|$)",Xt="(?:^|\\/)",Rt=`\\.{1,2}${yt}`,Cr="(?!\\.)",$r=`(?!${Xt}${Rt})`,Lr=`(?!\\.{0,1}${yt})`,vr=`(?!${Rt})`,wr="[^.\\/]",Tr=`${Kt}*?`,Or="/",jt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:xr,QMARK:Kt,END_ANCHOR:yt,DOTS_SLASH:Rt,NO_DOT:Cr,NO_DOTS:$r,NO_DOT_SLASH:Lr,NO_DOTS_SLASH:vr,QMARK_NO_DOT:wr,STAR:Tr,START_ANCHOR:Xt,SEP:Or},Hr={...jt,SLASH_LITERAL:"[\\\\/]",QMARK:Ut,STAR:`${Ut}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Ir={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Qt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Ir,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Hr:jt}}});var ut=et(q=>{"use strict";var{REGEX_BACKSLASH:Pr,REGEX_REMOVE_BACKSLASH:kr,REGEX_SPECIAL_CHARS:Dr,REGEX_SPECIAL_CHARS_GLOBAL:Nr}=it();q.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);q.hasRegexChars=t=>Dr.test(t);q.isRegexChar=t=>t.length===1&&q.hasRegexChars(t);q.escapeRegex=t=>t.replace(Nr,"\\$1");q.toPosixSlashes=t=>t.replace(Pr,"/");q.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};q.removeBackslashes=t=>t.replace(kr,r=>r==="\\"?"":r);q.escapeLast=(t,r,e)=>{let s=t.lastIndexOf(r,e);return s===-1?t:t[s-1]==="\\"?q.escapeLast(t,r,s-1):`${t.slice(0,s)}\\${t.slice(s)}`};q.removePrefix=(t,r={})=>{let e=t;return e.startsWith("./")&&(e=e.slice(2),r.prefix="./"),e};q.wrapOutput=(t,r={},e={})=>{let s=e.contains?"":"^",n=e.contains?"":"$",o=`${s}(?:${t})${n}`;return r.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};q.basename=(t,{windows:r}={})=>{let e=t.split(r?/[\\/]/:"/"),s=e[e.length-1];return s===""?e[e.length-2]:s}});var re=et((Zs,ee)=>{"use strict";var zt=ut(),{CHAR_ASTERISK:St,CHAR_AT:Fr,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:Br,CHAR_DOT:_t,CHAR_EXCLAMATION_MARK:Et,CHAR_FORWARD_SLASH:te,CHAR_LEFT_CURLY_BRACE:bt,CHAR_LEFT_PARENTHESES:ft,CHAR_LEFT_SQUARE_BRACKET:Mr,CHAR_PLUS:Gr,CHAR_QUESTION_MARK:Yt,CHAR_RIGHT_CURLY_BRACE:Wr,CHAR_RIGHT_PARENTHESES:Zt,CHAR_RIGHT_SQUARE_BRACKET:qr}=it(),Vt=t=>t===te||t===rt,Jt=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Ur=(t,r)=>{let e=r||{},s=t.length-1,n=e.parts===!0||e.tokens===!0||e.scanToEnd===!0,o=[],i=[],l=[],h=t,d=-1,g=0,A=0,S=!1,x=!1,y=!1,C=!1,H=!1,G=!1,_=!1,B=!1,j=!1,I=!1,w=0,L,R,m={value:"",depth:0,isGlob:!1},u=()=>d>=s,M=()=>h.charCodeAt(d+1),D=()=>(L=R,h.charCodeAt(++d));for(;d<s;){R=D();let $;if(R===rt){_=m.backslashes=!0,R=D(),R===bt&&(G=!0);continue}if(G===!0||R===bt){for(w++;u()!==!0&&(R=D());){if(R===rt){_=m.backslashes=!0,D();continue}if(R===bt){w++;continue}if(G!==!0&&R===_t&&(R=D())===_t){if(S=m.isBrace=!0,y=m.isGlob=!0,I=!0,n===!0)continue;break}if(G!==!0&&R===Br){if(S=m.isBrace=!0,y=m.isGlob=!0,I=!0,n===!0)continue;break}if(R===Wr&&(w--,w===0)){G=!1,S=m.isBrace=!0,I=!0;break}}if(n===!0)continue;break}if(R===te){if(o.push(d),i.push(m),m={value:"",depth:0,isGlob:!1},I===!0)continue;if(L===_t&&d===g+1){g+=2;continue}A=d+1;continue}if(e.noext!==!0&&(R===Gr||R===Fr||R===St||R===Yt||R===Et)===!0&&M()===ft){if(y=m.isGlob=!0,C=m.isExtglob=!0,I=!0,R===Et&&d===g&&(j=!0),n===!0){let U=0;for(;u()!==!0&&(R=D());){if(R===rt){_=m.backslashes=!0,D();continue}if(R===ft){U++;continue}if(R===Zt&&--U===0){I=!0;break}}continue}break}if(R===St){if(L===St&&(H=m.isGlobstar=!0),y=m.isGlob=!0,I=!0,n===!0)continue;break}if(R===Yt){if(y=m.isGlob=!0,I=!0,n===!0)continue;break}if(R===Mr){for(;u()!==!0&&($=D());){if($===rt){_=m.backslashes=!0,D();continue}if($===qr){x=m.isBracket=!0,y=m.isGlob=!0,I=!0;break}}if(n===!0)continue;break}if(e.nonegate!==!0&&R===Et&&d===g){B=m.negated=!0,g++;continue}if(e.noparen!==!0&&R===ft){if(y=m.isGlob=!0,n===!0){let W=1;for(;u()!==!0&&(R=D());){if(R===rt){_=m.backslashes=!0,D();continue}if(R===ft){W++;continue}if(R===Zt&&--W===0){I=!0;break}}continue}break}if(y===!0){if(I=!0,n===!0)continue;break}}e.noext===!0&&(C=!1,y=!1);let P=h,c="",a="";g>0&&(c=h.slice(0,g),h=h.slice(g),A-=g),P&&y===!0&&A>0?(P=h.slice(0,A),a=h.slice(A)):y===!0?(P="",a=h):P=h,P&&P!==""&&P!=="/"&&P!==h&&Vt(P.charCodeAt(P.length-1))&&(P=P.slice(0,-1)),e.unescape===!0&&(a&&(a=zt.removeBackslashes(a)),P&&_===!0&&(P=zt.removeBackslashes(P)));let X={prefix:c,input:t,start:g,base:P,glob:a,isBrace:S,isBracket:x,isGlob:y,isExtglob:C,isGlobstar:H,negated:B,negatedExtglob:j};if(e.tokens===!0&&(X.maxDepth=0,Vt(R)||i.push(m),X.tokens=i),e.parts===!0||e.tokens===!0){let $;for(let N=0;N<o.length;N++){let J=$!==void 0?$+1:g,ot=o[N],Y=t.slice(J,ot);e.tokens&&(N===0&&g!==0?(i[N].isPrefix=!0,i[N].value=c):i[N].value=Y,Jt(i[N]),X.maxDepth+=i[N].depth),ot>=g&&(l.push(Y),$=ot)}let W=$!==void 0?$+1:g,U=t.slice(W);l.push(U),e.tokens&&$&&$+1<t.length&&(i[i.length-1].value=U,Jt(i[i.length-1]),X.maxDepth+=i[i.length-1].depth),X.slashes=o,X.parts=l}return X};ee.exports=Ur});var ie=et((Vs,oe)=>{"use strict";var at=it(),K=ut(),{MAX_LENGTH:ht,POSIX_REGEX_SOURCE:Kr,REGEX_NON_SPECIAL_CHARS:Xr,REGEX_SPECIAL_CHARS_BACKREF:jr,REPLACEMENTS:se}=at,Qr=(t,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...t,r);t.sort();let e=`[${t.join("-")}]`;try{new RegExp(e)}catch{return t.map(n=>K.escapeRegex(n)).join("..")}return e},st=(t,r)=>`Missing ${t}: "${r}" - use "\\\\${r}" to match literal characters`,ne=t=>{let r=[],e=0,s=0,n=0,o="",i=!1;for(let l of t){if(i===!0){o+=l,i=!1;continue}if(l==="\\"){o+=l,i=!0;continue}if(l==='"'){n=n===1?0:1,o+=l;continue}if(n===0){if(l==="[")e++;else if(l==="]"&&e>0)e--;else if(e===0){if(l==="(")s++;else if(l===")"&&s>0)s--;else if(l==="|"&&s===0){r.push(o),o="";continue}}}o+=l}return r.push(o),r},zr=t=>{let r=!1;for(let e of t){if(r===!0){r=!1;continue}if(e==="\\"){r=!0;continue}if(/[?*+@!()[\]{}]/.test(e))return!1}return!0},xt=t=>{let r=t.trim(),e=!0;for(;e===!0;)e=!1,/^@\([^\\()[\]{}|]+\)$/.test(r)&&(r=r.slice(2,-1),e=!0);if(zr(r))return r.replace(/\\(.)/g,"$1")},Yr=t=>{let r=t.map(xt).filter(Boolean);for(let e=0;e<r.length;e++)for(let s=e+1;s<r.length;s++){let n=r[e],o=r[s],i=n[0];if(!(!i||n!==i.repeat(n.length)||o!==i.repeat(o.length))&&(n===o||n.startsWith(o)||o.startsWith(n)))return!0}return!1},mt=(t,r=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let e=0,s=0,n=0,o=!1;for(let i=1;i<t.length;i++){let l=t[i];if(o===!0){o=!1;continue}if(l==="\\"){o=!0;continue}if(l==='"'){n=n===1?0:1;continue}if(n!==1){if(l==="["){e++;continue}if(l==="]"&&e>0){e--;continue}if(!(e>0)){if(l==="("){s++;continue}if(l===")"&&(s--,s===0))return r===!0&&i!==t.length-1?void 0:{type:t[0],body:t.slice(2,i),end:i}}}}},Zr=t=>`${t.length===1?K.escapeRegex(t[0]):`[${t.map(e=>K.escapeRegex(e)).join("")}]`}*`,Vr=t=>{let r=0,e=[];for(;r<t.length;){let s=mt(t.slice(r),!1);if(!s||s.type!=="*")return;let n=ne(s.body).map(i=>i.trim());if(n.length!==1)return;let o=xt(n[0]);if(!o||o.length!==1)return;e.push(o),r+=s.end+1}if(!(e.length<1))return e},Jr=t=>{let r=0,e=t.trim(),s=mt(e);for(;s;)r++,e=s.body.trim(),s=mt(e);return r},ts=(t,r)=>{if(r.maxExtglobRecursion===!1)return{risky:!1};let e=typeof r.maxExtglobRecursion=="number"?r.maxExtglobRecursion:at.DEFAULT_MAX_EXTGLOB_RECURSION,s=ne(t).map(l=>l.trim());if(s.length>1&&(s.some(l=>l==="")||s.some(l=>/^[*?]+$/.test(l))||Yr(s)))return{risky:!0};let n=[],o=!1,i=!0;for(let l of s){let h=Vr(l);if(h){o=!0,n.push(...h);continue}let d=xt(l);if(d&&d.length===1){n.push(d);continue}if(i=!1,Jr(l)>e)return{risky:!0}}return o?i?{risky:!0,safeOutput:Zr([...new Set(n)])}:{risky:!0}:{risky:!1}},Ct=(t,r)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=se[t]||t;let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);let o={type:"bos",value:"",output:e.prepend||""},i=[o],l=e.capture?"":"?:",h=at.globChars(e.windows),d=at.extglobChars(h),{DOT_LITERAL:g,PLUS_LITERAL:A,SLASH_LITERAL:S,ONE_CHAR:x,DOTS_SLASH:y,NO_DOT:C,NO_DOT_SLASH:H,NO_DOTS_SLASH:G,QMARK:_,QMARK_NO_DOT:B,STAR:j,START_ANCHOR:I}=h,w=f=>`(${l}(?:(?!${I}${f.dot?y:g}).)*?)`,L=e.dot?"":C,R=e.dot?_:B,m=e.bash===!0?w(e):j;e.capture&&(m=`(${m})`),typeof e.noext=="boolean"&&(e.noextglob=e.noext);let u={input:t,index:-1,start:0,dot:e.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=K.removePrefix(t,u),n=t.length;let M=[],D=[],P=[],c=o,a,X=()=>u.index===n-1,$=u.peek=(f=1)=>t[u.index+f],W=u.advance=()=>t[++u.index]||"",U=()=>t.slice(u.index+1),N=(f="",O=0)=>{u.consumed+=f,u.index+=O},J=f=>{u.output+=f.output!=null?f.output:f.value,N(f.value)},ot=()=>{let f=1;for(;$()==="!"&&($(2)!=="("||$(3)==="?");)W(),u.start++,f++;return f%2===0?!1:(u.negated=!0,u.start++,!0)},Y=f=>{u[f]++,P.push(f)},z=f=>{u[f]--,P.pop()},E=f=>{if(c.type==="globstar"){let O=u.braces>0&&(f.type==="comma"||f.type==="brace"),p=f.extglob===!0||M.length&&(f.type==="pipe"||f.type==="paren");f.type!=="slash"&&f.type!=="paren"&&!O&&!p&&(u.output=u.output.slice(0,-c.output.length),c.type="star",c.value="*",c.output=m,u.output+=c.output)}if(M.length&&f.type!=="paren"&&(M[M.length-1].inner+=f.value),(f.value||f.output)&&J(f),c&&c.type==="text"&&f.type==="text"){c.output=(c.output||c.value)+f.value,c.value+=f.value;return}f.prev=c,i.push(f),c=f},lt=(f,O)=>{let p={...d[O],conditions:1,inner:""};p.prev=c,p.parens=u.parens,p.output=u.output,p.startIndex=u.index,p.tokensIndex=i.length;let b=(e.capture?"(":"")+p.open;Y("parens"),E({type:f,value:O,output:u.output?"":x}),E({type:"paren",extglob:!0,value:W(),output:b}),M.push(p)},me=f=>{let O=t.slice(f.startIndex,u.index+1),p=t.slice(f.startIndex+2,u.index),b=ts(p,e);if((f.type==="plus"||f.type==="star")&&b.risky){let v=b.safeOutput?(f.output?"":x)+(e.capture?`(${b.safeOutput})`:b.safeOutput):void 0,Q=i[f.tokensIndex];Q.type="text",Q.value=O,Q.output=v||K.escapeRegex(O);for(let Z=f.tokensIndex+1;Z<i.length;Z++)i[Z].value="",i[Z].output="",delete i[Z].suffix;u.output=f.output+Q.output,u.backtrack=!0,E({type:"paren",extglob:!0,value:a,output:""}),z("parens");return}let T=f.close+(e.capture?")":""),F;if(f.type==="negate"){let v=m;if(f.inner&&f.inner.length>1&&f.inner.includes("/")&&(v=w(e)),(v!==m||X()||/^\)+$/.test(U()))&&(T=f.close=`)$))${v}`),f.inner.includes("*")&&(F=U())&&/^\.[^\\/.]+$/.test(F)){let Q=Ct(F,{...r,fastpaths:!1}).output;T=f.close=`)${Q})${v})`}f.prev.type==="bos"&&(u.negatedExtglob=!0)}E({type:"paren",extglob:!0,value:a,output:T}),z("parens")};if(e.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let f=!1,O=t.replace(jr,(p,b,T,F,v,Q)=>F==="\\"?(f=!0,p):F==="?"?b?b+F+(v?_.repeat(v.length):""):Q===0?R+(v?_.repeat(v.length):""):_.repeat(T.length):F==="."?g.repeat(T.length):F==="*"?b?b+F+(v?m:""):m:b?p:`\\${p}`);return f===!0&&(e.unescape===!0?O=O.replace(/\\/g,""):O=O.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),O===t&&e.contains===!0?(u.output=t,u):(u.output=K.wrapOutput(O,u,r),u)}for(;!X();){if(a=W(),a==="\0")continue;if(a==="\\"){let p=$();if(p==="/"&&e.bash!==!0||p==="."||p===";")continue;if(!p){a+="\\",E({type:"text",value:a});continue}let b=/^\\+/.exec(U()),T=0;if(b&&b[0].length>2&&(T=b[0].length,u.index+=T,T%2!==0&&(a+="\\")),e.unescape===!0?a=W():a+=W(),u.brackets===0){E({type:"text",value:a});continue}}if(u.brackets>0&&(a!=="]"||c.value==="["||c.value==="[^")){if(e.posix!==!1&&a===":"){let p=c.value.slice(1);if(p.includes("[")&&(c.posix=!0,p.includes(":"))){let b=c.value.lastIndexOf("["),T=c.value.slice(0,b),F=c.value.slice(b+2),v=Kr[F];if(v){c.value=T+v,u.backtrack=!0,W(),!o.output&&i.indexOf(c)===1&&(o.output=x);continue}}}(a==="["&&$()!==":"||a==="-"&&$()==="]")&&(a=`\\${a}`),a==="]"&&(c.value==="["||c.value==="[^")&&(a=`\\${a}`),e.posix===!0&&a==="!"&&c.value==="["&&(a="^"),c.value+=a,J({value:a});continue}if(u.quotes===1&&a!=='"'){a=K.escapeRegex(a),c.value+=a,J({value:a});continue}if(a==='"'){u.quotes=u.quotes===1?0:1,e.keepQuotes===!0&&E({type:"text",value:a});continue}if(a==="("){Y("parens"),E({type:"paren",value:a});continue}if(a===")"){if(u.parens===0&&e.strictBrackets===!0)throw new SyntaxError(st("opening","("));let p=M[M.length-1];if(p&&u.parens===p.parens+1){me(M.pop());continue}E({type:"paren",value:a,output:u.parens?")":"\\)"}),z("parens");continue}if(a==="["){if(e.nobracket===!0||!U().includes("]")){if(e.nobracket!==!0&&e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));a=`\\${a}`}else Y("brackets");E({type:"bracket",value:a});continue}if(a==="]"){if(e.nobracket===!0||c&&c.type==="bracket"&&c.value.length===1){E({type:"text",value:a,output:`\\${a}`});continue}if(u.brackets===0){if(e.strictBrackets===!0)throw new SyntaxError(st("opening","["));E({type:"text",value:a,output:`\\${a}`});continue}z("brackets");let p=c.value.slice(1);if(c.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(a=`/${a}`),c.value+=a,J({value:a}),e.literalBrackets===!1||K.hasRegexChars(p))continue;let b=K.escapeRegex(c.value);if(u.output=u.output.slice(0,-c.value.length),e.literalBrackets===!0){u.output+=b,c.value=b;continue}c.value=`(${l}${b}|${c.value})`,u.output+=c.value;continue}if(a==="{"&&e.nobrace!==!0){Y("braces");let p={type:"brace",value:a,output:"(",outputIndex:u.output.length,tokensIndex:u.tokens.length};D.push(p),E(p);continue}if(a==="}"){let p=D[D.length-1];if(e.nobrace===!0||!p){E({type:"text",value:a,output:a});continue}let b=")";if(p.dots===!0){let T=i.slice(),F=[];for(let v=T.length-1;v>=0&&(i.pop(),T[v].type!=="brace");v--)T[v].type!=="dots"&&F.unshift(T[v].value);b=Qr(F,e),u.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let T=u.output.slice(0,p.outputIndex),F=u.tokens.slice(p.tokensIndex);p.value=p.output="\\{",a=b="\\}",u.output=T;for(let v of F)u.output+=v.output||v.value}E({type:"brace",value:a,output:b}),z("braces"),D.pop();continue}if(a==="|"){M.length>0&&M[M.length-1].conditions++,E({type:"text",value:a});continue}if(a===","){let p=a,b=D[D.length-1];b&&P[P.length-1]==="braces"&&(b.comma=!0,p="|"),E({type:"comma",value:a,output:p});continue}if(a==="/"){if(c.type==="dot"&&u.index===u.start+1){u.start=u.index+1,u.consumed="",u.output="",i.pop(),c=o;continue}E({type:"slash",value:a,output:S});continue}if(a==="."){if(u.braces>0&&c.type==="dot"){c.value==="."&&(c.output=g);let p=D[D.length-1];c.type="dots",c.output+=a,c.value+=a,p.dots=!0;continue}if(u.braces+u.parens===0&&c.type!=="bos"&&c.type!=="slash"){E({type:"text",value:a,output:g});continue}E({type:"dot",value:a,output:g});continue}if(a==="?"){if(!(c&&c.value==="(")&&e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("qmark",a);continue}if(c&&c.type==="paren"){let b=$(),T=a;(c.value==="("&&!/[!=<:]/.test(b)||b==="<"&&!/<([!=]|\w+>)/.test(U()))&&(T=`\\${a}`),E({type:"text",value:a,output:T});continue}if(e.dot!==!0&&(c.type==="slash"||c.type==="bos")){E({type:"qmark",value:a,output:B});continue}E({type:"qmark",value:a,output:_});continue}if(a==="!"){if(e.noextglob!==!0&&$()==="("&&($(2)!=="?"||!/[!=<:]/.test($(3)))){lt("negate",a);continue}if(e.nonegate!==!0&&u.index===0){ot();continue}}if(a==="+"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("plus",a);continue}if(c&&c.value==="("||e.regex===!1){E({type:"plus",value:a,output:A});continue}if(c&&(c.type==="bracket"||c.type==="paren"||c.type==="brace")||u.parens>0){E({type:"plus",value:a});continue}E({type:"plus",value:A});continue}if(a==="@"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){E({type:"at",extglob:!0,value:a,output:""});continue}E({type:"text",value:a});continue}if(a!=="*"){(a==="$"||a==="^")&&(a=`\\${a}`);let p=Xr.exec(U());p&&(a+=p[0],u.index+=p[0].length),E({type:"text",value:a});continue}if(c&&(c.type==="globstar"||c.star===!0)){c.type="star",c.star=!0,c.value+=a,c.output=m,u.backtrack=!0,u.globstar=!0,N(a);continue}let f=U();if(e.noextglob!==!0&&/^\([^?]/.test(f)){lt("star",a);continue}if(c.type==="star"){if(e.noglobstar===!0){N(a);continue}let p=c.prev,b=p.prev,T=p.type==="slash"||p.type==="bos",F=b&&(b.type==="star"||b.type==="globstar");if(e.bash===!0&&(!T||f[0]&&f[0]!=="/")){E({type:"star",value:a,output:""});continue}let v=u.braces>0&&(p.type==="comma"||p.type==="brace"),Q=M.length&&(p.type==="pipe"||p.type==="paren");if(!T&&p.type!=="paren"&&!v&&!Q){E({type:"star",value:a,output:""});continue}for(;f.slice(0,3)==="/**";){let tt=t[u.index+4];if(tt&&tt!=="/")break;f=f.slice(3),N("/**",3)}let Z=X()||u.parens>0&&f===")".repeat(u.parens)&&!M.some(tt=>tt.type==="negate");if(p.type==="bos"&&X()){c.type="globstar",c.value+=a,c.output=w(e),u.output=c.output,u.globstar=!0,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!F&&Z){u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=w(e)+(e.strictSlashes?")":"|$)"),c.value+=a,u.globstar=!0,u.output+=p.output+c.output,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&f[0]==="/"){let tt=f[1]!==void 0?"|$":"";u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=`${w(e)}${S}|${S}${tt})`,c.value+=a,u.output+=p.output+c.output,u.globstar=!0,N(a+W()),E({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&f[0]==="/"){c.type="globstar",c.value+=a,c.output=`(?:^|${S}|${w(e)}${S})`,u.output=c.output,u.globstar=!0,N(a+W()),E({type:"slash",value:"/",output:""});continue}u.output=u.output.slice(0,-c.output.length),c.type="globstar",c.output=w(e),c.value+=a,u.output+=c.output,u.globstar=!0,N(a);continue}let O={type:"star",value:a,output:m};if(e.bash===!0){O.output=".*?",(c.type==="bos"||c.type==="slash")&&(O.output=L+O.output),E(O);continue}if(c&&(c.type==="bracket"||c.type==="paren")&&e.regex===!0){O.output=a,E(O);continue}(u.index===u.start||c.type==="slash"||c.type==="dot")&&(c.type==="dot"?(u.output+=H,c.output+=H):e.dot===!0?(u.output+=G,c.output+=G):(u.output+=L,c.output+=L),$()!=="*"&&(u.output+=x,c.output+=x)),E(O)}for(;u.brackets>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));u.output=K.escapeLast(u.output,"["),z("brackets")}for(;u.parens>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing",")"));u.output=K.escapeLast(u.output,"("),z("parens")}for(;u.braces>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","}"));u.output=K.escapeLast(u.output,"{"),z("braces")}if(e.strictSlashes!==!0&&(c.type==="star"||c.type==="bracket")&&E({type:"maybe_slash",value:"",output:`${S}?`}),u.backtrack===!0){u.output="";for(let f of u.tokens)u.output+=f.output!=null?f.output:f.value,f.suffix&&(u.output+=f.suffix)}return u};Ct.fastpaths=(t,r)=>{let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);t=se[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:i,ONE_CHAR:l,DOTS_SLASH:h,NO_DOT:d,NO_DOTS:g,NO_DOTS_SLASH:A,STAR:S,START_ANCHOR:x}=at.globChars(e.windows),y=e.dot?g:d,C=e.dot?A:d,H=e.capture?"":"?:",G={negated:!1,prefix:""},_=e.bash===!0?".*?":S;e.capture&&(_=`(${_})`);let B=L=>L.noglobstar===!0?_:`(${H}(?:(?!${x}${L.dot?h:o}).)*?)`,j=L=>{switch(L){case"*":return`${y}${l}${_}`;case".*":return`${o}${l}${_}`;case"*.*":return`${y}${_}${o}${l}${_}`;case"*/*":return`${y}${_}${i}${l}${C}${_}`;case"**":return y+B(e);case"**/*":return`(?:${y}${B(e)}${i})?${C}${l}${_}`;case"**/*.*":return`(?:${y}${B(e)}${i})?${C}${_}${o}${l}${_}`;case"**/.*":return`(?:${y}${B(e)}${i})?${o}${l}${_}`;default:{let R=/^(.*?)\.(\w+)$/.exec(L);if(!R)return;let m=j(R[1]);return m?m+o+R[2]:void 0}}},I=K.removePrefix(t,G),w=j(I);return w&&e.strictSlashes!==!0&&(w+=`${i}?`),w};oe.exports=Ct});var ce=et((Js,ae)=>{"use strict";var es=re(),$t=ie(),ue=ut(),rs=it(),ss=t=>t&&typeof t=="object"&&!Array.isArray(t),k=(t,r,e=!1)=>{if(Array.isArray(t)){let g=t.map(S=>k(S,r,e));return S=>{for(let x of g){let y=x(S);if(y)return y}return!1}}let s=ss(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!s)throw new TypeError("Expected pattern to be a non-empty string");let n=r||{},o=n.windows,i=s?k.compileRe(t,r):k.makeRe(t,r,!1,!0),l=i.state;delete i.state;let h=()=>!1;if(n.ignore){let g={...r,ignore:null,onMatch:null,onResult:null};h=k(n.ignore,g,e)}let d=(g,A=!1)=>{let{isMatch:S,match:x,output:y}=k.test(g,i,r,{glob:t,posix:o}),C={glob:t,state:l,regex:i,posix:o,input:g,output:y,match:x,isMatch:S};return typeof n.onResult=="function"&&n.onResult(C),S===!1?(C.isMatch=!1,A?C:!1):h(g)?(typeof n.onIgnore=="function"&&n.onIgnore(C),C.isMatch=!1,A?C:!1):(typeof n.onMatch=="function"&&n.onMatch(C),A?C:!0)};return e&&(d.state=l),d};k.test=(t,r,e,{glob:s,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=e||{},i=o.format||(n?ue.toPosixSlashes:null),l=t===s,h=l&&i?i(t):t;return l===!1&&(h=i?i(t):t,l=h===s),(l===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?l=k.matchBase(t,r,e,n):l=r.exec(h)),{isMatch:!!l,match:l,output:h}};k.matchBase=(t,r,e,s=e&&e.windows)=>(r instanceof RegExp?r:k.makeRe(r,e)).test(ue.basename(t,{windows:s}));k.isMatch=(t,r,e)=>k(r,e)(t);k.parse=(t,r)=>Array.isArray(t)?t.map(e=>k.parse(e,r)):$t(t,{...r,fastpaths:!1});k.scan=(t,r)=>es(t,r);k.compileRe=(t,r,e=!1,s=!1)=>{if(e===!0)return t.output;let n=r||{},o=n.contains?"":"^",i=n.contains?"":"$",l=`${o}(?:${t.output})${i}`;t&&t.negated===!0&&(l=`^(?!${l}).*$`);let h=k.toRegex(l,r);return s===!0&&(h.state=t),h};k.makeRe=(t,r={},e=!1,s=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(n.output=$t.fastpaths(t,r)),n.output||(n=$t(t,r)),k.compileRe(n,r,e,s)};k.toRegex=(t,r)=>{try{let e=r||{};return new RegExp(t,e.flags||(e.nocase?"i":""))}catch(e){if(r&&r.debug===!0)throw e;return/$^/}};k.constants=rs;ae.exports=k});var he=et((tn,fe)=>{"use strict";var le=ce(),ns=ut();function pe(t,r,e=!1){return r&&(r.windows===null||r.windows===void 0)&&(r={...r,windows:ns.isWindows()}),le(t,r,e)}Object.assign(pe,le);fe.exports=pe});import{existsSync as ks}from"node:fs";import{stat as Ds}from"node:fs/promises";import{resolve as Ee}from"node:path";import{readdir as os,readdirSync as is,realpath as us,realpathSync as as,stat as cs,statSync as ls}from"fs";import{isAbsolute as ps,posix as V,resolve as fs}from"path";import{fileURLToPath as hs}from"url";import{createRequire as Ce}from"module";import{basename as $e,dirname as dt,normalize as Le,relative as ve,resolve as we,sep as kt}from"path";import*as Te from"fs";var It=Ce(import.meta.url);function Oe(t){let r=Le(t);return r.length>1&&r[r.length-1]===kt&&(r=r.substring(0,r.length-1)),r}var He=/[\\/]/g;function Dt(t,r){return t.replace(He,r)}var Ie=/^[a-z]:[\\/]$/i;function Pe(t){return t==="/"||Ie.test(t)}function At(t,r){let{resolvePaths:e,normalizePath:s,pathSeparator:n}=r,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(e&&(t=we(t)),(s||o)&&(t=Oe(t)),t===".")return"";let i=t[t.length-1]!==n;return Dt(i?t+n:t,n)}function Nt(t,r){return r+t}function ke(t,r){return function(e,s){return s.startsWith(t)?s.slice(t.length)+e:Dt(ve(t,s),r.pathSeparator)+r.pathSeparator+e}}function De(t){return t}function Ne(t,r,e){return r+t+e}function Fe(t,r){let{relativePaths:e,includeBasePath:s}=r;return e&&t?ke(t,r):s?Nt:De}function Be(t){return function(r,e){e.push(r.substring(t.length)||".")}}function Me(t){return function(r,e,s){let n=r.substring(t.length)||".";s.every(o=>o(n,!0))&&e.push(n)}}var Ge=(t,r)=>{r.push(t||".")},We=(t,r,e)=>{let s=t||".";e.every(n=>n(s,!0))&&r.push(s)},qe=()=>{};function Ue(t,r){let{includeDirs:e,filters:s,relativePaths:n}=r;return e?n?s&&s.length?Me(t):Be(t):s&&s.length?We:Ge:qe}var Ke=(t,r,e,s)=>{s.every(n=>n(t,!1))&&e.files++},Xe=(t,r,e,s)=>{s.every(n=>n(t,!1))&&r.push(t)},je=(t,r,e,s)=>{e.files++},Qe=(t,r)=>{r.push(t)},ze=()=>{};function Ye(t){let{excludeFiles:r,filters:e,onlyCounts:s}=t;return r?ze:e&&e.length?s?Ke:Xe:s?je:Qe}var Ze=t=>t,Ve=()=>[""].slice(0,0);function Je(t){return t.group?Ve:Ze}var tr=(t,r,e)=>{t.push({directory:r,files:e,dir:r})},er=()=>{};function rr(t){return t.group?tr:er}var sr=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue(),n.realpath(t,(i,l)=>{if(i)return s.dequeue(o?null:i,r);n.stat(l,(h,d)=>{if(h)return s.dequeue(o?null:h,r);if(d.isDirectory()&&Ft(t,l,r))return s.dequeue(null,r);e(d,l),s.dequeue(null,r)})})},nr=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue();try{let i=n.realpathSync(t),l=n.statSync(i);if(l.isDirectory()&&Ft(t,i,r))return;e(l,i)}catch(i){if(!o)throw i}};function or(t,r){return!t.resolveSymlinks||t.excludeSymlinks?null:r?nr:sr}function Ft(t,r,e){if(e.options.useRealPaths)return ir(r,e);let s=dt(t),n=1;for(;s!==e.root&&n<2;){let o=e.symlinks.get(s);!!o&&(o===r||o.startsWith(r)||r.startsWith(o))?n++:s=dt(s)}return e.symlinks.set(t,r),n>1}function ir(t,r){return r.visited.includes(t+r.options.pathSeparator)}var ur=t=>t.counts,ar=t=>t.groups,cr=t=>t.paths,lr=t=>t.paths.slice(0,t.options.maxFiles),pr=(t,r,e)=>(pt(r,e,t.counts,t.options.suppressErrors),null),fr=(t,r,e)=>(pt(r,e,t.paths,t.options.suppressErrors),null),hr=(t,r,e)=>(pt(r,e,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),gr=(t,r,e)=>(pt(r,e,t.groups,t.options.suppressErrors),null);function pt(t,r,e,s){r(t&&!s?t:null,e)}function Ar(t,r){let{onlyCounts:e,group:s,maxFiles:n}=t;return e?r?ur:pr:s?r?ar:gr:n?r?lr:hr:r?cr:fr}var Bt={withFileTypes:!0},dr=(t,r,e,s,n)=>{if(t.queue.enqueue(),s<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(r),t.counts.directories++,o.readdir(r||".",Bt,(i,l=[])=>{n(l,e,s),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},yr=(t,r,e,s,n)=>{let{fs:o}=t;if(s<0)return;t.visited.push(r),t.counts.directories++;let i=[];try{i=o.readdirSync(r||".",Bt)}catch(l){if(!t.options.suppressErrors)throw l}n(i,e,s)};function Rr(t){return t?yr:dr}var Sr=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,r){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,r),t&&(r.controller.abort(),this.onQueueEmpty=void 0))}},_r=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},Er=class{aborted=!1;abort(){this.aborted=!0}},Mt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,r,e){this.isSynchronous=!e,this.callbackInvoker=Ar(r,this.isSynchronous),this.root=At(t,r),this.state={root:Pe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new _r,options:r,queue:new Sr((s,n)=>this.callbackInvoker(n,s,e)),symlinks:new Map,visited:[""].slice(0,0),controller:new Er,fs:r.fs||Te},this.joinPath=Fe(this.root,r),this.pushDirectory=Ue(this.root,r),this.pushFile=Ye(r),this.getArray=Je(r),this.groupFiles=rr(r),this.resolveSymlink=or(r,this.isSynchronous),this.walkDirectory=Rr(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,r,e)=>{let{paths:s,options:{filters:n,resolveSymlinks:o,excludeSymlinks:i,exclude:l,maxFiles:h,signal:d,useRealPaths:g,pathSeparator:A},controller:S}=this.state;if(S.aborted||d&&d.aborted||h&&s.length>h)return;let x=this.getArray(this.state.paths);for(let y=0;y<t.length;++y){let C=t[y];if(C.isFile()||C.isSymbolicLink()&&!o&&!i){let H=this.joinPath(C.name,r);this.pushFile(H,x,this.state.counts,n)}else if(C.isDirectory()){let H=Ne(C.name,r,this.state.options.pathSeparator);if(l&&l(C.name,H))continue;this.pushDirectory(H,s,n),this.walkDirectory(this.state,H,H,e-1,this.walk)}else if(this.resolveSymlink&&C.isSymbolicLink()){let H=Nt(C.name,r);this.resolveSymlink(H,this.state,(G,_)=>{if(G.isDirectory()){if(_=At(_,this.state.options),l&&l(C.name,g?_:H+A))return;this.walkDirectory(this.state,_,g?_:H+A,e-1,this.walk)}else{_=g?_:H;let B=$e(_),j=At(dt(_),this.state.options);_=this.joinPath(B,j),this.pushFile(_,x,this.state.counts,n)}})}}this.groupFiles(this.state.groups,r,x)}};function br(t,r){return new Promise((e,s)=>{Gt(t,r,(n,o)=>{if(n)return s(n);e(o)})})}function Gt(t,r,e){new Mt(t,r,e).start()}function mr(t,r){return new Mt(t,r).start()}var Pt=class{constructor(t,r){this.root=t,this.options=r}withPromise(){return br(this.root,this.options)}withCallback(t){Gt(this.root,this.options,t)}sync(){return mr(this.root,this.options)}},Wt=null;try{It.resolve("picomatch"),Wt=It("picomatch")}catch{}var qt=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:kt,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new Pt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,r){return this.options={...this.options,...r},new Pt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...r){let e=this.globFunction||Wt;if(!e)throw new Error("Please specify a glob function to use glob matching.");var s=this.globCache[t.join("\0")];return s||(s=e(t,...r),this.globCache[t.join("\0")]=s),this.options.filters.push(n=>s(n)),this}};var nt=xe(he(),1),gs=Array.isArray,ye=/\\/g,As=/^[A-Za-z]:$/,Re=process.platform==="win32",ds=/^(\/?\.\.)+$/;function ys(t,r={}){let e=t.length,s=Array(e),n=Array(e),o,i;for(o=0;o<e;o++){let l=Se(t[o]);s[o]=l;let h=l.length,d=Array(h);for(i=0;i<h;i++)d[i]=(0,nt.default)(l[i],r);n[o]=d}return l=>{let h=l.split("/");if(h[0]===".."&&ds.test(l))return!0;for(o=0;o<e;o++){let d=s[o],g=n[o],A=h.length,S=Math.min(A,d.length);for(i=0;i<S;){let x=d[i];if(x.includes("/"))return!0;if(!g[i](h[i]))break;if(!r.noglobstar&&x==="**")return!0;i++}if(i===A)return!0}return!1}}var Rs=/^[A-Z]:\/$/i,Ss=Re?t=>Rs.test(t):t=>t==="/";function ge(t,r,e){if(t===r||r.startsWith(`${t}/`)){if(e){let n=t.length+ +!Ss(t);return(o,i)=>o.slice(n,i?-1:void 0)||"."}let s=r.slice(t.length+1);return s?(n,o)=>{if(n===".")return s;let i=`${s}/${n}`;return o?i.slice(0,-1):i}:(n,o)=>o&&n!=="."?n.slice(0,-1):n}return e?s=>V.relative(t,s)||".":s=>V.relative(t,`${r}/${s}`)||"."}function _s(t,r){if(r.startsWith(`${t}/`)){let e=r.slice(t.length+1);return s=>`${e}/${s}`}return e=>{let s=V.relative(t,`${r}/${e}`);return e[e.length-1]==="/"&&s!==""?`${s}/`:s||"."}}function Ae(t){return t.replace(As,r=>`${r}/`)}var Es={parts:!0};function Se(t){var r;let e=nt.default.scan(t,Es);return!((r=e.parts)===null||r===void 0)&&r.length?e.parts:[t]}var bs=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,ms=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,xs=t=>t.replace(bs,"\\$&"),Cs=t=>t.replace(ms,"\\$&"),$s=Re?Cs:xs;function Ls(t,r){if(r?.caseSensitiveMatch===!1)return!0;let e=nt.default.scan(t);return e.isGlob||e.negated}function ct(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function _e(t){return typeof t=="string"?[t]:t??[]}var vs=/^(\/?\.\.)+/,ws=/\\(?=[()[\]{}!*+?@|])/g;function Lt(t,r,e,s){var n;let o=r.cwd,i=t;t[t.length-1]==="/"&&(i=t.slice(0,-1)),i[i.length-1]!=="*"&&r.expandDirectories&&(i+="/**");let l=$s(o);i=ps(i.replace(ws,""))?V.relative(l,i):V.normalize(i);let h=(n=vs.exec(i))===null||n===void 0?void 0:n[0],d=Se(i);if(h){let A=(h.length+1)/3,S=0,x=l.split("/");for(;S<A&&d[S+A]===x[x.length+S-A];)i=i.slice(0,(A-S-1)*3)+i.slice((A-S)*3+d[S+A].length+1)||".",S++;let y=V.join(o,h.slice(S*3));y[0]!=="."&&e.root.length>y.length&&(e.root=Ae(y),e.depthOffset=-A+S)}if(!s&&e.depthOffset>=0){var g;(g=e.commonPath)!==null&&g!==void 0||(e.commonPath=d);let A=[],S=Math.min(e.commonPath.length,d.length);for(let x=0;x<S;x++){let y=d[x];if(y==="**"&&!d[x+1]){A.pop();break}if(x===d.length-1||y!==e.commonPath[x]||Ls(y))break;A.push(y)}e.depthOffset=A.length,e.commonPath=A,e.root=Ae(A.length>0?V.join(o,...A):o)}return i}function Ts(t,r,e){let s=[],n=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&n.push(Lt(o,t,e,!0));for(let o of r)o&&(o[0]!=="!"||o[1]==="("?s.push(Lt(o,t,e,!1)):(o[1]!=="!"||o[2]==="(")&&n.push(Lt(o.slice(1),t,e,!0)));return{match:s,ignore:n}}function Os(t,r){let e=t.cwd,s={root:e,depthOffset:0},n=Ts(t,r,s);t.debug&&ct("internal processing patterns:",n);let{absolute:o,caseSensitiveMatch:i,debug:l,dot:h,followSymbolicLinks:d,onlyDirectories:g}=t,A=s.root.replace(ye,""),S={dot:h,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},x=(0,nt.default)(n.match,S),y=(0,nt.default)(n.ignore,S),C=ys(n.match,S),H=ge(e,A,o),G=o?H:ge(e,A,!0),_=(I,w)=>{let L=G(w,!0);return L!=="."&&!C(L)||y(L)},B;t.deep!==void 0&&(B=Math.round(t.deep-s.depthOffset));let j=new qt({filters:[l?(I,w)=>{let L=H(I,w),R=x(L)&&!y(L);return R&&ct(`matched ${L}`),R}:(I,w)=>{let L=H(I,w);return x(L)&&!y(L)}],exclude:l?(I,w)=>{let L=_(I,w);return ct(`${L?"skipped":"crawling"} ${w}`),L}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:d,excludeSymlinks:!d,excludeFiles:g,includeDirs:g||!t.onlyFiles,maxDepth:B,signal:t.signal}).crawl(A);return t.debug&&ct("internal properties:",{...s,root:A}),[j,e!==A&&!o&&_s(e,A)]}function Hs(t,r){if(r)for(let e=t.length-1;e>=0;e--)t[e]=r(t[e]);return t}var de={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Is(t){let r=Object.assign({},t);for(let e in de)r[e]===void 0&&Object.assign(r,{[e]:de[e]});return r.cwd=(r.cwd instanceof URL?hs(r.cwd):fs(r.cwd||process.cwd())).replace(ye,"/"),r.ignore=_e(r.ignore),r.fs&&(r.fs={readdir:r.fs.readdir||os,readdirSync:r.fs.readdirSync||is,realpath:r.fs.realpath||us,realpathSync:r.fs.realpathSync||as,stat:r.fs.stat||cs,statSync:r.fs.statSync||ls}),r.debug&&ct("globbing with options:",r),r}function Ps(t,r={}){var e;if(t&&r?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let s=gs(t)||typeof t=="string",n=_e((e=s?t:t.patterns)!==null&&e!==void 0?e:"**/*"),o=Is(s?r:t);return n.length>0?Os(o,n):[]}async function vt(t,r){let[e,s]=Ps(t,r);return e?Hs(await e.withPromise(),s):[]}var be=Object.values(wt).flatMap(t=>t.extensions).map(t=>t.slice(1));function Ns(t){return/[*?[\]{}]/.test(t)}async function Fs(t,r){let e=r?`**/*.{${be.join(",")}}`:`*.{${be.join(",")}}`;return(await vt([e],{cwd:t,absolute:!0,onlyFiles:!0,caseSensitiveMatch:!1})).sort()}async function Bs(t,r,e,s){let n=await Fs(t,r);if(n.length===0){e.push({path:t,error:Ot(t)});return}for(let o of n)await s(o,t,!1)}async function gn(t,r){let e=[],s=[],n=new Map,o=new Set,i=async(l,h,d)=>{let g=Ee(l);if(!o.has(g)){o.add(g);try{e.push(await Ht(g)),h&&n.set(g,h)}catch(A){if(Tt(A))s.push({path:g,error:A});else if(d)throw A}}};for(let l of t){let h=Ee(l);if(Ns(l)&&!ks(h)){let g=(r.platform??process.platform)==="win32"?l.replaceAll("\\","/"):l,A=await vt([g],{absolute:!0,onlyFiles:!0});A.length===0&&s.push({path:h,error:gt(h)});for(let S of A.sort())await i(S,void 0,!1);continue}let d;try{d=await Ds(h)}catch{s.push({path:h,error:gt(h)});continue}if(d.isDirectory()){await Bs(h,r.recursive,s,i);continue}await i(h,void 0,!0)}return{sources:e,failures:s,roots:n}}export{gn as a};
|
|
3
|
+
import{i as Ht}from"./chunk-6L6C3GJU.js";import{E as Ot,d as Tt,e as gt}from"./chunk-3UEQ2OX6.js";import{a as wt}from"./chunk-M66BUNYO.js";import{c as et,e as xe}from"./chunk-TMUK2DD3.js";var it=et((zs,Qt)=>{"use strict";var Ut="[^\\\\/]",xr="(?=.)",Kt="[^/]",yt="(?:\\/|$)",Xt="(?:^|\\/)",Rt=`\\.{1,2}${yt}`,Cr="(?!\\.)",$r=`(?!${Xt}${Rt})`,Lr=`(?!\\.{0,1}${yt})`,vr=`(?!${Rt})`,wr="[^.\\/]",Tr=`${Kt}*?`,Or="/",jt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:xr,QMARK:Kt,END_ANCHOR:yt,DOTS_SLASH:Rt,NO_DOT:Cr,NO_DOTS:$r,NO_DOT_SLASH:Lr,NO_DOTS_SLASH:vr,QMARK_NO_DOT:wr,STAR:Tr,START_ANCHOR:Xt,SEP:Or},Hr={...jt,SLASH_LITERAL:"[\\\\/]",QMARK:Ut,STAR:`${Ut}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Ir={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Qt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Ir,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Hr:jt}}});var ut=et(q=>{"use strict";var{REGEX_BACKSLASH:Pr,REGEX_REMOVE_BACKSLASH:kr,REGEX_SPECIAL_CHARS:Dr,REGEX_SPECIAL_CHARS_GLOBAL:Nr}=it();q.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);q.hasRegexChars=t=>Dr.test(t);q.isRegexChar=t=>t.length===1&&q.hasRegexChars(t);q.escapeRegex=t=>t.replace(Nr,"\\$1");q.toPosixSlashes=t=>t.replace(Pr,"/");q.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};q.removeBackslashes=t=>t.replace(kr,r=>r==="\\"?"":r);q.escapeLast=(t,r,e)=>{let s=t.lastIndexOf(r,e);return s===-1?t:t[s-1]==="\\"?q.escapeLast(t,r,s-1):`${t.slice(0,s)}\\${t.slice(s)}`};q.removePrefix=(t,r={})=>{let e=t;return e.startsWith("./")&&(e=e.slice(2),r.prefix="./"),e};q.wrapOutput=(t,r={},e={})=>{let s=e.contains?"":"^",n=e.contains?"":"$",o=`${s}(?:${t})${n}`;return r.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};q.basename=(t,{windows:r}={})=>{let e=t.split(r?/[\\/]/:"/"),s=e[e.length-1];return s===""?e[e.length-2]:s}});var re=et((Zs,ee)=>{"use strict";var zt=ut(),{CHAR_ASTERISK:St,CHAR_AT:Fr,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:Br,CHAR_DOT:_t,CHAR_EXCLAMATION_MARK:Et,CHAR_FORWARD_SLASH:te,CHAR_LEFT_CURLY_BRACE:bt,CHAR_LEFT_PARENTHESES:ft,CHAR_LEFT_SQUARE_BRACKET:Mr,CHAR_PLUS:Gr,CHAR_QUESTION_MARK:Yt,CHAR_RIGHT_CURLY_BRACE:Wr,CHAR_RIGHT_PARENTHESES:Zt,CHAR_RIGHT_SQUARE_BRACKET:qr}=it(),Vt=t=>t===te||t===rt,Jt=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Ur=(t,r)=>{let e=r||{},s=t.length-1,n=e.parts===!0||e.tokens===!0||e.scanToEnd===!0,o=[],i=[],l=[],h=t,d=-1,g=0,A=0,S=!1,x=!1,y=!1,C=!1,H=!1,G=!1,_=!1,B=!1,j=!1,I=!1,w=0,L,R,m={value:"",depth:0,isGlob:!1},u=()=>d>=s,M=()=>h.charCodeAt(d+1),D=()=>(L=R,h.charCodeAt(++d));for(;d<s;){R=D();let $;if(R===rt){_=m.backslashes=!0,R=D(),R===bt&&(G=!0);continue}if(G===!0||R===bt){for(w++;u()!==!0&&(R=D());){if(R===rt){_=m.backslashes=!0,D();continue}if(R===bt){w++;continue}if(G!==!0&&R===_t&&(R=D())===_t){if(S=m.isBrace=!0,y=m.isGlob=!0,I=!0,n===!0)continue;break}if(G!==!0&&R===Br){if(S=m.isBrace=!0,y=m.isGlob=!0,I=!0,n===!0)continue;break}if(R===Wr&&(w--,w===0)){G=!1,S=m.isBrace=!0,I=!0;break}}if(n===!0)continue;break}if(R===te){if(o.push(d),i.push(m),m={value:"",depth:0,isGlob:!1},I===!0)continue;if(L===_t&&d===g+1){g+=2;continue}A=d+1;continue}if(e.noext!==!0&&(R===Gr||R===Fr||R===St||R===Yt||R===Et)===!0&&M()===ft){if(y=m.isGlob=!0,C=m.isExtglob=!0,I=!0,R===Et&&d===g&&(j=!0),n===!0){let U=0;for(;u()!==!0&&(R=D());){if(R===rt){_=m.backslashes=!0,D();continue}if(R===ft){U++;continue}if(R===Zt&&--U===0){I=!0;break}}continue}break}if(R===St){if(L===St&&(H=m.isGlobstar=!0),y=m.isGlob=!0,I=!0,n===!0)continue;break}if(R===Yt){if(y=m.isGlob=!0,I=!0,n===!0)continue;break}if(R===Mr){for(;u()!==!0&&($=D());){if($===rt){_=m.backslashes=!0,D();continue}if($===qr){x=m.isBracket=!0,y=m.isGlob=!0,I=!0;break}}if(n===!0)continue;break}if(e.nonegate!==!0&&R===Et&&d===g){B=m.negated=!0,g++;continue}if(e.noparen!==!0&&R===ft){if(y=m.isGlob=!0,n===!0){let W=1;for(;u()!==!0&&(R=D());){if(R===rt){_=m.backslashes=!0,D();continue}if(R===ft){W++;continue}if(R===Zt&&--W===0){I=!0;break}}continue}break}if(y===!0){if(I=!0,n===!0)continue;break}}e.noext===!0&&(C=!1,y=!1);let P=h,c="",a="";g>0&&(c=h.slice(0,g),h=h.slice(g),A-=g),P&&y===!0&&A>0?(P=h.slice(0,A),a=h.slice(A)):y===!0?(P="",a=h):P=h,P&&P!==""&&P!=="/"&&P!==h&&Vt(P.charCodeAt(P.length-1))&&(P=P.slice(0,-1)),e.unescape===!0&&(a&&(a=zt.removeBackslashes(a)),P&&_===!0&&(P=zt.removeBackslashes(P)));let X={prefix:c,input:t,start:g,base:P,glob:a,isBrace:S,isBracket:x,isGlob:y,isExtglob:C,isGlobstar:H,negated:B,negatedExtglob:j};if(e.tokens===!0&&(X.maxDepth=0,Vt(R)||i.push(m),X.tokens=i),e.parts===!0||e.tokens===!0){let $;for(let N=0;N<o.length;N++){let J=$!==void 0?$+1:g,ot=o[N],Y=t.slice(J,ot);e.tokens&&(N===0&&g!==0?(i[N].isPrefix=!0,i[N].value=c):i[N].value=Y,Jt(i[N]),X.maxDepth+=i[N].depth),ot>=g&&(l.push(Y),$=ot)}let W=$!==void 0?$+1:g,U=t.slice(W);l.push(U),e.tokens&&$&&$+1<t.length&&(i[i.length-1].value=U,Jt(i[i.length-1]),X.maxDepth+=i[i.length-1].depth),X.slashes=o,X.parts=l}return X};ee.exports=Ur});var ie=et((Vs,oe)=>{"use strict";var at=it(),K=ut(),{MAX_LENGTH:ht,POSIX_REGEX_SOURCE:Kr,REGEX_NON_SPECIAL_CHARS:Xr,REGEX_SPECIAL_CHARS_BACKREF:jr,REPLACEMENTS:se}=at,Qr=(t,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...t,r);t.sort();let e=`[${t.join("-")}]`;try{new RegExp(e)}catch{return t.map(n=>K.escapeRegex(n)).join("..")}return e},st=(t,r)=>`Missing ${t}: "${r}" - use "\\\\${r}" to match literal characters`,ne=t=>{let r=[],e=0,s=0,n=0,o="",i=!1;for(let l of t){if(i===!0){o+=l,i=!1;continue}if(l==="\\"){o+=l,i=!0;continue}if(l==='"'){n=n===1?0:1,o+=l;continue}if(n===0){if(l==="[")e++;else if(l==="]"&&e>0)e--;else if(e===0){if(l==="(")s++;else if(l===")"&&s>0)s--;else if(l==="|"&&s===0){r.push(o),o="";continue}}}o+=l}return r.push(o),r},zr=t=>{let r=!1;for(let e of t){if(r===!0){r=!1;continue}if(e==="\\"){r=!0;continue}if(/[?*+@!()[\]{}]/.test(e))return!1}return!0},xt=t=>{let r=t.trim(),e=!0;for(;e===!0;)e=!1,/^@\([^\\()[\]{}|]+\)$/.test(r)&&(r=r.slice(2,-1),e=!0);if(zr(r))return r.replace(/\\(.)/g,"$1")},Yr=t=>{let r=t.map(xt).filter(Boolean);for(let e=0;e<r.length;e++)for(let s=e+1;s<r.length;s++){let n=r[e],o=r[s],i=n[0];if(!(!i||n!==i.repeat(n.length)||o!==i.repeat(o.length))&&(n===o||n.startsWith(o)||o.startsWith(n)))return!0}return!1},mt=(t,r=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let e=0,s=0,n=0,o=!1;for(let i=1;i<t.length;i++){let l=t[i];if(o===!0){o=!1;continue}if(l==="\\"){o=!0;continue}if(l==='"'){n=n===1?0:1;continue}if(n!==1){if(l==="["){e++;continue}if(l==="]"&&e>0){e--;continue}if(!(e>0)){if(l==="("){s++;continue}if(l===")"&&(s--,s===0))return r===!0&&i!==t.length-1?void 0:{type:t[0],body:t.slice(2,i),end:i}}}}},Zr=t=>`${t.length===1?K.escapeRegex(t[0]):`[${t.map(e=>K.escapeRegex(e)).join("")}]`}*`,Vr=t=>{let r=0,e=[];for(;r<t.length;){let s=mt(t.slice(r),!1);if(!s||s.type!=="*")return;let n=ne(s.body).map(i=>i.trim());if(n.length!==1)return;let o=xt(n[0]);if(!o||o.length!==1)return;e.push(o),r+=s.end+1}if(!(e.length<1))return e},Jr=t=>{let r=0,e=t.trim(),s=mt(e);for(;s;)r++,e=s.body.trim(),s=mt(e);return r},ts=(t,r)=>{if(r.maxExtglobRecursion===!1)return{risky:!1};let e=typeof r.maxExtglobRecursion=="number"?r.maxExtglobRecursion:at.DEFAULT_MAX_EXTGLOB_RECURSION,s=ne(t).map(l=>l.trim());if(s.length>1&&(s.some(l=>l==="")||s.some(l=>/^[*?]+$/.test(l))||Yr(s)))return{risky:!0};let n=[],o=!1,i=!0;for(let l of s){let h=Vr(l);if(h){o=!0,n.push(...h);continue}let d=xt(l);if(d&&d.length===1){n.push(d);continue}if(i=!1,Jr(l)>e)return{risky:!0}}return o?i?{risky:!0,safeOutput:Zr([...new Set(n)])}:{risky:!0}:{risky:!1}},Ct=(t,r)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=se[t]||t;let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);let o={type:"bos",value:"",output:e.prepend||""},i=[o],l=e.capture?"":"?:",h=at.globChars(e.windows),d=at.extglobChars(h),{DOT_LITERAL:g,PLUS_LITERAL:A,SLASH_LITERAL:S,ONE_CHAR:x,DOTS_SLASH:y,NO_DOT:C,NO_DOT_SLASH:H,NO_DOTS_SLASH:G,QMARK:_,QMARK_NO_DOT:B,STAR:j,START_ANCHOR:I}=h,w=f=>`(${l}(?:(?!${I}${f.dot?y:g}).)*?)`,L=e.dot?"":C,R=e.dot?_:B,m=e.bash===!0?w(e):j;e.capture&&(m=`(${m})`),typeof e.noext=="boolean"&&(e.noextglob=e.noext);let u={input:t,index:-1,start:0,dot:e.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=K.removePrefix(t,u),n=t.length;let M=[],D=[],P=[],c=o,a,X=()=>u.index===n-1,$=u.peek=(f=1)=>t[u.index+f],W=u.advance=()=>t[++u.index]||"",U=()=>t.slice(u.index+1),N=(f="",O=0)=>{u.consumed+=f,u.index+=O},J=f=>{u.output+=f.output!=null?f.output:f.value,N(f.value)},ot=()=>{let f=1;for(;$()==="!"&&($(2)!=="("||$(3)==="?");)W(),u.start++,f++;return f%2===0?!1:(u.negated=!0,u.start++,!0)},Y=f=>{u[f]++,P.push(f)},z=f=>{u[f]--,P.pop()},E=f=>{if(c.type==="globstar"){let O=u.braces>0&&(f.type==="comma"||f.type==="brace"),p=f.extglob===!0||M.length&&(f.type==="pipe"||f.type==="paren");f.type!=="slash"&&f.type!=="paren"&&!O&&!p&&(u.output=u.output.slice(0,-c.output.length),c.type="star",c.value="*",c.output=m,u.output+=c.output)}if(M.length&&f.type!=="paren"&&(M[M.length-1].inner+=f.value),(f.value||f.output)&&J(f),c&&c.type==="text"&&f.type==="text"){c.output=(c.output||c.value)+f.value,c.value+=f.value;return}f.prev=c,i.push(f),c=f},lt=(f,O)=>{let p={...d[O],conditions:1,inner:""};p.prev=c,p.parens=u.parens,p.output=u.output,p.startIndex=u.index,p.tokensIndex=i.length;let b=(e.capture?"(":"")+p.open;Y("parens"),E({type:f,value:O,output:u.output?"":x}),E({type:"paren",extglob:!0,value:W(),output:b}),M.push(p)},me=f=>{let O=t.slice(f.startIndex,u.index+1),p=t.slice(f.startIndex+2,u.index),b=ts(p,e);if((f.type==="plus"||f.type==="star")&&b.risky){let v=b.safeOutput?(f.output?"":x)+(e.capture?`(${b.safeOutput})`:b.safeOutput):void 0,Q=i[f.tokensIndex];Q.type="text",Q.value=O,Q.output=v||K.escapeRegex(O);for(let Z=f.tokensIndex+1;Z<i.length;Z++)i[Z].value="",i[Z].output="",delete i[Z].suffix;u.output=f.output+Q.output,u.backtrack=!0,E({type:"paren",extglob:!0,value:a,output:""}),z("parens");return}let T=f.close+(e.capture?")":""),F;if(f.type==="negate"){let v=m;if(f.inner&&f.inner.length>1&&f.inner.includes("/")&&(v=w(e)),(v!==m||X()||/^\)+$/.test(U()))&&(T=f.close=`)$))${v}`),f.inner.includes("*")&&(F=U())&&/^\.[^\\/.]+$/.test(F)){let Q=Ct(F,{...r,fastpaths:!1}).output;T=f.close=`)${Q})${v})`}f.prev.type==="bos"&&(u.negatedExtglob=!0)}E({type:"paren",extglob:!0,value:a,output:T}),z("parens")};if(e.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let f=!1,O=t.replace(jr,(p,b,T,F,v,Q)=>F==="\\"?(f=!0,p):F==="?"?b?b+F+(v?_.repeat(v.length):""):Q===0?R+(v?_.repeat(v.length):""):_.repeat(T.length):F==="."?g.repeat(T.length):F==="*"?b?b+F+(v?m:""):m:b?p:`\\${p}`);return f===!0&&(e.unescape===!0?O=O.replace(/\\/g,""):O=O.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),O===t&&e.contains===!0?(u.output=t,u):(u.output=K.wrapOutput(O,u,r),u)}for(;!X();){if(a=W(),a==="\0")continue;if(a==="\\"){let p=$();if(p==="/"&&e.bash!==!0||p==="."||p===";")continue;if(!p){a+="\\",E({type:"text",value:a});continue}let b=/^\\+/.exec(U()),T=0;if(b&&b[0].length>2&&(T=b[0].length,u.index+=T,T%2!==0&&(a+="\\")),e.unescape===!0?a=W():a+=W(),u.brackets===0){E({type:"text",value:a});continue}}if(u.brackets>0&&(a!=="]"||c.value==="["||c.value==="[^")){if(e.posix!==!1&&a===":"){let p=c.value.slice(1);if(p.includes("[")&&(c.posix=!0,p.includes(":"))){let b=c.value.lastIndexOf("["),T=c.value.slice(0,b),F=c.value.slice(b+2),v=Kr[F];if(v){c.value=T+v,u.backtrack=!0,W(),!o.output&&i.indexOf(c)===1&&(o.output=x);continue}}}(a==="["&&$()!==":"||a==="-"&&$()==="]")&&(a=`\\${a}`),a==="]"&&(c.value==="["||c.value==="[^")&&(a=`\\${a}`),e.posix===!0&&a==="!"&&c.value==="["&&(a="^"),c.value+=a,J({value:a});continue}if(u.quotes===1&&a!=='"'){a=K.escapeRegex(a),c.value+=a,J({value:a});continue}if(a==='"'){u.quotes=u.quotes===1?0:1,e.keepQuotes===!0&&E({type:"text",value:a});continue}if(a==="("){Y("parens"),E({type:"paren",value:a});continue}if(a===")"){if(u.parens===0&&e.strictBrackets===!0)throw new SyntaxError(st("opening","("));let p=M[M.length-1];if(p&&u.parens===p.parens+1){me(M.pop());continue}E({type:"paren",value:a,output:u.parens?")":"\\)"}),z("parens");continue}if(a==="["){if(e.nobracket===!0||!U().includes("]")){if(e.nobracket!==!0&&e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));a=`\\${a}`}else Y("brackets");E({type:"bracket",value:a});continue}if(a==="]"){if(e.nobracket===!0||c&&c.type==="bracket"&&c.value.length===1){E({type:"text",value:a,output:`\\${a}`});continue}if(u.brackets===0){if(e.strictBrackets===!0)throw new SyntaxError(st("opening","["));E({type:"text",value:a,output:`\\${a}`});continue}z("brackets");let p=c.value.slice(1);if(c.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(a=`/${a}`),c.value+=a,J({value:a}),e.literalBrackets===!1||K.hasRegexChars(p))continue;let b=K.escapeRegex(c.value);if(u.output=u.output.slice(0,-c.value.length),e.literalBrackets===!0){u.output+=b,c.value=b;continue}c.value=`(${l}${b}|${c.value})`,u.output+=c.value;continue}if(a==="{"&&e.nobrace!==!0){Y("braces");let p={type:"brace",value:a,output:"(",outputIndex:u.output.length,tokensIndex:u.tokens.length};D.push(p),E(p);continue}if(a==="}"){let p=D[D.length-1];if(e.nobrace===!0||!p){E({type:"text",value:a,output:a});continue}let b=")";if(p.dots===!0){let T=i.slice(),F=[];for(let v=T.length-1;v>=0&&(i.pop(),T[v].type!=="brace");v--)T[v].type!=="dots"&&F.unshift(T[v].value);b=Qr(F,e),u.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let T=u.output.slice(0,p.outputIndex),F=u.tokens.slice(p.tokensIndex);p.value=p.output="\\{",a=b="\\}",u.output=T;for(let v of F)u.output+=v.output||v.value}E({type:"brace",value:a,output:b}),z("braces"),D.pop();continue}if(a==="|"){M.length>0&&M[M.length-1].conditions++,E({type:"text",value:a});continue}if(a===","){let p=a,b=D[D.length-1];b&&P[P.length-1]==="braces"&&(b.comma=!0,p="|"),E({type:"comma",value:a,output:p});continue}if(a==="/"){if(c.type==="dot"&&u.index===u.start+1){u.start=u.index+1,u.consumed="",u.output="",i.pop(),c=o;continue}E({type:"slash",value:a,output:S});continue}if(a==="."){if(u.braces>0&&c.type==="dot"){c.value==="."&&(c.output=g);let p=D[D.length-1];c.type="dots",c.output+=a,c.value+=a,p.dots=!0;continue}if(u.braces+u.parens===0&&c.type!=="bos"&&c.type!=="slash"){E({type:"text",value:a,output:g});continue}E({type:"dot",value:a,output:g});continue}if(a==="?"){if(!(c&&c.value==="(")&&e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("qmark",a);continue}if(c&&c.type==="paren"){let b=$(),T=a;(c.value==="("&&!/[!=<:]/.test(b)||b==="<"&&!/<([!=]|\w+>)/.test(U()))&&(T=`\\${a}`),E({type:"text",value:a,output:T});continue}if(e.dot!==!0&&(c.type==="slash"||c.type==="bos")){E({type:"qmark",value:a,output:B});continue}E({type:"qmark",value:a,output:_});continue}if(a==="!"){if(e.noextglob!==!0&&$()==="("&&($(2)!=="?"||!/[!=<:]/.test($(3)))){lt("negate",a);continue}if(e.nonegate!==!0&&u.index===0){ot();continue}}if(a==="+"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("plus",a);continue}if(c&&c.value==="("||e.regex===!1){E({type:"plus",value:a,output:A});continue}if(c&&(c.type==="bracket"||c.type==="paren"||c.type==="brace")||u.parens>0){E({type:"plus",value:a});continue}E({type:"plus",value:A});continue}if(a==="@"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){E({type:"at",extglob:!0,value:a,output:""});continue}E({type:"text",value:a});continue}if(a!=="*"){(a==="$"||a==="^")&&(a=`\\${a}`);let p=Xr.exec(U());p&&(a+=p[0],u.index+=p[0].length),E({type:"text",value:a});continue}if(c&&(c.type==="globstar"||c.star===!0)){c.type="star",c.star=!0,c.value+=a,c.output=m,u.backtrack=!0,u.globstar=!0,N(a);continue}let f=U();if(e.noextglob!==!0&&/^\([^?]/.test(f)){lt("star",a);continue}if(c.type==="star"){if(e.noglobstar===!0){N(a);continue}let p=c.prev,b=p.prev,T=p.type==="slash"||p.type==="bos",F=b&&(b.type==="star"||b.type==="globstar");if(e.bash===!0&&(!T||f[0]&&f[0]!=="/")){E({type:"star",value:a,output:""});continue}let v=u.braces>0&&(p.type==="comma"||p.type==="brace"),Q=M.length&&(p.type==="pipe"||p.type==="paren");if(!T&&p.type!=="paren"&&!v&&!Q){E({type:"star",value:a,output:""});continue}for(;f.slice(0,3)==="/**";){let tt=t[u.index+4];if(tt&&tt!=="/")break;f=f.slice(3),N("/**",3)}let Z=X()||u.parens>0&&f===")".repeat(u.parens)&&!M.some(tt=>tt.type==="negate");if(p.type==="bos"&&X()){c.type="globstar",c.value+=a,c.output=w(e),u.output=c.output,u.globstar=!0,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!F&&Z){u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=w(e)+(e.strictSlashes?")":"|$)"),c.value+=a,u.globstar=!0,u.output+=p.output+c.output,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&f[0]==="/"){let tt=f[1]!==void 0?"|$":"";u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=`${w(e)}${S}|${S}${tt})`,c.value+=a,u.output+=p.output+c.output,u.globstar=!0,N(a+W()),E({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&f[0]==="/"){c.type="globstar",c.value+=a,c.output=`(?:^|${S}|${w(e)}${S})`,u.output=c.output,u.globstar=!0,N(a+W()),E({type:"slash",value:"/",output:""});continue}u.output=u.output.slice(0,-c.output.length),c.type="globstar",c.output=w(e),c.value+=a,u.output+=c.output,u.globstar=!0,N(a);continue}let O={type:"star",value:a,output:m};if(e.bash===!0){O.output=".*?",(c.type==="bos"||c.type==="slash")&&(O.output=L+O.output),E(O);continue}if(c&&(c.type==="bracket"||c.type==="paren")&&e.regex===!0){O.output=a,E(O);continue}(u.index===u.start||c.type==="slash"||c.type==="dot")&&(c.type==="dot"?(u.output+=H,c.output+=H):e.dot===!0?(u.output+=G,c.output+=G):(u.output+=L,c.output+=L),$()!=="*"&&(u.output+=x,c.output+=x)),E(O)}for(;u.brackets>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));u.output=K.escapeLast(u.output,"["),z("brackets")}for(;u.parens>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing",")"));u.output=K.escapeLast(u.output,"("),z("parens")}for(;u.braces>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","}"));u.output=K.escapeLast(u.output,"{"),z("braces")}if(e.strictSlashes!==!0&&(c.type==="star"||c.type==="bracket")&&E({type:"maybe_slash",value:"",output:`${S}?`}),u.backtrack===!0){u.output="";for(let f of u.tokens)u.output+=f.output!=null?f.output:f.value,f.suffix&&(u.output+=f.suffix)}return u};Ct.fastpaths=(t,r)=>{let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);t=se[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:i,ONE_CHAR:l,DOTS_SLASH:h,NO_DOT:d,NO_DOTS:g,NO_DOTS_SLASH:A,STAR:S,START_ANCHOR:x}=at.globChars(e.windows),y=e.dot?g:d,C=e.dot?A:d,H=e.capture?"":"?:",G={negated:!1,prefix:""},_=e.bash===!0?".*?":S;e.capture&&(_=`(${_})`);let B=L=>L.noglobstar===!0?_:`(${H}(?:(?!${x}${L.dot?h:o}).)*?)`,j=L=>{switch(L){case"*":return`${y}${l}${_}`;case".*":return`${o}${l}${_}`;case"*.*":return`${y}${_}${o}${l}${_}`;case"*/*":return`${y}${_}${i}${l}${C}${_}`;case"**":return y+B(e);case"**/*":return`(?:${y}${B(e)}${i})?${C}${l}${_}`;case"**/*.*":return`(?:${y}${B(e)}${i})?${C}${_}${o}${l}${_}`;case"**/.*":return`(?:${y}${B(e)}${i})?${o}${l}${_}`;default:{let R=/^(.*?)\.(\w+)$/.exec(L);if(!R)return;let m=j(R[1]);return m?m+o+R[2]:void 0}}},I=K.removePrefix(t,G),w=j(I);return w&&e.strictSlashes!==!0&&(w+=`${i}?`),w};oe.exports=Ct});var ce=et((Js,ae)=>{"use strict";var es=re(),$t=ie(),ue=ut(),rs=it(),ss=t=>t&&typeof t=="object"&&!Array.isArray(t),k=(t,r,e=!1)=>{if(Array.isArray(t)){let g=t.map(S=>k(S,r,e));return S=>{for(let x of g){let y=x(S);if(y)return y}return!1}}let s=ss(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!s)throw new TypeError("Expected pattern to be a non-empty string");let n=r||{},o=n.windows,i=s?k.compileRe(t,r):k.makeRe(t,r,!1,!0),l=i.state;delete i.state;let h=()=>!1;if(n.ignore){let g={...r,ignore:null,onMatch:null,onResult:null};h=k(n.ignore,g,e)}let d=(g,A=!1)=>{let{isMatch:S,match:x,output:y}=k.test(g,i,r,{glob:t,posix:o}),C={glob:t,state:l,regex:i,posix:o,input:g,output:y,match:x,isMatch:S};return typeof n.onResult=="function"&&n.onResult(C),S===!1?(C.isMatch=!1,A?C:!1):h(g)?(typeof n.onIgnore=="function"&&n.onIgnore(C),C.isMatch=!1,A?C:!1):(typeof n.onMatch=="function"&&n.onMatch(C),A?C:!0)};return e&&(d.state=l),d};k.test=(t,r,e,{glob:s,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=e||{},i=o.format||(n?ue.toPosixSlashes:null),l=t===s,h=l&&i?i(t):t;return l===!1&&(h=i?i(t):t,l=h===s),(l===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?l=k.matchBase(t,r,e,n):l=r.exec(h)),{isMatch:!!l,match:l,output:h}};k.matchBase=(t,r,e,s=e&&e.windows)=>(r instanceof RegExp?r:k.makeRe(r,e)).test(ue.basename(t,{windows:s}));k.isMatch=(t,r,e)=>k(r,e)(t);k.parse=(t,r)=>Array.isArray(t)?t.map(e=>k.parse(e,r)):$t(t,{...r,fastpaths:!1});k.scan=(t,r)=>es(t,r);k.compileRe=(t,r,e=!1,s=!1)=>{if(e===!0)return t.output;let n=r||{},o=n.contains?"":"^",i=n.contains?"":"$",l=`${o}(?:${t.output})${i}`;t&&t.negated===!0&&(l=`^(?!${l}).*$`);let h=k.toRegex(l,r);return s===!0&&(h.state=t),h};k.makeRe=(t,r={},e=!1,s=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(n.output=$t.fastpaths(t,r)),n.output||(n=$t(t,r)),k.compileRe(n,r,e,s)};k.toRegex=(t,r)=>{try{let e=r||{};return new RegExp(t,e.flags||(e.nocase?"i":""))}catch(e){if(r&&r.debug===!0)throw e;return/$^/}};k.constants=rs;ae.exports=k});var he=et((tn,fe)=>{"use strict";var le=ce(),ns=ut();function pe(t,r,e=!1){return r&&(r.windows===null||r.windows===void 0)&&(r={...r,windows:ns.isWindows()}),le(t,r,e)}Object.assign(pe,le);fe.exports=pe});import{existsSync as ks}from"node:fs";import{stat as Ds}from"node:fs/promises";import{resolve as Ee}from"node:path";import{readdir as os,readdirSync as is,realpath as us,realpathSync as as,stat as cs,statSync as ls}from"fs";import{isAbsolute as ps,posix as V,resolve as fs}from"path";import{fileURLToPath as hs}from"url";import{createRequire as Ce}from"module";import{basename as $e,dirname as dt,normalize as Le,relative as ve,resolve as we,sep as kt}from"path";import*as Te from"fs";var It=Ce(import.meta.url);function Oe(t){let r=Le(t);return r.length>1&&r[r.length-1]===kt&&(r=r.substring(0,r.length-1)),r}var He=/[\\/]/g;function Dt(t,r){return t.replace(He,r)}var Ie=/^[a-z]:[\\/]$/i;function Pe(t){return t==="/"||Ie.test(t)}function At(t,r){let{resolvePaths:e,normalizePath:s,pathSeparator:n}=r,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(e&&(t=we(t)),(s||o)&&(t=Oe(t)),t===".")return"";let i=t[t.length-1]!==n;return Dt(i?t+n:t,n)}function Nt(t,r){return r+t}function ke(t,r){return function(e,s){return s.startsWith(t)?s.slice(t.length)+e:Dt(ve(t,s),r.pathSeparator)+r.pathSeparator+e}}function De(t){return t}function Ne(t,r,e){return r+t+e}function Fe(t,r){let{relativePaths:e,includeBasePath:s}=r;return e&&t?ke(t,r):s?Nt:De}function Be(t){return function(r,e){e.push(r.substring(t.length)||".")}}function Me(t){return function(r,e,s){let n=r.substring(t.length)||".";s.every(o=>o(n,!0))&&e.push(n)}}var Ge=(t,r)=>{r.push(t||".")},We=(t,r,e)=>{let s=t||".";e.every(n=>n(s,!0))&&r.push(s)},qe=()=>{};function Ue(t,r){let{includeDirs:e,filters:s,relativePaths:n}=r;return e?n?s&&s.length?Me(t):Be(t):s&&s.length?We:Ge:qe}var Ke=(t,r,e,s)=>{s.every(n=>n(t,!1))&&e.files++},Xe=(t,r,e,s)=>{s.every(n=>n(t,!1))&&r.push(t)},je=(t,r,e,s)=>{e.files++},Qe=(t,r)=>{r.push(t)},ze=()=>{};function Ye(t){let{excludeFiles:r,filters:e,onlyCounts:s}=t;return r?ze:e&&e.length?s?Ke:Xe:s?je:Qe}var Ze=t=>t,Ve=()=>[""].slice(0,0);function Je(t){return t.group?Ve:Ze}var tr=(t,r,e)=>{t.push({directory:r,files:e,dir:r})},er=()=>{};function rr(t){return t.group?tr:er}var sr=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue(),n.realpath(t,(i,l)=>{if(i)return s.dequeue(o?null:i,r);n.stat(l,(h,d)=>{if(h)return s.dequeue(o?null:h,r);if(d.isDirectory()&&Ft(t,l,r))return s.dequeue(null,r);e(d,l),s.dequeue(null,r)})})},nr=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue();try{let i=n.realpathSync(t),l=n.statSync(i);if(l.isDirectory()&&Ft(t,i,r))return;e(l,i)}catch(i){if(!o)throw i}};function or(t,r){return!t.resolveSymlinks||t.excludeSymlinks?null:r?nr:sr}function Ft(t,r,e){if(e.options.useRealPaths)return ir(r,e);let s=dt(t),n=1;for(;s!==e.root&&n<2;){let o=e.symlinks.get(s);!!o&&(o===r||o.startsWith(r)||r.startsWith(o))?n++:s=dt(s)}return e.symlinks.set(t,r),n>1}function ir(t,r){return r.visited.includes(t+r.options.pathSeparator)}var ur=t=>t.counts,ar=t=>t.groups,cr=t=>t.paths,lr=t=>t.paths.slice(0,t.options.maxFiles),pr=(t,r,e)=>(pt(r,e,t.counts,t.options.suppressErrors),null),fr=(t,r,e)=>(pt(r,e,t.paths,t.options.suppressErrors),null),hr=(t,r,e)=>(pt(r,e,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),gr=(t,r,e)=>(pt(r,e,t.groups,t.options.suppressErrors),null);function pt(t,r,e,s){r(t&&!s?t:null,e)}function Ar(t,r){let{onlyCounts:e,group:s,maxFiles:n}=t;return e?r?ur:pr:s?r?ar:gr:n?r?lr:hr:r?cr:fr}var Bt={withFileTypes:!0},dr=(t,r,e,s,n)=>{if(t.queue.enqueue(),s<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(r),t.counts.directories++,o.readdir(r||".",Bt,(i,l=[])=>{n(l,e,s),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},yr=(t,r,e,s,n)=>{let{fs:o}=t;if(s<0)return;t.visited.push(r),t.counts.directories++;let i=[];try{i=o.readdirSync(r||".",Bt)}catch(l){if(!t.options.suppressErrors)throw l}n(i,e,s)};function Rr(t){return t?yr:dr}var Sr=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,r){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,r),t&&(r.controller.abort(),this.onQueueEmpty=void 0))}},_r=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},Er=class{aborted=!1;abort(){this.aborted=!0}},Mt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,r,e){this.isSynchronous=!e,this.callbackInvoker=Ar(r,this.isSynchronous),this.root=At(t,r),this.state={root:Pe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new _r,options:r,queue:new Sr((s,n)=>this.callbackInvoker(n,s,e)),symlinks:new Map,visited:[""].slice(0,0),controller:new Er,fs:r.fs||Te},this.joinPath=Fe(this.root,r),this.pushDirectory=Ue(this.root,r),this.pushFile=Ye(r),this.getArray=Je(r),this.groupFiles=rr(r),this.resolveSymlink=or(r,this.isSynchronous),this.walkDirectory=Rr(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,r,e)=>{let{paths:s,options:{filters:n,resolveSymlinks:o,excludeSymlinks:i,exclude:l,maxFiles:h,signal:d,useRealPaths:g,pathSeparator:A},controller:S}=this.state;if(S.aborted||d&&d.aborted||h&&s.length>h)return;let x=this.getArray(this.state.paths);for(let y=0;y<t.length;++y){let C=t[y];if(C.isFile()||C.isSymbolicLink()&&!o&&!i){let H=this.joinPath(C.name,r);this.pushFile(H,x,this.state.counts,n)}else if(C.isDirectory()){let H=Ne(C.name,r,this.state.options.pathSeparator);if(l&&l(C.name,H))continue;this.pushDirectory(H,s,n),this.walkDirectory(this.state,H,H,e-1,this.walk)}else if(this.resolveSymlink&&C.isSymbolicLink()){let H=Nt(C.name,r);this.resolveSymlink(H,this.state,(G,_)=>{if(G.isDirectory()){if(_=At(_,this.state.options),l&&l(C.name,g?_:H+A))return;this.walkDirectory(this.state,_,g?_:H+A,e-1,this.walk)}else{_=g?_:H;let B=$e(_),j=At(dt(_),this.state.options);_=this.joinPath(B,j),this.pushFile(_,x,this.state.counts,n)}})}}this.groupFiles(this.state.groups,r,x)}};function br(t,r){return new Promise((e,s)=>{Gt(t,r,(n,o)=>{if(n)return s(n);e(o)})})}function Gt(t,r,e){new Mt(t,r,e).start()}function mr(t,r){return new Mt(t,r).start()}var Pt=class{constructor(t,r){this.root=t,this.options=r}withPromise(){return br(this.root,this.options)}withCallback(t){Gt(this.root,this.options,t)}sync(){return mr(this.root,this.options)}},Wt=null;try{It.resolve("picomatch"),Wt=It("picomatch")}catch{}var qt=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:kt,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new Pt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,r){return this.options={...this.options,...r},new Pt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...r){let e=this.globFunction||Wt;if(!e)throw new Error("Please specify a glob function to use glob matching.");var s=this.globCache[t.join("\0")];return s||(s=e(t,...r),this.globCache[t.join("\0")]=s),this.options.filters.push(n=>s(n)),this}};var nt=xe(he(),1),gs=Array.isArray,ye=/\\/g,As=/^[A-Za-z]:$/,Re=process.platform==="win32",ds=/^(\/?\.\.)+$/;function ys(t,r={}){let e=t.length,s=Array(e),n=Array(e),o,i;for(o=0;o<e;o++){let l=Se(t[o]);s[o]=l;let h=l.length,d=Array(h);for(i=0;i<h;i++)d[i]=(0,nt.default)(l[i],r);n[o]=d}return l=>{let h=l.split("/");if(h[0]===".."&&ds.test(l))return!0;for(o=0;o<e;o++){let d=s[o],g=n[o],A=h.length,S=Math.min(A,d.length);for(i=0;i<S;){let x=d[i];if(x.includes("/"))return!0;if(!g[i](h[i]))break;if(!r.noglobstar&&x==="**")return!0;i++}if(i===A)return!0}return!1}}var Rs=/^[A-Z]:\/$/i,Ss=Re?t=>Rs.test(t):t=>t==="/";function ge(t,r,e){if(t===r||r.startsWith(`${t}/`)){if(e){let n=t.length+ +!Ss(t);return(o,i)=>o.slice(n,i?-1:void 0)||"."}let s=r.slice(t.length+1);return s?(n,o)=>{if(n===".")return s;let i=`${s}/${n}`;return o?i.slice(0,-1):i}:(n,o)=>o&&n!=="."?n.slice(0,-1):n}return e?s=>V.relative(t,s)||".":s=>V.relative(t,`${r}/${s}`)||"."}function _s(t,r){if(r.startsWith(`${t}/`)){let e=r.slice(t.length+1);return s=>`${e}/${s}`}return e=>{let s=V.relative(t,`${r}/${e}`);return e[e.length-1]==="/"&&s!==""?`${s}/`:s||"."}}function Ae(t){return t.replace(As,r=>`${r}/`)}var Es={parts:!0};function Se(t){var r;let e=nt.default.scan(t,Es);return!((r=e.parts)===null||r===void 0)&&r.length?e.parts:[t]}var bs=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,ms=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,xs=t=>t.replace(bs,"\\$&"),Cs=t=>t.replace(ms,"\\$&"),$s=Re?Cs:xs;function Ls(t,r){if(r?.caseSensitiveMatch===!1)return!0;let e=nt.default.scan(t);return e.isGlob||e.negated}function ct(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function _e(t){return typeof t=="string"?[t]:t??[]}var vs=/^(\/?\.\.)+/,ws=/\\(?=[()[\]{}!*+?@|])/g;function Lt(t,r,e,s){var n;let o=r.cwd,i=t;t[t.length-1]==="/"&&(i=t.slice(0,-1)),i[i.length-1]!=="*"&&r.expandDirectories&&(i+="/**");let l=$s(o);i=ps(i.replace(ws,""))?V.relative(l,i):V.normalize(i);let h=(n=vs.exec(i))===null||n===void 0?void 0:n[0],d=Se(i);if(h){let A=(h.length+1)/3,S=0,x=l.split("/");for(;S<A&&d[S+A]===x[x.length+S-A];)i=i.slice(0,(A-S-1)*3)+i.slice((A-S)*3+d[S+A].length+1)||".",S++;let y=V.join(o,h.slice(S*3));y[0]!=="."&&e.root.length>y.length&&(e.root=Ae(y),e.depthOffset=-A+S)}if(!s&&e.depthOffset>=0){var g;(g=e.commonPath)!==null&&g!==void 0||(e.commonPath=d);let A=[],S=Math.min(e.commonPath.length,d.length);for(let x=0;x<S;x++){let y=d[x];if(y==="**"&&!d[x+1]){A.pop();break}if(x===d.length-1||y!==e.commonPath[x]||Ls(y))break;A.push(y)}e.depthOffset=A.length,e.commonPath=A,e.root=Ae(A.length>0?V.join(o,...A):o)}return i}function Ts(t,r,e){let s=[],n=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&n.push(Lt(o,t,e,!0));for(let o of r)o&&(o[0]!=="!"||o[1]==="("?s.push(Lt(o,t,e,!1)):(o[1]!=="!"||o[2]==="(")&&n.push(Lt(o.slice(1),t,e,!0)));return{match:s,ignore:n}}function Os(t,r){let e=t.cwd,s={root:e,depthOffset:0},n=Ts(t,r,s);t.debug&&ct("internal processing patterns:",n);let{absolute:o,caseSensitiveMatch:i,debug:l,dot:h,followSymbolicLinks:d,onlyDirectories:g}=t,A=s.root.replace(ye,""),S={dot:h,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},x=(0,nt.default)(n.match,S),y=(0,nt.default)(n.ignore,S),C=ys(n.match,S),H=ge(e,A,o),G=o?H:ge(e,A,!0),_=(I,w)=>{let L=G(w,!0);return L!=="."&&!C(L)||y(L)},B;t.deep!==void 0&&(B=Math.round(t.deep-s.depthOffset));let j=new qt({filters:[l?(I,w)=>{let L=H(I,w),R=x(L)&&!y(L);return R&&ct(`matched ${L}`),R}:(I,w)=>{let L=H(I,w);return x(L)&&!y(L)}],exclude:l?(I,w)=>{let L=_(I,w);return ct(`${L?"skipped":"crawling"} ${w}`),L}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:d,excludeSymlinks:!d,excludeFiles:g,includeDirs:g||!t.onlyFiles,maxDepth:B,signal:t.signal}).crawl(A);return t.debug&&ct("internal properties:",{...s,root:A}),[j,e!==A&&!o&&_s(e,A)]}function Hs(t,r){if(r)for(let e=t.length-1;e>=0;e--)t[e]=r(t[e]);return t}var de={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Is(t){let r=Object.assign({},t);for(let e in de)r[e]===void 0&&Object.assign(r,{[e]:de[e]});return r.cwd=(r.cwd instanceof URL?hs(r.cwd):fs(r.cwd||process.cwd())).replace(ye,"/"),r.ignore=_e(r.ignore),r.fs&&(r.fs={readdir:r.fs.readdir||os,readdirSync:r.fs.readdirSync||is,realpath:r.fs.realpath||us,realpathSync:r.fs.realpathSync||as,stat:r.fs.stat||cs,statSync:r.fs.statSync||ls}),r.debug&&ct("globbing with options:",r),r}function Ps(t,r={}){var e;if(t&&r?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let s=gs(t)||typeof t=="string",n=_e((e=s?t:t.patterns)!==null&&e!==void 0?e:"**/*"),o=Is(s?r:t);return n.length>0?Os(o,n):[]}async function vt(t,r){let[e,s]=Ps(t,r);return e?Hs(await e.withPromise(),s):[]}var be=Object.values(wt).flatMap(t=>t.extensions).map(t=>t.slice(1));function Ns(t){return/[*?[\]{}]/.test(t)}async function Fs(t,r){let e=r?`**/*.{${be.join(",")}}`:`*.{${be.join(",")}}`;return(await vt([e],{cwd:t,absolute:!0,onlyFiles:!0,caseSensitiveMatch:!1})).sort()}async function Bs(t,r,e,s){let n=await Fs(t,r);if(n.length===0){e.push({path:t,error:Ot(t)});return}for(let o of n)await s(o,t,!1)}async function gn(t,r){let e=[],s=[],n=new Map,o=new Set,i=async(l,h,d)=>{let g=Ee(l);if(!o.has(g)){o.add(g);try{e.push(await Ht(g)),h&&n.set(g,h)}catch(A){if(Tt(A))s.push({path:g,error:A});else if(d)throw A}}};for(let l of t){let h=Ee(l);if(Ns(l)&&!ks(h)){let g=(r.platform??process.platform)==="win32"?l.replaceAll("\\","/"):l,A=await vt([g],{absolute:!0,onlyFiles:!0});A.length===0&&s.push({path:h,error:gt(h)});for(let S of A.sort())await i(S,void 0,!1);continue}let d;try{d=await Ds(h)}catch{s.push({path:h,error:gt(h)});continue}if(d.isDirectory()){await Bs(h,r.recursive,s,i);continue}await i(h,void 0,!0)}return{sources:e,failures:s,roots:n}}export{gn as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{i as F}from"./chunk-LNB5D67B.js";import{a as y}from"./chunk-QR6QHTC3.js";import{i as h}from"./chunk-6L6C3GJU.js";import{b as g}from"./chunk-EXLXSKRH.js";import{d as b}from"./chunk-3UEQ2OX6.js";import{a as u}from"./chunk-M66BUNYO.js";import{existsSync as I}from"node:fs";import{open as k,readdir as w,stat as K}from"node:fs/promises";import{basename as A,dirname as j,extname as S,join as v,resolve as R}from"node:path";function M(e){return e.startsWith(".")||/\.(crdownload|part|download|tmp)$/i.test(e)}function O(e){return e.kind==="image"?"images":e.format==="pdf"?"pdfs":"documents"}var $=new Set(Object.values(u).flatMap(e=>e.extensions));async function E(e){let r=await k(e,"r"),n=Buffer.alloc(4096),i=0;try{i=(await r.read(n,0,n.length,0)).bytesRead}finally{await r.close()}let t=n.subarray(0,i),o=(c,a)=>t.subarray(c,c+a).toString("latin1");return o(4,4)==="ftyp"?/^(M4A |M4B |M4P )$/.test(o(8,4))?"audio":"video":t[0]===26&&t[1]===69&&t[2]===223&&t[3]===163?"video":o(0,4)==="RIFF"?o(8,4)==="WAVE"?"audio":o(8,3)==="AVI"?"video":"other":t[0]===0&&t[1]===0&&t[2]===1&&(t[3]===186||t[3]===179)?"video":o(0,3)==="ID3"||o(0,4)==="fLaC"||o(0,4)==="OggS"||o(0,4)==="FORM"&&/^AIF[FC]$/.test(o(8,4))||t[0]===255&&t[1]!==void 0&&(t[1]&224)===224?"audio":i>0&&!t.includes(0)&&N(t)?"text":"other"}function N(e){try{return new TextDecoder("utf-8",{fatal:!0}).decode(e,{stream:!0}),!0}catch{return!1}}var x=["images","pdfs","documents","videos","audio","other"];function q(e,r){if(e==="videos"||e==="audio")return"not yet supported";if(e==="other")return r.every(n=>n==="text")?r.length===1?"a text file":"text files":"not supported"}async function G(e){let r=R(e),n=await w(r,{withFileTypes:!0}),i=[],t=[],o=new Map,c=[],a=0;for(let f of n.sort((d,s)=>d.name.localeCompare(s.name))){if(!f.isFile()||M(f.name))continue;let d=v(r,f.name);c.push(d);let s=await D(d);if(s.kind==="source")i.push(s.source),a+=s.source.bytes;else if(s.kind==="failed")t.push(s.failure),a+=s.bytes;else{let p=s.kind,m=o.get(p)??{bytes:0,sniffed:[]};m.bytes+=s.bytes,m.sniffed.push(s.sniffed),o.set(p,m),a+=s.bytes}}let l=[];for(let f of x){let d=i.filter(s=>O(s)===f);d.length>0&&l.push({id:f,count:d.length,bytes:d.reduce((s,p)=>s+p.bytes,0),sources:d})}l.sort((f,d)=>d.count-f.count);for(let f of x){let d=o.get(f);if(!d)continue;let s=q(f,d.sniffed);l.push({id:f,count:d.sniffed.length,bytes:d.bytes,sources:[],...s===void 0?{}:{why:s}})}return{dir:r,sources:i,failures:t,kinds:l,bytes:a,paths:c}}async function D(e){let r=()=>K(e).then(n=>n.size,()=>0);try{let n=await h(e);if(n.kind==="media"){let i=u[n.format].media==="video";return{kind:i?"videos":"audio",sniffed:i?"video":"audio",bytes:n.bytes}}return{kind:"source",source:n}}catch(n){let i=await r(),t=await E(e).catch(()=>"other");if(t==="video"||t==="audio")return{kind:t==="video"?"videos":"audio",sniffed:t,bytes:i};if($.has(S(e).toLowerCase())){let o=b(n)?n:void 0;if(o)return{kind:"failed",failure:{path:e,error:o},bytes:i}}return{kind:"other",sniffed:t,bytes:i}}}function T(e){let r=new Set(e.flatMap(n=>y(n).filter(i=>i!==n.format)));return Object.keys(u).filter(n=>r.has(n))}function H(e,r){let n=T(e),i=e[0],t=i?.kind==="image"?"webp":i?.format==="pdf"?"png":void 0,o=t&&n.includes(t)?t:n[0];if(o)return B(e,o,r)}function B(e,r,n){let i={target:r};return u[r].lossy&&(i.quality=n),e.some(t=>t.kind==="document"&&t.format==="pdf")&&(r==="png"||r==="jpeg")&&(i.dpi=150),i}function Q(e,r,n,i){if(e.format===r.target)return{left:`already ${u[r.target].label}`};if(!y(e).includes(r.target))return{left:`can\u2019t become ${u[r.target].label}`};let[t]=F.plan([e],{target:r.target,...r.quality===void 0?{}:{quality:r.quality},...r.dpi===void 0?{}:{dpi:String(r.dpi)},pages:"all",...i===void 0?{}:{destination:i}});if(t?.op!=="convert")return{left:"not supported"};if(t.outputs.some(o=>I(o)&&!n.has(o)))return{left:"already converted"};t.outputs=t.outputs.map(o=>C(o,n));for(let o of t.outputs)n.add(o);return{job:t}}function C(e,r){if(!r.has(e))return e;let n=S(e),i=A(e,n);for(let t=1;;t++){let o=v(j(e),g(i,` (${t})${n}`));if(!r.has(o)&&!I(o))return o}}export{M as a,O as b,E as c,G as d,D as e,T as f,H as g,B as h,Q as i};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
function f(n){let t=n.trim().split(":");if(t.length===0||t.length>3)return;let e=0;for(let[o,i]of t.entries()){if(!(o===t.length-1?/^\d+(\.\d+)?$/:/^\d+$/).test(i))return;let u=Number(i);if(o>0&&u>=60)return;e=e*60+u}return e}function R(n){let t=n.indexOf("-");if(t<0)return;let e=f(n.slice(0,t)),o=n.slice(t+1).trim(),i=o===""?void 0:f(o);if(!(e===void 0||o!==""&&i===void 0)&&!(i!==void 0&&i<=e))return{start:e,end:i}}var s=n=>String(n).padStart(2,"0");function A(n){let t=Math.round(n*10),e=t%600/10,o=Math.floor(t/600)%60,i=Math.floor(t/36e3),d=e.toFixed(1).padStart(4,"0");return i>0?`${i}:${s(o)}:${d}`:`${o}:${d}`}function _(n){let t=Math.round(n),e=t%60,o=Math.floor(t/60)%60,i=Math.floor(t/3600);return i>0?`${i}:${s(o)}:${s(e)}`:`${o}:${s(e)}`}var S=[1,5,10,30,60,300,600,1800];function K(n){return S.filter((t,e)=>e===0||t<=n/4)}function P(n){return n<60?`${n} s`:`${n/60} min`}var w=[1920,1280,854],O=[30,24],E=15,M=64,$=32,x=32,r=n=>Math.max(2,Math.round(n/2)*2);function a(n,t){let e=n.width>=n.height,o=e?n.width:n.height;if(t>=o)return{width:r(n.width-1),height:r(n.height-1)};let i=t/o;return e?{width:r(t),height:r(n.height*i)}:{width:r(n.width*i),height:r(t)}}function c(n){let t=Math.max(n.width,n.height),e=[t,...w.filter(u=>u<t)],o=n.hasAudio?M:0,i=[];for(let u of e){let{width:p,height:l}=a(n,u),g=[...new Set([n.fps,...O].filter(h=>h<=n.fps))];for(let h of g)i.push({width:p,height:l,fps:h,audioKbps:o})}let d=a(n,e[e.length-1]??t);return i.push({...d,fps:Math.min(E,n.fps),audioKbps:n.hasAudio?x:0}),i}var m=n=>n.width*n.height*n.fps*.02/1e3;function b(n){let t=c(n),e=t[t.length-1];return e?Math.ceil((m(e)+e.audioKbps)*1e3/8/.98*n.duration):0}function v(n){let t=n.targetBytes*8/n.duration/1e3*.98;for(let e of c(n)){let o=t-e.audioKbps;if(o>=m(e))return{...e,videoKbps:Math.floor(o)}}return{floor:b(n)}}function z(n,t={}){let e=n.audio!==void 0&&t.mute!==!0;return n.video&&!t.soundOnly?b({duration:n.duration,width:n.video.width,height:n.video.height,fps:n.video.fps,hasAudio:e}):Math.ceil($*1e3/8/.98*n.duration)}export{f as a,R as b,A as c,_ as d,K as e,P as f,v as g,z as h};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
var v="0.4.
|
|
4
|
-
\u25BC`,dotFilled:"\u25CF",dotEmpty:"\u25CB"},f={name:"dark",fg:"#e7e7e7",dim:"#b0b0b0",accent:"#e5a23c",ok:"#6fcf7f",warn:"#e5c07b",fail:"#e8796d",failTint:"#2e2020",failTintDim:"#b0b0b0",larger:"#f2994a",shedHatch:"#47774f",grownFill:"#403225",tag:"#63c1d8",label:"#a68ce0",modeConvert:"#55c7d9",modeConvertBg:"#122c33",modeCompress:"#79c98b",modeCompressBg:"#182c1e",modePdf:"#ff6b4a",modePdfBg:"#361c16",modeColour:"#f27ba8",modeColourBg:"#3a1e2b",modeEdit:"#b39ae8",modeEditBg:"#2a2238",modeTranscribe:"#e63946",modeTranscribeBg:"#3a1a1d",border:"#808080",selectionBg:"#2c2c2c",band:"#2c2c2c",canvas:"#1e1e1e",textSelectionBg:"#3f5c86",brand:"#e5a23c",keycapBg:"#333333",violet:"#a68ce0",faint:"#4d4d4d",listBand:"#323232",shelf:"#242424",tabChip:"#262626",panelBand:"#404040",ink:"#0c1d22",track:"#2e2e2e",trackFill:"#515151",thumb:"#e7e7e7",folderChip:"#414141",pill:"#e7e7e7",fieldBand:"#3d3d3d",defaultTagBg:"#33261a",defaultTag:"#c98a4b",newTagBg:"#2a3448",newTag:"#4f77c5"},o={name:"light",fg:"#262626",dim:"#4f4f4f",accent:"#915a01",ok:"#0e702c",warn:"#8a6100",fail:"#a43c32",failTint:"#f9e3df",failTintDim:"#4a4a4a",larger:"#8b4d01",shedHatch:"#87b896",grownFill:"#ece3d6",tag:"#0a6b86",label:"#5e4b99",modeConvert:"#036b7b",modeConvertBg:"#e6f7fa",modeCompress:"#24733a",modeCompressBg:"#eaf5ec",modePdf:"#b82a06",modePdfBg:"#fceee9",modeColour:"#b0306a",modeColourBg:"#f7e3ec",modeEdit:"#64569f",modeEditBg:"#f0ebfa",modeTranscribe:"#c0102c",modeTranscribeBg:"#fef0ef",border:"#767676",selectionBg:"#e4e4e4",band:"#e4e4e4",canvas:"#ffffff",textSelectionBg:"#b9cfe8",brand:"#915a01",keycapBg:"#e1e1e1",violet:"#5e4b99",faint:"#b2b2b2",listBand:"#dcdcdc",shelf:"#f3f3f3",tabChip:"#f0f0f0",panelBand:"#d5d5d5",ink:"#ffffff",track:"#e4e4e4",trackFill:"#afafaf",thumb:"#262626",folderChip:"#d0d0d0",pill:"#262626",fieldBand:"#d7d7d7",defaultTagBg:"#f5e2cc",defaultTag:"#8f5000",newTagBg:"#e1e7f4",newTag:"#3358a3"},i={name:"neutral",fg:"",dim:"gray",accent:"yellow",ok:"green",warn:"yellow",fail:"red",failTint:"",failTintDim:"gray",larger:"yellow",shedHatch:"green",grownFill:"",tag:"cyan",label:"magenta",modeConvert:"cyan",modeConvertBg:"",modeCompress:"green",modeCompressBg:"",modePdf:"red",modePdfBg:"",modeColour:"magenta",modeColourBg:"",modeEdit:"magenta",modeEditBg:"",modeTranscribe:"redBright",modeTranscribeBg:"",border:"gray",selectionBg:"",band:"",canvas:"",textSelectionBg:"",brand:"yellow",keycapBg:"",violet:"magenta",faint:"gray",listBand:"",shelf:"",tabChip:"",panelBand:"",ink:"",track:"",trackFill:"",thumb:"",folderChip:"",pill:"",fieldBand:"",defaultTagBg:"",defaultTag:"",newTagBg:"",newTag:""},d=["convert","compress","pdf","edit","
|
|
3
|
+
var v="0.4.1",x={ok:"\u2713",fail:"\u2715",warn:"\u26A0",cursor:"\u276F",strip:"\u258C",star:"\u2605",arrow:"\u2192",tip:"\u2727",longArrow:"\u2500\u2500\u2192",longArrowDown:`\u2502
|
|
4
|
+
\u25BC`,dotFilled:"\u25CF",dotEmpty:"\u25CB"},f={name:"dark",fg:"#e7e7e7",dim:"#b0b0b0",accent:"#e5a23c",ok:"#6fcf7f",warn:"#e5c07b",fail:"#e8796d",failTint:"#2e2020",failTintDim:"#b0b0b0",larger:"#f2994a",shedHatch:"#47774f",grownFill:"#403225",tag:"#63c1d8",label:"#a68ce0",modeConvert:"#55c7d9",modeConvertBg:"#122c33",modeCompress:"#79c98b",modeCompressBg:"#182c1e",modePdf:"#ff6b4a",modePdfBg:"#361c16",modeColour:"#f27ba8",modeColourBg:"#3a1e2b",modeEdit:"#b39ae8",modeEditBg:"#2a2238",modeTranscribe:"#e63946",modeTranscribeBg:"#3a1a1d",border:"#808080",selectionBg:"#2c2c2c",band:"#2c2c2c",canvas:"#1e1e1e",textSelectionBg:"#3f5c86",brand:"#e5a23c",keycapBg:"#333333",violet:"#a68ce0",faint:"#4d4d4d",listBand:"#323232",shelf:"#242424",tabChip:"#262626",panelBand:"#404040",ink:"#0c1d22",track:"#2e2e2e",trackFill:"#515151",thumb:"#e7e7e7",folderChip:"#414141",pill:"#e7e7e7",fieldBand:"#3d3d3d",defaultTagBg:"#33261a",defaultTag:"#c98a4b",newTagBg:"#2a3448",newTag:"#4f77c5"},o={name:"light",fg:"#262626",dim:"#4f4f4f",accent:"#915a01",ok:"#0e702c",warn:"#8a6100",fail:"#a43c32",failTint:"#f9e3df",failTintDim:"#4a4a4a",larger:"#8b4d01",shedHatch:"#87b896",grownFill:"#ece3d6",tag:"#0a6b86",label:"#5e4b99",modeConvert:"#036b7b",modeConvertBg:"#e6f7fa",modeCompress:"#24733a",modeCompressBg:"#eaf5ec",modePdf:"#b82a06",modePdfBg:"#fceee9",modeColour:"#b0306a",modeColourBg:"#f7e3ec",modeEdit:"#64569f",modeEditBg:"#f0ebfa",modeTranscribe:"#c0102c",modeTranscribeBg:"#fef0ef",border:"#767676",selectionBg:"#e4e4e4",band:"#e4e4e4",canvas:"#ffffff",textSelectionBg:"#b9cfe8",brand:"#915a01",keycapBg:"#e1e1e1",violet:"#5e4b99",faint:"#b2b2b2",listBand:"#dcdcdc",shelf:"#f3f3f3",tabChip:"#f0f0f0",panelBand:"#d5d5d5",ink:"#ffffff",track:"#e4e4e4",trackFill:"#afafaf",thumb:"#262626",folderChip:"#d0d0d0",pill:"#262626",fieldBand:"#d7d7d7",defaultTagBg:"#f5e2cc",defaultTag:"#8f5000",newTagBg:"#e1e7f4",newTag:"#3358a3"},i={name:"neutral",fg:"",dim:"gray",accent:"yellow",ok:"green",warn:"yellow",fail:"red",failTint:"",failTintDim:"gray",larger:"yellow",shedHatch:"green",grownFill:"",tag:"cyan",label:"magenta",modeConvert:"cyan",modeConvertBg:"",modeCompress:"green",modeCompressBg:"",modePdf:"red",modePdfBg:"",modeColour:"magenta",modeColourBg:"",modeEdit:"magenta",modeEditBg:"",modeTranscribe:"redBright",modeTranscribeBg:"",border:"gray",selectionBg:"",band:"",canvas:"",textSelectionBg:"",brand:"yellow",keycapBg:"",violet:"magenta",faint:"gray",listBand:"",shelf:"",tabChip:"",panelBand:"",ink:"",track:"",trackFill:"",thumb:"",folderChip:"",pill:"",fieldBand:"",defaultTagBg:"",defaultTag:"",newTagBg:"",newTag:""},d=["convert","compress","pdf","edit","transcribe","colour"],k=`1\u2013${d.length}`;function E(e,t){let r=d,n=e==="menu"?r.length:r.indexOf(e),a=Math.max(0,Math.min(r.length-1,n+t));return r[a]}function P(e){return/^[1-9]$/.test(e)?d[Number(e)-1]:void 0}var S={convert:"\u2194",compress:"\u2193",pdf:"\u25A3",colour:"\u25D0",edit:"\u2726",transcribe:"\xB6"},c="#7d6ad0",l="#cc8ae2";function s(e,t){return t==="compress"?{fg:e.modeCompress,bg:e.modeCompressBg}:t==="pdf"?{fg:e.modePdf,bg:e.modePdfBg}:t==="colour"?{fg:e.modeColour,bg:e.modeColourBg}:t==="edit"?{fg:e.modeEdit,bg:e.modeEditBg}:t==="transcribe"?{fg:e.modeTranscribe,bg:e.modeTranscribeBg}:{fg:e.modeConvert,bg:e.modeConvertBg}}var g=["#f26e69","#e5a23c","#ace02c","#55c7d9","#6579fd","#ad95e9"],b=["#e5a23c","#f2cf6b"],m={convert:["#1e96a7","#1e94b3","#1e92c0","#1d8ed2","#1b86ef","#4a7df8","#6974f8","#816af8","#995cf8"],compress:["#24b459","#22ab6d","#21a479","#209f81","#1f9c89","#1f9a91","#1e9998","#1e97a0","#1e96a7"],pdf:["#eb4319","#e3541a","#de601b","#db6a1c","#d9731d","#d87c1e","#d8841f","#d98c20","#d99522"],edit:["#9b5af8","#985cf8","#965ef8","#945ff8","#9161f8","#8f62f8","#8d64f8","#8a65f8","#8867f8"],transcribe:["#f3233e","#f12259","#ee2270","#ea2186","#e6219b","#e121b0","#da22c6","#d122dc","#c723f2"],colour:["#f42335","#e05b1a","#d87d1e","#da9b23","#d2b427","#b4c027","#5bbf23","#20a27c","#1e989b","#1e94b6","#1c8cd9","#577af8","#7371f8","#8568f8","#965df8"]},u=["#d99522","#da9822","#da9b23","#da9f24","#d9a224","#d9a525","#d8a825","#d7ab26","#d6ad26"],B={convert:["#d6f7fd","#ddf5fe","#e1f4fe","#e4f2fe","#e7f1fe","#eaf0fe","#eceffe","#efeefe","#f1edfe"],compress:["#e0f7e4","#def8e7","#dcf8ea","#daf8ed","#d8f8f1","#d7f8f4","#d6f8f7","#d6f8fa","#d6f7fd"],pdf:["#feece7","#feece6","#feece5","#feece3","#feece2","#feede0","#feedde","#feeddc","#feeed9"],edit:["#f2edfe","#f1edfe","#f1edfe","#f1eefe","#f0eefe","#f0eefe","#f0eefe","#f0eefe","#efeefe"],transcribe:["#feebea","#feebec","#feebee","#feeaf0","#feeaf2","#feeaf5","#fee9f9","#fde9fd","#f9eafe"],colour:["#feebe9","#feece5","#feede0","#feeed7","#f7f1d6","#eff3d9","#e5f6df","#dbf8eb","#d6f8f8","#def5fe","#e5f2fe","#ebf0fe","#edeffe","#efeefe","#f1edfe"]},p=["#feeed9","#feeed8","#feeed7","#fdeed6","#fcefd6","#fbefd6","#fbefd6","#faefd6","#f9f0d6"],T={convert:["#138291","#8467bd"],compress:["#2b8748","#138291"],pdf:["#d54322","#a06c10"],edit:["#8567bc","#7b67cd"],transcribe:["#df3140","#9c5cb1"],colour:["#cb4b49","#a06c10","#618110","#138291","#5869ec","#8268bd"]};function C(e,t){return e.name==="light"?t==="menu"?u:m[t]:t==="menu"?e.name==="dark"?b:[e.brand]:t==="compress"?[e.modeCompress,e.modeConvert]:t==="pdf"?[e.modePdf,e.brand]:t==="colour"?e.name==="dark"?g:[e.modeColour,e.violet]:t==="edit"?[e.modeEdit,e.name==="dark"?c:e.violet]:t==="transcribe"?[e.modeTranscribe,e.name==="dark"?l:e.violet]:[e.modeConvert,e.violet]}function y(e,t){if(e.name==="light")return t==="menu"?p:B[t]}function w(e,t){return e.name==="light"?T[t]:C(e,t)}function M(e){return{...e,accent:e.brand,tag:e.brand,label:e.brand}}function R(e,t){let{fg:r,bg:n}=s(e,t);return{...e,accent:r,tag:r,label:r,band:n===""?e.band:n}}function H(e){return e.canvas!==""}function O(e){return e==="dark"?f:e==="light"?o:i}function D(e){return e===""?void 0:e}var _={filled:"\u2501",empty:"\u2501",knob:"\u25CF"};function h(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""?!1:process.stdout.isTTY===!0}function F(){h()||(process.env.FORCE_COLOR="0")}export{v as a,x as b,f as c,o as d,i as e,d as f,k as g,E as h,P as i,S as j,s as k,C as l,y as m,w as n,M as o,R as p,H as q,O as r,D as s,_ as t,h as u,F as v};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a}from"./chunk-HON4OV7M.js";import{b as c}from"./chunk-
|
|
3
|
+
import{a}from"./chunk-HON4OV7M.js";import{b as c}from"./chunk-5B5XXH22.js";import{access as x,readFile as p}from"node:fs/promises";import{join as n,sep as y}from"node:path";function g(){return n(a(),"forge","extensions")}var E=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;async function v(e){if(c(e)!==void 0)try{let u=n(g(),e),t=(await p(n(u,"current"),"utf8")).trim();if(!E.test(t))return;let r=n(u,t),i=JSON.parse(await p(n(r,"manifest.json"),"utf8"));if(typeof i!="object"||i===null)return;let{id:m,version:l,entry:o,kind:s,files:d}=i;if(m!==e||l!==t||s!=="node"&&s!=="exec"||typeof o!="string"||typeof d!="object"||d===null||!(o in d))return;let f=n(r,o);return f.startsWith(`${r}${y}`)?(await x(f),{id:e,version:t,dir:r,entry:f,kind:s}):void 0}catch{return}}export{g as a,E as b,v as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{c as x}from"./chunk-M66BUNYO.js";import{existsSync as l,statSync as h}from"node:fs";import{basename as f,dirname as E,extname as a,isAbsolute as F,join as o,relative as R,resolve as s,sep as k}from"node:path";function y(t){return t.endsWith("/")||t.endsWith(k)||l(t)&&h(t).isDirectory()?!0:a(t)===""}var O=255;function b(t,r){return r==="darwin"||r==="win32"?t.length:Buffer.byteLength(t)}function c(t,r,e=process.platform){if(b(t+r,e)<=O)return t+r;let n="";for(let i of t){if(b(n+i+r,e)>O)break;n+=i}return n+r}function j(t,r){if(s(t)===s(r))return!0;try{let e=h(t),n=h(r);return e.dev===n.dev&&e.ino===n.ino}catch{return!1}}function A(t,r){let e=f(t),n=a(e),i=n?e.slice(0,-n.length):e;return c(i,x(r))}function S(t,r,e){if(!e)return t;let n=R(s(e),r);return!n||n.startsWith("..")?t:o(t,n)}function L(t){let r=s(t.sourcePath),e=A(r,t.target);if(!t.output)return o(s(r,".."),e);let n=F(t.output)?t.output:s(t.output);return y(t.output)?o(S(n,s(r,".."),t.sourceRoot),e):s(n)}function D(t){let r=L(t);if(t.output&&!y(t.output))return r;let e=a(r);return o(s(r,".."),c(f(r,e),`-${t.suffix}${e}`))}function J(t){if(!l(t))return t;let r=s(t,".."),e=f(t),n=a(e),i=n?e.slice(0,-n.length):e;for(let u=1;u<1e4;u++){let g=o(r,c(i,` (${u})${n}`));if(!l(g))return g}throw new Error(`no free name beside ${e}`)}function p(t){let r=s(t,".."),e=f(t),n=a(e);return{dir:r,stem:n?e.slice(0,-n.length):e,ext:n||".pdf"}}function w(t,r){let{dir:e,stem:n,ext:i}=p(s(t));return o(e,c(n,`-${r}${i}`))}function T(t,r){let{dir:e,stem:n,ext:i}=p(s(t)),u=String(r).length;return Array.from({length:r},(g,m)=>o(e,c(n,`-${String(m+1).padStart(u,"0")}${i}`)))}function z(t,r,e,n,i){let{stem:u}=p(s(t)),g=n?S(s(n),s(t,".."),i):s(t,".."),m=x(e),P=String(Math.max(1,...r.map(d=>d+1))).length,I=r.map(d=>o(g,c(u,`-${String(d+1).padStart(P,"0")}${m}`))),[$,...v]=I;if($===void 0)throw new Error("rasterOutputPaths requires at least one selected page");return[$,...v]}function B(t,r,e){if(!e)return[w(t,"extract")];let{dir:n,stem:i,ext:u}=p(s(t));return r.map(g=>o(n,c(i,`-p${g+1}${u}`)))}function C(t){let r=s(t[0]??"merged.pdf");if(new Set(t.map(n=>s(n,".."))).size===1){let n=s(r,"..");return o(n,c(f(n),"-merged.pdf"))}return w(r,"merged")}function N(t,r,e){let n=r?t.map(u=>o(r,f(u))):t,[i]=n;return!e||n.length!==1||i===void 0?n:[o(E(i),`${e}${a(i)}`)]}function G(t,r,e){return N([t],r,e)[0]??t}export{y as a,c as b,j as c,L as d,D as e,J as f,w as g,T as h,z as i,B as j,C as k,N as l,G as m};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as $,h as lt,i as D}from"./chunk-
|
|
3
|
+
import{a as $,h as lt,i as D}from"./chunk-IWFVEMDN.js";import{b as x,c as R,d as H,f as v,g as P,h as X}from"./chunk-QVACE4IE.js";import{i as it}from"./chunk-6L6C3GJU.js";import{D as at,E as st,v as ot}from"./chunk-KAHWYWNT.js";import{d as tt,m as et,o as nt,u as rt}from"./chunk-3UEQ2OX6.js";import{a as Z}from"./chunk-M66BUNYO.js";var xt=[[15,"rose"],[45,"red"],[70,"orange"],[95,"amber"],[120,"yellow"],[140,"lime"],[165,"green"],[185,"teal"],[215,"cyan"],[250,"sky"],[280,"blue"],[295,"indigo"],[315,"violet"],[340,"purple"],[355,"pink"],[360,"rose"]];function w(t){let{C:e,h:n}=v(R(t));return e<.03?"grey":_(n)}function _(t){let e=(t%360+360)%360;return(xt.find(([n])=>e<n)??[360,"rose"])[1]}var Tt=["full","mono","analogous","opposite","split","triad","pastel"],ct={full:"Full set",mono:"Monochromatic",analogous:"Analogous",opposite:"Complementary",split:"Split complementary",triad:"Triadic",pastel:"Pastel"},B={brightness:0,saturation:0,hue:0,contrast:0},At=t=>!!(t.brightness||t.saturation||t.hue||t.contrast),G=[{name:"red",hex:{r:251,g:44,b:54},role:"danger"},{name:"orange",hex:{r:255,g:105,b:0}},{name:"yellow",hex:{r:239,g:177,b:0},role:"warning"},{name:"green",hex:{r:0,g:201,b:80},role:"success"},{name:"teal",hex:{r:0,g:187,b:167}},{name:"blue",hex:{r:43,g:127,b:255},role:"info"},{name:"purple",hex:{r:173,g:70,b:255}},{name:"pink",hex:{r:246,g:51,b:154}}],$t={analogous:[-30,0,30],opposite:[0,180],split:[0,150,210],triad:[0,120,240]},wt=.553,yt=.024,b=t=>v(R(t)),C=(t,e,n)=>H(P({L:t,C:Math.max(0,e),h:(n+360)%360})),K=(t,e)=>(t-e+540)%360-180;function ht(t,e,n){let r=P({L:t,C:e,h:n}),a=R(H(r));return Math.hypot(a.L-r.L,a.a-r.a,a.b-r.b)<.003}function L(t,e){let n=0,r=.4;for(let a=0;a<30;a++){let o=(n+r)/2;ht(t,o,e)?n=o:r=o}return n}function W({L:t,C:e,h:n}){let r=L(t,n);return r>0?Math.min(1,e/r):0}var A=(t,e)=>e>=0?t+(.98-t)*(e/100):t+(t-.05)*(e/100),q=(t,e,n)=>n>=0?t+(Math.max(t,e)-t)*(n/100):t*(1+n/100);function T(t,e){if(!(e.brightness||e.saturation||e.hue))return t;let{L:n,C:r,h:a}=b(t),o=A(n,e.brightness),i=(a+e.hue+360)%360,l=q(r,L(o,i),e.saturation);for(let s=0;s<40&&l>0&&!ht(o,l,i);s++)l-=.005;return C(o,l,i)}function k(t,e,n,r){let a=A(t,r.brightness),o=(n+r.hue+360)%360,i=L(a,o);return C(a,Math.min(i,q(e,i,r.saturation)),o)}function Y(t,e,n){if(!e)return t;let r=b(t[n].rgb).L;return t.map((a,o)=>{if(o===n)return a;let i=b(a.rgb),l=Math.max(.02,Math.min(.995,r+(i.L-r)*(1+e/100))),s=C(l,Math.min(i.C,L(l,i.h)),i.h);return{...a,rgb:s,hex:x(s)}})}function Et(t,e,n,r){return Y(t(T(e,n)),n.contrast,r)}function ut(t,e){let n=b(t),r=G.map(s=>b(s.hex)),a=0;r.forEach((s,c)=>{Math.abs(K(n.h,s.h))<Math.abs(K(n.h,r[a].h))&&(a=c)});let o=r[a],i=Math.max(-10,Math.min(10,K(n.h,o.h)/2)),l=W(n);return G.map((s,c)=>{if(c===a)return{name:s.name,role:s.role,rgb:T(t,e),yours:!0};let h=r[c],p=n.L>=o.L?h.L+(n.L-o.L)*(1-h.L)/(1-o.L):h.L*n.L/o.L,f=A(p,e.brightness),g=(h.h+i+e.hue+360)%360,d=L(f,g),u=Math.min(1,W(h)),S=Math.min(d,q(l*u*d,d,e.saturation));return{name:s.name,role:s.role,rgb:C(f,S,g),yours:!1}})}function St(t,e,n){let r=b(t),a=w(t);if(e==="mono")return[{name:a,rgb:T(t,n),yours:!0},{name:`${a} soft`,rgb:k(r.L,r.C*.5,r.h,n),yours:!1},{name:`${a} dusty`,rgb:k(r.L,r.C*.22,r.h,n),yours:!1}];if(e==="pastel")return ut(t,B).map((l,s)=>{let c=b(l.rgb),h=c.C<.01?b(G[s].hex).h:c.h;return{...l,rgb:k(.86,Math.min(.1,L(.86,h))*.85,h,n)}});let o=W(r);return($t[e]??[0]).map(l=>{if(l===0)return{name:a,rgb:T(t,n),yours:!0};let s=(r.h+l+360)%360,c=o*L(r.L,s);return{name:o>0?_(s):w(k(r.L,c,s,B)),rgb:k(r.L,c,s,n),yours:!1}}).sort((l,s)=>Number(s.yours)-Number(l.yours))}function Lt(t,e,n){let r=b(t).h+e.hue,a=Math.max(0,yt*(1+e.saturation/100));return D(C(A(wt,e.brightness),a,r),n)}function Ot(t,e,n=B,r=$){let a=lt(r);return{rows:(e==="full"?ut(t,n):St(t,e,n)).map(({name:l,role:s,rgb:c,yours:h})=>({name:l,...s?{role:s}:{},steps:Y(D(c,r),n.contrast,a),yours:h})),neutral:Y(Lt(t,n,r),n.contrast,a)}}var M=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),E=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"colour",y='font-family="Inter"',O=t=>`${t[0]?.toUpperCase()??""}${t.slice(1)}`;function mt(t){let e=t==="dark";return{ink:e?"#FAFAFA":"#111111",grey:e?"#A1A1AA":"#71717A",edge:e?"#FFFFFF":"#000000",paper:e?"#18181B":"#FFFFFF"}}var Mt=`<defs><pattern id="checker" width="16" height="16" patternUnits="userSpaceOnUse"><rect width="16" height="16" fill="#FFFFFF"/><rect width="8" height="8" fill="#E5E5E5"/><rect x="8" y="8" width="8" height="8" fill="#E5E5E5"/></pattern></defs>
|
|
4
4
|
`;function I(t,e,n,r="light"){let{ink:a,grey:o,edge:i,paper:l}=mt(r),s=n.length>8?64:104,c=10,h=48+n.length*s+Math.max(0,n.length-1)*c,p=84+s+56,f=s>80?12:10,g=`<text id="title" x="24" y="38" ${y} font-size="15" font-weight="600" fill="${a}">${M(t)}</text><text id="subtitle" x="24" y="58" ${y} font-size="12" fill="${o}">${M(e)}</text>`,d=n.map((u,S)=>`<g id="${E(u.id)}" transform="translate(${24+S*(s+c)} 80)">`+(u.alpha===void 0?"":`<rect id="checker" width="${s}" height="${s}" rx="${f}" fill="url(#checker)"/>`)+`<rect id="swatch" width="${s}" height="${s}" rx="${f}" fill="${u.hex}"`+(u.alpha===void 0?"":` fill-opacity="${u.alpha.toFixed(3)}"`)+` stroke="${i}" stroke-opacity="0.08"/><text id="name" x="1" y="${s+22}" ${y} font-size="13" font-weight="600" fill="${a}">${M(u.name)}</text><text id="value" x="1" y="${s+40}" ${y} font-size="11" fill="${o}">${M(u.value)}</text></g>`).join(`
|
|
5
5
|
`);return`<svg xmlns="http://www.w3.org/2000/svg" width="${h}" height="${p}" viewBox="0 0 ${h} ${p}">
|
|
6
6
|
`+(n.some(u=>u.alpha!==void 0)?Mt:"")+`<g id="${E(t)}">
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{
|
|
3
|
+
import{b as P,d as R,e as B}from"./chunk-CKUIRXDS.js";import{a as w,b as I,c as k,d as $,e as O,f as m}from"./chunk-TMQDQLY7.js";import{e as h}from"./chunk-EHARO6IS.js";import{i as x}from"./chunk-6L6C3GJU.js";import{Y as y,Z as C,_ as v,b as p}from"./chunk-3UEQ2OX6.js";import{a as f}from"./chunk-J7FLFHQJ.js";import{a as l}from"./chunk-EGIKV2GZ.js";import{a as c}from"./chunk-M66BUNYO.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-4VETUGMN.js");return e((await r()).prefs.defaultOutput)}function F(t){if(t.pasteboard)return t.pasteboard;if(!w())throw C();return I()}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 k(o,e.root);if(!a)throw y((await o.peek()).text?"text":"nothing");let s=await x(a.source),n=t.target??s.format,b=E(t,a,s.format,n),i=await R(b,r),g=i.results[0];if(!g||i.failures.length>0)return{report:i,status:"failed"};let u=g.job.outputs[0],d={report:i,output:u,source:{format:s.format,bytes:s.bytes},target:n};if(await $(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-4VETUGMN.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 ${P(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 O(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 B(e.report,r);if(r.json){let o={...h(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};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as m}from"./chunk-
|
|
3
|
+
import{a as m}from"./chunk-EX7KZBI6.js";import{U as l}from"./chunk-3UEQ2OX6.js";import{randomBytes as h}from"node:crypto";import{link as y,mkdir as p,readdir as x,readFile as P,rename as E,rm as c,stat as L,writeFile as S}from"node:fs/promises";import{join as u}from"node:path";var b=720*60*1e3,k=600*1e3,M=200,F=600*1e3;function a(){return u(m(),".locks")}function f(t){return u(a(),`${t}.lock`)}function v(t){if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(n){return n.code==="EPERM"}}async function s(t){try{let n=JSON.parse(await P(t,"utf8"));return typeof n.pid!="number"||typeof n.token!="string"?void 0:n}catch{return}}async function d(t,n){if(n===void 0||!v(n.pid))return!0;let e=await L(t).catch(()=>{});return e!==void 0&&Date.now()-e.mtimeMs>b}async function D(t){let n=`${t}.stale-${h(4).toString("hex")}`;try{await E(t,n)}catch{return}let e=await s(n);e!==void 0&&!await d(n,e)&&await y(n,t).catch(()=>{}),await c(n,{force:!0})}async function A(){let t=await x(a()).catch(()=>[]);for(let n of t){if(!/\.lock\.(stale-)?[0-9a-f]+$/.test(n))continue;let e=u(a(),n),i=await L(e).catch(()=>{});i&&Date.now()-i.mtimeMs>F&&await c(e,{force:!0})}}async function g(t,n){await p(a(),{recursive:!0});let e=f(t),i={pid:process.pid,token:h(8).toString("hex"),at:Date.now(),...n!==void 0?{what:n}:{}},r=`${e}.${i.token}`;await S(r,JSON.stringify(i),{flag:"wx"});try{for(let o=0;o<2;o++){try{return await y(r,e),i}catch(w){if(w.code!=="EEXIST")throw w}if(!await d(e,await s(e)))return;await D(e)}return}finally{await c(r,{force:!0})}}async function T(t,n){let e=f(t);(await s(e))?.token===n.token&&await c(e,{force:!0})}async function _(t){let n=f(t),e=await s(n);if(!(e===void 0||await d(n,e)))return{pid:e.pid,...e.what!==void 0?{what:e.what}:{}}}async function H(t,n,e={}){let i=Date.now()+(e.waitMs??k);await p(a(),{recursive:!0}),await A();let r=await g(t,e.what);for(r===void 0&&(e.waitMs??k)>0&&e.onWait?.();r===void 0;){if(e.signal?.aborted)throw e.signal.reason??new Error("aborted");if(Date.now()>=i)throw l(t,await _(t),e.action??"run");await new Promise(o=>setTimeout(o,M)),r=await g(t,e.what)}try{return await n()}finally{await T(t,r)}}export{k as a,_ as b,H as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{b as v,d as a,e as $,g as B,i as Q}from"./chunk-LNB5D67B.js";import{a as S}from"./chunk-BZXDNDPG.js";import{a as J,j as E,l as I,m as N}from"./chunk-QR6QHTC3.js";import{a as q,b as k,d as C}from"./chunk-6L6C3GJU.js";import{d as M,k as T,s as y}from"./chunk-KAHWYWNT.js";import{b as R,e as d,g as f,h as F,j,k as D,l as g,m as s}from"./chunk-EXLXSKRH.js";import{F as l,t as w}from"./chunk-3UEQ2OX6.js";import{a as u,c as P}from"./chunk-M66BUNYO.js";var b=t=>t.length>0&&t.every(e=>e.kind==="image")?t:void 0;function Pt(t,e){let n=J(t);return n.includes(e)?void 0:w(t,e,n)}function _(t){return{target:t.target??"png",background:typeof t.background=="string"?t.background:"#ffffff",keepMetadata:t.keepMetadata===!0,...typeof t.output=="string"?{output:t.output}:{},...t.roots instanceof Map?{roots:t.roots}:{},...typeof t.quality=="number"?{quality:t.quality}:{}}}var G=()=>({kind:"select",id:"target",label:"Save as",default:"png",choices:[{value:"png",label:"PNG",hint:u.png.hint}]}),pt=t=>t===1?"sharp":`${t}x`,ut=t=>t===1||t===3||t===4?t:2,X={id:"boost",label:"Boost resolution",verb:"Boosting",hint:"sharper, at its size or at 2\xD7, 3\xD7 or 4\xD7",requires:"boost",appliesTo:t=>b(t)!==void 0,unavailable:()=>"images only",options:()=>[{kind:"select",id:"scale",label:"Scale",default:"2",choices:[{value:"1",label:"Sharpen",hint:"the same size, sharper"},{value:"2",label:"2\xD7",hint:"twice the width and height"},{value:"3",label:"3\xD7",hint:"three times the width and height"},{value:"4",label:"4\xD7",hint:"four times the width and height"}]},G()],plan(t,e){let n=b(t);if(!n)return[];let o=_(e),r=ut(Number(e.scale??2));return n.map(i=>({op:"boost",sources:[i],outputs:[d({sourcePath:i.path,target:o.target,suffix:pt(r),...o.output===void 0?{}:{output:o.output},...o.roots?.get(i.path)===void 0?{}:{sourceRoot:o.roots.get(i.path)}})],scale:r,target:o.target,options:{background:o.background,keepMetadata:o.keepMetadata,...o.quality===void 0?{}:{quality:o.quality}}}))}},H={id:"remove-background",label:"Remove background",verb:"Removing",hint:"cut out the subject",requires:"remove-background",appliesTo:t=>b(t)!==void 0,unavailable:()=>"images only",options:()=>[G()],plan(t,e){let n=b(t);if(!n)return[];let o=_(e);return n.map(r=>({op:"remove-background",sources:[r],outputs:[d({sourcePath:r.path,target:o.target,suffix:"cutout",...o.output===void 0?{}:{output:o.output},...o.roots?.get(r.path)===void 0?{}:{sourceRoot:o.roots.get(r.path)}})],target:o.target,options:{background:o.background,keepMetadata:o.keepMetadata,...o.quality===void 0?{}:{quality:o.quality}}}))}};import{dirname as ct}from"node:path";var mt=t=>u[t.format].media==="video",dt=t=>t.length===1&&t[0]?.kind==="image"?t[0]:void 0,lt=t=>t.length===1&&t[0]?.kind==="document"?t[0]:void 0,ft="-small",c={min:30,max:100,step:35},gt=t=>{let e=Math.ceil((t-c.min)/c.step);return Math.min(c.max,c.min+Math.max(0,e)*c.step)},U={id:"compress",label:"Compress",verb:"Compressing",hint:"make it smaller",appliesTo:t=>{if(t.length===1&&t[0]?.kind==="media")return!0;let e=dt(t);if(e!==void 0){let o=u[e.format];return o.lossy||o.quantisable===!0}return(lt(t)?.images?.compressible??0)>0},options(t,e,n){let o=t[0];if(!o)return[];let r=[{kind:"select",id:"mode",label:`Compress ${S(o.path)??"this file"}`,choices:[o.kind==="media"?{value:"quality",label:"By quality"}:{value:"quality",label:"By quality",hint:"pick a level, see the result"},{value:"size",label:"To a target size",hint:"smallest quality that fits"}],default:"quality"}];if(e.mode==="quality"&&o.kind==="media"&&!mt(o))r.push({kind:"slider",id:"bitrate",label:"Quality",min:32,max:320,step:32,default:96});else if(e.mode==="quality"){let i=o.kind==="image"&&u[o.format].quantisable===!0;r.push(i?{kind:"slider",id:"quality",label:"Quality",...c,default:gt(n.quality),points:!0}:{kind:"slider",id:"quality",label:"Quality",min:1,max:100,step:5,default:n.quality})}else if(e.mode==="size")r.push({kind:"text",id:"size",label:"Target size",placeholder:"e.g. 500kb or 2mb"});else return r;return r.push(v(o,n)),r},plan(t,e){let n=e.mode;if(n!=="quality"&&n!=="size")throw l(`compressAction.plan() needs a mode of "quality" or "size", got ${JSON.stringify(n)}.`,"This is a caller bug, not a user-facing condition: walk options() before calling plan().");let o=t[0];if(!o)return[];let r=(S(o.path)??"file").replace(/\.[^.]+$/,""),i=typeof e.destination=="string"?e.destination:ct(o.path),p=o.kind==="media"?$(o.format):o.format,st=`${i}/${R(r,`${ft}${P(p)}`)}`,z=o.kind==="media"?B(e):void 0;return[{op:"convert",sources:[o],target:p,outputs:[st],options:{background:"#ffffff",keepMetadata:!1,...n==="quality"&&typeof e.quality=="number"?{quality:e.quality}:{},compress:{dither:e.dither===!0},...z?{media:z}:{}}}]}};function bt(t,e){if(e.crop){let n=T(e.crop.aspect);if(!e.resize)return n;let o=e.crop.box??M(t,e.crop.aspect);return`${n}-${I(y(o,e.resize))}`}return e.trim&&e.resize?`trimmed-${N(e.resize)}`:e.resize?I(y(t,e.resize)):"trimmed"}function ht(t,e){if(e.trim&&e.crop)throw new Error("planEdit cannot trim and crop the same image");return t.map(n=>{let o=e.target??E(n),r={background:e.background,keepMetadata:e.keepMetadata,...e.quality===void 0?{}:{quality:e.quality},...e.trim?{trim:!0}:{},...e.resize?{resize:e.resize}:{},...e.crop?{crop:e.crop}:{}},i=e.roots?.get(n.path),p=d({sourcePath:n.path,target:o,suffix:bt(n,e),...e.output===void 0?{}:{output:e.output},...i===void 0?{}:{sourceRoot:i}});return{op:"convert",sources:[n],outputs:[s(p,a(e.destination),a(e.name))],target:o,options:r}})}var x=t=>t.length>0&&t.every(e=>e.kind==="image")?t:void 0,yt=t=>typeof t=="object"&&t!==null&&("percent"in t||"width"in t||"height"in t),K=t=>typeof t=="object"&&t!==null&&"aspect"in t&&typeof t.aspect=="object"&&t.aspect!==null&&"w"in t.aspect&&"h"in t.aspect;function A(t,e,n,o){return{id:t,label:e,verb:n,hint:o,appliesTo:r=>x(r)?.every(i=>t==="resize"||i.frames<=1)===!0,unavailable:r=>x(r)?"animated":"images only",options:()=>[],plan(r,i){let p=x(r);return p?t==="crop"&&!K(i.crop)?[]:ht(p,{trim:t==="trim"||i.trim===!0,...yt(i.resize)?{resize:i.resize}:{},...K(i.crop)?{crop:i.crop}:{},...typeof i.target=="string"?{target:i.target}:{},...typeof i.output=="string"?{output:i.output}:{},...i.roots instanceof Map?{roots:i.roots}:{},destination:i.destination,name:i.name,background:typeof i.background=="string"?i.background:"#ffffff",keepMetadata:i.keepMetadata===!0,...typeof i.quality=="number"?{quality:i.quality}:{}}):[]}}}var L=A("trim","Trim edges","Trimming edges","cut empty borders"),V=A("resize","Resize","Resizing","smaller or larger"),W=A("crop","Crop to shape","Cropping","change the shape");var h=t=>t.length===1&&t[0]?.kind==="document"&&t[0].format==="pdf"?t[0]:void 0,Y={id:"split",label:"Split",verb:"Splitting",hint:"into several files",appliesTo:t=>(h(t)?.pages??0)>1,unavailable:t=>h(t)===void 0?"one PDF at a time":"only one page",options(t){let e=h(t);return e?[{kind:"select",id:"mode",label:"How",default:"every-page",choices:[{value:"every-page",label:"Every page",hint:`${e.pages} files`},{value:"every-n",label:"Every N pages",hint:"ask how many"},{value:"points",label:"At points I choose",hint:"grid"}]}]:[]},plan(t,e){let n=h(t);if(!n)return[];let o=Array.isArray(e.cuts)?e.cuts:[],r=C(o,n.pages).length,i=g(F(n.path,r),a(e.destination),a(e.name));return[{op:"split",sources:[n],outputs:i,cuts:o}]}};function Xt(t){return Array.from({length:Math.max(0,t-1)},(e,n)=>n)}function Ht(t,e){if(!Number.isInteger(e)||e<1)throw l("Splitting every N pages needs N to be a whole number, at least 1.");let n=[];for(let o=e;o<t;o+=e)n.push(o-1);return n}var m=t=>t.length===1&&t[0]?.kind==="document"&&t[0].format==="pdf"?t[0]:void 0;function Z(t,e){return Array.isArray(e.pages)?k(e.pages):typeof e.pages=="string"?k(q(e.pages,t.pages)):[]}var tt=t=>({kind:"text",id:"pages",label:"Pages",placeholder:`1-${t.pages}`}),et={id:"extract",label:"Extract",verb:"Extracting",hint:"keep only some pages",appliesTo:t=>m(t)!==void 0,unavailable:()=>"one PDF at a time",options:t=>{let e=m(t);return e?[tt(e),{kind:"select",id:"separate",label:"Output",default:"one",choices:[{value:"one",label:"One file",hint:"all selected pages together"},{value:"many",label:"Separate files",hint:"one per page"}]}]:[]},plan(t,e){let n=m(t);if(!n)return[];let o=Z(n,e),r=e.separate==="many";return[{op:"extract",sources:[n],outputs:g(j(n.path,o,r),a(e.destination),a(e.name)),pages:o,separate:r}]}},ot={id:"delete",label:"Delete",verb:"Deleting",hint:"drop some pages",appliesTo:t=>m(t)!==void 0,unavailable:()=>"one PDF at a time",options:t=>{let e=m(t);return e?[tt(e)]:[]},plan(t,e){let n=m(t);return n?[{op:"delete",sources:[n],outputs:[s(f(n.path,"trimmed"),a(e.destination),a(e.name))],pages:Z(n,e)}]:[]}};var O=t=>t.filter(e=>e.kind==="document"&&e.format==="pdf"),nt={id:"merge",label:"Merge",verb:"Merging",hint:"several files into one",appliesTo:t=>O(t).length>=2&&O(t).length===t.length,unavailable:t=>O(t).length!==t.length?"PDFs only":"needs 2+ files",options:()=>[],plan(t,e){let n=s(D(t.map(o=>o.path)),a(e.destination),a(e.name));return[{op:"merge",sources:t,outputs:[n]}]}};var it=t=>t.length===1&&t[0]?.kind==="document"&&t[0].format==="pdf"?t[0]:void 0,rt={id:"rotate",label:"Rotate",verb:"Rotating",hint:"turn pages",appliesTo:t=>it(t)!==void 0,unavailable:()=>"one PDF at a time",options:()=>[{kind:"select",id:"degrees",label:"Turn",default:"90",choices:[{value:"90",label:"90\xB0 right",hint:"a quarter turn"},{value:"180",label:"180\xB0",hint:"upside down"},{value:"270",label:"90\xB0 left",hint:"a quarter turn back"}]}],plan(t,e){let n=it(t);if(!n)return[];let r=Number(e.degrees??90)/90%4||1;return[{op:"rotate",sources:[n],outputs:[s(f(n.path,"rotated"),a(e.destination),a(e.name))],turns:r}]}};var at=[Q,U,nt,Y,et,ot,rt,L,V,W],de=at.filter(t=>!["convert","compress","trim","resize","crop"].includes(t.id)),kt=[X,H];function le(t,e=new Set){return[...at,...kt.filter(n=>n.requires&&e.has(n.requires))].filter(n=>n.appliesTo(t))}function fe(t,e){return t.appliesTo(e)?void 0:t.unavailable?.(e)}export{Pt as a,X as b,H as c,U as d,ht as e,L as f,V as g,W as h,rt as i,Y as j,Xt as k,Ht as l,at as m,de as n,le as o,fe as p};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{d as f}from"./chunk-
|
|
3
|
+
import{d as f}from"./chunk-AAXBN572.js";import{randomBytes as g}from"node:crypto";import{mkdir as N,readFile as b,rename as x,rm as y,writeFile as k}from"node:fs/promises";import{dirname as l,join as E}from"node:path";var A="https://registry.npmjs.org/forge-terminal/latest",C=1440*60*1e3,R=3e3,O=/^(\d+)\.(\d+)\.(\d+)$/;function a(t){let e=O.exec(t);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:void 0}function P(t,e){let n=a(t),o=a(e);if(!n||!o)return!1;for(let r=0;r<3;r++)if(n[r]!==o[r])return n[r]>o[r];return!1}function D(t,e=process.env){return!(t.updateCheck===!1||e.CI!==void 0&&e.CI!==""&&e.CI!=="false"||e.FORGE_NO_UPDATE_CHECK!==void 0&&e.FORGE_NO_UPDATE_CHECK!=="")}var S=20,_=22,T=200;function U(t){let e=t.codePointAt(0)??0;return e>=32&&(e<127||e>159)}var d=(t,e)=>typeof t=="string"?[...t].filter(U).join("").trim().slice(0,e):"";function p(t){if(!Array.isArray(t))return;let e=t.map(n=>{let{title:o,text:r}=typeof n=="object"&&n!==null?n:{};return{title:d(o,_),text:d(r,T)}}).filter(n=>n.title!==""&&n.text!=="").slice(0,S);return e.length>0?e:void 0}function h(){return E(l(f()),"update-check.json")}async function c(){try{let t=JSON.parse(await b(h(),"utf8"));if(typeof t!="object"||t===null)return;let{checkedAt:e,latest:n,notifiedAt:o,whatsNew:r}=t;if(typeof e!="number")return;let s=typeof n=="string"&&a(n)!==void 0,i=s?p(r):void 0;return{checkedAt:e,...s?{latest:n}:{},...typeof o=="number"?{notifiedAt:o}:{},...i?{whatsNew:i}:{}}}catch{return}}async function F(t){let e=h();await N(l(e),{recursive:!0});let n=`${e}.${g(4).toString("hex")}.tmp`;try{await k(n,`${JSON.stringify(t)}
|
|
4
4
|
`),await x(n,e)}catch(o){throw await y(n,{force:!0}).catch(()=>{}),o}}function L(t,e=Date.now()){return t===void 0?!0:t.checkedAt>e||e-t.checkedAt>C}async function $(t={}){return(await w(t))?.version}async function w(t){let e=t.fetchImpl??fetch,n=AbortSignal.timeout(t.timeoutMs??R),o=t.signal?AbortSignal.any([t.signal,n]):n;try{let r=await e(A,{signal:o,headers:{accept:"application/json"}});if(!r.ok)return;let s=await r.json(),{version:i,whatsNew:m}=s??{};if(typeof i!="string"||!a(i))return;let u=p(m);return u?{version:i,whatsNew:u}:{version:i}}catch{return}}async function G(t={}){let e=await w(t),n=await c(),o=e??(n?.latest!==void 0?n:void 0),r=e?.version??n?.latest,s={checkedAt:t.now??Date.now(),...r!==void 0?{latest:r}:{},...n?.notifiedAt!==void 0?{notifiedAt:n.notifiedAt}:{},...o?.whatsNew!==void 0?{whatsNew:o.whatsNew}:{}};return await F(s).catch(()=>{}),e?.version}async function H(t){let e=await c();return e?.latest===t?e.whatsNew??[]:[]}async function J(t){let e=(await c())?.latest;return e!==void 0&&P(e,t)?e:void 0}export{A as a,C as b,P as c,D as d,S as e,_ as f,T as g,h,c as i,F as j,L as k,$ as l,G as m,H as n,J as o};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{b as h,c as S,d as A,e as R,f as T,g}from"./chunk-QVACE4IE.js";import{F as E}from"./chunk-
|
|
3
|
+
import{b as h,c as S,d as A,e as R,f as T,g}from"./chunk-QVACE4IE.js";import{F as E}from"./chunk-3UEQ2OX6.js";var y={set:"tailwind",start:50,end:950,count:11},O=["tailwind","even","radix"],v=[0,50,100,150,200,250,300,350,400,450],D=[550,600,650,700,750,800,850,900,950,1e3],I=Array.from({length:19},(e,n)=>n+3),$=[20,50,100,150,200,260,330,420,500,560,750,920],N=8;function P({set:e,start:n,end:r,count:o}){if(!O.includes(e))return`The set must be tailwind, even or radix; got ${e}.`;if(e!=="radix"){if(!v.includes(n))return n%50===0?`The start must be from 0 to 450, so the colour (500) stays in the scale; got ${n}.`:`The start must be a multiple of 50; got ${n}.`;if(!D.includes(r))return r%50===0?`The end must be from 550 to 1000, so the colour (500) stays in the scale; got ${r}.`:`The end must be a multiple of 50; got ${r}.`;if(e==="even"&&!I.includes(o))return`An even set has 3 to 21 steps; got ${o}.`}}function d(e){let{set:n,start:r,end:o,count:a}=e;if(n==="radix")return $.map((t,s)=>({step:s+1,at:t}));if(n==="tailwind"){let t=new Set([r,o,500]);for(let s=Math.ceil((r+1)/100)*100;s<o;s+=100)t.add(s);return[...t].sort((s,u)=>s-u).map(s=>({step:s,at:s}))}let i=a-1,f=Math.round(i*(500-r)/(o-r)),c=Math.max(1,Math.min(i-1,f)),p=i-c,b=[];for(let t=0;t<=c;t++)b.push(r+(500-r)*t/c);for(let t=1;t<=p;t++)b.push(500+(o-500)*t/p);for(let t of[10,5,1]){let s=b.map(u=>Math.round(u/t)*t);if(new Set(s).size===s.length)return b.map((u,l)=>({step:s[l],at:u}))}return b.map(t=>({step:t,at:t}))}function _(e){return d(e).map(n=>n.step)}var z=_(y);function K(e){return e.set==="radix"?N:d(e).findIndex(n=>n.at===500)}var W=[[50,1],[100,.86],[200,.68],[300,.46],[400,.22],[500,0]],F=[[500,0],[600,.2],[700,.4],[800,.6],[900,.8],[950,1]];function w(e,n){for(let r=1;r<e.length;r++){let[o,a]=e[r-1],[i,f]=e[r];if(n<=i)return a+(f-a)*(n-o)/(i-o)}return e[e.length-1][1]}var H=.995,U=.35,j=5e-4;function Y(e,n=y){let r=P(n);if(r)throw E(r,"Try: Tailwind, from 50 to 950.");let{L:o,C:a,h:i}=T(S(e)),f=a<j,c=Math.max(.975,o),p=o<.16?.42*o:Math.max(.16,.42*o);return d(n).map(({step:b,at:t})=>{if(t===500)return{step:b,at:t,rgb:{...e},hex:h(e),reference:!0};let s,u;if(t>=50&&t<500){let m=w(W,t);s=o+(c-o)*m,u=a*(1-.88*m)}else if(t<50){let m=(50-t)/50;s=c+(Math.max(H,c)-c)*m,u=a*.12*(1-m)}else if(t<=950){let m=w(F,t);s=o-(o-p)*m,u=a*(1-.45*m)}else{let m=(t-950)/50;s=p*(1-U*m),u=a*.55*(1-.4*m)}for(f&&(u=0);u>0&&!R(g({L:s,C:u,h:i}));)u-=.002;let l=A(g({L:s,C:Math.max(0,u),h:i}));return{step:b,at:t,rgb:l,hex:h(l),reference:!1}})}var x=e=>{let n=e/255;return n<=.04045?n/12.92:((n+.055)/1.055)**2.4},M=({r:e,g:n,b:r})=>.2126*x(e)+.7152*x(n)+.0722*x(r);function L(e,n){let[r,o]=[M(e),M(n)].sort((a,i)=>i-a);return(r+.05)/(o+.05)}function J(e){return e>=7?"AAA":e>=4.5?"AA":e>=3?"large":"fails"}var k={r:255,g:255,b:255},B={r:0,g:0,b:0},C=e=>Math.floor(e*10)/10;function Q(e){return{white:C(L(e,k)),black:C(L(e,B))}}export{y as a,O as b,v as c,D as d,I as e,d as f,_ as g,K as h,Y as i,L as j,J as k,Q as l};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{O as a,P as u,Q as l}from"./chunk-
|
|
3
|
+
import{O as a,P as u,Q as l}from"./chunk-3UEQ2OX6.js";import{spawn as x}from"node:child_process";import{existsSync as c,realpathSync as b}from"node:fs";import{dirname as h,join as E,win32 as d}from"node:path";function f(n,t=process.platform,e=c){if(n===void 0)return!1;if(t==="win32"){let r=/^(.*)[\\/]node_modules[\\/]forge-terminal[\\/]/.exec(n)?.[1];return r!==void 0&&e(d.join(r,"forge.cmd"))}return/\/lib\/node_modules\/forge-terminal\//.test(n)&&!n.includes("/_npx/")}function m(n){if(n!==void 0)try{return b(n)}catch{return n}}function P(n,t=c){let e=E(h(n),"npm");return t(e)?e:"npm"}function R(n,t=c){let e=d.join(d.dirname(n),"node_modules","npm","bin","npm-cli.js");return t(e)?e:void 0}var g=(n,t,e)=>new Promise(r=>{let o="",s=x(n,t,{stdio:["ignore","pipe","pipe"],...e?{signal:e}:{}});s.stdout.setEncoding("utf8").on("data",i=>{o+=i}),s.stderr.setEncoding("utf8").on("data",i=>{o+=i}),s.on("error",i=>r({code:null,output:`${o}
|
|
4
4
|
${i.message}`})),s.on("close",i=>r({code:i,output:o}))});function w(n){return n.split(`
|
|
5
|
-
`).map(e=>e.replace(/^npm (error|ERR!)\s*/,"").trim()).filter(e=>e!==""&&!/^(code|errno|syscall|path|dest|A complete log)/.test(e)).at(-1)??"npm exited without saying why"}async function _(n,t={}){let e=t.platform??process.platform;if(e==="win32")return S(n,t);let r=t.script??m(process.argv[1]);if(!f(r,e))throw a(n);let o=t.npm??P(process.execPath),s=t.run??g,{code:i,output:p}=await s(o,["install","--global",`forge-terminal@${n}`],t.signal);if(i!==0)throw/EACCES|EPERM|permission denied/i.test(p)?u(n,e):l(n,w(p))}async function S(n,t){let e=t.script??m(process.argv[1]);if(!f(e,"win32",t.exists))throw a(n);let r=R(process.execPath,t.exists);if(r===void 0)throw l(n,"npm was not found beside Node");let o=t.run??g,{code:s,output:i}=await o(process.execPath,[r,"install","--global",`forge-terminal@${n}`],t.signal);if(s!==0)throw/EACCES|EPERM|EBUSY|permission denied/i.test(i)?u(n,"win32"):l(n,w(i))}export{f as a,m as b,P as c,R as d,_ as
|
|
5
|
+
`).map(e=>e.replace(/^npm (error|ERR!)\s*/,"").trim()).filter(e=>e!==""&&!/^(code|errno|syscall|path|dest|A complete log)/.test(e)).at(-1)??"npm exited without saying why"}async function _(n,t={}){let e=t.platform??process.platform;if(e==="win32")return S(n,t);let r=t.script??m(process.argv[1]);if(!f(r,e))throw a(n);let o=t.npm??P(process.execPath),s=t.run??g,{code:i,output:p}=await s(o,["install","--global",`forge-terminal@${n}`],t.signal);if(i!==0)throw/EACCES|EPERM|permission denied/i.test(p)?u(n,e):l(n,w(p))}async function S(n,t){let e=t.script??m(process.argv[1]);if(!f(e,"win32",t.exists))throw a(n);let r=R(process.execPath,t.exists);if(r===void 0)throw l(n,"npm was not found beside Node");let o=t.run??g,{code:s,output:i}=await o(process.execPath,[r,"install","--global",`forge-terminal@${n}`],t.signal);if(s!==0)throw/EACCES|EPERM|EBUSY|permission denied/i.test(i)?u(n,"win32"):l(n,w(i))}export{f as a,m as b,P as c,R as d,w as e,_ as f};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{c as h}from"./chunk-
|
|
3
|
+
import{c as h}from"./chunk-YWKMG5WO.js";import{i as P}from"./chunk-6L6C3GJU.js";import{d as y,ga as s}from"./chunk-3UEQ2OX6.js";import{mkdtemp as F,rm as x}from"node:fs/promises";import{tmpdir as z}from"node:os";import{join as v}from"node:path";var f={background:"#ffffff",keepMetadata:!1};function w(e,r,o){switch(e.kind){case"cut":return{op:"convert",sources:[r],outputs:[o],target:"png",options:{...f,...e.trim?{trim:!0}:{},...e.crop?{crop:{aspect:e.crop}}:{},...e.resize?{resize:e.resize}:{}}};case"cutout":return{op:"remove-background",sources:[r],outputs:[o],target:"png",options:f};case"boost":return{op:"boost",sources:[r],outputs:[o],scale:e.scale,target:"png",options:f};case"encode":return{op:"convert",sources:[r],outputs:[o],target:e.target,options:{...f,...e.background?{background:e.background}:{},...e.quality!==void 0?{quality:e.quality}:{},...e.trim?{trim:!0}:{},...e.crop?{crop:{aspect:e.crop}}:{},...e.resize?{resize:e.resize}:{}}}}}async function C(e,r,o,n){let E=n.probe??P,l=await F(v(z(),"forge-preset-")),I={force:n.force,...n.signal?{signal:n.signal}:{},...n.onEvent?{onEvent:n.onEvent}:{}};try{let i=e;for(let[d,t]of r.entries()){let u=d===r.length-1,g=u?o:v(l,`${d}.png`),a=await h([w(t,i,g)],{...I,...u?{}:{force:!0},...u&&t.kind==="encode"&&t.maxBytes?{targetBytes:t.maxBytes}:{}});if(a.cancelled)return{kind:"cancelled"};let m=a.refusals[0];if(m)return{kind:"refused",error:m.error};let p=a.unreachable[0];if(p)return{kind:"unreachable",entry:p};let b=a.failures[0];if(b)return{kind:"failed",pass:t,error:b.error};let c=a.results[0];if(!c)return{kind:"failed",pass:t,error:s(e.path,"no result")};if(u){let j=c.job.op==="convert"?{...c.job,sources:[e]}:c.job;return{kind:"done",result:{...c,job:j}}}let k=await E(g);if(k.kind!=="image")return{kind:"failed",pass:t,error:s(e.path,"not an image")};i=k}return{kind:"failed",pass:{kind:"encode",target:e.format},error:s(e.path,"nothing to run")}}catch(i){return{kind:"failed",pass:r[r.length-1]??{kind:"encode",target:e.format},error:y(i)?i:s(e.path,i)}}finally{await x(l,{recursive:!0,force:!0})}}export{C 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 gt,b as q,d as yt}from"./chunk-SMBK6BTC.js";import{$ as pt,C as ct,F as B,K as ft,X as dt,ba as ut,c as k,ca as mt,d as C,da as lt,e as et,ea as wt,f as rt,g as W,ga as U,h as it,i as nt,j as ot,k as at,l as st,o as I,u as ht,v as j}from"./chunk-3UEQ2OX6.js";import{a as w}from"./chunk-M66BUNYO.js";import{constants as Jt}from"node:fs";import{access as Vt,readFile as Bt,rm as Xt,stat as Zt,writeFile as Gt}from"node:fs/promises";import{dirname as Kt}from"node:path";var Ft=[{w:1,h:1,label:"1:1"},{w:4,h:5,label:"4:5"},{w:16,h:9,label:"16:9"},{w:9,h:16,label:"9:16"}],ue=20,me=10,E=t=>Math.max(1,Math.round(t)),N=(t,e,r)=>Math.min(Math.max(t,e),r);function A(t,e){let r=E(t.width*e.h/e.w),[i,n]=r<=t.height?[t.width,r]:[Math.min(t.width,E(t.height*e.w/e.h)),t.height];return{left:Math.floor((t.width-i)/2),top:Math.floor((t.height-n)/2),width:i,height:n}}var zt=(t,e)=>e.width===t.width&&e.height===t.height;function le(t){return Ft.filter(e=>!zt(t,A(t,e)))}function we(t,e,r,i){let n=A(t,e),o,a;return e.w>=e.h?(o=E(n.width*i/100),a=Math.min(t.height,E(o*e.h/e.w))):(a=E(n.height*i/100),o=Math.min(t.width,E(a*e.w/e.h))),{left:N(Math.round(r.x-o/2),0,t.width-o),top:N(Math.round(r.y-a/2),0,t.height-a),width:o,height:a}}function ge(t,e,r,i){return{...e,left:N(e.left+r,0,t.width-e.width),top:N(e.top+i,0,t.height-e.height)}}function ye(t,e){return{x:e.width<t.width,y:e.height<t.height}}function xe(t){return{x:t.left+t.width/2,y:t.top+t.height/2}}function be(t,e){return Math.round(e.width*e.height*100/(t.width*t.height))}var J=t=>`${t.w}:${t.h}`,Se=t=>`cropped-${t.w}x${t.h}`;function Ie(t){let e=/^(\d{1,3}):(\d{1,3})$/.exec(t.trim()),r=Number(e?.[1]),i=Number(e?.[2]);if(!e||r<1||r>100||i<1||i>100)throw B(`"${t}" is not a shape; it takes two whole numbers from 1 to 100, as W:H.`,"Try --crop 1:1 or --crop 16:9.");return{w:r,h:i}}function Me(t,e,r){let i=r*2,n=new Uint8Array(e*i*3),o=t.alpha?new Uint8Array(e*i):void 0,a=t.width/e,d=t.height/i;for(let s=0;s<i;s++){let h=s*d,l=h+d;for(let p=0;p<e;p++){let f=p*a,u=f+a,x=0,m=0,g=0,c=0,y=0;for(let b=Math.floor(h);b<Math.min(Math.ceil(l),t.height);b++){let L=Math.min(b+1,l)-Math.max(b,h);for(let O=Math.floor(f);O<Math.min(Math.ceil(u),t.width);O++){let Y=b*t.width+O,tt=(Math.min(O+1,u)-Math.max(O,f))*L,R=tt*(t.alpha?(t.alpha[Y]??0)/255:1),H=Y*3;x+=(t.rgb[H]??0)*R,m+=(t.rgb[H+1]??0)*R,g+=(t.rgb[H+2]??0)*R,c+=R,y+=tt}}let z=s*e+p;c>0&&n.set([x/c,m/c,g/c].map(Math.round),z*3),o&&y>0&&(o[z]=Math.round(c*255/y))}}return{cols:e,dotRows:i,rgb:n,...o?{alpha:o}:{}}}function Oe(t){if(w[t].hasAlpha)return;let e=Object.keys(w).filter(r=>w[r].hasAlpha&&r!=="heic").join(", ");return B(`${w[t].label} cannot hold transparency, so a cutout cannot be saved as one.`,`Choose a format that can: ${e}.`)}var xt="1.1.0";function Rt(t,e){let r=t.split(".").map(n=>Number.parseInt(n,10)||0),i=e.split(".").map(n=>Number.parseInt(n,10)||0);for(let n=0;n<Math.max(r.length,i.length);n++){let o=(r[n]??0)-(i[n]??0);if(o!==0)return o>0}return!0}function V(t){return t!==void 0&&Rt(t,xt)?[2,3,4]:[2,4]}function Be(t,e,r){if(t===1||V(e).some(n=>n===t))return;if(r!==void 0&&V(r).some(n=>n===t))return ft("boost",`boost ${t}\xD7`,e,xt);let i=V(e).map(n=>`--boost ${n}`);return B(`No released boost makes ${t}\xD7 yet.`,`Try ${i.slice(0,-1).join(", ")} or ${i.at(-1)}.`)}var kt=16384,Ct=1e8;function bt(t,e,r){let i=Math.max(t,e)*r;if(i>kt)return{side:i};let n=t*r*e*r;if(n>Ct)return{megapixels:Math.round(n/1e6)}}var v=t=>Math.max(1,Math.round(t));function X(t,e){return"percent"in e?{width:v(t.width*e.percent/100),height:v(t.height*e.percent/100)}:"width"in e?{width:v(e.width),height:v(t.height*e.width/t.width)}:{width:v(t.width*e.height/t.height),height:v(e.height)}}function St(t){return bt(t.width,t.height,1)}import{execFile as Nt}from"node:child_process";import{randomBytes as Dt}from"node:crypto";import{mkdtemp as _t,open as It,readFile as $t,rm as Z}from"node:fs/promises";import{tmpdir as Mt}from"node:os";import{join as _}from"node:path";import{promisify as Lt}from"node:util";function S(t){let e;return()=>(e??=t(),e)}var M=S(async()=>(await import("sharp")).default),ze=S(()=>import("./es-T2U7NBLD.js")),Re=S(()=>import("@hyzyla/pdfium")),ke=S(async()=>(await import("./lib-TPEJ5CJJ.js")).default),Ce=S(async()=>(await import("./word-OGQ2KZAJ.js")).default),Ue=S(async()=>(await import("./adm-zip-SQKLKBDP.js")).default),Ne=S(async()=>(await import("./cfb-V6M2PYOD.js")).default);async function Ut(){let t=Object.getOwnPropertyDescriptor(globalThis,"localStorage");if(!t?.configurable)return import("./dist-J2V6ITHG.js");Object.defineProperty(globalThis,"localStorage",{value:void 0,configurable:!0,enumerable:t.enumerable??!1,writable:!0});try{return await import("./dist-J2V6ITHG.js")}finally{Object.defineProperty(globalThis,"localStorage",t)}}var De=S(Ut);var G=Lt(Nt),Et=async()=>({...await import("./paths-5XI5L4KW.js"),...await import("./run-6BK4REXK.js")}),T;async function P(t=process.platform){if(t==="win32")return await(await Et()).installed("heic")!==void 0;if(T!==void 0)return T;try{await G("/usr/bin/sips",["--help"],{timeout:5e3}),T=!0}catch{T=!1}return T}async function $(t,e=process.platform){if(e==="win32")return Ht(t);let r=_(Mt(),`forge-heic-${Dt(8).toString("hex")}.png`),i=async()=>{await Z(r,{force:!0}).catch(()=>{})};try{return await G("/usr/bin/sips",["-s","format","png",t,"--out",r],{timeout:12e4}),{path:r,cleanup:i}}catch(n){throw await i(),n}}async function At(t){let{installed:e,runExtension:r}=await Et(),i=await e("heic");if(i===void 0)throw I(t,"win32");return{ext:i,runExtension:r}}async function Ht(t){let e=await _t(_(Mt(),"forge-heic-")),r=async()=>{await Z(e,{recursive:!0,force:!0}).catch(()=>{})};try{let{ext:i,runExtension:n}=await At(t),o=_(e,"decoded.rgba"),a=_(e,"decoded.png"),{width:d,height:s}=await n(i,["--in",t,"--out",o],{subject:t});return await(await M())(await $t(o),{raw:{width:d,height:s,channels:4}}).png().toFile(a),await Z(o,{force:!0}),{path:a,cleanup:r}}catch(i){throw await r(),i}}var Wt=new Set(["heic","heix","hevc","hevx","heim","heis","mif1","msf1"]),jt=new Set(["avif","avis"]);async function vt(t){let e;try{e=await It(t,"r")}catch{return!1}try{let r=Buffer.alloc(64),{bytesRead:i}=await e.read(r,0,64,0);if(i<12||r.toString("latin1",4,8)!=="ftyp")return!1;let n=Math.min(r.readUInt32BE(0),i),o=[];for(let a=8;a+4<=n;a+=4)o.push(r.toString("latin1",a,a+4));return o.some(a=>jt.has(a))?!1:o.some(a=>Wt.has(a))}catch{return!1}finally{await e.close().catch(()=>{})}}async function Ot(t,e=process.platform){if(e==="win32"){let{ext:a,runExtension:d}=await At(t),s=await d(a,["--info","--in",t],{subject:t});return{width:s.width,height:s.height,hasAlpha:s.hasAlpha??!0}}let{stdout:r}=await G("/usr/bin/sips",["-g","pixelWidth","-g","pixelHeight","-g","hasAlpha",t],{timeout:3e4}),i=Number(/pixelWidth:\s*(\d+)/.exec(r)?.[1]??0),n=Number(/pixelHeight:\s*(\d+)/.exec(r)?.[1]??0),o=await qt(t);return{width:o?n:i,height:o?i:n,hasAlpha:/hasAlpha:\s*yes/i.test(r)}}function*D(t,e,r){let i=e;for(;i+8<=r;){let n=t.readUInt32BE(i),o=8;if(n===1&&i+16<=r?(n=Number(t.readBigUInt64BE(i+8)),o=16):n===0&&(n=r-i),n<o)return;yield{type:t.toString("latin1",i+4,i+8),start:i+o,end:Math.min(i+n,r)},i+=n}}async function qt(t){let e=await It(t,"r");try{let r=Buffer.alloc(262144),{bytesRead:i}=await e.read(r,0,r.length,0),n=[...D(r,0,i)].find(c=>c.type==="meta");if(!n)return!1;let o=[...D(r,n.start+4,n.end)],a=o.find(c=>c.type==="pitm"),d=o.find(c=>c.type==="iprp");if(!a||!d)return!1;let s=r.readUInt8(a.start)===0?r.readUInt16BE(a.start+4):r.readUInt32BE(a.start+4),h=[...D(r,d.start,d.end)],l=h.find(c=>c.type==="ipco"),p=h.find(c=>c.type==="ipma");if(!l||!p)return!1;let f=new Map;if([...D(r,l.start,l.end)].forEach((c,y)=>{c.type==="irot"&&f.set(y+1,r.readUInt8(c.start)&3)}),f.size===0)return!1;let u=r.readUInt8(p.start),x=(r.readUInt8(p.start+3)&1)===1,m=p.start+4,g=r.readUInt32BE(m);m+=4;for(let c=0;c<g&&m<p.end;c++){let y=u<1?r.readUInt16BE(m):r.readUInt32BE(m);m+=u<1?2:4;let z=r.readUInt8(m);m+=1;for(let b=0;b<z;b++){let L=x?r.readUInt16BE(m)&32767:r.readUInt8(m)&127;if(m+=x?2:1,y===s&&(f.get(L)??0)%2===1)return!0}}return!1}catch{return!1}finally{await e.close().catch(()=>{})}}var Qt=new Set(["jpeg","png","webp","avif","heic","gif","tiff"]),Yt=new Set(["jpeg","png","webp","avif","gif","tiff"]),te={jpeg:"jpeg",png:"png",webp:"webp",gif:"gif",tiff:"tiff"};function ee(t,e){if(e.format==="heif")return e.compression==="av1"?"avif":"heic";let r=te[e.format??""];if(!r)throw st(t,e.format??"an unknown format");return r}async function re(t){let e;try{e=await Zt(t)}catch(n){let o=n.code;throw o==="ENOENT"?et(t):o==="EACCES"||o==="EPERM"?W(t):o==="ENOTDIR"?it(t):o==="ELOOP"?nt(t):o==="ENAMETOOLONG"?ot(t):at(t,n)}if(!e.isFile())throw rt(t);try{await Vt(t,Jt.R_OK)}catch{throw W(t)}if(await vt(t)){if(!await P())throw I(t);let n;try{n=await Ot(t)}catch(o){throw j(t,"heic",o)}if(n.width===0||n.height===0)throw j(t,"heic",void 0);return{kind:"image",path:t,format:"heic",width:n.width,height:n.height,bytes:e.size,hasAlpha:n.hasAlpha,frames:1}}let r=await M(),i;try{i=await r(t).metadata()}catch(n){throw ht(t,n)}return{kind:"image",path:t,format:ee(t,i),width:i.autoOrient?.width??i.width??0,height:i.autoOrient?.height??i.height??0,bytes:e.size,hasAlpha:i.hasAlpha??!1,frames:i.pages??1}}function K(t,e,r,i){let n=r??w[e].defaultQuality;if(i&&w[e].quantisable)return ie(t,e,r,i);switch(e){case"jpeg":return t.jpeg({quality:n,mozjpeg:!0});case"webp":return t.webp({quality:n});case"avif":return t.avif({quality:n});case"png":return t.png({compressionLevel:9});case"gif":return t.gif();case"tiff":return t.tiff({compression:"deflate"});case"heic":throw new Error("heic is not writable; the capability graph should have prevented this");case"pdf":throw new Error("pdf is not an image target; the capability graph should have prevented this");case"docx":throw new Error("docx is not an image target; the capability graph should have prevented this");case"doc":throw new Error("doc is not an image target; the capability graph should have prevented this");default:throw new Error(`${e} is not an image target; the capability graph should have prevented this`)}}function ie(t,e,r,{dither:i}){let n=r??100,o=i?1:0;return e==="gif"?t.gif({interFrameMaxError:Math.round(32*(100-n)/100),dither:o}):t.png({palette:!0,quality:n,dither:o,compressionLevel:9,effort:10})}var Q=(t,e)=>t.kind==="image"&&t.frames>1&&w[e].animatable;async function ne(t,e){let r=Kt(e);await q(e);let i=gt(e);try{return await Gt(i,t),await yt(i,e),t.length}catch(n){throw await Xt(i,{force:!0}).catch(()=>{}),ct(e,n)}}async function F(t,e,r,i,n,o){if(t.kind!=="image")throw new Error("pipelineFor received a non-image source");if(n===void 0&&t.format==="heic"&&!await P())throw I(t.path);let a=n===void 0&&t.format==="heic"?await $(t.path):void 0,d=async()=>{await a?.cleanup()},h=(await M())(n??a?.path??t.path,i?{animated:!0}:{});if(h=h.rotate(),r.trim&&(h=h.trim()),r.crop){if(!r.crop.box)throw new Error("pipelineFor needs the crop placed (run does it)");h=h.extract(r.crop.box)}if(r.resize){if(!o&&(r.trim||r.crop))throw new Error("pipelineFor needs the resolved size to resize a cut image");let l=o??X(t,r.resize);h=h.resize(l.width,l.height,{fit:"fill"})}return t.hasAlpha&&!w[e].hasAlpha&&(h=h.flatten({background:r.background})),h=r.keepMetadata?h.keepMetadata():h.keepIccProfile(),{pipeline:h,cleanup:d}}async function ar(t,e){let r={background:"#ffffff",keepMetadata:!1},{pipeline:i,cleanup:n}=await F(t,"png",r,!1);try{await i.png({compressionLevel:1}).toFile(e)}finally{await n()}}async function sr(t,e,r){let{pipeline:i,cleanup:n}=await F(t,e,r,Q(t,e));try{return await K(i,e,r.quality,r.compress).toBuffer()}finally{await n()}}async function oe(t){let e={width:t.width,height:t.height};if(t.frames>1)return{upright:e,trimmed:"animated"};if(t.format==="heic"&&!await P())throw I(t.path);let r=t.format==="heic"?await $(t.path):void 0;try{let i=await M(),{info:n}=await i(r?.path??t.path).rotate().trim().jpeg({quality:1}).toBuffer({resolveWithObject:!0});return n.width===e.width&&n.height===e.height?{upright:e,trimmed:"nothing"}:{upright:e,trimmed:{width:n.width,height:n.height}}}catch(i){throw C(i)?i:U(t.path,i)}finally{await r?.cleanup()}}var Tt=1024;async function ae(t){let e={background:"#ffffff",keepMetadata:!1},{pipeline:r,cleanup:i}=await F(t,"png",e,!1);try{let{data:n,info:o}=await r.resize(Tt,Tt,{fit:"inside",withoutEnlargement:!0}).ensureAlpha().raw().toBuffer({resolveWithObject:!0}),a=o.width*o.height,d=o.channels,s=new Uint8Array(a*3),h=new Uint8Array(a),l=!1;for(let p=0;p<a;p++){for(let f=0;f<3;f++)s[p*3+f]=n[p*d+(d>=4?f:0)]??0;h[p]=n[p*d+d-1]??255,h[p]!==255&&(l=!0)}return{size:{width:t.width,height:t.height},thumb:{width:o.width,height:o.height,rgb:s,...l?{alpha:h}:{}}}}catch(n){throw C(n)?n:U(t.path,n)}finally{await i()}}var Pt=128;async function se(t,e){let{thumb:r,size:i}=t,n=A(r,e),o=await M(),{info:a}=await o(he(r),{raw:{width:r.width,height:r.height,channels:3}}).resize(n.width,n.height,{fit:"cover",position:o.strategy.attention}).raw().toBuffer({resolveWithObject:!0}),d=A(i,e),s=Math.round(-(a.cropOffsetLeft??0)*i.width/r.width),h=Math.round(-(a.cropOffsetTop??0)*i.height/r.height);return{...d,left:Math.min(Math.max(s,0),i.width-d.width),top:Math.min(Math.max(h,0),i.height-d.height)}}function he(t){let{alpha:e}=t;if(!e)return t.rgb;let r=new Uint8Array(t.rgb.length);for(let i=0;i<r.length;i++){let n=(e[Math.floor(i/3)]??255)/255;r[i]=Math.round(Pt+((t.rgb[i]??0)-Pt)*n)}return r}async function ce(t,e){if(t.op!=="convert")throw new Error(`image engine cannot ${t.op}`);let r=t.sources[0],i=t.outputs[0];if(r.kind!=="image")throw new Error("the image engine cannot convert a document source");let n=w[t.target],o=[];e({phase:"reading"});let a=r.frames>1,d=Q(r,t.target);a&&!n.animatable&&o.push({code:"animation-flattened",message:`${k(r.path)} has ${r.frames} frames, and ${n.label} cannot animate. Only the first frame was converted.`});let s=t.options,h;if(s.trim||s.crop||s.resize){let f={width:r.width,height:r.height};if(s.trim&&s.crop)throw new Error("a job cannot both trim and crop");if(s.crop){if(a)throw wt(r.path);let{aspect:u}=s.crop,x=c=>c.width===r.width&&c.height===r.height,m=A(f,u),g=s.crop.box??(x(m)?m:await se(await ae(r),u));if(x(g)){if(!s.resize)throw lt(r.path,J(u));o.push({code:"nothing-cropped",message:`${k(r.path)} is already ${J(u)}; resized only.`});let{crop:c,...y}=s;s=y}else s={...s,crop:{aspect:u,box:g}},f={width:g.width,height:g.height}}if(s.trim){if(a)throw mt(r.path);let{trimmed:u}=await oe(r);if(u==="nothing"){if(!s.resize)throw ut(r.path);o.push({code:"nothing-trimmed",message:`${k(r.path)} has no empty edges; resized only.`})}else u!=="animated"&&(f=u)}if(s.resize&&(h=X(f,s.resize),St(h)))throw dt(r.path,h)}e({phase:"decoding"});let{pipeline:l,cleanup:p}=await F(r,t.target,s,d,void 0,h);try{await q(i),e({phase:"encoding"});let f=await K(l,t.target,s.quality,s.compress).toBuffer();if(s.compress&&f.length>=r.bytes)throw pt(r.path,r.bytes,f.length);e({phase:"writing"});let u=await ne(f,i);return{job:t,outputBytes:u,warnings:o}}catch(f){throw C(f)?f:U(r.path,f)}finally{await p()}}async function fe(t){if(t.format!=="heic")return Bt(t.path);if(!await P())throw I(t.path);let e=await $(t.path);try{return await Bt(e.path)}finally{await e.cleanup()}}async function de(t){if(t.op!=="convert")return;let e=w[t.target];if(!e.lossy&&!(e.quantisable&&t.options.compress))return;let r=t.sources[0];if(r.kind!=="image")return;let i=await fe(r);return{ladder:[{}],measure:async n=>{let{pipeline:o}=await F(r,t.target,n,Q(r,t.target),i);return(await K(o,t.target,n.quality,n.compress).toBuffer()).length}}}var hr={id:"image",reads:Qt,writes:Yt,ops:new Set(["convert"]),probe:re,run:ce,measurer:de};export{Ft as a,ue as b,me as c,A as d,le as e,we as f,ge as g,ye as h,xe as i,be as j,Se as k,Ie as l,Me as m,Oe as n,V as o,Be as p,kt as q,bt as r,X as s,St as t,S as u,M as v,ze as w,Re as x,ke as y,Ce as z,Ue as A,Ne as B,De as C,P as D,$ as E,vt as F,K as G,ne as H,ar as I,sr as J,oe as K,ae as L,se as M,hr as N};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{execFile as O,spawn as B}from"node:child_process";import{access as I,constants as T}from"node:fs/promises";import{join as A}from"node:path";import{promisify as K}from"node:util";function E(e){let[n,r]=(e??"").split("/").map(Number);return!n||!r?0:Math.round(n/r*100)/100}function R(e){let n=e.side_data_list?.find(t=>typeof t.rotation=="number")?.rotation,r=n!==void 0?-n:Number(e.tags?.rotate??0);return(Math.round(r/90)*90%360+360)%360}function S(e){let n=e,r=n.streams??[],t=r.find(o=>o.codec_type==="video"&&o.disposition?.attached_pic!==1),i=r.find(o=>o.codec_type==="audio"),a={duration:Number(n.format?.duration)||Math.max(0,...r.map(o=>Number(o.duration)||0))};if(t){let o=R(t),f=o===90||o===270,s=t.width??0,u=t.height??0;a.video={codec:t.codec_name??"",width:f?u:s,height:f?s:u,fps:E(t.avg_frame_rate)||E(t.r_frame_rate),rotation:o,hdr:t.color_transfer==="arib-std-b67"||t.color_transfer==="smpte2084"}}return i&&(a.audio={codec:i.codec_name??"",channels:i.channels??0,sampleRate:Number(i.sample_rate)||0}),a}var _=K(O);function $(e,n){let r=n.PATH??n.Path??"",t=e==="win32"?";":":",i=r.split(t).filter(Boolean);return e==="darwin"&&i.push("/opt/homebrew/bin","/usr/local/bin"),[...new Set(i)]}var L=e=>process.platform==="win32"?`${e}.exe`:e;async function N(e){try{return await I(e,T.X_OK),!0}catch{return!1}}function D(e){let n=new Set;for(let r of e.split(`
|
|
4
|
+
`)){let t=r.match(/^\s*[A-Z.|]{3,6}\s+(\S+)\s/);t?.[1]&&t[1]!=="="&&n.add(t[1])}return n}async function G(){try{let{installed:e}=await import("./paths-5XI5L4KW.js");return(await e("video"))?.dir}catch{return}}async function J(){let e=await G(),n=[...$(process.platform,process.env),...e?[e]:[]];for(let r of n){let t=A(r,L("ffmpeg")),i=A(r,L("ffprobe"));if(!await N(t)||!await N(i))continue;try{await _(t,["-hide_banner","-version"],{timeout:5e3})}catch{continue}let[m,a]=await Promise.all(["-encoders","-filters"].map(f=>_(t,["-hide_banner",f],{timeout:5e3,maxBuffer:4<<20}).then(({stdout:s})=>D(s)).catch(()=>{}))),o=m&&a?new Set([...m,...a]):void 0;return{ffmpeg:t,ffprobe:i,...o?{has:o}:{}}}}var h,y=null;function v(){return y?Promise.resolve(y.value):(h=(h??J()).then(n=>(n||(h=void 0),n)),h)}function U(e){y=e===null?null:{value:e},h=void 0}async function W(e,n){let r=n??await v();if(!r)throw new Error("ffmpeg is not installed");let{stdout:t}=await _(r.ffprobe,["-v","error","-print_format","json","-show_format","-show_streams",e],{timeout:3e4,maxBuffer:16*1024*1024});return S(JSON.parse(t))}async function Y(e,n,r){let t=r??await v();if(!t)return;let i=Math.max(0,n-15),{stdout:m}=await _(t.ffprobe,["-v","error","-select_streams","v:0","-skip_frame","nokey","-show_entries","frame=pts_time","-of","csv=p=0","-read_intervals",`${i}%${n+.01}`,e],{timeout:3e4,maxBuffer:4*1024*1024}),a=m.split(`
|
|
5
|
+
`).map(o=>Number.parseFloat(o)).filter(o=>Number.isFinite(o)&&o<=n+.001);return a.length?Math.max(...a):void 0}var k=4e3;async function ee(e,n,r,t={}){let i=t.tools??await v();if(!i)return null;let m=Math.max(1,Math.round(n*k)),a=Math.max(1,Math.ceil(m/r)),o=new Array(r).fill(0),f=0,s=Buffer.alloc(0);if(!await new Promise((p,d)=>{let c=B(i.ffmpeg,["-hide_banner","-nostdin","-loglevel","error","-i",e,"-map","0:a:0","-ac","1","-ar",String(k),"-f","s16le","-"],{stdio:["ignore","pipe","pipe"]}),b=()=>c.kill("SIGKILL");t.signal?.addEventListener("abort",b,{once:!0}),c.stdout.on("data",l=>{let w=s.length?Buffer.concat([s,l]):l,F=w.length-w.length%2;for(let x=0;x<F;x+=2){let P=Math.abs(w.readInt16LE(x)),M=Math.min(r-1,Math.floor(f/a));P>(o[M]??0)&&(o[M]=P),f++}s=w.subarray(F)}),c.stderr.resume(),c.on("error",d),c.on("close",l=>{t.signal?.removeEventListener("abort",b),t.signal?.aborted?d(t.signal.reason??new Error("aborted")):p(l===0&&f>0)})}))return null;let g=Math.max(1,...o);return o.map(p=>Math.sqrt(p/g))}async function te(e,n,r,t){await C(["-ss",String(Math.max(0,n)),"-i",e,"-frames:v","1","-y",r],{tools:t})}function j(e){let n;for(let r of e.matchAll(/out_time_us=(\d+)/g))n=Number(r[1])/1e6;return n}var q=4e3;async function C(e,n={}){let{signal:r,onTime:t}=n;if(r?.aborted)throw r.reason??new Error("aborted");let i=n.tools??await v();if(!i)throw new Error("ffmpeg is not installed");let a=["-hide_banner","-nostdin","-loglevel",n.report?"info":"error","-progress","pipe:1","-nostats",...e];return new Promise((o,f)=>{let s=B(i.ffmpeg,a,{stdio:["ignore","pipe","pipe"]}),u="",g=()=>s.kill("SIGKILL");r?.addEventListener("abort",g,{once:!0}),s.stdout.setEncoding("utf8");let p="";s.stdout.on("data",d=>{let c=p+d,b=c.lastIndexOf(`
|
|
6
|
+
`);p=c.slice(b+1);let l=j(c.slice(0,b+1));l!==void 0&&t?.(l)}),s.stderr.setEncoding("utf8"),s.stderr.on("data",d=>{u=(u+d).slice(-q)}),s.on("error",d=>{r?.removeEventListener("abort",g),f(d)}),s.on("close",d=>{r?.removeEventListener("abort",g),r?.aborted?f(r.reason??new Error("aborted")):d===0?o(u):f(new Error(u.trim()||`ffmpeg exited with ${d}`))})})}export{$ as a,D as b,v as c,U as d,W as e,Y as f,ee as g,te as h,j as i,C as j};
|