forge-terminal 0.5.9 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -16
- package/dist/chunks/{about-credits-32BUKO4K.js → about-credits-PWTKZG3Y.js} +1 -1
- package/dist/chunks/args-RHIBM3R3.js +3 -0
- package/dist/chunks/{available-TNMISSBA.js → available-FPBRQ3LS.js} +1 -1
- package/dist/chunks/boot-PHDTJAFT.js +3 -0
- package/dist/chunks/{catalog-FMHWWMUX.js → catalog-G44MXIAF.js} +1 -1
- package/dist/chunks/check-BFHBPCGW.js +3 -0
- package/dist/chunks/chunk-2YU4EI24.js +3 -0
- package/dist/chunks/chunk-3IAJTXYM.js +3 -0
- package/dist/chunks/chunk-3OCPO5V6.js +3 -0
- package/dist/chunks/chunk-42IEPG2K.js +3 -0
- package/dist/chunks/{chunk-WE6KP4FR.js → chunk-4AL5QJLM.js} +1 -1
- package/dist/chunks/chunk-56B3VZCM.js +3 -0
- package/dist/chunks/chunk-56QHX7QR.js +3 -0
- package/dist/chunks/chunk-6NCN7OJ5.js +7 -0
- package/dist/chunks/chunk-6PUV4HSU.js +3 -0
- package/dist/chunks/chunk-72UR37EG.js +3 -0
- package/dist/chunks/chunk-7NP76V4U.js +3 -0
- package/dist/chunks/{chunk-7XFLG32B.js → chunk-AETM2PCZ.js} +1 -1
- package/dist/chunks/chunk-BQV3DSUZ.js +23 -0
- package/dist/chunks/chunk-BSFBZBAI.js +16 -0
- package/dist/chunks/chunk-DC2DHMXO.js +3 -0
- package/dist/chunks/{chunk-WBW6G4N6.js → chunk-DKHBJ52G.js} +1 -1
- package/dist/chunks/chunk-E5VPEBUQ.js +3 -0
- package/dist/chunks/chunk-EYOO35US.js +3 -0
- package/dist/chunks/chunk-F4TUCI6D.js +3 -0
- package/dist/chunks/{chunk-MF3KKEFB.js → chunk-FEJSM3E4.js} +1 -1
- package/dist/chunks/chunk-FGR6QCG5.js +3 -0
- package/dist/chunks/{chunk-W53XNVNH.js → chunk-G2V33TMN.js} +1 -1
- package/dist/chunks/{chunk-ILQDMVJR.js → chunk-G4M2XYFJ.js} +1 -1
- package/dist/chunks/chunk-H332YFSO.js +4 -0
- package/dist/chunks/chunk-HAOKWLD3.js +4 -0
- package/dist/chunks/chunk-I2LPGKUU.js +3 -0
- package/dist/chunks/{chunk-YRXJDFP3.js → chunk-I3C3SRF2.js} +1 -1
- package/dist/chunks/{chunk-SM735FG7.js → chunk-ID4GJZJ6.js} +1 -1
- package/dist/chunks/chunk-ID75X37Z.js +3 -0
- package/dist/chunks/chunk-JPASVE56.js +3 -0
- package/dist/chunks/chunk-JZM37DG2.js +3 -0
- package/dist/chunks/chunk-KPUKMAYK.js +19 -0
- package/dist/chunks/{chunk-SZRSAL64.js → chunk-M7HB4L6L.js} +1 -1
- package/dist/chunks/chunk-NUCGWLOY.js +8 -0
- package/dist/chunks/{chunk-4KGC5ZBZ.js → chunk-OK56WDPA.js} +1 -1
- package/dist/chunks/{chunk-I25E2XDH.js → chunk-OLKPV4WO.js} +1 -1
- package/dist/chunks/chunk-OPDC577C.js +3 -0
- package/dist/chunks/chunk-OQ6DTE56.js +3 -0
- package/dist/chunks/chunk-PA7AG2NK.js +55 -0
- package/dist/chunks/chunk-PNPAHKJR.js +3 -0
- package/dist/chunks/chunk-PON65UTS.js +3 -0
- package/dist/chunks/{chunk-GVVQP3LF.js → chunk-PXCEMDOY.js} +2 -2
- package/dist/chunks/chunk-QMNERJL2.js +3 -0
- package/dist/chunks/{chunk-OXDRJO4V.js → chunk-R6QVLPGC.js} +1 -1
- package/dist/chunks/chunk-S44LAUHZ.js +3 -0
- package/dist/chunks/chunk-SCJ2QXZF.js +80 -0
- package/dist/chunks/{chunk-4MJEEEFA.js → chunk-SJIDFYPT.js} +1 -1
- package/dist/chunks/{chunk-3374PCO5.js → chunk-TQEGSODD.js} +1 -1
- package/dist/chunks/chunk-ULX4ZD2Y.js +3 -0
- package/dist/chunks/chunk-W6QOV4RP.js +6 -0
- package/dist/chunks/chunk-WWWWXOM4.js +3 -0
- package/dist/chunks/{chunk-6RCS3KBP.js → chunk-XIR3VWQY.js} +1 -1
- package/dist/chunks/chunk-XUJLUOGD.js +6 -0
- package/dist/chunks/chunk-Y3DMALHT.js +66 -0
- package/dist/chunks/chunk-YXV3PYVI.js +3 -0
- package/dist/chunks/chunk-Z3PQ5TMU.js +3 -0
- package/dist/chunks/chunk-ZL7E7PZN.js +4 -0
- package/dist/chunks/clip-command-6Q7BTXR5.js +3 -0
- package/dist/chunks/clipboard-QWNPA3GM.js +3 -0
- package/dist/chunks/colour-7HPH6KTY.js +3 -0
- package/dist/chunks/command-JTK4IOS7.js +3 -0
- package/dist/chunks/config-command-DIQTU7DM.js +3 -0
- package/dist/chunks/continue-editing-FTUY6UFG.js +3 -0
- package/dist/chunks/decoded-IXLPWTGZ.js +3 -0
- package/dist/chunks/{entry-BZYPZONY.js → entry-ZF7D32ZI.js} +2 -2
- package/dist/chunks/execute-RP7ZMWLZ.js +3 -0
- package/dist/chunks/extensions-YOZ4IF4E.js +3 -0
- package/dist/chunks/{extensions-command-JZSOQJEV.js → extensions-command-O7UHUJ3Y.js} +1 -1
- package/dist/chunks/ffmpeg-2ZP3GXJX.js +3 -0
- package/dist/chunks/image-6A7FXKIR.js +3 -0
- package/dist/chunks/{install-KGFOAQCU.js → install-4L7JGP3X.js} +1 -1
- package/dist/chunks/install-XJAPLIH2.js +3 -0
- package/dist/chunks/launch-2KSJ4GGN.js +18 -0
- package/dist/chunks/link-inputs-GTEW6ZH4.js +3 -0
- package/dist/chunks/lock-KNR7XS7Q.js +3 -0
- package/dist/chunks/manager-YH5XAMZA.js +4 -0
- package/dist/chunks/{needed-DYERJ72M.js → needed-TB3OC76N.js} +1 -1
- package/dist/chunks/notify-UD7FQAWX.js +3 -0
- package/dist/chunks/{own-2QGMHSKL.js → own-KUGTZ3BV.js} +1 -1
- package/dist/chunks/{paths-6OENILJ4.js → paths-BBUKTDDP.js} +1 -1
- package/dist/chunks/pdfium-MJ65YOXW.js +3 -0
- package/dist/chunks/preferences-7S7YZOFK.js +3 -0
- package/dist/chunks/preset-command-KMKR6KMG.js +3 -0
- package/dist/chunks/registry-657JRJR5.js +3 -0
- package/dist/chunks/run-VJDF5WRF.js +3 -0
- package/dist/chunks/server-6PH2DSFW.js +81 -0
- package/dist/chunks/signals-VY2XE3LV.js +3 -0
- package/dist/chunks/text-layer-PFIDCTEL.js +5 -0
- package/dist/chunks/theme-FVQOSLPB.js +3 -0
- package/dist/chunks/transcribe-FUN2SKRN.js +3 -0
- package/dist/chunks/transcribe-command-KNSUHROE.js +3 -0
- package/dist/chunks/update-command-X4OSYETA.js +3 -0
- package/dist/chunks/update-note-LV7G4CHE.js +3 -0
- package/dist/chunks/video-link-CF7GUA6V.js +3 -0
- package/dist/chunks/watch-command-3C4AWM7A.js +3 -0
- package/dist/helpers/forge-transcribe +0 -0
- package/dist/index.js +16 -15
- package/package.json +15 -3
- package/skills/forge/SKILL.md +7 -3
- package/dist/chunks/args-ZVZQR23M.js +0 -3
- package/dist/chunks/boot-2YFTQOMG.js +0 -3
- package/dist/chunks/check-B6NP7BEM.js +0 -3
- package/dist/chunks/chunk-4RNVZQRC.js +0 -3
- package/dist/chunks/chunk-6KUWZQGG.js +0 -3
- package/dist/chunks/chunk-6MWJO3GB.js +0 -4
- package/dist/chunks/chunk-6PEIZZNE.js +0 -3
- package/dist/chunks/chunk-7FW7JX74.js +0 -36
- package/dist/chunks/chunk-7XDMC7FL.js +0 -72
- package/dist/chunks/chunk-AR3M2PLK.js +0 -3
- package/dist/chunks/chunk-ASLKQXZ2.js +0 -3
- package/dist/chunks/chunk-BKLPRILS.js +0 -3
- package/dist/chunks/chunk-EEQSUBBL.js +0 -3
- package/dist/chunks/chunk-FAUL5L2W.js +0 -3
- package/dist/chunks/chunk-FBVRKMAF.js +0 -3
- package/dist/chunks/chunk-GHYODKA3.js +0 -3
- package/dist/chunks/chunk-H3DIRJFE.js +0 -3
- package/dist/chunks/chunk-HTA25PO2.js +0 -3
- package/dist/chunks/chunk-J7FLFHQJ.js +0 -3
- package/dist/chunks/chunk-K253E723.js +0 -3
- package/dist/chunks/chunk-KH5DHZ2U.js +0 -8
- package/dist/chunks/chunk-L44NRTP4.js +0 -3
- package/dist/chunks/chunk-N32JL4UI.js +0 -3
- package/dist/chunks/chunk-N6RCLJE6.js +0 -4
- package/dist/chunks/chunk-NDYMC3HY.js +0 -66
- package/dist/chunks/chunk-NMECUMJD.js +0 -7
- package/dist/chunks/chunk-OQBIYNGK.js +0 -6
- package/dist/chunks/chunk-Q6KQWJ4J.js +0 -3
- package/dist/chunks/chunk-QQV7CCAY.js +0 -3
- package/dist/chunks/chunk-RCWFUBTG.js +0 -3
- package/dist/chunks/chunk-TFGK7IRZ.js +0 -19
- package/dist/chunks/chunk-TGC24JEW.js +0 -4
- package/dist/chunks/chunk-TLHUFIXD.js +0 -3
- package/dist/chunks/chunk-V6GWPR2A.js +0 -3
- package/dist/chunks/chunk-VJMOZPHW.js +0 -3
- package/dist/chunks/chunk-YPAFAG4W.js +0 -6
- package/dist/chunks/chunk-ZBMJTIYR.js +0 -3
- package/dist/chunks/chunk-ZX5FDZZW.js +0 -55
- package/dist/chunks/clip-command-MDSM6KJP.js +0 -3
- package/dist/chunks/clipboard-IZJTBTSW.js +0 -3
- package/dist/chunks/colour-2MYODUDY.js +0 -3
- package/dist/chunks/command-GAGAD65W.js +0 -3
- package/dist/chunks/config-command-CKPJXJEE.js +0 -3
- package/dist/chunks/continue-editing-M6WESEVB.js +0 -3
- package/dist/chunks/decoded-XWKU23RG.js +0 -3
- package/dist/chunks/execute-7M6WA4W7.js +0 -3
- package/dist/chunks/extensions-E3OUBT36.js +0 -3
- package/dist/chunks/ffmpeg-KDZEPLNA.js +0 -3
- package/dist/chunks/image-R5C3AWHT.js +0 -3
- package/dist/chunks/install-MFYGS5TG.js +0 -3
- package/dist/chunks/launch-VNW4YQ4Z.js +0 -17
- package/dist/chunks/lock-BG3CLOHA.js +0 -3
- package/dist/chunks/manager-L753MI7U.js +0 -4
- package/dist/chunks/notify-NQNNOBFC.js +0 -3
- package/dist/chunks/pdfium-77L526HZ.js +0 -3
- package/dist/chunks/preferences-3P4V2EDX.js +0 -3
- package/dist/chunks/preset-command-UNMXHW5A.js +0 -3
- package/dist/chunks/registry-RS7LQ3UA.js +0 -3
- package/dist/chunks/run-GUFPETHF.js +0 -3
- package/dist/chunks/server-PIXRL5PA.js +0 -77
- package/dist/chunks/text-layer-LHZNDMPZ.js +0 -3
- package/dist/chunks/theme-P3ZE2ZYB.js +0 -3
- package/dist/chunks/transcribe-KXQXEVBJ.js +0 -3
- package/dist/chunks/transcribe-command-JHWN4RWU.js +0 -3
- package/dist/chunks/update-command-DWEBUFT5.js +0 -3
- package/dist/chunks/update-note-CY3LCBCJ.js +0 -3
- package/dist/chunks/watch-command-QGVXM23I.js +0 -3
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a as w,h as nt,i as P}from"./chunk-AETM2PCZ.js";import{b as y,c as F,d as D,f as O,g as K,h as et}from"./chunk-EYOO35US.js";import{a as tt}from"./chunk-I2LPGKUU.js";var ct=[[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 S(t){let{C:e,h:n}=O(F(t));return e<.03?"grey":B(n)}function B(t){let e=(t%360+360)%360;return(ct.find(([n])=>e<n)??[360,"rose"])[1]}var St=["full","mono","analogous","opposite","split","triad","pastel"],rt={full:"Full set",mono:"Monochromatic",analogous:"Analogous",opposite:"Complementary",split:"Split complementary",triad:"Triadic",pastel:"Pastel"},W={brightness:0,saturation:0,hue:0,contrast:0},Mt=t=>!!(t.brightness||t.saturation||t.hue||t.contrast),Y=[{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}}],ut={analogous:[-30,0,30],opposite:[0,180],split:[0,150,210],triad:[0,120,240]},gt=.553,mt=.024,d=t=>O(F(t)),T=(t,e,n)=>D(K({L:t,C:Math.max(0,e),h:(n+360)%360})),G=(t,e)=>(t-e+540)%360-180;function ot(t,e,n){let r=K({L:t,C:e,h:n}),a=F(D(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;ot(t,o,e)?n=o:r=o}return n}function q({L:t,C:e,h:n}){let r=L(t,n);return r>0?Math.min(1,e/r):0}var z=(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 N(t,e){if(!(e.brightness||e.saturation||e.hue))return t;let{L:n,C:r,h:a}=d(t),o=z(n,e.brightness),s=(a+e.hue+360)%360,l=Q(r,L(o,s),e.saturation);for(let i=0;i<40&&l>0&&!ot(o,l,s);i++)l-=.005;return T(o,l,s)}function v(t,e,n,r){let a=z(t,r.brightness),o=(n+r.hue+360)%360,s=L(a,o);return T(a,Math.min(s,Q(e,s,r.saturation)),o)}function J(t,e,n){if(!e)return t;let r=d(t[n].rgb).L;return t.map((a,o)=>{if(o===n)return a;let s=d(a.rgb),l=Math.max(.02,Math.min(.995,r+(s.L-r)*(1+e/100))),i=T(l,Math.min(s.C,L(l,s.h)),s.h);return{...a,rgb:i,hex:y(i)}})}function Lt(t,e,n,r){return J(t(N(e,n)),n.contrast,r)}function at(t,e){let n=d(t),r=Y.map(i=>d(i.hex)),a=0;r.forEach((i,h)=>{Math.abs(G(n.h,i.h))<Math.abs(G(n.h,r[a].h))&&(a=h)});let o=r[a],s=Math.max(-10,Math.min(10,G(n.h,o.h)/2)),l=q(n);return Y.map((i,h)=>{if(h===a)return{name:i.name,role:i.role,rgb:N(t,e),yours:!0};let u=r[h],c=n.L>=o.L?u.L+(n.L-o.L)*(1-u.L)/(1-o.L):u.L*n.L/o.L,x=z(c,e.brightness),m=(u.h+s+e.hue+360)%360,f=L(x,m),$=Math.min(1,q(u)),b=Math.min(f,Q(l*$*f,f,e.saturation));return{name:i.name,role:i.role,rgb:T(x,b,m),yours:!1}})}function pt(t,e,n){let r=d(t),a=S(t);if(e==="mono")return[{name:a,rgb:N(t,n),yours:!0},{name:`${a} soft`,rgb:v(r.L,r.C*.5,r.h,n),yours:!1},{name:`${a} dusty`,rgb:v(r.L,r.C*.22,r.h,n),yours:!1}];if(e==="pastel")return at(t,W).map((l,i)=>{let h=d(l.rgb),u=h.C<.01?d(Y[i].hex).h:h.h;return{...l,rgb:v(.86,Math.min(.1,L(.86,u))*.85,u,n)}});let o=q(r);return(ut[e]??[0]).map(l=>{if(l===0)return{name:a,rgb:N(t,n),yours:!0};let i=(r.h+l+360)%360,h=o*L(r.L,i);return{name:o>0?B(i):S(v(r.L,h,i,W)),rgb:v(r.L,h,i,n),yours:!1}}).sort((l,i)=>Number(i.yours)-Number(l.yours))}function ft(t,e,n){let r=d(t).h+e.hue,a=Math.max(0,mt*(1+e.saturation/100));return P(T(z(gt,e.brightness),a,r),n)}function Rt(t,e,n=W,r=w){let a=nt(r);return{rows:(e==="full"?at(t,n):pt(t,e,n)).map(({name:l,role:i,rgb:h,yours:u})=>({name:l,...i?{role:i}:{},steps:J(P(h,r),n.contrast,a),yours:u})),neutral:J(ft(t,n,r),n.contrast,a)}}var R=t=>tt(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),I=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"colour",M='font-family="Inter"',U=t=>`${t[0]?.toUpperCase()??""}${t.slice(1)}`;function st(t){let e=t==="dark";return{ink:e?"#FAFAFA":"#111111",grey:e?"#A1A1AA":"#71717A",edge:e?"#FFFFFF":"#000000",paper:e?"#18181B":"#FFFFFF"}}var xt=`<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
|
+
`;function H(t,e,n,r="light",a={}){let{ink:o,grey:s,edge:l,paper:i}=st(r),h=Math.min(n.length,a.perRow??n.length),u=Math.ceil(n.length/Math.max(1,h)),c=h>8?64:104,x=10,m=Math.max(c,...n.map(g=>Math.max(g.name.length*8,Math.ceil(g.value.length*6.5)))),f=c+56,$=48+h*m+Math.max(0,h-1)*x,b=84+u*f,k=c>80?12:10,j=`<text id="title" x="24" y="38" ${M} font-size="15" font-weight="600" fill="${o}">${R(t)}</text><text id="subtitle" x="24" y="58" ${M} font-size="12" fill="${s}">${R(e)}</text>`,C=n.map((g,E)=>`<g id="${I(g.id)}" transform="translate(${24+E%h*(m+x)} ${80+Math.floor(E/h)*f})">`+(g.alpha===void 0?"":`<rect id="checker" width="${c}" height="${c}" rx="${k}" fill="url(#checker)"/>`)+`<rect id="swatch" width="${c}" height="${c}" rx="${k}" fill="${g.hex}"`+(g.alpha===void 0?"":` fill-opacity="${g.alpha.toFixed(3)}"`)+` stroke="${l}" stroke-opacity="0.08"/><text id="name" x="1" y="${c+22}" ${M} font-size="13" font-weight="600" fill="${o}">${R(g.name)}</text><text id="value" x="1" y="${c+40}" ${M} font-size="11" fill="${s}">${R(g.value)}</text></g>`).join(`
|
|
5
|
+
`);return`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${b}" viewBox="0 0 ${$} ${b}">
|
|
6
|
+
`+(n.some(g=>g.alpha!==void 0)?xt:"")+`<g id="${I(t)}">
|
|
7
|
+
<rect id="card" width="${$}" height="${b}" rx="0" fill="${i}"/>
|
|
8
|
+
${j}
|
|
9
|
+
${C}
|
|
10
|
+
</g>
|
|
11
|
+
</svg>`}function At(t,e,n="light",r){let a=t.replace(/\.[^.]+$/,""),o=e.length;return H(t,r?`${o} shade${o===1?"":"s"} of ${r}`:`${o} colour${o===1?"":"s"}, most of the image first`,e.map((s,l)=>({id:`${a}-${l+1}`,name:s.hex,value:et(s.rgb),hex:s.hex})),n)}function _(t){if(t.set==="radix")return"Radix 1\u201312";if(t.set==="even")return`${t.start}\u2013${t.end}, ${t.count} even steps`;let e=w;return t.start===e.start&&t.end===e.end?"50\u2013950":`Tailwind ${t.start}\u2013${t.end}`}function Ot(t,e,n="light",r=w){let a=S(t);return H(U(a),`from ${y(t)} \xB7 ${_(r)} in OKLCH`,e.map(o=>({id:`${a}-${o.step}`,name:String(o.step),value:o.hex,hex:o.hex})),n)}function Nt(t,e,n,r=w,a="light"){let{ink:o,grey:s,edge:l,paper:i}=st(a),h=`${U(S(t))} palette`,u=`from ${y(t)} \xB7 ${rt[n]} \xB7 ${_(r)} in OKLCH`,c=[...e.rows.map(p=>({name:p.name,steps:p.steps})),{name:"neutral",steps:e.neutral}],x=c[0]?.steps.map(p=>p.step)??[],m=44,f=6,$=m+10,b=92,k=24+Math.max(92,...c.map(p=>p.name.length*8+12)),j=k+x.length*m+Math.max(0,x.length-1)*f+24,C=Math.max(j,48+Math.ceil(u.length*6.5)),g=b+c.length*$+24+10,E=`<text id="title" x="24" y="38" ${M} font-size="15" font-weight="600" fill="${o}">${R(h)}</text><text id="subtitle" x="24" y="58" ${M} font-size="12" fill="${s}">${R(u)}</text>`,it=x.map((p,A)=>`<text id="step-${p}" x="${k+A*(m+f)+1}" y="${b-10}" ${M} font-size="11" font-weight="600" fill="${s}">${p}</text>`).join(""),lt=c.map((p,A)=>{let V=b+A*$+(A===c.length-1?10:0),X=I(p.name);return`<g id="${X}"><text id="name" x="24" y="${V+m/2+4}" ${M} font-size="13" font-weight="600" fill="${o}">${R(p.name)}</text>`+p.steps.map((Z,ht)=>`<g id="${X}-${Z.step}"><rect id="swatch" x="${k+ht*(m+f)}" y="${V}" width="${m}" height="${m}" rx="8" fill="${Z.hex}" stroke="${l}" stroke-opacity="0.08"/></g>`).join("")+"</g>"}).join(`
|
|
12
|
+
`);return`<svg xmlns="http://www.w3.org/2000/svg" width="${C}" height="${g}" viewBox="0 0 ${C} ${g}">
|
|
13
|
+
<g id="${I(h)}">
|
|
14
|
+
<rect id="card" width="${C}" height="${g}" rx="0" fill="${i}"/>
|
|
15
|
+
${E}
|
|
16
|
+
<g id="steps">${it}</g>
|
|
17
|
+
${lt}
|
|
18
|
+
</g>
|
|
19
|
+
</svg>`}function zt(t,e,n,r="light",a=w){return H(`${U(S(t))} neutral`,`from ${y(t)} \xB7 ${n} tint \xB7 ${_(a)} in OKLCH`,e.map(o=>({id:`neutral-${o.step}`,name:String(o.step),value:o.hex,hex:o.hex})),r)}function It(t,e,n,r="light",a=w){let o=S(t);return H(`${U(o)} alpha`,`from ${y(t)} \xB7 over ${n} \xB7 ${_(a)}`,e.map(s=>({id:`${o}-alpha-${s.step}`,name:String(s.step),value:s.hex8,hex:y(s.rgb),alpha:s.a})),r)}export{St as a,rt as b,W as c,Mt as d,Lt as e,Rt as f,H as g,At as h,Ot as i,Nt as j,zt as k,It as l};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{c as f}from"./chunk-
|
|
3
|
+
import{c as f}from"./chunk-ZL7E7PZN.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};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a as u}from"./chunk-I2LPGKUU.js";var o=[{id:"md",label:"Markdown",ext:".md"},{id:"docx",label:"Word",ext:".docx"},{id:"pdf",label:"PDF",ext:".pdf"},{id:"txt",label:"Text",ext:".txt"}],c="md",m=t=>o.some(e=>e.id===t),h=t=>o.find(e=>e.id===t)?.ext??".md",$=t=>o.find(e=>e.id===t)?.label??"Markdown";function p(t){let e=/^(#{1,3}) (.*)$/.exec(t);if(e)return{kind:"heading",level:e[1]?.length,text:e[2]??""};let s=/^<(https?:\/\/\S+)>$/.exec(t);if(s)return{kind:"link",url:s[1]??""};if(t.startsWith("- "))return{kind:"point",text:t.slice(2)};let r=/^\*\*([0-9:]+)\*\* (.*)$/.exec(t);if(r)return{kind:"timed",time:r[1]??"",text:r[2]??""};let i=/^_(.*)_$/.exec(t);return i?{kind:"aside",text:i[1]??""}:t.trim()===""?{kind:"blank"}:{kind:"text",text:t}}function x(t){return t.kind==="blank"?"":t.kind==="link"?t.url:t.kind==="point"?`- ${t.text}`:t.kind==="timed"?`${t.time} ${t.text}`:t.text}function b(t){return t.split(`
|
|
4
|
+
`).map(e=>x(p(e))).join(`
|
|
5
|
+
`)}var d=t=>u(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),f=['body{font-family:-apple-system,"Helvetica Neue",Helvetica,sans-serif;font-size:11pt;line-height:1.45;color:#1d1d1f}',"h1{font-size:20pt;margin:0 0 6pt}","h2{font-size:15pt;margin:18pt 0 6pt}","h3{font-size:12pt;margin:12pt 0 4pt}","p,ul{margin:0 0 8pt}","li{margin-bottom:4pt}","a{color:#0b57d0}","i{color:#6e6e73}"].join("");function T(t){let e=[],s=[],r=()=>{s.length&&e.push({kind:"list",ordered:!1,items:s}),s=[]};for(let i of t.split(`
|
|
6
|
+
`).map(p)){if(i.kind==="point"){s.push(i.text);continue}r(),i.kind==="heading"?e.push({kind:"heading",level:i.level===1?1:2,text:i.text}):i.kind==="link"?e.push({kind:"paragraph",text:i.url}):i.kind==="timed"?e.push({kind:"paragraph",text:`${i.time} ${i.text}`}):(i.kind==="aside"||i.kind==="text")&&e.push({kind:"paragraph",text:i.text})}return r(),[e]}function y(t){let e=t.split(`
|
|
7
|
+
`).map(p),s=e.find(n=>n.kind==="heading"&&n.level===1),r=[],i=[],a=()=>{i.length&&r.push(`<ul>${i.map(n=>`<li>${n}</li>`).join("")}</ul>`),i=[]};for(let n of e){if(n.kind==="point"){i.push(d(n.text));continue}if(a(),n.kind==="heading")r.push(`<h${n.level}>${d(n.text)}</h${n.level}>`);else if(n.kind==="link"){let l=d(n.url);r.push(`<p><a href="${l}">${l}</a></p>`)}else n.kind==="timed"?r.push(`<p><b>${d(n.time)}</b> ${d(n.text)}</p>`):n.kind==="aside"?r.push(`<p><i>${d(n.text)}</i></p>`):n.kind==="text"&&r.push(`<p>${d(n.text)}</p>`)}return a(),["<!doctype html>",`<html><head><meta charset="utf-8"><title>${s?.kind==="heading"?d(s.text):"Transcript"}</title><style>${f}</style></head><body>`,...r,"</body></html>"].join(`
|
|
8
|
+
`)}export{o as a,c as b,m as c,h as d,$ as e,b as f,d as g,f as h,T as i,y as j};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{
|
|
3
|
+
import{da as a,ea as u,fa as l}from"./chunk-PNPAHKJR.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
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
|
-
var e="https://github.com/AtharvaN16/forge-terminal/releases/download",n="https://github.com/yt-dlp/yt-dlp/releases/download/2026.08.19",i=[{id:"boost",title:"Boost resolution",summary:"Sharpen, or boost resolution 2x or 4x, with a local AI model",minMacos:14,assets:{"darwin-arm64":{version:"1.0.0",url:`${e}/ext-boost-v1.0.0/forge-ext-boost-1.0.0-arm64.tar.gz`,bytes:14866325,sha256:"7af24c92f95b1cd34618adde4a90926c91a8db4347d640be4921f1dc706a9a2e"},"darwin-x64":{version:"1.2.0",url:`${e}/ext-boost-v1.2.0/forge-ext-boost-1.2.0-x64.tar.gz`,bytes:16062122,sha256:"4770833905b4b6c348d1eb18bb735ace9a4f63ace51097c4a7c4b74ec1787998"},"win32-x64":{version:"1.1.0",url:`${e}/ext-boost-v1.1.0/forge-ext-boost-1.1.0-win32-x64.tar.gz`,bytes:22993151,sha256:"abac81a9efe616f33b3bce98db2c0ff0b5597b43a7e3d5ea98968761a2b7a0ce"},"win32-arm64":{version:"1.1.0",url:`${e}/ext-boost-v1.1.0/forge-ext-boost-1.1.0-win32-arm64.tar.gz`,bytes:22936985,sha256:"7d39d93cae52f298423db0b185b0ae3a3bac65464abeb23561d9bcb2ebb3f026"},"linux-x64":{version:"1.3.0",url:`${e}/ext-boost-v1.3.0/forge-ext-boost-1.3.0-linux-x64.tar.gz`,bytes:8305889,sha256:"27f6768abae3ece2a32432129b724066ab86897f75149fafb54ce2f397d107de"},"linux-arm64":{version:"1.3.0",url:`${e}/ext-boost-v1.3.0/forge-ext-boost-1.3.0-linux-arm64.tar.gz`,bytes:6813573,sha256:"ae30dce9b85afc99fc418cea8dc09db07b2657ae987aeae88320423c21b58b8f"}},licence:"Real-ESRGAN general-x4v3 (BSD-3-Clause), ONNX Runtime (MIT), Dawn (BSD-3-Clause), ncnn (BSD-3-Clause)"},{id:"remove-background",title:"Remove background",summary:"Cut the subject out of a photo, on your own computer",minMacos:14,assets:{"darwin-universal":{version:"1.0.0",url:`${e}/ext-remove-background-v1.0.0/forge-ext-remove-background-1.0.0-universal.tar.gz`,bytes:32489,sha256:"9f6e055c0ce25f7504e10c7871e506a813bc75d6536396a675a8c075c4eb4686"},"win32-x64":{version:"1.1.0",url:`${e}/ext-remove-background-v1.1.0/forge-ext-remove-background-1.1.0-win32-x64.tar.gz`,bytes:47185054,sha256:"50e8ec4df513d491fa5c1a08e92919426d78f021aa7641e0e0e8b958fd5ebb32"},"win32-arm64":{version:"1.1.0",url:`${e}/ext-remove-background-v1.1.0/forge-ext-remove-background-1.1.0-win32-arm64.tar.gz`,bytes:47167233,sha256:"1210707480f0119019be21d9bfefe80faa472ebb345e9ae3e560bb7b5c1989a3"},"linux-x64":{version:"1.1.0",url:`${e}/ext-remove-background-v1.1.0/forge-ext-remove-background-1.1.0-linux-x64.tar.gz`,bytes:51958081,sha256:"d3c6cf5e02bd1dfdc73c564acf679d9e4ec0e218386573347e17d2392237c123"},"linux-arm64":{version:"1.1.0",url:`${e}/ext-remove-background-v1.1.0/forge-ext-remove-background-1.1.0-linux-arm64.tar.gz`,bytes:45516645,sha256:"97ebaaad5ee7b13696bfc1e7bf8203942370987d828625e25e095c3f9d350a5c"}},licence:"Apple Vision on a Mac (the helper is MIT); BiRefNet-lite (MIT) and ONNX Runtime (MIT) on Windows and Linux"},{id:"heic",title:"HEIC photos",summary:"Open iPhone photos (HEIC)",assets:{"win32-universal":{version:"1.0.0",url:`${e}/ext-heic-v1.0.0/forge-ext-heic-1.0.0-win32-universal.tar.gz`,bytes:532364,sha256:"6c5f86c1a896d84264fb19371117e6ca6ec9b8726afec03f8c30aa5125a3ad97"},"linux-universal":{version:"1.0.0",url:`${e}/ext-heic-v1.0.0/forge-ext-heic-1.0.0-linux-universal.tar.gz`,bytes:532362,sha256:"fccac1de0c707c18778e7909237747fdd47602f9c6861e600a24d23ac3f5b63c"}},licence:"libheif and libde265 (LGPL-3.0), via libheif-js"},{id:"raw",title:"Camera RAW photos",summary:"Open camera RAW photos",assets:{"win32-universal":{version:"1.0.0",url:`${e}/ext-raw-v1.0.0/forge-ext-raw-1.0.0-win32-universal.tar.gz`,bytes:529983,sha256:"def170f48e004240c0cd23a539e4345d8056ea1f4d9c90f45c2a07573bfad199"},"linux-universal":{version:"1.0.0",url:`${e}/ext-raw-v1.0.0/forge-ext-raw-1.0.0-linux-universal.tar.gz`,bytes:529982,sha256:"35c21be2691cecfcadca944ee8c61736b7d6149130e42492c097115467facd36"}},licence:"LibRaw (LGPL-2.1 or CDDL-1.0), via libraw-wasm (ISC)"},{id:"video",title:"Video and audio",summary:"Convert, compress and trim video and audio (ffmpeg)",minMacos:13,assets:{"darwin-arm64":{version:"1.0.0",url:`${e}/ext-video-v1.0.0/forge-ext-video-1.0.0-arm64.tar.gz`,bytes:24926308,sha256:"6be130647a9a12272c64eacb6a766cf977d80137f84825435ff62f33c464988a"}},licence:"FFmpeg (GPL-2.0-or-later) with x264 (GPL-2.0), LAME (LGPL-2.0), Opus and libvpx (BSD), zimg (WTFPL)"},{id:"yt-dlp",title:"
|
|
3
|
+
var e="https://github.com/AtharvaN16/forge-terminal/releases/download",n="https://github.com/yt-dlp/yt-dlp/releases/download/2026.08.19",i=[{id:"boost",title:"Boost resolution",summary:"Sharpen, or boost resolution 2x or 4x, with a local AI model",minMacos:14,assets:{"darwin-arm64":{version:"1.0.0",url:`${e}/ext-boost-v1.0.0/forge-ext-boost-1.0.0-arm64.tar.gz`,bytes:14866325,sha256:"7af24c92f95b1cd34618adde4a90926c91a8db4347d640be4921f1dc706a9a2e"},"darwin-x64":{version:"1.2.0",url:`${e}/ext-boost-v1.2.0/forge-ext-boost-1.2.0-x64.tar.gz`,bytes:16062122,sha256:"4770833905b4b6c348d1eb18bb735ace9a4f63ace51097c4a7c4b74ec1787998"},"win32-x64":{version:"1.1.0",url:`${e}/ext-boost-v1.1.0/forge-ext-boost-1.1.0-win32-x64.tar.gz`,bytes:22993151,sha256:"abac81a9efe616f33b3bce98db2c0ff0b5597b43a7e3d5ea98968761a2b7a0ce"},"win32-arm64":{version:"1.1.0",url:`${e}/ext-boost-v1.1.0/forge-ext-boost-1.1.0-win32-arm64.tar.gz`,bytes:22936985,sha256:"7d39d93cae52f298423db0b185b0ae3a3bac65464abeb23561d9bcb2ebb3f026"},"linux-x64":{version:"1.3.0",url:`${e}/ext-boost-v1.3.0/forge-ext-boost-1.3.0-linux-x64.tar.gz`,bytes:8305889,sha256:"27f6768abae3ece2a32432129b724066ab86897f75149fafb54ce2f397d107de"},"linux-arm64":{version:"1.3.0",url:`${e}/ext-boost-v1.3.0/forge-ext-boost-1.3.0-linux-arm64.tar.gz`,bytes:6813573,sha256:"ae30dce9b85afc99fc418cea8dc09db07b2657ae987aeae88320423c21b58b8f"}},licence:"Real-ESRGAN general-x4v3 (BSD-3-Clause), ONNX Runtime (MIT), Dawn (BSD-3-Clause), ncnn (BSD-3-Clause)"},{id:"remove-background",title:"Remove background",summary:"Cut the subject out of a photo, on your own computer",minMacos:14,assets:{"darwin-universal":{version:"1.0.0",url:`${e}/ext-remove-background-v1.0.0/forge-ext-remove-background-1.0.0-universal.tar.gz`,bytes:32489,sha256:"9f6e055c0ce25f7504e10c7871e506a813bc75d6536396a675a8c075c4eb4686"},"win32-x64":{version:"1.1.0",url:`${e}/ext-remove-background-v1.1.0/forge-ext-remove-background-1.1.0-win32-x64.tar.gz`,bytes:47185054,sha256:"50e8ec4df513d491fa5c1a08e92919426d78f021aa7641e0e0e8b958fd5ebb32"},"win32-arm64":{version:"1.1.0",url:`${e}/ext-remove-background-v1.1.0/forge-ext-remove-background-1.1.0-win32-arm64.tar.gz`,bytes:47167233,sha256:"1210707480f0119019be21d9bfefe80faa472ebb345e9ae3e560bb7b5c1989a3"},"linux-x64":{version:"1.1.0",url:`${e}/ext-remove-background-v1.1.0/forge-ext-remove-background-1.1.0-linux-x64.tar.gz`,bytes:51958081,sha256:"d3c6cf5e02bd1dfdc73c564acf679d9e4ec0e218386573347e17d2392237c123"},"linux-arm64":{version:"1.1.0",url:`${e}/ext-remove-background-v1.1.0/forge-ext-remove-background-1.1.0-linux-arm64.tar.gz`,bytes:45516645,sha256:"97ebaaad5ee7b13696bfc1e7bf8203942370987d828625e25e095c3f9d350a5c"}},licence:"Apple Vision on a Mac (the helper is MIT); BiRefNet-lite (MIT) and ONNX Runtime (MIT) on Windows and Linux"},{id:"heic",title:"HEIC photos",summary:"Open iPhone photos (HEIC)",assets:{"win32-universal":{version:"1.0.0",url:`${e}/ext-heic-v1.0.0/forge-ext-heic-1.0.0-win32-universal.tar.gz`,bytes:532364,sha256:"6c5f86c1a896d84264fb19371117e6ca6ec9b8726afec03f8c30aa5125a3ad97"},"linux-universal":{version:"1.0.0",url:`${e}/ext-heic-v1.0.0/forge-ext-heic-1.0.0-linux-universal.tar.gz`,bytes:532362,sha256:"fccac1de0c707c18778e7909237747fdd47602f9c6861e600a24d23ac3f5b63c"}},licence:"libheif and libde265 (LGPL-3.0), via libheif-js"},{id:"raw",title:"Camera RAW photos",summary:"Open camera RAW photos",assets:{"win32-universal":{version:"1.0.0",url:`${e}/ext-raw-v1.0.0/forge-ext-raw-1.0.0-win32-universal.tar.gz`,bytes:529983,sha256:"def170f48e004240c0cd23a539e4345d8056ea1f4d9c90f45c2a07573bfad199"},"linux-universal":{version:"1.0.0",url:`${e}/ext-raw-v1.0.0/forge-ext-raw-1.0.0-linux-universal.tar.gz`,bytes:529982,sha256:"35c21be2691cecfcadca944ee8c61736b7d6149130e42492c097115467facd36"}},licence:"LibRaw (LGPL-2.1 or CDDL-1.0), via libraw-wasm (ISC)"},{id:"video",title:"Video and audio",summary:"Convert, compress and trim video and audio (ffmpeg)",minMacos:13,assets:{"darwin-arm64":{version:"1.0.0",url:`${e}/ext-video-v1.0.0/forge-ext-video-1.0.0-arm64.tar.gz`,bytes:24926308,sha256:"6be130647a9a12272c64eacb6a766cf977d80137f84825435ff62f33c464988a"}},licence:"FFmpeg (GPL-2.0-or-later) with x264 (GPL-2.0), LAME (LGPL-2.0), Opus and libvpx (BSD), zimg (WTFPL)"},{id:"yt-dlp",title:"Video links",summary:"Videos from links, to save, edit or transcribe: yt-dlp fetches them",minMacos:13,assets:{"darwin-universal":{version:"2026.08.19",url:`${n}/yt-dlp_macos`,bytes:37146048,sha256:"0f192b7ec147ab6288885d6351d9ab67367640029b4377576ef46dd79cf7b202",binary:"yt-dlp"},"linux-x64":{version:"2026.08.19",url:`${n}/yt-dlp_linux`,bytes:40446224,sha256:"58162f9bfdc27458ea47bfcb311cf47028f17d8154a8bf7d689861d46399230a",binary:"yt-dlp"},"linux-arm64":{version:"2026.08.19",url:`${n}/yt-dlp_linux_aarch64`,bytes:40167448,sha256:"b16e4dab368a816cd05d477d698a605a6ae87ccee1c8ffd38fa21d7254141fcc",binary:"yt-dlp"},"win32-x64":{version:"2026.08.19",url:`${n}/yt-dlp.exe`,bytes:17840399,sha256:"66674953fe251b89f4d08c5f0e35e0728679bd67ab3d7d05c0562af101dd3e7a",binary:"yt-dlp.exe"},"win32-arm64":{version:"2026.08.19",url:`${n}/yt-dlp_arm64.exe`,bytes:21159286,sha256:"05b438997bafc3affdfda9d041353c9d73e04dc842207254b655b0887c4445b0",binary:"yt-dlp.exe"}},licence:"yt-dlp (Unlicense); its bundled Python and libraries under their own licences"},{id:"whisper",title:"Speech to text (whisper.cpp)",summary:"Transcribe video and sound on this computer, with whisper.cpp",minMacos:13,assets:{"darwin-universal":{version:"1.0.0",url:`${e}/ext-whisper-v1.0.0/forge-ext-whisper-1.0.0-universal.tar.gz`,bytes:61123538,sha256:"f521e829afdbcf56da901bd9df5f7644d9903489a2167c3cf75c72cab98629ad"},"win32-x64":{version:"1.0.0",url:`${e}/ext-whisper-v1.0.0/forge-ext-whisper-1.0.0-win32-x64.tar.gz`,bytes:60751383,sha256:"930014128158e14903413dce5b15b1a9853d6257fd6998da5ecedffb8a435c2f"},"win32-arm64":{version:"1.0.0",url:`${e}/ext-whisper-v1.0.0/forge-ext-whisper-1.0.0-win32-arm64.tar.gz`,bytes:58197088,sha256:"f11f1fdcc07816033558ebc89d19e31f60a4672b0e239a67e18160d205cc4460"},"linux-arm64":{version:"1.0.0",url:`${e}/ext-whisper-v1.0.0/forge-ext-whisper-1.0.0-linux-arm64.tar.gz`,bytes:57902587,sha256:"17f793a111809b81f7761a7c226be1f9c71aa23701030e0616663ed411d0b827"},"linux-x64":{version:"1.0.0",url:`${e}/ext-whisper-v1.0.0/forge-ext-whisper-1.0.0-linux-x64.tar.gz`,bytes:58051297,sha256:"23ef0a03fa46364a85b485f03234327e6a6cc9c8b31e8ac86f6abb9dfad8f82e"}},licence:"whisper.cpp and ggml (MIT), OpenAI Whisper base model (MIT)"},{id:"read-text",title:"Read text",summary:"Read the text of pictures and PDFs on this computer",minMacos:13,assets:{"darwin-arm64":{version:"1.1.0",url:`${e}/ext-read-text-v1.1.0/forge-ext-read-text-1.1.0-arm64.tar.gz`,bytes:42705161,sha256:"5fea76dcbe7ea8b52feb2f42796ca831de8237db14cc13f541fcecf310552599"},"darwin-x64":{version:"1.1.0",url:`${e}/ext-read-text-v1.1.0/forge-ext-read-text-1.1.0-x64.tar.gz`,bytes:43898855,sha256:"028e8643d7d96c90dc030124a5c2a2348a9549560017f10b5b49aff50382bb1e"},"win32-x64":{version:"1.1.0",url:`${e}/ext-read-text-v1.1.0/forge-ext-read-text-1.1.0-win32-x64.tar.gz`,bytes:41461196,sha256:"39a1da83498d9858cebc3202f884ca852954ffee01383af90efd9e99dd752e6d"},"win32-arm64":{version:"1.1.0",url:`${e}/ext-read-text-v1.1.0/forge-ext-read-text-1.1.0-win32-arm64.tar.gz`,bytes:41540477,sha256:"ee551378b14c199b4528511d5a0066e29a11397caf4f5c7fb801eeb40544cb25"},"linux-x64":{version:"1.1.0",url:`${e}/ext-read-text-v1.1.0/forge-ext-read-text-1.1.0-linux-x64.tar.gz`,bytes:44859772,sha256:"b5d1158d06dc008e1986a0684049911194e97b72f35d01c2110d71e0d39b446a"},"linux-arm64":{version:"1.1.0",url:`${e}/ext-read-text-v1.1.0/forge-ext-read-text-1.1.0-linux-arm64.tar.gz`,bytes:39842973,sha256:"bfa94581c43f9d9760d6ca33f7e19dc31e58732ac6c07bf89fe433ac594d8176"}},licence:"PP-OCRv4 detection and PP-OCRv5 and PP-OCRv6 recognition (Apache-2.0, PaddlePaddle; ONNX by RapidOCR and PaddlePaddle), ONNX Runtime (MIT)"}];function b(a=process.platform){return a==="win32"?"PC":a==="darwin"?"Mac":"computer"}function f(a=process.platform){return a==="win32"?"Windows":a==="darwin"?"macOS":a==="linux"?"Linux":"this system"}var l=["darwin","win32","linux"];function o(a){return i.find(r=>r.id===a)}function d(a,r=process.platform,t=process.arch){let s=a.assets;return s[`${r}-${t}`]??s[`${r}-universal`]}function c(a,r=process.platform){return Object.keys(a.assets).some(t=>t.startsWith(`${r}-`))}function u(a,r=process.platform,t){let s=o(a);return s===void 0||!c(s,r)?!1:t===void 0||d(s,r,t)!==void 0}export{i as a,b,f as c,l as d,o as e,d as f,c as g,u as h};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a as Q,b as X,f as Y}from"./chunk-6PUV4HSU.js";import{a as A,b as O}from"./chunk-42IEPG2K.js";import{B as C,C as _,E as H,F as U,G as V,b as J,c as W,w as $,y as q,z as N}from"./chunk-YXV3PYVI.js";import{b as j}from"./chunk-56QHX7QR.js";import{b as G}from"./chunk-3OCPO5V6.js";import{d as S}from"./chunk-Z3PQ5TMU.js";import{a as L}from"./chunk-TQEGSODD.js";import{f as K,g as T,h as D}from"./chunk-JPASVE56.js";import{b as P}from"./chunk-JZM37DG2.js";import{d as R}from"./chunk-PNPAHKJR.js";import{a as z}from"./chunk-FGR6QCG5.js";import{existsSync as ye}from"node:fs";import{existsSync as M}from"node:fs";import{basename as re,dirname as se,extname as ie,join as ae}from"node:path";var le={images:"an image",pdfs:"a PDF",documents:"a document",videos:"a video",audio:"audio",other:"a file Forge reads"};function ce(e){let t=Object.keys(e).filter(s=>e[s]);if(t.length===0)return"not supported";let o=t.map(s=>le[s]);return`not ${o.length===1?o[0]:`${o.slice(0,-1).join(", ")} or ${o.at(-1)}`}`}function fe(e){return e.kind==="document"?e.format==="pdf"?"no images to shrink":"nothing to compress":`${R[e.format].label} is lossless`}function de(e,t,o){if(e.kind!=="image")return{left:"images only"};let s=e,r=o===void 0?{}:{output:o};if(t.tool==="sharpen"||t.tool==="boost"){let l=t.tool==="sharpen"?1:t.scale??2;if(K(s.width,s.height,l))return{left:l===1?"too large":`too large for ${l}\xD7`};let[c]=J.plan([s],{scale:String(l),target:S(s),...r});return c?{job:c}:{left:"not supported"}}if(t.tool==="cutout"){let[l]=W.plan([s],{target:"png",...r});return l?{job:l}:{left:"not supported"}}if(t.tool==="rotate"){if(s.frames>1)return{left:"animated"};let[l]=H.plan([s],{turn:t.turn??90,...r});return l?{job:l}:{left:"not supported"}}if(t.tool==="deband"){if(s.frames>1)return{left:"animated"};let[l]=V.plan([s],{deband:t.level??T[D].id,target:S(s),...r});return l?{job:l}:{left:"not supported"}}if(t.tool==="dither"){if(!N(s))return{left:"animated"};let[l]=U.plan([s],{dither:t.colours??$[0],target:q(s),...r});return l?{job:l}:{left:"not supported"}}if(t.tool==="trim"&&s.frames>1)return{left:"animated"};let n=t.tool==="trim"?C:_,[i]=n.plan([s],{target:S(s),...t.resize?{resize:t.resize}:{},...r});return i?{job:i}:{left:"not supported"}}function ue(e,t,o){if(t.op==="edit")return de(e,t,o);if(e.kind==="media")return{left:"one at a time"};let s=o===void 0?{}:{destination:o};if(t.op==="compress"){if(!A.appliesTo([e]))return{left:fe(e)};if(t.targetBytes!==void 0&&e.bytes<=t.targetBytes)return{left:"already under that size"};let[i]=A.plan([e],{mode:t.targetBytes===void 0?"quality":"size",...t.quality===void 0?{}:{quality:t.quality},...s});return i?{job:i}:{left:"not supported"}}let r=t.answers[X(e)];if(!r)return{left:ce(t.answers)};if(e.format===r.target)return{left:`already ${R[r.target].label}`};if(!L(e).includes(r.target))return{left:`can\u2019t become ${R[r.target].label}`};let[n]=O.plan([e],{target:r.target,...r.quality===void 0?{}:{quality:r.quality},...r.dpi===void 0?{}:{dpi:String(r.dpi)},pages:"all",...s});return n?.op==="convert"?{job:n}:{left:"not supported"}}function pe(e,t){if(!t(e))return e;let o=ie(e),s=re(e,o);for(let r=1;;r++){let n=ae(se(e),P(s,` (${r})${o}`));if(!t(n)&&!M(n))return n}}function me(e,t,o,s={}){let r=s.existing??"leave",n=ue(e,t,s.destination);if(!("job"in n))return n;let{job:i}=n,l=i.outputs.some(f=>M(f)&&!o.has(f));if(l&&r==="leave")return{left:t.op==="compress"?"already compressed":t.op==="edit"?"already edited":"already converted"};let c=r==="number"?f=>o.has(f)||M(f):f=>o.has(f);i.outputs=i.outputs.map(f=>pe(f,c));for(let f of i.outputs)o.add(f);return l&&r==="ask"?{job:i,taken:!0}:{job:i}}function F(e,t,o,s={}){let r=[],n=[],i=[];for(let l of e){let c=me(l,t,o,s);"job"in c?(r.push(c.job),c.taken&&i.push(c.job)):n.push({path:l.path,reason:c.left})}return{jobs:r,left:n,taken:i}}async function Z(e,t,o={}){let s=new Set,r=o.existing??"leave",{jobs:n,left:i}=F(e,t,s,{destination:o.destination,existing:r});return{outcome:await j(n,{force:r==="replace",...t.op==="compress"&&t.targetBytes!==void 0?{targetBytes:t.targetBytes}:{},...o.concurrency===void 0?{}:{concurrency:o.concurrency},...o.onEvent?{onEvent:o.onEvent}:{},...o.signal?{signal:o.signal}:{}}),left:i,claimed:s,jobs:n}}function ee(e,t){let{outcome:o,left:s}=t,r=new Map;for(let n of o.results){let i=n.job.sources[0].path;r.set(i,{path:i,state:"done",result:n})}for(let n of[...o.refusals,...o.failures])if(n.error.code==="cannot-compress-more"){let i=n.error.short==="nothing written"?"can\u2019t get smaller":"already under that size";r.set(n.path,{path:n.path,state:"left",reason:i})}else n.error.code==="nothing-to-trim"?r.set(n.path,{path:n.path,state:"left",reason:"no empty edges"}):n.error.code==="no-sound"?r.set(n.path,{path:n.path,state:"left",reason:"no sound"}):r.set(n.path,{path:n.path,state:"failed",reason:n.error.title.toLowerCase()});for(let n of o.unreachable){let i=n.job.sources[0].path;r.set(i,{path:i,state:"left",reason:`can\u2019t get below ${z(n.smallest)}`})}for(let n of s)r.set(n.path,{path:n.path,state:"left",reason:n.reason});return e.map(n=>r.get(n.path)??{path:n.path,state:"left",reason:o.cancelled?"stopped":"not run"})}import{watch as ge}from"node:fs";import{readdir as he,stat as te}from"node:fs/promises";import{join as be,resolve as k}from"node:path";function ne(e,t,o){let s=k(e),r=o.settleMs??1e3,n=o.pollMs??500,i=new Set([...t].map(u=>k(u))),l=new Map,c=new Map,f=!1,v=!1,x=!1,y=async()=>{if(!f){if(v){x=!0;return}v=!0;try{let u=await he(s,{withFileTypes:!0}).catch(()=>[]),d=new Set;for(let p of u){if(!p.isFile()||Q(p.name))continue;let g=be(s,p.name);if(d.add(g),i.has(g)||o.ignore?.(g))continue;let h=await te(g).catch(()=>{});if(!h||f)continue;let w=Date.now(),b=c.get(g);if(b){if(b.size===h.size&&b.mtimeMs===h.mtimeMs)continue;c.delete(g)}let m=l.get(g);if(!m||m.size!==h.size||m.mtimeMs!==h.mtimeMs){l.set(g,{size:h.size,mtimeMs:h.mtimeMs,since:w});continue}w-m.since<r||(l.delete(g),i.add(g),o.onFile(g))}for(let p of[...i,...l.keys(),...c.keys()])d.has(p)||(i.delete(p),l.delete(p),c.delete(p))}finally{v=!1,x&&!f&&(x=!1,y())}}},E=setInterval(()=>{y()},n),a;try{a=ge(s,{persistent:!1},()=>{y()}),a.on("error",()=>{})}catch{}return y(),{again(u){let d=k(u);f||!i.has(d)||te(d).then(p=>{f||!i.has(d)||(i.delete(d),c.set(d,{size:p.size,mtimeMs:p.mtimeMs}))}).catch(()=>{})},close(){f=!0,clearInterval(E),a?.close()}}}var I=e=>"op"in e&&(e.op==="convert"||e.op==="compress"||e.op==="edit")?e:{op:"convert",answers:e};function ve(e,t,o,s){let{jobs:r,left:n}=F(e,I(t),o,{destination:s});return{jobs:r,left:n}}async function Ge(e,t,o={}){return Z(e.sources,I(t),o)}var we=(e,t)=>e==="other"?t==="text"?"a text file":"not supported":"not yet supported";function Qe(e){let t=G(e.concurrency),o=I(e.answers),s=[],r=new Set,n=!1,i=e.holdMs??4e3,l=new Map,c=new Map,f=a=>{let u=c.get(a);u&&(clearTimeout(u.timer),c.delete(a),e.onEvent({type:"failed",path:a,error:u.error}))},v=(a,u)=>{E.again(a);let d=Math.max(0,(l.get(a)??0)+i-Date.now());c.set(a,{error:u,timer:setTimeout(()=>f(a),d)})},x=async a=>{let u=c.get(a);u?(clearTimeout(u.timer),c.delete(a)):e.onEvent({type:"arrived",path:a}),e.onEvent({type:"phase",path:a,phase:"reading"});let d=await Y(a);if(d.kind==="failed"){v(a,d.failure.error);return}if(d.kind!=="source"){e.onEvent({type:"left",path:a,reason:we(d.kind,d.sniffed)});return}let{jobs:p,left:g}=ve([d.source],o,e.claimed,e.destination),[h]=g;if(h){e.onEvent({type:"left",path:a,reason:h.reason});return}let w=await j(p,{force:!1,concurrency:1,...o.op==="compress"&&o.targetBytes!==void 0?{targetBytes:o.targetBytes}:{},onEvent:m=>{m.type==="job:phase"&&"phase"in m.progress&&m.progress.phase!=="page"&&m.progress.phase!=="time"&&m.progress.phase!=="tiles"&&e.onEvent({type:"phase",path:a,phase:m.progress.phase,job:m.job})}}),[b]=ee([d.source],{outcome:w,left:[],claimed:e.claimed,jobs:p});if(b?.result)e.onEvent({type:"converted",path:a,result:b.result});else if(b?.state==="left")e.onEvent({type:"left",path:a,reason:b.reason??""});else{let m=[...w.refusals,...w.failures][0];if(m){for(let B of p.flatMap(oe=>oe.outputs))ye(B)||e.claimed.delete(B);v(a,m.error)}}},y=()=>{for(;!n&&r.size<t&&s.length>0;){let a=s.shift(),u=x(a).catch(()=>{}).finally(()=>{r.delete(u),y()});r.add(u)}},E=ne(e.dir,e.known,{...e.settleMs===void 0?{}:{settleMs:e.settleMs},...e.pollMs===void 0?{}:{pollMs:e.pollMs},ignore:a=>e.claimed.has(a),onFile:a=>{l.set(a,Date.now()),s.push(a),y()}});return{async stop(){n=!0,E.close(),s.length=0,await Promise.all([...r]);for(let a of[...c.keys()])f(a)}}}export{F as a,ee as b,Ge as c,Qe as d};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{b as w,c as y}from"./chunk-DC2DHMXO.js";import{Na as h,i as g,za as m}from"./chunk-PNPAHKJR.js";import{a as u}from"./chunk-FGR6QCG5.js";import{existsSync as v}from"node:fs";import{sep as x}from"node:path";function f(t){let n=w(t);if(!(n&&!/^https?:\/\//i.test(t.trim())&&v(t)))return n}var B=t=>t.some(n=>f(n)!==void 0),j=t=>t.length>0&&t.every(n=>f(n)!==void 0);async function A(t,n={}){let{findFfmpeg:I}=await import("./ffmpeg-2ZP3GXJX.js"),{fetchVideo:k}=await import("./video-link-CF7GUA6V.js"),{loadPreferences:F}=await import("./preferences-7S7YZOFK.js"),S=(await F()).prefs.signIn??{},o=[],s=[],p=[];for(let e of t){let i=f(e);if(i===void 0){o.push(e);continue}let d=y(i);if(d||i.kind!=="video"){s.push({path:e,error:d});continue}try{let r=await I();if(!r)throw m(i.url);let c=n.signIn??S[i.site];n.onStatus?.("");let l=await k(i.url,r.ffmpeg,{...n.signal?{signal:n.signal}:{},...c?{signIn:c}:{},onEvent:a=>{a.kind==="bytes"&&n.onStatus?.(`${u(a.done)} of ${u(a.total)}`)}}).finally(()=>n.onStatus?.(void 0));p.push(l.dispose),o.push(l.path)}catch(r){if(n.signal?.aborted)throw r;s.push({path:e,error:g(r)?r:h(r)})}}return{inputs:o,failures:s,output:`${n.cwd??process.cwd()}${x}`,dispose:async()=>{await Promise.all(p.map(e=>e()))}}}export{f as a,B as b,j as c,A as d};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a as D}from"./chunk-6RMRWBMB.js";import{a as u}from"./chunk-I2LPGKUU.js";import{execFile as v}from"node:child_process";import{accessSync as U,constants as _}from"node:fs";import{isAbsolute as F,join as a}from"node:path";var N=e=>u(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function y(e,t){if(typeof e=="string")return`${t}<string>${N(e)}</string>`;if(typeof e=="number")return`${t}<integer>${e}</integer>`;if(typeof e=="boolean")return`${t}<${e}/>`;if(Array.isArray(e))return`${t}<array>
|
|
4
|
+
${e.map(i=>y(i,`${t} `)).join(`
|
|
5
|
+
`)}
|
|
6
|
+
${t}</array>`;let n=Object.entries(e).map(([i,o])=>`${t} <key>${N(i)}</key>
|
|
7
|
+
${y(o,`${t} `)}`);return n.length===0?`${t}<dict/>`:`${t}<dict>
|
|
8
|
+
${n.join(`
|
|
9
|
+
`)}
|
|
10
|
+
${t}</dict>`}var A=e=>`<?xml version="1.0" encoding="UTF-8"?>
|
|
11
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
12
|
+
<plist version="1.0">
|
|
13
|
+
${y(e,"")}
|
|
14
|
+
</plist>
|
|
15
|
+
`,w={image:"public.image",folder:"public.folder",pdf:"com.adobe.pdf",video:"public.movie",audio:"public.audio"};function E(e){return e.length===1&&e[0]==="image"?"com.apple.Automator.fileSystemObject.image":e.length===1&&e[0]==="pdf"?"com.apple.Automator.fileSystemObject.PDF":e.length===1&&e[0]==="folder"?"com.apple.Automator.fileSystemObject.folder":"com.apple.Automator.fileSystemObject"}var p=e=>`'${e.replace(/'/g,"'\\''")}'`,k="forge",I=e=>e.preset===void 0?`com.forge-terminal.menu.${e.action}`:`com.forge-terminal.menu.preset.${e.preset}`,z="com.forge-terminal.menu.",M="runWorkflowAsService",Z=e=>`${I(e)} - ${e.label} - ${M}`,L=`ObjC.import('Foundation')
|
|
16
|
+
function run(argv) {
|
|
17
|
+
const domain = argv[0]
|
|
18
|
+
const defaults = $.NSUserDefaults.standardUserDefaults
|
|
19
|
+
const or = (v) => (v.isNil() ? $.NSDictionary.dictionary : v)
|
|
20
|
+
const all = $.NSMutableDictionary.dictionaryWithDictionary(or(defaults.persistentDomainForName(domain)))
|
|
21
|
+
const status = $.NSMutableDictionary.dictionaryWithDictionary(or(all.objectForKey('NSServicesStatus')))
|
|
22
|
+
const on = { presentation_modes: { ContextMenu: true, FinderPreview: true, ServicesMenu: true, TouchBar: true } }
|
|
23
|
+
for (const arg of argv.slice(1)) {
|
|
24
|
+
const key = arg.slice(1)
|
|
25
|
+
if (arg[0] === '+') status.setObjectForKey($(on), key)
|
|
26
|
+
else status.removeObjectForKey(key)
|
|
27
|
+
}
|
|
28
|
+
all.setObjectForKey(status, 'NSServicesStatus')
|
|
29
|
+
defaults.setPersistentDomainForName(all, domain)
|
|
30
|
+
}`;function ee(e){return[e.osascript??"/usr/bin/osascript",["-l","JavaScript","-e",L,e.domain??"pbs",...e.on.map(t=>`+${t}`),...e.off.map(t=>`-${t}`)]]}function te(e,t){let n=A({CFBundleDevelopmentRegion:"English",CFBundleIdentifier:I(e),CFBundleInfoDictionaryVersion:"6.0",CFBundleName:e.label,CFBundlePackageType:"BNDL",CFBundleShortVersionString:"1.0",CFBundleVersion:"1",NSServices:[{NSIconName:k,NSMenuItem:{default:e.label},NSMessage:M,NSRequiredContext:{NSApplicationIdentifier:"com.apple.finder"},NSSendFileTypes:e.kinds.map(c=>w[c])}]}),i=e.preset===void 0?"":` ${p(e.preset)}`,o=`${p(t)} ${e.action}${i} "$@"`,r=A({AMApplicationBuild:"521",AMApplicationVersion:"2.10",AMDocumentVersion:"2",actions:[{action:{AMAccepts:{Container:"List",Optional:!0,Types:["com.apple.cocoa.path"]},AMActionVersion:"2.0.3",AMApplication:["Automator"],AMParameterProperties:{COMMAND_STRING:{},CheckedForUserDefaultShell:{},inputMethod:{},shell:{},source:{}},AMProvides:{Container:"List",Types:["com.apple.cocoa.string"]},ActionBundlePath:"/System/Library/Automator/Run Shell Script.action",ActionName:"Run Shell Script",ActionParameters:{COMMAND_STRING:o,CheckedForUserDefaultShell:!0,inputMethod:1,shell:"/bin/zsh",source:""},BundleIdentifier:"com.apple.RunShellScript",CFBundleVersion:"2.0.3",CanShowSelectedItemsWhenRun:!1,CanShowWhenRun:!0,Category:["AMCategoryUtilities"],"Class Name":"RunShellScriptAction",InputUUID:"7A1F3C2E-0F4B-4E8A-9C61-5B2D8E4F1A01",OutputUUID:"7A1F3C2E-0F4B-4E8A-9C61-5B2D8E4F1A02",UUID:"7A1F3C2E-0F4B-4E8A-9C61-5B2D8E4F1A03",UnlocalizedApplications:["Automator"]},isViewVisible:!0}],connectors:{},workflowMetaData:{serviceApplicationBundleID:"com.apple.finder",serviceApplicationPath:"/System/Library/CoreServices/Finder.app",serviceInputTypeIdentifier:E(e.kinds),serviceOutputTypeIdentifier:"com.apple.Automator.nothing",serviceProcessesInput:!1,workflowTypeIdentifier:"com.apple.Automator.servicesMenu"}});return{name:`${e.label}.workflow`,files:{"Contents/Info.plist":n,"Contents/document.wflow":r,"Contents/Resources/document.wflow":r}}}var f="forge-terminal-menu";function ae(e){let t=i=>i&&F(i)?i:void 0,n=(e.xdgConfigDirs??"").split(":").filter(i=>F(i));return{dataHome:t(e.xdgDataHome)??a(e.home,".local","share"),configHome:t(e.xdgConfigHome)??a(e.home,".config"),configDirs:n.length>0?n:["/etc/xdg"]}}function h(e,t=process.env.PATH){for(let n of(t??"").split(":"))if(n!=="")try{return U(a(n,e),_.X_OK),!0}catch{}return!1}var b={image:"image/*",folder:"inode/directory",pdf:"application/pdf",video:"video/*",audio:"audio/*"},O=e=>e.map(t=>`${b[t]};`).join(""),C=e=>`${e.paint}.png`,ce=e=>a(e.dataHome,"nautilus","scripts","Forge"),g=e=>e.preset===void 0?e.action:`preset-${e.preset}`,$=e=>e.preset===void 0?e.action:`preset ${e.preset}`,ue=e=>e.label;function pe(e,t){return`#!/bin/sh
|
|
31
|
+
# ${f}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.
|
|
32
|
+
if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then
|
|
33
|
+
IFS='
|
|
34
|
+
'
|
|
35
|
+
set -f
|
|
36
|
+
set -- $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
|
|
37
|
+
fi
|
|
38
|
+
exec ${p(t)} ${$(e)} "$@"
|
|
39
|
+
`}var le=e=>a(e.dataHome,"nemo","actions"),me=(e,t)=>`forge-${e.preset===void 0?t.indexOf(e.action)+1:t.length+1}-${g(e)}.nemo_action`,d=e=>e.replace(/%/g,"%%");function de(e,t){return`[Nemo Action]
|
|
40
|
+
# ${f}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.
|
|
41
|
+
Name=${d(e.label)}
|
|
42
|
+
Comment=${d(e.label)}
|
|
43
|
+
Exec=${d(p(t))} ${$(e)} %F
|
|
44
|
+
Selection=notnone
|
|
45
|
+
Mimetypes=${O(e.kinds)}
|
|
46
|
+
`}var fe=e=>a(e.dataHome,"kio","servicemenus"),ge=e=>`forge-${e}.desktop`,$e=["image","folder","pdf","video","audio"],j=e=>d(`"${e.replace(/[\\"`$]/g,"\\$&")}"`).replace(/\\/g,"\\\\");function xe(e,t,n){let i=t.filter(s=>s.kinds.includes(e));if(i.length===0)return;let o=i.length>1,r=["[Desktop Entry]",`# ${f}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.`,"Type=Service","ServiceTypes=KonqPopupMenu/Plugin","X-KDE-ServiceTypes=KonqPopupMenu/Plugin",`MimeType=${b[e]};`,`Actions=${i.map(s=>`${g(s)};`).join("")}`,"X-KDE-Priority=TopLevel",...o?["X-KDE-Submenu=Forge",`Icon=${a(n.menuDir,"forge.png")}`]:[]],c=i.map(s=>["",`[Desktop Action ${g(s)}]`,`Name=${s.label}`,`Icon=${a(n.menuDir,C(s))}`,`Exec=${j(n.launcher)} ${$(s)} %F`].join(`
|
|
47
|
+
`));return`${[...r,...c].join(`
|
|
48
|
+
`)}
|
|
49
|
+
`}var ye=e=>a(e.configHome,"Thunar","uca.xml"),Se=e=>e.configDirs.map(t=>a(t,"Thunar","uca.xml")),he=`<?xml version="1.0" encoding="UTF-8"?>
|
|
50
|
+
<actions>
|
|
51
|
+
</actions>
|
|
52
|
+
`,S=e=>`${f}-${g(e)}`,m=e=>u(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),R={image:{patterns:["*"],type:"image-files"},folder:{patterns:["*"],type:"directories"},pdf:{patterns:["*.pdf","*.PDF"],type:"other-files"},video:{patterns:["*"],type:"video-files"},audio:{patterns:["*"],type:"audio-files"}};function De(e,t){return e.flatMap(n=>{let i=n.kinds.filter(r=>r==="pdf"),o=n.kinds.filter(r=>r!=="pdf");return[...o.length>0?[{item:n,kinds:o,id:S(n)}]:[],...i.length>0?[{item:n,kinds:i,id:o.length>0?`${S(n)}-pdf`:S(n)}]:[]]}).map(({item:n,kinds:i,id:o})=>{let r=i.map(l=>R[l]),c=[...new Set(r.flatMap(l=>l.patterns))],s=c.includes("*")?["*"]:c;return["<action>",` <icon>${m(a(t.menuDir,C(n)))}</icon>`,` <name>${m(n.label)}</name>`,` <submenu>${i.includes("pdf")?"":"Forge"}</submenu>`,` <unique-id>${o}</unique-id>`,` <command>${m(d(p(t.launcher)))} ${$(n)} %F</command>`,` <description>${m(n.label)}</description>`," <range></range>",` <patterns>${m(s.join(";"))}</patterns>`,...r.map(l=>` <${l.type}/>`),"</action>"].join(`
|
|
53
|
+
`)}).map(n=>`${n}
|
|
54
|
+
`).join("")}var B=/[ \t]*<action>[\s\S]*?<\/action>[ \t]*\r?\n?/g;function K(e){return e.replace(B,t=>t.includes(`<unique-id>${f}-`)?"":t)}function Ne(e,t){let n=K(e),i=n.lastIndexOf("</actions>");if(i===-1||!/<actions>/.test(n))return;let o=n.lastIndexOf(`
|
|
55
|
+
`,i)+1;return/^[ \t]*$/.test(n.slice(o,i))&&(i=o),`${n.slice(0,i)}${t}${n.slice(i)}`}var Ae=(e,t,n)=>h("thunar",t)||n(a(e.configHome,"Thunar"));var H="ForgeTerminal.Forge",T=e=>u(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),W=e=>e.replace(/['‘’‚‛]/g,"$&$&"),P=W;function X(e,t){return["[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null","[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] > $null","$x = New-Object Windows.Data.Xml.Dom.XmlDocument",`$x.LoadXml('<toast><visual><binding template="ToastText02"><text id="1">${P(T(e))}</text><text id="2">${P(T(t))}</text></binding></visual></toast>')`,`[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('${H}').Show([Windows.UI.Notifications.ToastNotification]::new($x))`].join("; ")}function V(e,t,n=process.platform){return n==="win32"?["powershell.exe",["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",X(e,t)]]:["/usr/bin/osascript",["-e","on run argv","-e","display notification (item 2 of argv) with title (item 1 of argv)","-e","end run",e,t]]}var x=e=>`"${e.replace(/[\\"]/g,"\\$&").replace(/\n/g,"\\n")}"`;function q(e,t,n={}){let i=n.has??(o=>h(o));if(i("notify-send"))return["notify-send",["--app-name=Forge",...n.icon?[`--icon=${n.icon}`]:[],"--",e,t]];if(i("gdbus"))return["gdbus",["call","--session","--dest","org.freedesktop.Notifications","--object-path","/org/freedesktop/Notifications","--method","org.freedesktop.Notifications.Notify",x("Forge"),"0",x(n.icon??""),x(e),x(t),"[]","{}","-1"]]}function J(e,t,n=process.platform,i={}){let o=n==="linux"?q(e,t,i):V(e,t,n);return new Promise(r=>{if(o===void 0)return r();try{v(o[0],o[1],{timeout:1e4,windowsHide:!0},()=>r())}catch{r()}})}var Y=(e,t)=>new Promise((n,i)=>v(e,t,{timeout:2e3},(o,r)=>o?i(o):n(r)));async function G(e,t=Y){let n=(await t("lsappinfo",["front"])).trim();return(await t("lsappinfo",["info","-only","bundleid",n])).match(/bundleID="([^"]*)"/)?.[1]===e}async function Te(e,t,n={}){if(e===void 0||!D(t))return;let i=n.platform??process.platform,o=n.env??process.env;if(o.FORGE_NO_NOTIFY||o.SSH_CONNECTION||o.SSH_TTY)return;let r=o.__CFBundleIdentifier;i==="darwin"&&r&&await G(r,n.ask).catch(()=>!1)||await(n.post??((c,s)=>J(c,s,i)))(e.title,e.body)}export{p as a,k as b,z as c,Z as d,ee as e,te as f,f as g,ae as h,h as i,C as j,ce as k,ue as l,pe as m,le as n,me as o,de as p,fe as q,ge as r,$e as s,xe as t,ye as u,Se as v,he as w,De as x,K as y,Ne as z,Ae as A,H as B,W as C,X as D,V as E,x as F,q as G,J as H,G as I,Te as J};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a as u}from"./chunk-FGR6QCG5.js";import{c as r}from"./chunk-VLVNA4T3.js";var f={chrome:"Chrome",safari:"Safari",firefox:"Firefox",brave:"Brave",edge:"Edge",chromium:"Chromium",opera:"Opera",vivaldi:"Vivaldi"},R=e=>typeof e=="string"&&Object.hasOwn(f,e),c=e=>f[e];var s={jpeg:{id:"jpeg",label:"JPEG",extensions:[".jpg",".jpeg"],hasAlpha:!1,animatable:!1,lossy:!0,hint:"universal",defaultQuality:82},png:{id:"png",label:"PNG",extensions:[".png"],hasAlpha:!0,animatable:!1,lossy:!1,hint:"lossless",quantisable:!0},webp:{id:"webp",label:"WebP",extensions:[".webp"],hasAlpha:!0,animatable:!0,lossy:!0,hint:"smaller, modern",defaultQuality:80},avif:{id:"avif",label:"AVIF",extensions:[".avif"],hasAlpha:!0,animatable:!1,lossy:!0,hint:"smallest",defaultQuality:50},heic:{id:"heic",label:"HEIC",extensions:[".heic",".heif"],hasAlpha:!0,animatable:!1,lossy:!0,hint:"Apple photos"},raw:{id:"raw",label:"RAW",extensions:[".dng",".cr2",".cr3",".nef",".nrw",".arw",".srf",".sr2",".raf",".orf",".rw2",".rwl",".pef",".srw",".3fr",".fff",".erf",".dcr",".kdc",".mos"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"camera photos"},mp4:{id:"mp4",label:"MP4",extensions:[".mp4",".m4v"],hasAlpha:!1,animatable:!0,lossy:!0,hint:"H.264 \xB7 AAC",media:"video"},mov:{id:"mov",label:"MOV",extensions:[".mov",".qt"],hasAlpha:!1,animatable:!0,lossy:!0,hint:"QuickTime",media:"video",keepsOnly:!0},hevc:{id:"hevc",label:"HEVC",extensions:[".mp4"],hasAlpha:!1,animatable:!0,lossy:!0,hint:"H.265 \xB7 AAC",media:"video"},webm:{id:"webm",label:"WebM",extensions:[".webm"],hasAlpha:!1,animatable:!0,lossy:!0,hint:"VP9 \xB7 Opus",media:"video"},gif:{id:"gif",label:"GIF",extensions:[".gif"],hasAlpha:!0,animatable:!0,lossy:!1,hint:"animation",quantisable:!0,media:"video"},tiff:{id:"tiff",label:"TIFF",extensions:[".tif",".tiff"],hasAlpha:!0,animatable:!1,lossy:!1,hint:"archival"},pdf:{id:"pdf",label:"PDF",extensions:[".pdf"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"document"},docx:{id:"docx",label:"DOCX",extensions:[".docx"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"Word document"},doc:{id:"doc",label:"DOC",extensions:[".doc"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"legacy Word"},mkv:{id:"mkv",label:"MKV",extensions:[".mkv"],hasAlpha:!1,animatable:!0,lossy:!0,hint:"Matroska",media:"video",keepsOnly:!0},avi:{id:"avi",label:"AVI",extensions:[".avi"],hasAlpha:!1,animatable:!0,lossy:!0,hint:"legacy video",media:"video",keepsOnly:!0},mp3:{id:"mp3",label:"MP3",extensions:[".mp3"],hasAlpha:!1,animatable:!1,lossy:!0,hint:"plays anywhere",media:"sound"},m4a:{id:"m4a",label:"M4A",extensions:[".m4a",".m4b"],hasAlpha:!1,animatable:!1,lossy:!0,hint:"AAC",media:"sound"},opus:{id:"opus",label:"Opus",extensions:[".opus"],hasAlpha:!1,animatable:!1,lossy:!0,hint:"smallest",media:"sound"},flac:{id:"flac",label:"FLAC",extensions:[".flac"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"lossless",media:"sound"},aiff:{id:"aiff",label:"AIFF",extensions:[".aiff",".aif",".aifc"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"uncompressed",media:"sound"},wav:{id:"wav",label:"WAV",extensions:[".wav"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"uncompressed",media:"sound"},ogg:{id:"ogg",label:"OGG",extensions:[".ogg",".oga"],hasAlpha:!1,animatable:!1,lossy:!0,hint:"Vorbis",media:"sound",keepsOnly:!0}},D=Object.keys(s);function M(e){return s[e.toLowerCase()]}function U(e){let t=e.toLowerCase();return Object.values(s).filter(o=>o.extensions.includes(t))}function j(e){let t=s[e].extensions[0];if(!t)throw new Error(`format ${e} declares no extensions`);return t}var y=80;function J(e,t){return t??(e?s[e].defaultQuality:void 0)??y}import{dirname as v}from"node:path";var n=class extends Error{code;title;detail;short;hint;shellHint;constructor(t){super(t.detail===""?t.title:`${t.title}: ${t.detail}`,t.cause===void 0?void 0:{cause:t.cause}),this.name="ForgeError",this.code=t.code,this.title=t.title,this.detail=t.detail,this.short=t.short,this.hint=t.hint,this.shellHint=t.shellHint}};function E(e){return e instanceof n}function q(e){return new n({code:"file-not-found",title:"File not found",detail:`${r(e)} could not be found.`,short:`${r(e)} could not be found.`,hint:"Check the filename and try again."})}function Q(e){return new n({code:"not-a-file",title:"Not a file",detail:`${r(e)} is not a file.`,short:`${r(e)} is not a file.`,hint:"Point Forge at an image, or at a directory of images."})}function Y(e){return new n({code:"permission-denied",title:"Permission denied",detail:`${r(e)} could not be read.`,short:`${r(e)} could not be read.`,hint:"Check the file permissions and try again."})}function K(e){return new n({code:"not-a-directory",title:"Invalid path",detail:`${r(e)} could not be found: part of its path is not a directory.`,short:`part of ${r(e)}'s path is not a folder.`,hint:"Check the path and try again."})}function X(e){return new n({code:"symlink-loop",title:"Too many symbolic links",detail:`${r(e)} could not be resolved: its path contains a symbolic-link loop.`,short:`${r(e)}'s path loops back on itself.`,hint:"Check for a circular symlink somewhere in the path."})}function Z(e){return new n({code:"path-too-long",title:"Path too long",detail:`${r(e)}'s path is too long for the filesystem to resolve.`,short:`${r(e)}'s path is too long.`,hint:"Use a shorter path and try again."})}function ee(e,t){return new n({code:"unreadable-path",title:"Could not read path",detail:`${r(e)} could not be checked.`,short:`${r(e)} could not be checked.`,hint:"Check the path and try again.",cause:t})}var k=new Set(["HEIC","HEVC","FLAC","RAW"]);function m(e){return`${(/^[A-Z0-9]+$/.test(e)&&!k.has(e)?/^[AEFILMNORSX8]/.test(e):/^[aeiou]/i.test(e))?"an":"a"} ${e}`}function S(e){return e.kind==="image"?"image":e.kind==="document"?"document":(e.facts?!e.facts.video:s[e.format].media==="sound")?"sound file":"video"}function te(e,t){return new n({code:"unsupported-source",title:"Unsupported file type",detail:`${r(e)} is ${t}, which Forge cannot read.`,short:`${r(e)} is ${t}, which Forge cannot read.`})}function ne(e,t){return new n({code:"unsupported-source",title:"Not an image",detail:`${r(e)} is ${t}, not an image.`,hint:"A palette is taken from a photo, a screenshot or artwork."})}function oe(e){return new n({code:"unsupported-source",title:"Nothing to take colours from",detail:`${r(e)} has no visible pixels.`})}function re(e){return new n({code:"unsupported-source",title:"No colours",detail:`There are no colours in ${e} that Forge can read.`,hint:"Write one a line, a name and a colour (bg #F8F1E6), or use a CSV with name and hex columns, CSS variables or design tokens."})}function ie(e,t){let o=t.slice(0,8).join("; "),i=t.length>8?`; and ${t.length-8} more`:"";return new n({code:"unsupported-source",title:"Not colours",detail:`${t.length===1?"One line":`${t.length} lines`} of ${e} could not be read as a colour: ${o}${i}.`,hint:"Write each as a name and a colour, such as bg #F8F1E6, or take the line out."})}function ae(e,t=process.platform){if(t!=="darwin"){let o=t==="win32"?"Windows":t==="linux"?"Linux":"this system";return new n({code:"heic-decoder-unavailable",title:"Cannot read HEIC here",detail:`${r(e,t)} is a HEIC photo, which needs Forge's free HEIC extension on ${o}.`,short:"HEIC needs the heic extension.",hint:"Install it with: forge extensions add heic",shellHint:"Open /extensions to install it."})}return new n({code:"heic-decoder-unavailable",title:"Cannot read HEIC here",detail:`${r(e)} is a HEIC photo, which Forge decodes with the macOS sips tool.`,short:"HEIC needs sips, which could not be run.",hint:"sips could not be run. It ships with macOS at /usr/bin/sips."})}function se(e,t=process.platform){if(t!=="darwin"){let o=t==="win32"?"Windows":t==="linux"?"Linux":"this system";return new n({code:"raw-decoder-unavailable",title:"Cannot read RAW here",detail:`${r(e,t)} is a camera RAW photo, which needs Forge's free RAW extension on ${o}.`,short:"RAW needs the raw extension.",hint:"Install it with: forge extensions add raw",shellHint:"Open /extensions to install it."})}return new n({code:"raw-decoder-unavailable",title:"Cannot read RAW here",detail:`${r(e,t)} is a camera RAW photo, which Forge reads with macOS's own RAW support.`,short:"RAW needs sips, which could not be run.",hint:"sips could not be run. It ships with macOS at /usr/bin/sips."})}function le(e){return new n({code:"raw-decoder-unavailable",title:"Cannot read this RAW",detail:`${r(e)} is a camera RAW photo that this Mac cannot read.`,short:"macOS cannot read RAW photos from this camera.",hint:"A newer camera usually needs a newer macOS."})}function de(e,t){let o=r(e.path);if(t!==void 0&&t!==e.format){let i=s[t].label;return s[t].lossy?new n({code:"unsupported-compress",title:"Cannot fit that to a size",detail:`Forge cannot search ${o} \u2192 ${i} toward a size yet.`,hint:"Convert it first, then compress the result with --max-size.",shellHint:"Convert it first, then /compress the result to a size."}):new n({code:"unsupported-compress",title:"Cannot fit that to a size",detail:`${i} is lossless \u2014 there is no quality to trade away, so ${o} cannot be made to fit as ${i}.`,hint:"Drop --max-size, or choose a lossy target. forge --formats lists them.",shellHint:"Choose a lossy target to aim for a size."})}if(e.kind==="document"&&e.format==="pdf"){let i=e.images?.skipped??0;return new n({code:"unsupported-compress",title:"Nothing to compress",detail:i>0?`${o}'s images are a kind Forge cannot re-encode, so there is nothing to make smaller.`:`${o} has no images \u2014 it is text and layout, which compression cannot shrink.`,hint:"Try a page operation such as --extract to keep fewer pages, or --to <format> to turn its pages into images.",shellHint:"Try /pdf to keep fewer pages, or /convert to turn its pages into images."})}return e.kind==="document"?new n({code:"unsupported-compress",title:"Nothing to compress",detail:`${o} is ${s[e.format].label}, which has no images Forge can re-encode.`,hint:`Use --to pdf to change it to PDF instead: forge ${o} --to pdf`,shellHint:"Use /convert to change it to PDF instead."}):new n({code:"unsupported-compress",title:"Nothing to compress",detail:`${o} is ${s[e.format].label}, which is lossless \u2014 there is no quality to trade away.`,hint:"Use --to to change it to a smaller format instead. forge --formats lists them.",shellHint:"Use /convert to change it to a smaller format instead."})}function ue(e){let t=r(e.path);return new n({code:"unsupported-pdf",title:"/pdf needs a PDF",detail:`${t} is ${s[e.format].label}, not a PDF.`,hint:"Converting it instead."})}function ce(e,t,o){return new n({code:"unsupported-operation",title:`Cannot ${e} these files`,detail:`Not available for these files: ${t}.`,hint:o??"Page operations work on PDFs: --merge takes two or more, the others take one.",shellHint:o??"Use /pdf with a PDF staged \u2014 two or more for merge."})}function pe(e,t,o){let i=e.kind==="media"?`The smallest ${r(e.path)} can get is ${u(o)}, which is still over ${u(t)}.`:`${r(e.path)} is ${u(o)} even at the lowest quality, which is still over ${u(t)}.`;return new n({code:"target-unreachable",title:"Cannot get that small",detail:i,hint:"Try a larger --max-size, or --to a smaller format.",shellHint:"Try a larger target, or /convert to a smaller format."})}function he(e,t,o){return new n({code:"unsupported-target",title:`Cannot convert ${r(e.path)} to ${t}`,detail:`${r(e.path)} is ${m(s[e.format].label)} ${S(e)}.`,hint:`Available: ${o.join(", ")}`})}function C(e,t){return new n({code:"corrupt-source",title:"Damaged file",detail:`${r(e)} could not be read. It may be damaged, or not a format Forge recognises.`,short:`${r(e)} could not be read.`,hint:"The file may be incomplete or corrupted.",cause:t})}function A(e,t,o){return new n({code:"corrupt-source",title:`Damaged ${s[t].label}`,detail:`${r(e)} is ${m(s[t].label)} file, but its content could not be read.`,short:`${r(e)} could not be read.`,hint:"The file may be incomplete or corrupted.",cause:o})}function ge(e,t={}){let o=r(e);return new n({code:"encrypted-source",title:"This PDF is password-protected",detail:`${o} is password-protected.`,short:`${o} is password-protected.`,hint:t.attempted?"That password didn't open it. Check it and try again.":`Convert it to images instead: forge ${o} --to jpeg --password-stdin`})}var p=e=>e==="convert"||e==="boost"||e==="remove-background";function fe(e,t="convert"){return new n({code:"output-exists",title:"File already exists",detail:`${r(e)} is already there.`,hint:p(t)?"Pass --force to replace it, or choose a different --output.":"Pass --force to replace it, or move the existing file out of the way.",shellHint:"Run it again and Forge will ask before replacing it."})}function me(e,t){return new n({code:"output-collision",title:"Two files want the same output",detail:`${r(e[0])} and ${r(e[1])} would both become ${r(t)}.`,hint:"Convert them separately, or use --output to send them to different folders.",shellHint:"Convert them one at a time."})}function we(e,t){return new n({code:"output-collision",title:"One output, written twice",detail:`${r(e)} would write ${r(t)} twice, and only the second would survive.`,hint:"Every output has to be its own file. Check the selection for a repeated page."})}function be(e,t="convert"){return new n({code:"output-is-input",title:"Output would replace the original",detail:`${r(e)} is both the input and the output.`,hint:p(t)?"Choose a different --output, or pass --force to overwrite in place.":"Move or rename that file first, or pass --force to overwrite it in place.",shellHint:p(t)?"Choose a different folder to save it in.":"Move or rename that file first."})}function w(e,t){return new n({code:"permission-denied",title:"Permission denied",detail:`${r(v(e))} is not a folder you can write to.`,hint:"Choose a different --output, or check the folder permissions.",shellHint:"Choose a different folder, or check its permissions.",cause:t})}var g=new Set(["EACCES","EPERM","EROFS"]);function xe(e,t){if(E(t))return t;let o=t?.code;return o!==void 0&&g.has(o)?w(e,t):o==="ENOSPC"||o==="EDQUOT"?b(e,t,e):o==="ENAMETOOLONG"?x(e,t):t}function I(e,t){return new n({code:"output-invalid",title:"Cannot write there",detail:`${e} could not be written to.`,hint:"Check that the path is valid and that you have permission to write to it.",cause:t})}function $e(e){return new n({code:"empty-directory",title:"No images found",detail:`${r(e)} contains no images Forge can convert.`,hint:"Try --recursive to look inside subfolders.",shellHint:"Only files directly inside a folder are read \u2014 drop the files themselves, or the folder that holds them."})}function Fe(e,t){return new n({code:"invalid-cut",title:"Cut past the end",detail:`The cut keeps nothing of ${r(e)}: it starts at or after its end.`,hint:`It is ${t} long.`})}function ye(e){return new n({code:"unsupported-operation",title:"Cannot use --to here",detail:"--to is for video and sound: a picture or PDF gives its text as it is.",hint:`Try: forge transcribe ${e}`})}function ve(e,t){let o=t?.code;return new n({code:o!==void 0&&g.has(o)?"permission-denied":"output-invalid",title:"Settings not saved",detail:`${e} is not a folder Forge can write to.`,cause:t})}function N(e,t){return new n({code:"invalid-arguments",title:"Invalid arguments",detail:e,hint:t})}function Ee(e){return new n({code:"invalid-arguments",title:"No files given",detail:"",hint:e})}function ke(e,t="--background"){return N(`${t} takes a colour, not '${e}'.`,"Try a hex code (#ffffff), rgb(), hsl(), oklch() or a colour name.")}function Se(e,t,o){let i=Math.max(o-1,0);return new n({code:"invalid-page-range",title:"Page range not understood",detail:`'${e}' is outside 1 and ${i}.`,hint:`${t} has ${o} pages, so it can be cut after page 1 to ${i}.`})}function Ce(e,t,o){return new n({code:"invalid-page-range",title:"Page range not understood",detail:t,hint:`This document has ${o} pages. Use numbers and spans, like '3-7, 12, 20-'.`})}function Ae(e){return new n({code:"empty-selection",title:"Nothing to write",detail:e,hint:"Select at least one page to keep."})}function Ie(e,t,o){return new n({code:"invalid-arguments",title:"Nothing to split",detail:`${r(e)} has ${t} pages; splitting every ${o} makes only one file.`,hint:`Use every=N with N below ${t}.`})}function Ne(e){return new n({code:"invalid-dpi",title:"Invalid resolution",detail:`${String(e)} is not a resolution Forge can use.`,hint:"Give a number between 36 and 600. The default is 150."})}function Te(e){return new n({code:"extension-missing",title:"Extension not installed",detail:`${e} is an optional extension and is not installed.`,hint:`Install it with: forge extensions add ${e}`,shellHint:"Open /extensions to install it."})}function Oe(e,t,o,i){return new n({code:"extension-outdated",title:"Extension out of date",detail:`${e} ${o} cannot ${t}; that needs ${i} or later.`,hint:`Update it with: forge extensions add ${e}`,shellHint:"Open /extensions to update it."})}function Pe(e,t){return new n({code:"extension-corrupt",title:"Extension failed verification",detail:`${e}: ${t}`,hint:`Nothing was installed. Try again with: forge extensions add ${e}`,shellHint:"Nothing was installed. Try again from /extensions."})}function He(e,t,o=process.platform){let i=o==="win32"?"PC":o==="darwin"?"Mac":"computer";return new n({code:"extension-unsupported",title:"Extension not available here",detail:`${e} cannot be installed on this ${i}: ${t}`,hint:"See what is available with: forge extensions",shellHint:"See what is available in /extensions."})}function Re(e,t=process.platform){let o=t==="win32"?"Windows":t==="darwin"?"macOS":t==="linux"?"Linux":"this system";return new n({code:"extension-unsupported",title:"Extension not available here",detail:`${e} is not available on ${o}.`,hint:"See what is available with: forge extensions",shellHint:"See what is available in /extensions."})}function We(e){return new n({code:"update-unavailable",title:"Cannot update this Forge",detail:`This copy of Forge was not installed with npm i -g, so ${e} cannot be installed over it.`,hint:"npm i -g forge-terminal"})}function De(e,t=process.platform){return t==="win32"?new n({code:"update-denied",title:"Forge is in use",detail:`npm could not replace Forge's files to update it to ${e}. Windows keeps them locked while Forge runs: close every Forge window, then run the command below. If Node is installed for every user, run it in a terminal opened as administrator.`,short:"Windows locks Forge while it runs: close it, then run this",hint:`npm i -g forge-terminal@${e}`}):new n({code:"update-denied",title:"npm needs permission",detail:`npm needs permission to update Forge to ${e}.`,short:"npm needs permission to update Forge",hint:`sudo npm i -g forge-terminal@${e}`})}function Me(e,t){return new n({code:"update-failed",title:"Update failed",detail:`npm could not install Forge ${e}: ${t}`,short:"npm could not install the update",hint:`npm i -g forge-terminal@${e}`})}function Ue(){return new n({code:"update-unreachable",title:"Could not check for updates",detail:"The npm registry could not be reached.",short:"could not reach npm",hint:"Check your connection, then run: forge update",shellHint:"Check your connection, then try again."})}function je(e,t){return new n({code:"extension-download-failed",title:"Download failed",detail:`${e}: ${t}`,hint:`Check your connection, then run: forge extensions add ${e}`,shellHint:"Check your connection, then try again from /extensions."})}function Je(e,t){return new n({code:"extension-download-failed",title:"Not enough disk space",detail:`${e}: ${t}`,hint:`Free some disk space, then run: forge extensions add ${e}`,shellHint:"Free some disk space, then try again from /extensions."})}function Le(e,t,o){let i=t?t.what?`${t.what} (forge, pid ${t.pid})`:`another forge (pid ${t.pid}) is using it`:"another forge is using it";return new n({code:"extension-in-use",title:"Extension in use",detail:`${e} is in use: ${i}.`,hint:o==="remove"?`Wait for that job to finish, then run: forge extensions remove ${e}`:"Wait for that job to finish, then try again.",shellHint:o==="remove"?"It can be removed when that job finishes.":"Try again when that job finishes."})}function ze(e){return new n({code:"no-subject",title:"No subject found",detail:`${r(e)} has no clear subject to cut out.`,hint:"Try a photo where the subject stands apart from the background."})}function Be(e,t,o){return o===1?new n({code:"boost-too-large",title:"Too large to sharpen",detail:`${r(e)} is too large to sharpen.`,hint:"Sharpen works on images up to 16,384 px a side and 100 megapixels."}):new n({code:"boost-too-large",title:"Too large to boost",detail:t>=2?`${r(e)} is too large to boost that far; ${t}x is the most it can take.`:`${r(e)} is already too large to boost.`,hint:t>=2?`Try --boost ${t}.`:"Boost works on images up to 100 megapixels.",shellHint:t>=2?`Choose ${t}x instead.`:void 0})}function Ve(e,t,o,i=process.platform){let a=o===1?"sharpen":"boost",l=i==="win32"?"PC":i==="darwin"?"Mac":"computer",d=Math.max(1,Math.round(t/60));return new n({code:"boost-too-slow",title:`Too slow to ${a}`,detail:`${r(e)} would take about ${d} ${d===1?"minute":"minutes"} to ${a} on this ${l}.`,hint:"Try a smaller photo."})}function _e(e,t){return new n({code:"resize-too-large",title:"Too large to resize to",detail:`${r(e)} would be ${t.width} \xD7 ${t.height}.`,hint:"Resize works up to 16,384 px a side and 100 megapixels."})}var T={darwin:"\u2303\u21E7\u23184",win32:"Win+Shift+S"};function Ge(e,t=process.platform){let o=T[t];return new n({code:"no-clipboard-image",title:"No image",detail:e==="text"?"The clipboard holds text, not a picture.":"The clipboard is empty.",hint:o===void 0?"Copy a picture or a screenshot, then run forge clip again.":`Copy a picture, or take a screenshot with ${o}, then run forge clip again.`})}function qe(e=process.platform){return new n({code:"clipboard-unavailable",title:"No clipboard",detail:e==="linux"?"Forge reads the clipboard of a Wayland or X11 desktop, and not over SSH.":"Forge reads the clipboard on macOS, Windows and Linux, and not over SSH."})}function Qe(e){return new n({code:"clipboard-tool-missing",title:`Clipboard needs ${e}`,detail:`Forge reaches the clipboard through ${e}, and it is not on this computer.`,short:`${e} is not on this computer`,hint:`Install it with sudo apt install ${e} (or your distribution's package manager), then try again.`})}function Ye(){return new n({code:"nothing-to-undo",title:"Nothing to undo",detail:"No copied image has been changed yet."})}function Ke(e,t,o,i=!1){let a=r(e);if(i)return new n({code:"cannot-compress-more",title:"Cannot compress more",detail:`${a} is no smaller even at the lowest quality, so nothing was written.`,short:"nothing written"});let l=o>t?`would grow from ${u(t)} to ${u(o)}`:`would stay at ${u(t)}`;return new n({code:"cannot-compress-more",title:"Cannot compress more",detail:`${a} ${l}, so nothing was written.`,short:"nothing written",hint:"Try a lower --quality.",shellHint:"Try a lower quality."})}function Xe(e,t,o){return new n({code:"cannot-compress-more",title:"Already small enough",detail:`${r(e)} is ${u(t)}, already under ${u(o)}, so nothing was written.`,short:"already under that size"})}function Ze(e){return new n({code:"nothing-to-trim",title:"Nothing to trim",detail:`${r(e)} has no empty edges.`,short:"no empty edges"})}function et(e){return new n({code:"animated-trim",title:"Cannot trim an animation",detail:`${r(e)} is animated; trimming works on still images.`})}function tt(e,t){return new n({code:"nothing-to-crop",title:"Nothing to crop",detail:`${r(e)} is already ${t}.`,short:`already ${t}`})}function nt(e){return new n({code:"animated-crop",title:"Cannot crop an animation",detail:`${r(e)} is animated; cropping works on still images.`})}function ot(e){return new n({code:"animated-rotate",title:"Cannot rotate an animation",detail:`${r(e)} is animated; rotating works on still images.`})}function rt(e,t=process.platform,o=!1){let i=h(t),a=o?`forge extensions add video (or ${i})`:t==="linux"?`${i} (or your distribution's package manager)`:i;return new n({code:"ffmpeg-missing",title:"Video and audio need ffmpeg",detail:`${r(e)} is a video or audio file, and ffmpeg is not on this computer.`,short:"ffmpeg is not on this computer",hint:`Install it with ${a}, then run Forge again.`})}function it(e,t,o=process.platform){let i=s[e].label,a=/^[AEFHILMNORSX]/.test(t.codec)?"an":"a",l=t.encoders,d=l.length>1?`${l.slice(0,-1).join(", ")} or ${l.at(-1)}`:l[0]??"",$=l.length>1?"any of them":"it",F=o==="linux"?"Install a full build of ffmpeg, then run Forge again. On Fedora, RPM Fusion's ffmpeg replaces ffmpeg-free.":o==="win32"?`Install a full build of ffmpeg, such as gyan.dev's (${h(o)}), then run Forge again.`:`Install a full build of ffmpeg (${h(o)}), then run Forge again.`;return new n({code:"encoder-missing",title:`Your ffmpeg cannot write ${i}`,detail:`${i} needs ${a} ${t.codec} encoder${t.sound?" for its sound":""}: ${d}. Your ffmpeg was built without ${$}.`,short:`Your ffmpeg has no ${t.codec} encoder`,hint:F})}function h(e=process.platform){return e==="win32"?"winget install ffmpeg":e==="linux"?"sudo apt install ffmpeg":"brew install ffmpeg"}function at(e,t,o){return H(e,t,o)??O(e,t)}function O(e,t){return new n({code:"conversion-failed",title:"Conversion failed",detail:`${r(e)} could not be converted.`,hint:"Run again with --debug for the underlying error.",shellHint:"Run the same conversion with forge --debug from the command line to see why.",cause:t})}var P=/premature end|truncated|unexpected end of|libpng read error|corrupt/i;function H(e,t,o){let i=t?.code,a=t instanceof Error?t.message:typeof t=="string"?t:"",l=t?.path,d=typeof l=="string"?l:void 0;if(i==="ENOSPC"||i==="EDQUOT"||/no space left on device|quota exceeded/i.test(a))return b(e,t,d);if(i==="ENAMETOOLONG"||/file name too long/i.test(a))return x(d??e,t,d===void 0);if(d!==void 0&&i!==void 0&&g.has(i))return w(d,t);if(d!==void 0&&i==="ENOTDIR")return I(d,t);if(P.test(a))return o?A(e,o,t):C(e,t)}function b(e,t,o){return new n({code:"disk-full",title:"Disk full",detail:o!==void 0?`There is no space left to write ${r(o)}.`:`${r(e)} could not be converted: no disk space left.`,short:"The disk is full.",hint:"Free up disk space, or choose a different --output.",shellHint:"Free up disk space, or choose a different folder.",cause:t})}function x(e,t,o=!1){let i=o?`${r(e)} could not be converted: the name to write it under is too long.`:`${r(e)} is too long to write.`;return new n({code:"path-too-long",title:"Name too long",detail:i,short:o?"The name to write is too long.":`${r(e)} is too long to write.`,hint:"Choose a shorter name with --output.",shellHint:"Choose a shorter name.",cause:t})}function st(e){return new n({code:"no-sound",title:"Nothing to transcribe",detail:`${r(e)} has no sound.`})}function lt(e){return new n({code:"no-sound",title:"No sound",detail:`${r(e)} has no sound.`,short:"no sound"})}function dt(e){return new n({code:"source-changed",title:"File changed",detail:`${r(e)} changed while converting, so nothing was written.`,short:"changed while converting"})}function ut(e,t=process.platform,o=t==="darwin"?"apple":"whisper"){return o==="whisper"?new n({code:"unsupported-source",title:"Cannot transcribe this file",detail:`${r(e,t)} cannot be read by whisper.`,hint:"Video and sound files can be transcribed."}):new n({code:"unsupported-source",title:"Cannot transcribe this file",detail:`${r(e)} cannot be read by Apple's speech recogniser.`,hint:"MP4, MOV, M4A, MP3, WAV and AIFF can be transcribed; with ffmpeg (brew install ffmpeg), any video or sound file."})}function ct(e,t=process.platform,o=t==="darwin"?"apple":"whisper"){let i=o==="apple"?"Apple's speech recogniser":"The whisper extension";return new n({code:"language-unsupported",title:"Language not supported",detail:`${i} does not support ${e}.`,hint:"Pass another with --language, for example --language en-US."})}function pt(e,t,{title:o="Cannot use this link",...i}={}){return new n({code:"link-unavailable",title:o,detail:e,...i,...t===void 0?{}:{cause:t}})}function ht(e){return new n({code:"transcribe-unavailable",title:"Transcribe is not available",detail:e})}function gt(e=!1){return e?new n({code:"read-unavailable",title:"Reading text is not available",detail:"Reading text needs Forge's free read-text extension.",short:"Needs the read-text extension.",hint:"Install it with: forge extensions add read-text",shellHint:"Open /extensions to install it."}):new n({code:"read-unavailable",title:"Reading text is not available",detail:"Reading text needs macOS 26 or later.",short:"Reading text needs macOS 26 or later."})}function ft(e){let t=r(e);return new n({code:"no-text",title:"No text found",detail:`No text found in ${t}.`,short:`No text found in ${t}.`})}function mt(e){let t=r(e);return new n({code:"no-speech",title:"No speech found",detail:`No speech found in ${t}.`,short:`No speech found in ${t}.`})}function wt(e){return new n({code:"unexpected",title:"Something went wrong",detail:e instanceof Error?e.message:String(e),hint:"This was not expected. Try again \u2014 if it keeps happening, it may be worth reporting.",cause:e})}function bt(e,t={}){let o=[`\u2715 ${e.title}`];e.detail!==""&&o.push("",` ${e.detail}`);let i=e.cause instanceof Error?e.cause.stack??e.cause.message:typeof e.cause=="string"?e.cause:void 0,a=t.debug===!0&&i!==void 0;return e.hint&&!(a&&e.hint.includes("--debug"))&&o.push("",` ${e.hint}`),a&&o.push("",` ${i}`),o}function xt(e,t){return new n({code:"link-sign-in",title:"Cannot get this video",detail:t?`${e} still wants you signed in.`:`${e} wants you signed in.`,hint:t?`Sign in to ${e} in ${c(t)}, then try again.`:"Pass --cookies-from-browser chrome (or safari, firefox, brave, edge) to use that browser's sign-in.",...t?{shellHint:`Sign in to ${e} in ${c(t)}, then paste the link again.`}:{}})}function $t(e,t){return new n({code:"link-sign-in-blocked",title:`Cannot use ${c(e)}\u2019s sign-in`,detail:e==="safari"?`${t??"Your terminal"} needs Full Disk Access.`:`${c(e)}\u2019s sign-in could not be read.`,hint:e==="safari"?"Allow your terminal in System Settings \u2192 Privacy & Security \u2192 Full Disk Access.":`Quit ${c(e)} and try again, or pass another browser.`})}export{f as a,R as b,c,s as d,M as e,U as f,j as g,J as h,E as i,q as j,Q as k,Y as l,K as m,X as n,Z as o,ee as p,m as q,te as r,ne as s,oe as t,re as u,ie as v,ae as w,se as x,le as y,de as z,ue as A,ce as B,pe as C,he as D,C as E,A as F,ge as G,fe as H,me as I,we as J,be as K,w as L,xe as M,I as N,$e as O,Fe as P,ye as Q,ve as R,N as S,Ee as T,ke as U,Se as V,Ce as W,Ae as X,Ie as Y,Ne as Z,Te as _,Oe as $,Pe as aa,He as ba,Re as ca,We as da,De as ea,Me as fa,Ue as ga,je as ha,Je as ia,Le as ja,ze as ka,Be as la,Ve as ma,_e as na,Ge as oa,qe as pa,Qe as qa,Ye as ra,Ke as sa,Xe as ta,Ze as ua,et as va,tt as wa,nt as xa,ot as ya,rt as za,it as Aa,h as Ba,at as Ca,st as Da,lt as Ea,dt as Fa,ut as Ga,ct as Ha,pt as Ia,ht as Ja,gt as Ka,ft as La,mt as Ma,wt as Na,bt as Oa,xt as Pa,$t as Qa};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{spawn as l}from"node:child_process";var o=new Map;function u(e,n={}){if(e.pid===void 0)return e;let i=n.pooled===!0,t=process.platform==="win32"||i?void 0:s(e.pid);o.set(e,{lifeline:t,pooled:i});let r=()=>{o.delete(e),t?.kill("SIGKILL")};return e.once("exit",r),e.once("close",r),e.once("error",r),e}function s(e){try{let n=l("/bin/sh",["-c",'read _; kill -9 "$1" 2>/dev/null',"forge-lifeline",`${e}`],{stdio:["pipe","ignore","ignore"],detached:!0});return n.on("error",()=>{}),n.stdin?.on("error",()=>{}),n.unref(),n.stdin?.unref?.(),n}catch{return}}function f(){for(let[e,{lifeline:n}]of o)try{e.kill("SIGKILL"),n?.kill("SIGKILL")}catch{}}function c(){let e=0;for(let{pooled:n}of o.values())n||e++;return e}export{u as a,f as b,c};
|
|
@@ -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 l,c}from"./chunk-
|
|
3
|
+
import{a as l,c}from"./chunk-FEJSM3E4.js";import{e as p,f as u}from"./chunk-OLKPV4WO.js";import{execFile as P}from"node:child_process";import{access as N,constants as A,mkdir as I,readFile as E,realpath as _,writeFile as F}from"node:fs/promises";import{homedir as B}from"node:os";import{dirname as C,join as f,posix as R,sep as m,win32 as S}from"node:path";import{promisify as T}from"node:util";var w=T(P),H=["yt-dlp","video"],X=e=>H.includes(e),a={"yt-dlp":{binary:"yt-dlp",name:"yt-dlp",formula:"yt-dlp",versionArgs:["--version"],version:e=>e.trim().split(`
|
|
4
4
|
`)[0]?.match(/^\d+(\.\d+)+$/)?.[0]},video:{binary:"ffmpeg",name:"ffmpeg",formula:"ffmpeg",versionArgs:["-hide_banner","-version"],version:e=>e.match(/ffmpeg version (\S+)/)?.[1],beside:["ffprobe"]}},Y=e=>a[e].name,q=e=>a[e].formula;function $(e,n){let r=e.split(".").map(Number),i=n.split(".").map(Number);for(let t=0;t<Math.max(r.length,i.length);t++){let o=r[t]??0,s=i[t]??0;if(Number.isNaN(o)||Number.isNaN(s))return e>n;if(o!==s)return o>s}return!1}function g(e){let n=p(e);return n&&(u(n)?.version??u(n,"darwin","universal")?.version)}function y({platform:e=process.platform,env:n=process.env,deep:r=!1}={}){let t=(n.PATH??n.Path??"").split(e==="win32"?";":":").filter(Boolean);if(e==="darwin"&&t.push("/opt/homebrew/bin","/usr/local/bin"),r){let o=n.HOME??B(),{join:s}=e==="win32"?S:R;t.push(s(o,".local","bin"),s(o,"bin"),"/opt/local/bin","/usr/bin")}return[...new Set(t)]}var O=(e,n=process.platform)=>n==="win32"?`${e}.exe`:e;async function d(e){try{return await N(e,A.X_OK),!0}catch{return!1}}async function b(e,n){let r=a[e];if(await d(n)){for(let i of r.beside??[])if(!await d(f(C(n),O(i))))return;try{let{stdout:i}=await w(n,r.versionArgs,{timeout:5e3}),t=r.version(i);if(t===void 0)return;let o=await _(n).catch(()=>n),s=g(e);return{id:e,path:n,version:t,homebrew:o.includes(`${m}Cellar${m}`),tooOld:e==="yt-dlp"&&s!==void 0&&$(s,t)}}catch{return}}}var h=()=>f(l(),"own.json");async function v(){try{let e=JSON.parse(await E(h(),"utf8"));return typeof e=="object"&&e!==null?e:{}}catch{return{}}}async function j(e){let n=(await v())[e];return typeof n=="string"&&n!==""?n:void 0}async function z(e,n){let r=await v();n===void 0?delete r[e]:r[e]=n,await I(l(),{recursive:!0}),await F(h(),`${JSON.stringify(r,null,2)}
|
|
5
|
-
`)}async function J(e,n={}){let r=await j(e);if(r!==void 0){let o=await b(e,r);if(o)return o}let t=process.env.FORGE_NO_OWN_TOOLS==="1"&&n.dirs===void 0?[]:n.dirs??y({deep:n.deep??!1});for(let o of t){let s=await b(e,f(o,O(a[e].binary)));if(s)return s}}async function k(e){if(await c(e)===void 0)return 0;try{let{removeExtension:n,extensionBytes:r}=await import("./manager-
|
|
5
|
+
`)}async function J(e,n={}){let r=await j(e);if(r!==void 0){let o=await b(e,r);if(o)return o}let t=process.env.FORGE_NO_OWN_TOOLS==="1"&&n.dirs===void 0?[]:n.dirs??y({deep:n.deep??!1});for(let o of t){let s=await b(e,f(o,O(a[e].binary)));if(s)return s}}async function k(e){if(await c(e)===void 0)return 0;try{let{removeExtension:n,extensionBytes:r}=await import("./manager-YH5XAMZA.js"),i=await r(e);return await n(e)?i:0}catch{return 0}}async function Q(e={}){let n=await J("yt-dlp",e);if(n&&!n.tooOld)return await k("yt-dlp"),{entry:n.path,own:!0};let r=await c("yt-dlp");return r?{entry:r.entry,own:!1}:void 0}async function x(e){if(e.brew!==void 0)return await d(e.brew)?e.brew:void 0;for(let n of y({env:{PATH:process.env.PATH??""}})){let r=f(n,"brew");if(await d(r))return r}}async function V(e,n={}){if(e.tooOld)return g(e.id);if(!e.homebrew)return;let r=await x(n);if(r!==void 0)try{let{stdout:i}=await w(r,["outdated","--json=v2","--formula",a[e.id].formula],{timeout:15e3,env:{...process.env,HOMEBREW_NO_AUTO_UPDATE:"1"}}),t=JSON.parse(i);if(!Array.isArray(t.formulae))return;let o=t.formulae[0]?.current_version;return typeof o=="string"?o:null}catch{return}}var Z=e=>e.homebrew?"Homebrew":e.id==="yt-dlp"?"yt-dlp":void 0;async function ee(e,n={}){let r,i;if(e.homebrew){let t=await x(n);if(t===void 0)throw new Error("Homebrew was not found");r=t,i=["upgrade",a[e.id].formula]}else if(e.id==="yt-dlp")r=e.path,i=["--update"];else throw new Error(`${a[e.id].name} cannot update itself`);try{await w(r,i,{timeout:10*6e4,maxBuffer:8<<20,...n.signal?{signal:n.signal}:{}})}catch(t){if(n.signal?.aborted)throw n.signal.reason??t;let o=t,s=(o.stderr??"").trim().split(`
|
|
6
6
|
`).filter(Boolean).at(-1)?.replace(/^Error:\s*/,"");throw new Error(s||o.message||"the update failed")}}export{H as a,X as b,Y as c,q as d,$ as e,y as f,b as g,j as h,z as i,J as j,k,Q as l,V as m,Z as n,ee as o};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a as w,b as I,d as k,e as m}from"./chunk-G2V33TMN.js";import{a as $,c as O}from"./chunk-ID4GJZJ6.js";import{b as h,d as P,e as R}from"./chunk-HAOKWLD3.js";import{f as x}from"./chunk-YJ6XLDRA.js";import{q as B}from"./chunk-ULX4ZD2Y.js";import{a as l}from"./chunk-H332YFSO.js";import{d as c,oa as g,pa as C,ra as v}from"./chunk-PNPAHKJR.js";import{a as f}from"./chunk-FGR6QCG5.js";import{b as p}from"./chunk-VLVNA4T3.js";import{dirname as S,join as q}from"node:path";async function T(t){if(t.fallback!==void 0)return t.fallback;let{loadPreferences:r,expandTilde:e}=await import("./preferences-7S7YZOFK.js");return e((await r()).prefs.defaultOutput)}function F(t){if(t.pasteboard)return t.pasteboard;if(!$())throw C();return O()}function E(t,r,e,o){let a=q(r.outDir,`Copied image${c[o].extensions[0]}`),s={inputs:[r.source],output:a,force:!1,recursive:!1,debug:t.debug},n={background:"#ffffff",keepMetadata:!1,...t.quality===void 0?{}:{quality:t.quality}};return o===e?{kind:"compress",...s,options:n,...t.quality===void 0?{}:{quality:t.quality},...t.maxBytes===void 0?{}:{maxBytes:t.maxBytes}}:{kind:"convert",...s,target:o,options:n,...t.maxBytes===void 0?{}:{maxBytes:t.maxBytes}}}async function J(t,r={}){let e=r.clip??{},o=F(e),a=await w(o,e.root);if(!a)throw g((await o.peek()).text?"text":"nothing");let s=await B(a.source),n=t.target??s.format,b=E(t,a,s.format,n),i=await P(b,r),y=i.results[0];if(!y||i.failures.length>0)return{report:i,status:"failed"};let u=y.job.outputs[0],d={report:i,output:u,source:{format:s.format,bytes:s.bytes},target:n};if(await I(o,a,u,n)==="changed")return{...d,status:"changed",saved:await m(u,await T(e))};if(t.save===void 0)return{...d,status:"placed"};let j=t.save===!0?await T(e):t.save,{expandTilde:D}=await import("./preferences-7S7YZOFK.js");return{...d,status:"placed",saved:await m(u,D(j))}}function N(t){let r=t.target===t.source.format?"":` as ${c[t.target].label}`,e=` ${f(t.source.bytes)} \u2192 ${f(t.report.outputBytes)} \xB7 ${h(t.source.bytes,t.report.outputBytes)}`;if(t.status==="changed"){let a=t.target===t.source.format?"compressed":"converted";return[`\u2713 Copied image \u2192 ${p(t.saved)}${r}`,e,"","\u26A0 Clipboard changed"," The file you uploaded is no longer in the clipboard.",` The ${a} image is saved to ${p(S(t.saved))}.`]}let o=t.saved===void 0?"":` + ${p(t.saved)}`;return[`\u2713 Copied image \u2192 clipboard${r}${o}`,e]}async function U(t){if(!await k(F(t),t.root))throw v()}async function Z(t,r){if(t.undo)return await U(r.clip??{}),{exitCode:0,stdout:r.json?[JSON.stringify({forge:l,ok:!0,clipboard:"restored"})]:["\u2713 The original is back on the clipboard"],stderr:[]};let e=await J(t,r);if(e.status==="failed")return R(e.report,r);if(r.json){let o={...x(l,e.report),clipboard:e.status,...e.saved===void 0?{}:{saved:e.saved}};return{exitCode:0,stdout:[JSON.stringify(o)],stderr:[]}}return{exitCode:0,stdout:N(e),stderr:[]}}export{J as a,N as b,U as c,Z as d};
|
|
@@ -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 f}from"./chunk-
|
|
3
|
+
import{b as f}from"./chunk-ID4GJZJ6.js";import{execFile as s,execFileSync as i,spawn as d}from"node:child_process";var u=()=>({...process.env,LANG:process.env.LANG??"en_US.UTF-8"});function m(e,r=process.platform,n=process.env){if(e!==""){if(r==="linux"){c(Buffer.from(e,"utf8"),p(n,"copy"));return}if(r==="win32"){try{let t=s("clip.exe",()=>{});t.on("error",()=>{}),t.stdin?.end(Buffer.concat([Buffer.from([255,254]),Buffer.from(e,"utf16le")]))}catch{}return}try{let t=s("pbcopy",{env:u()},()=>{});t.on("error",()=>{}),t.stdin?.end(Buffer.from(e,"utf8"))}catch{}}}function y(e=process.platform,r=process.env){if(e==="linux")return l(p(r,"paste"));if(e==="win32")try{return i("powershell.exe",["-NoProfile","-NonInteractive","-Command","[Console]::OutputEncoding=[Text.Encoding]::UTF8; Get-Clipboard -Raw"],{encoding:"buffer",maxBuffer:67108864,timeout:5e3}).toString("utf8").replace(/\r\n$/,"")}catch{return""}try{return i("pbpaste",{encoding:"buffer",env:u(),maxBuffer:67108864,timeout:2e3}).toString("utf8")}catch{return""}}function p(e,r){return f(e).flatMap(n=>n.name==="wayland"?r==="copy"?[["wl-copy",["--type","text/plain;charset=utf-8"]]]:[["wl-paste",["--no-newline","--type","text"]]]:r==="copy"?[["xclip",["-selection","clipboard","-i"]],["xsel",["--clipboard","--input"]]]:[["xclip",["-selection","clipboard","-o"]],["xsel",["--clipboard","--output"]]])}function c(e,r){let[n,...t]=r;if(n)try{let o=d(n[0],n[1],{stdio:["pipe","ignore","ignore"],detached:!0});o.on("error",a=>{a.code==="ENOENT"&&c(e,t)}),o.stdin?.on("error",()=>{}),o.stdin?.end(e),o.unref()}catch{c(e,t)}}function l(e){for(let[r,n]of e)try{return i(r,n,{encoding:"buffer",maxBuffer:67108864,timeout:2e3,stdio:["ignore","pipe","ignore"]}).toString("utf8")}catch(t){if(t.code!=="ENOENT")return""}return""}export{m as a,y as b,p 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 i,c as n}from"./chunk-PON65UTS.js";import{q as e,r}from"./chunk-JZM37DG2.js";var o=0;async function a(t){o++;try{return await t}finally{o--}}function p(){return o>0||n()>0||e().length>0}function f(){i(),r()}export{a,p as b,f as c};
|