forge-terminal 0.4.4 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +104 -19
  2. package/dist/chunks/{about-credits-QMC5GQU2.js → about-credits-5UQU5WHE.js} +2 -2
  3. package/dist/chunks/args-QKAIL3E4.js +3 -0
  4. package/dist/chunks/{available-GYIHVSRX.js → available-M6Z62OWE.js} +1 -1
  5. package/dist/chunks/boot-MGR26CBU.js +3 -0
  6. package/dist/chunks/catalog-VPSTQTFD.js +3 -0
  7. package/dist/chunks/check-B6NP7BEM.js +3 -0
  8. package/dist/chunks/chunk-37P6QZ5Q.js +3 -0
  9. package/dist/chunks/chunk-3GJ7GV3V.js +19 -0
  10. package/dist/chunks/{chunk-EHARO6IS.js → chunk-57M4J2BR.js} +1 -1
  11. package/dist/chunks/chunk-63XCSYHM.js +3 -0
  12. package/dist/chunks/{chunk-JFJ3ZJQL.js → chunk-63ZK5SRQ.js} +1 -1
  13. package/dist/chunks/chunk-C4UCCBCX.js +3 -0
  14. package/dist/chunks/{chunk-DERIWZAT.js → chunk-CKZBBDAW.js} +1 -1
  15. package/dist/chunks/chunk-DZOBIUV6.js +3 -0
  16. package/dist/chunks/chunk-EKTUUKDP.js +80 -0
  17. package/dist/chunks/chunk-F34DPQFQ.js +63 -0
  18. package/dist/chunks/chunk-G46QQBT3.js +3 -0
  19. package/dist/chunks/chunk-GSK2A3TN.js +3 -0
  20. package/dist/chunks/chunk-H3DIRJFE.js +3 -0
  21. package/dist/chunks/chunk-HKINXTUW.js +3 -0
  22. package/dist/chunks/chunk-HOZ6XGQQ.js +6 -0
  23. package/dist/chunks/chunk-I6754KTB.js +36 -0
  24. package/dist/chunks/{chunk-YYB3TTGT.js → chunk-JMBEZPYC.js} +1 -1
  25. package/dist/chunks/chunk-K7KKCR7V.js +6 -0
  26. package/dist/chunks/chunk-KH5DHZ2U.js +8 -0
  27. package/dist/chunks/chunk-KXKQDFHX.js +3 -0
  28. package/dist/chunks/chunk-LVYQVJOF.js +3 -0
  29. package/dist/chunks/chunk-N6RCLJE6.js +4 -0
  30. package/dist/chunks/chunk-N72E43Z3.js +3 -0
  31. package/dist/chunks/chunk-NDECMPOM.js +3 -0
  32. package/dist/chunks/chunk-NXJGO66P.js +3 -0
  33. package/dist/chunks/chunk-OK7XOZFO.js +3 -0
  34. package/dist/chunks/chunk-P4RAYEM7.js +6 -0
  35. package/dist/chunks/{chunk-EX7KZBI6.js → chunk-PE5LAYGF.js} +1 -1
  36. package/dist/chunks/chunk-PPR7B5AR.js +3 -0
  37. package/dist/chunks/chunk-Q6KQWJ4J.js +3 -0
  38. package/dist/chunks/{chunk-GJ2GZHRI.js → chunk-RMD7F3QX.js} +1 -1
  39. package/dist/chunks/chunk-SK2UZ25Y.js +3 -0
  40. package/dist/chunks/chunk-SNDFMJIX.js +3 -0
  41. package/dist/chunks/{chunk-IGF6ZFTM.js → chunk-SZRSAL64.js} +1 -1
  42. package/dist/chunks/chunk-THDAQBQ3.js +3 -0
  43. package/dist/chunks/chunk-TL5MACSF.js +3 -0
  44. package/dist/chunks/chunk-V3I6DSF4.js +3 -0
  45. package/dist/chunks/{chunk-M7A55JKD.js → chunk-W6SY5PPG.js} +2 -2
  46. package/dist/chunks/chunk-WC6SJN5Y.js +3 -0
  47. package/dist/chunks/chunk-WE6KP4FR.js +3 -0
  48. package/dist/chunks/chunk-WIPP5TWQ.js +3 -0
  49. package/dist/chunks/{chunk-I2IATJNL.js → chunk-XBOMWF34.js} +1 -1
  50. package/dist/chunks/chunk-XRI5XKEB.js +66 -0
  51. package/dist/chunks/chunk-Y7LOIHFU.js +3 -0
  52. package/dist/chunks/chunk-YINYF6C7.js +3 -0
  53. package/dist/chunks/chunk-ZRHYGR2L.js +134 -0
  54. package/dist/chunks/chunk-ZZZAPVKM.js +3 -0
  55. package/dist/chunks/clip-command-R2NKW4TI.js +3 -0
  56. package/dist/chunks/clipboard-GICOXMMN.js +3 -0
  57. package/dist/chunks/colour-APVBMEJQ.js +3 -0
  58. package/dist/chunks/command-GYCYLUHN.js +3 -0
  59. package/dist/chunks/config-command-6YUMMZF3.js +3 -0
  60. package/dist/chunks/continue-editing-QE5RRIMG.js +3 -0
  61. package/dist/chunks/decoded-UNCEUPNW.js +3 -0
  62. package/dist/chunks/entry-TSLQHDP7.js +6 -0
  63. package/dist/chunks/execute-S5WN34PS.js +3 -0
  64. package/dist/chunks/extensions-XI5R74TS.js +3 -0
  65. package/dist/chunks/{extensions-command-L2AT6OVR.js → extensions-command-25JOL47P.js} +1 -1
  66. package/dist/chunks/ffmpeg-3CJ6C37W.js +3 -0
  67. package/dist/chunks/image-QSTDWHJ4.js +3 -0
  68. package/dist/chunks/install-IDUHZTTS.js +3 -0
  69. package/dist/chunks/{install-V62EEK54.js → install-L5C2UT6M.js} +1 -1
  70. package/dist/chunks/install-size-PZUFEDGI.js +3 -0
  71. package/dist/chunks/launch-LFFWVTFE.js +17 -0
  72. package/dist/chunks/libs-EK64ACG3.js +3 -0
  73. package/dist/chunks/lock-PTQUMNYX.js +3 -0
  74. package/dist/chunks/manager-CQ6NNQY4.js +4 -0
  75. package/dist/chunks/needed-MYXIUZI4.js +3 -0
  76. package/dist/chunks/own-WNA6BFYL.js +3 -0
  77. package/dist/chunks/{paths-5XI5L4KW.js → paths-EOYKOUBC.js} +1 -1
  78. package/dist/chunks/pdfium-WFGSET5S.js +3 -0
  79. package/dist/chunks/preferences-3P4V2EDX.js +3 -0
  80. package/dist/chunks/preset-command-HMOFTZSG.js +3 -0
  81. package/dist/chunks/registry-4IOXO6DT.js +3 -0
  82. package/dist/chunks/{reveal-L6TBFOMV.js → reveal-D5FCZYOA.js} +1 -1
  83. package/dist/chunks/run-HGZVOXRW.js +5 -0
  84. package/dist/chunks/{server-7PMVIYWQ.js → server-KKF3XBQG.js} +8 -8
  85. package/dist/chunks/text-layer-LHZNDMPZ.js +3 -0
  86. package/dist/chunks/{theme-Z6X54JY4.js → theme-NAWQ77WF.js} +1 -1
  87. package/dist/chunks/transcribe-Q5NLWSSR.js +3 -0
  88. package/dist/chunks/transcribe-command-2L7F7MCG.js +3 -0
  89. package/dist/chunks/{update-command-GMBG7BK6.js → update-command-JCTCRPCS.js} +1 -1
  90. package/dist/chunks/update-note-FRMHMUMD.js +3 -0
  91. package/dist/chunks/watch-command-XCCMIQIM.js +3 -0
  92. package/dist/fonts/NotoSans-Bold.ttf.gz +0 -0
  93. package/dist/fonts/NotoSans-Regular.ttf.gz +0 -0
  94. package/dist/fonts/OFL.txt +93 -0
  95. package/dist/helpers/forge-transcribe +0 -0
  96. package/dist/helpers/forge-transcribe-whisper.mjs +525 -0
  97. package/dist/index.js +8 -8
  98. package/dist/third-party-licenses.txt +98 -0
  99. package/package.json +45 -10
  100. package/dist/chunks/args-VPUOIDWE.js +0 -3
  101. package/dist/chunks/boot-FOKV7OHT.js +0 -3
  102. package/dist/chunks/catalog-YSMT3PXT.js +0 -3
  103. package/dist/chunks/check-KAR72Y4X.js +0 -3
  104. package/dist/chunks/chunk-3UEQ2OX6.js +0 -3
  105. package/dist/chunks/chunk-5B5XXH22.js +0 -3
  106. package/dist/chunks/chunk-5IS7O673.js +0 -6
  107. package/dist/chunks/chunk-5SMYDPVX.js +0 -63
  108. package/dist/chunks/chunk-6FUVEO3A.js +0 -78
  109. package/dist/chunks/chunk-6L6C3GJU.js +0 -3
  110. package/dist/chunks/chunk-AAXBN572.js +0 -4
  111. package/dist/chunks/chunk-BZXDNDPG.js +0 -3
  112. package/dist/chunks/chunk-DOWMSJ6R.js +0 -3
  113. package/dist/chunks/chunk-EXLXSKRH.js +0 -3
  114. package/dist/chunks/chunk-FH3R2YYD.js +0 -19
  115. package/dist/chunks/chunk-I63TO22X.js +0 -3
  116. package/dist/chunks/chunk-IWFVEMDN.js +0 -3
  117. package/dist/chunks/chunk-JSMGNA55.js +0 -3
  118. package/dist/chunks/chunk-KAHWYWNT.js +0 -3
  119. package/dist/chunks/chunk-LDKF7KIZ.js +0 -6
  120. package/dist/chunks/chunk-LNB5D67B.js +0 -3
  121. package/dist/chunks/chunk-M66BUNYO.js +0 -3
  122. package/dist/chunks/chunk-NWREILRP.js +0 -66
  123. package/dist/chunks/chunk-PSEIJXGT.js +0 -3
  124. package/dist/chunks/chunk-QR6QHTC3.js +0 -3
  125. package/dist/chunks/chunk-QXTXBMTM.js +0 -3
  126. package/dist/chunks/chunk-SMBK6BTC.js +0 -3
  127. package/dist/chunks/chunk-TDW6KQH6.js +0 -3
  128. package/dist/chunks/chunk-TMQDQLY7.js +0 -21
  129. package/dist/chunks/chunk-XEQVXPPY.js +0 -3
  130. package/dist/chunks/chunk-XSOCV3F2.js +0 -3
  131. package/dist/chunks/chunk-YWKMG5WO.js +0 -3
  132. package/dist/chunks/clip-command-SGB3B4OJ.js +0 -3
  133. package/dist/chunks/clipboard-CPHPA4FH.js +0 -3
  134. package/dist/chunks/colour-QMGYV6WQ.js +0 -3
  135. package/dist/chunks/command-I5M275ZV.js +0 -3
  136. package/dist/chunks/config-command-TYNYVUMP.js +0 -3
  137. package/dist/chunks/entry-3PEVSH2X.js +0 -6
  138. package/dist/chunks/execute-WQJ37VKD.js +0 -3
  139. package/dist/chunks/extensions-ZKOWPSLD.js +0 -3
  140. package/dist/chunks/ffmpeg-PF3VLTHK.js +0 -3
  141. package/dist/chunks/image-J4FT4ACZ.js +0 -3
  142. package/dist/chunks/install-2A5BGKQU.js +0 -3
  143. package/dist/chunks/launch-L5DKAUA3.js +0 -15
  144. package/dist/chunks/lock-KN7CF4YN.js +0 -3
  145. package/dist/chunks/manager-TEZ3V4L4.js +0 -4
  146. package/dist/chunks/preferences-4VETUGMN.js +0 -3
  147. package/dist/chunks/preset-command-HORY7KZQ.js +0 -3
  148. package/dist/chunks/run-6BK4REXK.js +0 -4
  149. package/dist/chunks/transcribe-command-YUSBCQEQ.js +0 -3
  150. package/dist/chunks/update-note-RQG2RZNR.js +0 -3
  151. package/dist/chunks/watch-command-DUHMTXQL.js +0 -3
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as o}from"./chunk-PPR7B5AR.js";import{f as n}from"./chunk-V3I6DSF4.js";import{H as i}from"./chunk-WIPP5TWQ.js";import{a as r}from"./chunk-H3DIRJFE.js";var I=5,h=200,x=5;function z(t){return t.format==="heic"||t.format==="raw"?"jpeg":o(t).includes(t.format)?t.format:"png"}function E(t,m){let e=n.find(f=>f.id==="image")?.writes;if(!e?.has(t))return i(`Cannot ${m} into ${r[t].label}; only an image format can take the edit.`,`Choose one of: ${[...e??[]].join(", ")}.`)}var c=t=>`${t.width}x${t.height}`,u=t=>"percent"in t?`${t.percent}pct`:"width"in t?`${t.width}w`:`${t.height}h`;export{I as a,h as b,x as c,z as d,E as e,c as f,u as g};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{b as g,c as R,d as T,e as E,f as w,g as d}from"./chunk-QVACE4IE.js";import{H as y}from"./chunk-WIPP5TWQ.js";var L={set:"tailwind",start:50,end:950,count:11},D=["tailwind","even","radix"],I=[0,50,100,150,200,250,300,350,400,450],$=[550,600,650,700,750,800,850,900,950,1e3],N=Array.from({length:19},(e,t)=>t+3),P=[20,50,100,150,200,260,330,420,500,560,750,920],_=8;function W({set:e,start:t,end:n,count:r}){if(!D.includes(e))return`The set must be tailwind, even or radix; got ${e}.`;if(e!=="radix"){if(!I.includes(t))return t%50===0?`The start must be from 0 to 450, so the colour (500) stays in the scale; got ${t}.`:`The start must be a multiple of 50; got ${t}.`;if(!$.includes(n))return n%50===0?`The end must be from 550 to 1000, so the colour (500) stays in the scale; got ${n}.`:`The end must be a multiple of 50; got ${n}.`;if(e==="even"&&!N.includes(r))return`An even set has 3 to 21 steps; got ${r}.`}}function x(e){let{set:t,start:n,end:r,count:a}=e;if(t==="radix")return P.map((o,u)=>({step:u+1,at:o}));if(t==="tailwind"){let o=new Set([n,r,500]);for(let u=Math.ceil((n+1)/100)*100;u<r;u+=100)o.add(u);return[...o].sort((u,s)=>u-s).map(u=>({step:u,at:u}))}let i=a-1,l=Math.round(i*(500-n)/(r-n)),f=Math.max(1,Math.min(i-1,l)),h=i-f,c=[];for(let o=0;o<=f;o++)c.push(n+(500-n)*o/f);for(let o=1;o<=h;o++)c.push(500+(r-500)*o/h);for(let o of[10,5,1]){let u=c.map(s=>Math.round(s/o)*o);if(new Set(u).size===u.length)return c.map((s,p)=>({step:u[p],at:s}))}return c.map(o=>({step:o,at:o}))}function F(e){return x(e).map(t=>t.step)}var Y=F(L);function q(e){return e.set==="radix"?_:x(e).findIndex(t=>t.at===500)}var H=[[50,1],[100,.86],[200,.68],[300,.46],[400,.22],[500,0]],U=[[500,0],[600,.2],[700,.4],[800,.6],[900,.8],[950,1]];function M(e,t){for(let n=1;n<e.length;n++){let[r,a]=e[n-1],[i,l]=e[n];if(t<=i)return a+(l-a)*(t-r)/(i-r)}return e[e.length-1][1]}var j=.995,k=.35,B=5e-4;function J(e,t=L){let n=W(t);if(n)throw y(n,"Try: Tailwind, from 50 to 950.");let{L:r,C:a,h:i}=w(R(e)),l=a<B,f=Math.max(.975,r),h=r<.16?.42*r:Math.max(.16,.42*r),c=x(t),o=c[c.length-1]?.at===1e3;return c.map(({step:u,at:s})=>{if(s===500)return{step:u,at:s,rgb:{...e},hex:g(e),reference:!0};let p,b;if(s>=50&&s<500){let m=M(H,s);p=r+(f-r)*m,b=a*(1-.88*m)}else if(s<50){let m=(50-s)/50;p=f+(Math.max(j,f)-f)*m,b=a*.12*(1-m)}else if(s<=950||o){let m=o?(s-500)/500:M(U,s);p=r-(r-h)*m,b=a*(1-.45*m)}else{let m=(s-950)/50;p=h*(1-k*m),b=a*.55*(1-.4*m)}for(l&&(b=0);b>0&&!E(d({L:p,C:b,h:i}));)b-=.002;let A=T(d({L:p,C:Math.max(0,b),h:i}));return{step:u,at:s,rgb:A,hex:g(A),reference:!1}})}var S=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},C=({r:e,g:t,b:n})=>.2126*S(e)+.7152*S(t)+.0722*S(n);function O(e,t){let[n,r]=[C(e),C(t)].sort((a,i)=>i-a);return(n+.05)/(r+.05)}function V(e){return e>=7?"AAA":e>=4.5?"AA":e>=3?"large":"fails"}var G={r:255,g:255,b:255},X={r:0,g:0,b:0},v=e=>Math.floor(e*10)/10;function Z(e){return{white:v(O(e,G)),black:v(O(e,X))}}export{L as a,D as b,I as c,$ as d,N as e,x as f,F as g,q as h,J as i,O as j,V as k,Z as l};
@@ -0,0 +1,134 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{r as F}from"./chunk-DZOBIUV6.js";import{execFile as vn}from"node:child_process";import{chmodSync as le,existsSync as Ke,mkdirSync as pe,readdirSync as Ge,readFileSync as H,rmdirSync as Mn,rmSync as $,writeFileSync as In}from"node:fs";import{dirname as U,join as u}from"node:path";var tn={convert:"#55c7d9",compress:"#79c98b",edit:"#b39ae8",pdf:"#ff6b4a"},rn="#55c7d9",on="#a68ce0",sn=4/5,an=(e,n,t,r)=>`<path fill="${r}" d="M${e} ${n}h${4*t}v${t}h${-3*t}v${t}h${2*t}v${t}h${-2*t}v${2*t}h${-t}z"/>`;function cn(e,n){let t=n<=20,r=t?3:4,i=t?6:4.6,o=t?51:51.5,c=Array.from({length:r},(g,w)=>o-(r-1-w)*i).map(g=>`<line x1="${g}" y1="66" x2="${g+66*sn}" y2="0"/>`).join(""),f=e==="forge"?"url(#w)":tn[e];return`<svg width="${n}" height="${n}" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="w" gradientUnits="userSpaceOnUse" x1="34" y1="0" x2="62" y2="0"><stop offset="0" stop-color="${rn}"/><stop offset="1" stop-color="${on}"/></linearGradient><clipPath id="c"><rect width="64" height="64" rx="14"/></clipPath><clipPath id="i"><rect x="1.5" y="1.5" width="61" height="61" rx="12.5"/></clipPath></defs><g clip-path="url(#c)"><rect width="64" height="64" fill="#1e1e1e"/><g clip-path="url(#i)" stroke="${f}" stroke-width="${t?3.6:2.4}">${c}</g>${an(16,12,8,"#e7e7e7")}</g><rect x=".75" y=".75" width="62.5" height="62.5" rx="13.5" fill="none" stroke="#3a3a3a" stroke-width="1.5"/></svg>`}async function S(e,n){let{default:t}=await import("sharp");return t(Buffer.from(cn(e,n))).png().toBuffer()}function he(e){let n=Buffer.alloc(6);n.writeUInt16LE(0,0),n.writeUInt16LE(1,2),n.writeUInt16LE(e.length,4);let t=6+16*e.length,r=e.map(({size:i,png:o})=>{let s=Buffer.alloc(16);return s[0]=i>=256?0:i,s[1]=i>=256?0:i,s.writeUInt16LE(1,4),s.writeUInt16LE(32,6),s.writeUInt32LE(o.length,8),s.writeUInt32LE(t,12),t+=o.length,s});return Buffer.concat([n,...r,...e.map(i=>i.png)])}function y(e){let n=[{action:"open",label:"Open Forge",kinds:["image","folder"],window:!0,paint:"forge"},{action:"convert",label:"Convert in Forge",kinds:["image","folder"],window:!0,paint:"convert"},{action:"compress",label:"Compress in Forge",kinds:["image","folder"],window:!0,paint:"compress"},{action:"sharpen",label:"Sharpen in Forge",kinds:["image"],window:!1,paint:"edit"},{action:"open-pdf",label:"Open in Forge",kinds:["pdf"],window:!0,paint:"pdf"}],t=(e.presets??[]).map(r=>({action:"preset",preset:r,label:`${r} in Forge`,kinds:["image"],window:!1,paint:"forge"}));return[...e.sharpen?n:n.filter(r=>r.action!=="sharpen"),...t]}var $e=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function B(e,n){if(typeof e=="string")return`${n}<string>${$e(e)}</string>`;if(typeof e=="number")return`${n}<integer>${e}</integer>`;if(typeof e=="boolean")return`${n}<${e}/>`;if(Array.isArray(e))return`${n}<array>
4
+ ${e.map(r=>B(r,`${n} `)).join(`
5
+ `)}
6
+ ${n}</array>`;let t=Object.entries(e).map(([r,i])=>`${n} <key>${$e(r)}</key>
7
+ ${B(i,`${n} `)}`);return t.length===0?`${n}<dict/>`:`${n}<dict>
8
+ ${t.join(`
9
+ `)}
10
+ ${n}</dict>`}var ye=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
+ ${B(e,"")}
14
+ </plist>
15
+ `,un={image:"public.image",folder:"public.folder",pdf:"com.adobe.pdf"};function fn(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 a=e=>`'${e.replace(/'/g,"'\\''")}'`,j="forge",xe=e=>e.preset===void 0?`com.forge-terminal.menu.${e.action}`:`com.forge-terminal.menu.preset.${e.preset}`,we="com.forge-terminal.menu.",Se="runWorkflowAsService",E=e=>`${xe(e)} - ${e.label} - ${Se}`,ln=`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 D(e){return[e.osascript??"/usr/bin/osascript",["-l","JavaScript","-e",ln,e.domain??"pbs",...e.on.map(n=>`+${n}`),...e.off.map(n=>`-${n}`)]]}function _(e,n){let t=ye({CFBundleDevelopmentRegion:"English",CFBundleIdentifier:xe(e),CFBundleInfoDictionaryVersion:"6.0",CFBundleName:e.label,CFBundlePackageType:"BNDL",CFBundleShortVersionString:"1.0",CFBundleVersion:"1",NSServices:[{NSIconName:j,NSMenuItem:{default:e.label},NSMessage:Se,NSRequiredContext:{NSApplicationIdentifier:"com.apple.finder"},NSSendFileTypes:e.kinds.map(s=>un[s])}]}),r=e.preset===void 0?"":` ${a(e.preset)}`,i=`${a(n)} ${e.action}${r} "$@"`,o=ye({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:i,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:fn(e.kinds),serviceOutputTypeIdentifier:"com.apple.Automator.nothing",serviceProcessesInput:!1,workflowTypeIdentifier:"com.apple.Automator.servicesMenu"}});return{name:`${e.label}.workflow`,files:{"Contents/Info.plist":t,"Contents/document.wflow":o,"Contents/Resources/document.wflow":o}}}import{execFile as xn}from"node:child_process";import{accessSync as pn,constants as mn}from"node:fs";import{isAbsolute as De,join as p}from"node:path";var d="forge-terminal-menu";function ve(e){let n=r=>r&&De(r)?r:void 0,t=(e.xdgConfigDirs??"").split(":").filter(r=>De(r));return{dataHome:n(e.xdgDataHome)??p(e.home,".local","share"),configHome:n(e.xdgConfigHome)??p(e.home,".config"),configDirs:t.length>0?t:["/etc/xdg"]}}function K(e,n=process.env.PATH){for(let t of(n??"").split(":"))if(t!=="")try{return pn(p(t,e),mn.X_OK),!0}catch{}return!1}var Me={image:"image/*",folder:"inode/directory",pdf:"application/pdf"},gn=e=>e.map(n=>`${Me[n]};`).join(""),P=e=>`${e.paint}.png`,h=e=>p(e.dataHome,"nautilus","scripts","Forge"),b=e=>e.preset===void 0?e.action:`preset-${e.preset}`,k=e=>e.preset===void 0?e.action:`preset ${e.preset}`,G=e=>e.label;function Ie(e,n){return`#!/bin/sh
31
+ # ${d}: 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 ${a(n)} ${k(e)} "$@"
39
+ `}var I=e=>p(e.dataHome,"nemo","actions"),W=(e,n)=>`forge-${e.preset===void 0?n.indexOf(e.action)+1:n.length+1}-${b(e)}.nemo_action`,M=e=>e.replace(/%/g,"%%");function Ne(e,n){return`[Nemo Action]
40
+ # ${d}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.
41
+ Name=${M(e.label)}
42
+ Comment=${M(e.label)}
43
+ Exec=${M(a(n))} ${k(e)} %F
44
+ Selection=notnone
45
+ Mimetypes=${gn(e.kinds)}
46
+ `}var A=e=>p(e.dataHome,"kio","servicemenus"),V=e=>`forge-${e}.desktop`,X=["image","folder","pdf"],dn=e=>M(`"${e.replace(/[\\"`$]/g,"\\$&")}"`).replace(/\\/g,"\\\\");function Fe(e,n,t){let r=n.filter(c=>c.kinds.includes(e));if(r.length===0)return;let i=r.length>1,o=["[Desktop Entry]",`# ${d}: 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=${Me[e]};`,`Actions=${r.map(c=>`${b(c)};`).join("")}`,"X-KDE-Priority=TopLevel",...i?["X-KDE-Submenu=Forge",`Icon=${p(t.menuDir,"forge.png")}`]:[]],s=r.map(c=>["",`[Desktop Action ${b(c)}]`,`Name=${c.label}`,`Icon=${p(t.menuDir,P(c))}`,`Exec=${dn(t.launcher)} ${k(c)} %F`].join(`
47
+ `));return`${[...o,...s].join(`
48
+ `)}
49
+ `}var C=e=>p(e.configHome,"Thunar","uca.xml"),Ee=e=>e.configDirs.map(n=>p(n,"Thunar","uca.xml")),be=`<?xml version="1.0" encoding="UTF-8"?>
50
+ <actions>
51
+ </actions>
52
+ `,hn=e=>`${d}-${b(e)}`,v=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),$n={image:{patterns:["*"],type:"image-files"},folder:{patterns:["*"],type:"directories"},pdf:{patterns:["*.pdf","*.PDF"],type:"other-files"}};function Pe(e,n){return e.map(t=>{let r=t.kinds.map(s=>$n[s]),i=[...new Set(r.flatMap(s=>s.patterns))],o=i.includes("*")?["*"]:i;return["<action>",` <icon>${v(p(n.menuDir,P(t)))}</icon>`,` <name>${v(t.label)}</name>`,` <submenu>${t.kinds.includes("pdf")?"":"Forge"}</submenu>`,` <unique-id>${hn(t)}</unique-id>`,` <command>${v(M(a(n.launcher)))} ${k(t)} %F</command>`,` <description>${v(t.label)}</description>`," <range></range>",` <patterns>${v(o.join(";"))}</patterns>`,...r.map(s=>` <${s.type}/>`),"</action>"].join(`
53
+ `)}).map(t=>`${t}
54
+ `).join("")}var yn=/[ \t]*<action>[\s\S]*?<\/action>[ \t]*\r?\n?/g;function J(e){return e.replace(yn,n=>n.includes(`<unique-id>${d}-`)?"":n)}function q(e,n){let t=J(e),r=t.lastIndexOf("</actions>");if(r===-1||!/<actions>/.test(t))return;let i=t.lastIndexOf(`
55
+ `,r)+1;return/^[ \t]*$/.test(t.slice(i,r))&&(r=i),`${t.slice(0,r)}${n}${t.slice(r)}`}var ke=(e,n,t)=>K("thunar",n)||t(p(e.configHome,"Thunar"));var Y="ForgeTerminal.Forge",Ae=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Q=e=>e.replace(/['‘’‚‛]/g,"$&$&"),Ce=Q;function Z(e,n){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">${Ce(Ae(e))}</text><text id="2">${Ce(Ae(n))}</text></binding></visual></toast>')`,`[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('${Y}').Show([Windows.UI.Notifications.ToastNotification]::new($x))`].join("; ")}function wn(e,n,t=process.platform){return t==="win32"?["powershell.exe",["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",Z(e,n)]]:["/usr/bin/osascript",["-e","on run argv","-e","display notification (item 2 of argv) with title (item 1 of argv)","-e","end run",e,n]]}var T=e=>`"${e.replace(/[\\"]/g,"\\$&").replace(/\n/g,"\\n")}"`;function Sn(e,n,t={}){let r=t.has??(i=>K(i));if(r("notify-send"))return["notify-send",["--app-name=Forge",...t.icon?[`--icon=${t.icon}`]:[],"--",e,n]];if(r("gdbus"))return["gdbus",["call","--session","--dest","org.freedesktop.Notifications","--object-path","/org/freedesktop/Notifications","--method","org.freedesktop.Notifications.Notify",T("Forge"),"0",T(t.icon??""),T(e),T(n),"[]","{}","-1"]]}function _n(e,n,t=process.platform,r={}){let i=t==="linux"?Sn(e,n,r):wn(e,n,t);return new Promise(o=>{if(i===void 0)return o();try{xn(i[0],i[1],{timeout:1e4,windowsHide:!0},()=>o())}catch{o()}})}var z="Forge was uninstalled",ee="Its menu items are removed.",Te="Forge could not start",Oe="Run forge in a terminal once to set its menu up again.";function Le(e){let{osascript:n,pbs:t}=e.tools??{osascript:"/usr/bin/osascript",pbs:"/System/Library/CoreServices/pbs"},r=[e.node,...e.execArgv,e.forge].map(a).join(" "),[i,o]=D({on:[],off:e.services,osascript:n}),s=[i,...o].map(a).join(" "),c=(f,g)=>`${a(n)} -e 'display notification "${g}" with title "${f}"'`;return`#!/bin/sh
56
+ # Forge's right-click menu. Rewritten by Forge whenever it sets the menu up.
57
+ if [ ! -f ${a(e.forge)} ]; then
58
+ # Forge is gone: take its menu with it, and say so once.
59
+ ${e.bundles.map(f=>` rm -rf ${a(f)}`).join(`
60
+ `)}
61
+ rm -rf ${a(e.menuDir)}
62
+ ${s}
63
+ ${a(t)} -update
64
+ ${c(z,ee)}
65
+ exit 0
66
+ fi
67
+ if [ ! -x ${a(e.node)} ]; then
68
+ ${c(Te,Oe)}
69
+ exit 1
70
+ fi
71
+ ${e.xdgConfigHome===void 0?"":`export XDG_CONFIG_HOME=${a(e.xdgConfigHome)}
72
+ `}exec ${r} menu run "$@"
73
+ `}function Ue(e){let n=e.xdgConfigHome===void 0?{}:{XDG_CONFIG_HOME:e.xdgConfigHome};return`// Forge's right-click menu. Rewritten by Forge whenever it sets the menu up.
74
+ import { execFileSync, spawn } from 'node:child_process'
75
+ import { existsSync, rmSync } from 'node:fs'
76
+
77
+ const FORGE = ${JSON.stringify(e.forge)}
78
+ const ARGS = ${JSON.stringify(e.execArgv)}
79
+ const MENU = ${JSON.stringify(e.menuDir)}
80
+ const KEYS = ${JSON.stringify(e.keys)}
81
+ const ENV = ${JSON.stringify(n)}
82
+
83
+ if (existsSync(FORGE)) {
84
+ const child = spawn(process.execPath, [...ARGS, FORGE, 'menu', 'run', ...process.argv.slice(2)], {
85
+ stdio: 'inherit',
86
+ windowsHide: true,
87
+ env: { ...process.env, ...ENV },
88
+ })
89
+ child.on('exit', (code) => process.exit(code ?? 0))
90
+ } else {
91
+ // Forge is gone: say so while its app ID still exists, then take the menu with it.
92
+ try {
93
+ execFileSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', ${JSON.stringify(Z(z,ee))}], { windowsHide: true })
94
+ } catch {}
95
+ for (const key of KEYS) {
96
+ try {
97
+ execFileSync('reg.exe', ['delete', key, '/f'], { windowsHide: true, stdio: 'ignore' })
98
+ } catch {}
99
+ }
100
+ rmSync(MENU, { recursive: true, force: true })
101
+ }
102
+ `}function Dn(){return`say() {
103
+ if command -v notify-send >/dev/null 2>&1; then
104
+ notify-send --app-name=Forge -- "$1" "$2" >/dev/null 2>&1
105
+ elif command -v gdbus >/dev/null 2>&1; then
106
+ ${["gdbus call --session --dest org.freedesktop.Notifications","--object-path /org/freedesktop/Notifications","--method org.freedesktop.Notifications.Notify",`Forge 0 "''" "\\"$1\\"" "\\"$2\\"" '[]' '{}' -1`].join(" ")} >/dev/null 2>&1
107
+ fi
108
+ }`}function He(e){let n=[e.node,...e.execArgv,e.forge].map(a).join(" "),t=e.files.map(a).join(` \\
109
+ `),r="";if(e.thunar!==void 0){let i=a(e.thunar.file),o=a(`${e.thunar.file}.forge-tmp`),s=a(e.thunar.seed),c=['/<action>/ { held = ""; holding = 1 }',`holding { held = held $0 "\\n"; if (/<\\/action>/) { holding = 0; if (held !~ /<unique-id>${e.marker}-/) printf "%s", held }; next }`,"{ print }"].join(`
110
+ `);r=` if [ -f ${i} ] && grep -qF '<unique-id>${e.marker}-' ${i}; then
111
+ awk ${a(c)} ${i} > ${o} && mv -f ${o} ${i}
112
+ if [ -f ${s} ] && cmp -s ${s} ${i}; then rm -f ${i}; fi
113
+ fi
114
+ `}return`#!/bin/sh
115
+ # Forge's right-click menu. Rewritten by Forge whenever it sets the menu up.
116
+ ${Dn()}
117
+ if [ ! -f ${a(e.forge)} ]; then
118
+ # Forge is gone: take its menu with it, and say so once.
119
+ for f in ${t}; do
120
+ if [ -f "$f" ] && grep -qF ${a(e.marker)} "$f"; then rm -f "$f"; fi
121
+ done
122
+ ${r}${e.folders.map(i=>` rmdir ${a(i)} 2>/dev/null
123
+ `).join("")} rm -rf ${a(e.menuDir)}
124
+ say ${a(z)} ${a(ee)}
125
+ exit 0
126
+ fi
127
+ if [ ! -x ${a(e.node)} ]; then
128
+ say ${a(Te)} ${a(Oe)}
129
+ exit 1
130
+ fi
131
+ ${e.xdgConfigHome===void 0?"":`export XDG_CONFIG_HOME=${a(e.xdgConfigHome)}
132
+ `}exec ${n} menu run "$@"
133
+ `}var O="HKCU\\Software\\Classes",Re=`${O}\\SystemFileAssociations\\image\\shell\\Forge`,Be=`${O}\\Directory\\shell\\Forge`,te=`${O}\\SystemFileAssociations\\.pdf\\shell\\ForgeOpen`,je=`${O}\\AppUserModelId\\${Y}`,ie=()=>[Re,Be,te,je],oe=e=>`${e.paint}.ico`;function _e(e){let n=o=>`conhost.exe --headless "${e.node}" "${e.menuDir}\\run.mjs" ${o.action}${o.preset===void 0?"":` ${o.preset}`} "%1"`,t=o=>`${e.menuDir}\\${oe(o)}`,r=(o,s)=>{let c=e.items.filter(f=>f.kinds.includes(s));return c.length===0?[]:[{key:o,values:{MUIVerb:"Forge",Icon:t({paint:"forge"}),SubCommands:""}},...c.flatMap((f,g)=>{let w=f.preset===void 0?f.action:`preset-${f.preset}`,l=`${o}\\shell\\${g+1}${w}`;return[{key:l,values:{MUIVerb:f.label,Icon:t(f)}},{key:`${l}\\command`,values:{"":n(f)}}]})]},i=e.items.find(o=>o.kinds.includes("pdf"));return[...r(Re,"image"),...r(Be,"folder"),...i?[{key:te,values:{MUIVerb:i.label,Icon:t(i)}},{key:`${te}\\command`,values:{"":n(i)}}]:[],{key:je,values:{DisplayName:"Forge",IconUri:`${e.menuDir}\\forge.png`}}]}var re=e=>`'${Q(e)}'`,ne=e=>re(`Registry::${e.replace(/^HKCU\\/,"HKEY_CURRENT_USER\\")}`);function se(e){return["$ErrorActionPreference = 'Stop'",...ie().map(t=>`Remove-Item -Path ${ne(t)} -Recurse -Force -ErrorAction SilentlyContinue`),...e.flatMap(({key:t,values:r})=>[`New-Item -Path ${ne(t)} -Force | Out-Null`,...Object.entries(r).map(([i,o])=>`Set-ItemProperty -LiteralPath ${ne(t)} -Name ${re(i===""?"(default)":i)} -Value ${re(o)}`)])].join(`
134
+ `)}var ot=(e,n)=>e.version===n.version&&e.forge===n.forge&&e.node===n.node&&e.execArgv.join("\0")===n.execArgv.join("\0")&&e.xdgConfigHome===n.xdgConfigHome&&(e.presets??[]).join("\0")===(n.presets??[]).join("\0"),We="/System/Library/CoreServices/pbs",Ve=e=>u(e.menuDir,"state.json"),N=e=>u(e.home,"Library","Services"),ce=e=>y({sharpen:!0}).map(n=>u(N(e),`${n.label}.workflow`)),ue=()=>y({sharpen:!0}).map(E);function Xe(e){let n;try{n=Ge(N(e)).filter(t=>t.endsWith(".workflow"))}catch{return[]}return n.flatMap(t=>{let r=u(N(e),t);try{let i=H(u(r,"Contents","Info.plist"),"utf8"),o=/<key>CFBundleIdentifier<\/key>\s*<string>([^<]*)<\/string>/.exec(i)?.[1],s=/<key>CFBundleName<\/key>\s*<string>([^<]*)<\/string>/.exec(i)?.[1];return!o?.startsWith(we)||s===void 0?[]:[{path:r,key:`${o} - ${(f=>f.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"))(s)} - runWorkflowAsService`}]}catch{return[]}})}function Nn(e){try{return JSON.parse(H(Ve(e),"utf8"))}catch{return}}var st=e=>Nn(e)!==void 0,m=(e,n)=>{pe(U(e),{recursive:!0}),In(e,n)};async function at(e){if(!Fn(e.platform))return;let n=y({sharpen:e.sharpen,presets:e.presets??[]});if(pe(e.menuDir,{recursive:!0}),e.platform==="linux")await kn(e,n);else if(e.platform==="darwin"){let r=u(e.menuDir,"run"),i=n.filter(l=>l.preset!==void 0),o=i.map(l=>u(N(e),_(l,r).name));m(r,Le({...e,bundles:[...ce(e),...o],services:[...ue(),...i.map(E)]})),le(r,493);let s=Xe(e);for(let l of[...ce(e),...s.map(R=>R.path)])$(l,{recursive:!0,force:!0});let c=new Map,{default:f}=await import("sharp");for(let l of n){c.has(l.paint)||c.set(l.paint,await f(await S(l.paint,64)).tiff().toBuffer());let{name:R,files:ze}=_(l,r),de=u(N(e),R);for(let[en,nn]of Object.entries(ze))m(u(de,en),nn);m(u(de,"Contents","Resources",`${j}.tiff`),c.get(l.paint))}let g=n.map(E),w=new Set([...ue(),...s.map(l=>l.key)]);await e.run(...D({on:g,off:[...w].filter(l=>!g.includes(l))})),await e.run(We,["-update"])}else{m(u(e.menuDir,"run.mjs"),Ue({...e,keys:ie()}));for(let r of Je){let i=await Promise.all([16,24,32,48,256].map(async o=>({size:o,png:await S(r,o)})));m(u(e.menuDir,oe({paint:r})),he(i))}m(u(e.menuDir,"forge.png"),await S("forge",256)),await e.run("powershell.exe",Ze(se(_e({...e,items:n}))))}let t={version:e.version,forge:e.forge,node:e.node,execArgv:e.execArgv,...e.xdgConfigHome===void 0?{}:{xdgConfigHome:e.xdgConfigHome},...e.presets&&e.presets.length>0?{presets:[...e.presets]}:{}};m(Ve(e),JSON.stringify(t))}var Fn=e=>e==="darwin"||e==="win32"||e==="linux",Je=["forge","convert","compress","edit","pdf"],qe=e=>ve({home:e.home,...e.xdgDataHome===void 0?{}:{xdgDataHome:e.xdgDataHome},...e.xdgConfigHome===void 0?{}:{xdgConfigHome:e.xdgConfigHome},...e.xdgConfigDirs===void 0?{}:{xdgConfigDirs:e.xdgConfigDirs}});function fe(e){let n=y({sharpen:!0}),t=n.map(i=>i.action),r=(i,o)=>{try{return Ge(i).filter(o).map(s=>u(i,s))}catch{return[]}};return[...new Set([...n.map(i=>u(h(e),G(i))),...r(h(e),()=>!0),...n.map(i=>u(I(e),W(i,t))),...r(I(e),i=>i.startsWith("forge-")&&i.endsWith(".nemo_action")),...X.map(i=>u(A(e),V(i)))])]}var x=e=>{try{return H(e,"utf8")}catch{return}};function Ye(e){for(let n of e)x(n)?.includes(d)&&$(n,{force:!0})}var Qe=e=>u(e.menuDir,"made.json"),me=e=>{try{return JSON.parse(H(Qe(e),"utf8"))}catch{return[]}};function L(e,n){let t=[];for(let r=n;!Ke(r)&&U(r)!==r;r=U(r))t.push(r);t.length!==0&&(pe(n,{recursive:!0}),m(Qe(e),JSON.stringify([...new Set([...me(e),...t])])))}function En(e){for(let n of[...e].sort((t,r)=>r.length-t.length))try{Mn(n)}catch{}}var ge=e=>u(e.menuDir,"thunar-seed.xml");async function bn(e,n,t,r){let i=C(n),o=x(i);if(o===void 0){if(!ke(n,e.path,Ke))return;o=Ee(n).map(x).find(c=>c!==void 0&&q(c,"")!==void 0)??be,m(ge(e),o),L(e,U(i))}let s=q(o,Pe(t,{launcher:r,menuDir:e.menuDir}));s!==void 0&&s!==x(i)&&await F(i,Buffer.from(s))}async function Pn(e,n){let t=C(n),r=x(t);if(r===void 0||!r.includes(`<unique-id>${d}-`))return;let i=J(r);i===x(ge(e))?$(t,{force:!0}):await F(t,Buffer.from(i))}async function ae(e,n,t=!1){await F(e,Buffer.from(n)),t&&le(e,493)}async function kn(e,n){let t=qe(e),r=u(e.menuDir,"run");for(let o of Je)m(u(e.menuDir,P({paint:o})),await S(o,128));Ye(fe(t));let i=y({sharpen:!0}).map(o=>o.action);L(e,h(t));for(let o of n)await ae(u(h(t),G(o)),Ie(o,r),!0);L(e,I(t));for(let o of n)await ae(u(I(t),W(o,i)),Ne(o,r));L(e,A(t));for(let o of X){let s=Fe(o,n,{launcher:r,menuDir:e.menuDir});s!==void 0&&await ae(u(A(t),V(o)),s,!0)}await bn(e,t,n,r),m(r,He({...e,files:fe(t),folders:[...new Set([h(t),...me(e)])].sort((o,s)=>s.length-o.length),marker:d,thunar:{file:C(t),seed:ge(e)}})),le(r,493)}async function An(e){let n=qe(e);Ye(fe(n)),await Pn(e,n),En([h(n),...me(e)]),$(e.menuDir,{recursive:!0,force:!0})}async function ct(e){if(e.platform==="linux")await An(e);else if(e.platform==="darwin"){let n=Xe(e);for(let r of[...ce(e),...n.map(i=>i.path)])$(r,{recursive:!0,force:!0});$(e.menuDir,{recursive:!0,force:!0});let t=new Set([...ue(),...n.map(r=>r.key)]);await e.run(...D({on:[],off:[...t]})),await e.run(We,["-update"])}else e.platform==="win32"&&($(e.menuDir,{recursive:!0,force:!0}),await e.run("powershell.exe",Ze(se([]))))}var Ze=e=>["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",e],ut=(e,n)=>new Promise((t,r)=>{vn(e,n,{timeout:6e4,windowsHide:!0},i=>i?r(i):t())});export{a,K as b,P as c,_n as d,ot as e,Nn as f,st as g,at as h,Fn as i,ct as j,ut as k};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{c as P}from"./chunk-GSK2A3TN.js";import{j as v}from"./chunk-V3I6DSF4.js";import{d as y,na as s}from"./chunk-WIPP5TWQ.js";import{mkdtemp as x,rm as F}from"node:fs/promises";import{tmpdir as z}from"node:os";import{join as h}from"node:path";var f={background:"#ffffff",keepMetadata:!1};function q(e,r,n){switch(e.kind){case"cut":return{op:"convert",sources:[r],outputs:[n],target:"png",options:{...f,...e.trim?{trim:!0}:{},...e.crop?{crop:{aspect:e.crop}}:{},...e.resize?{resize:e.resize}:{}}};case"cutout":return{op:"remove-background",sources:[r],outputs:[n],target:"png",options:f};case"boost":return{op:"boost",sources:[r],outputs:[n],scale:e.scale,target:"png",options:f};case"encode":return{op:"convert",sources:[r],outputs:[n],target:e.target,options:{...f,...e.background?{background:e.background}:{},...e.quality!==void 0?{quality:e.quality}:{},...e.compress?{compress:e.compress}:{},...e.trim?{trim:!0}:{},...e.crop?{crop:{aspect:e.crop}}:{},...e.resize?{resize:e.resize}:{}}}}}async function C(e,r,n,o){let E=o.probe??v,d=await x(h(z(),"forge-preset-")),I={force:o.force,...o.signal?{signal:o.signal}:{},...o.onEvent?{onEvent:o.onEvent}:{}};try{let i=e;for(let[l,t]of r.entries()){o.onPass?.(l);let u=l===r.length-1,m=u?n:h(d,`${l}.png`),a=await P([q(t,i,m)],{...I,...u?{}:{force:!0},...u&&t.kind==="encode"&&t.maxBytes?{targetBytes:t.maxBytes,...t.quality===void 0?{}:{maxQuality:t.quality}}:{}});if(a.cancelled)return{kind:"cancelled"};let g=a.refusals[0];if(g)return{kind:"refused",error:g.error};let p=a.unreachable[0];if(p)return{kind:"unreachable",entry:p};let b=a.failures[0];if(b)return{kind:"failed",pass:t,error:b.error};let c=a.results[0];if(!c)return{kind:"failed",pass:t,error:s(e.path,"no result")};if(u){let j=c.job.op==="convert"?{...c.job,sources:[e]}:c.job;return{kind:"done",result:{...c,job:j}}}let k=await E(m);if(k.kind!=="image")return{kind:"failed",pass:t,error:s(e.path,"not an image")};i=k}return{kind:"failed",pass:{kind:"encode",target:e.format},error:s(e.path,"nothing to run")}}catch(i){return{kind:"failed",pass:r[r.length-1]??{kind:"encode",target:e.format},error:y(i)?i:s(e.path,i)}}finally{await F(d,{recursive:!0,force:!0})}}export{C as a};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a,b,c,d}from"./chunk-37P6QZ5Q.js";import"./chunk-C4UCCBCX.js";import"./chunk-EKTUUKDP.js";import"./chunk-W6SY5PPG.js";import"./chunk-WC6SJN5Y.js";import"./chunk-OK7XOZFO.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-CKZBBDAW.js";import"./chunk-GSK2A3TN.js";import"./chunk-Y7LOIHFU.js";import"./chunk-57M4J2BR.js";import"./chunk-63XCSYHM.js";import"./chunk-PPR7B5AR.js";import"./chunk-XBOMWF34.js";import"./chunk-V3I6DSF4.js";import"./chunk-EEQSUBBL.js";import"./chunk-K7KKCR7V.js";import"./chunk-LVYQVJOF.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-SNDFMJIX.js";import"./chunk-THDAQBQ3.js";import"./chunk-DZOBIUV6.js";import"./chunk-TL5MACSF.js";import"./chunk-WIPP5TWQ.js";import"./chunk-J7FLFHQJ.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{b as clipLines,a as runClip,d as runClipCommand,c as runUndo};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a,b,c}from"./chunk-SK2UZ25Y.js";import"./chunk-EKTUUKDP.js";import"./chunk-DZOBIUV6.js";import"./chunk-WIPP5TWQ.js";import"./chunk-J7FLFHQJ.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{a as copy,c as linuxText,b as paste};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{h as S,i as k,m as C}from"./chunk-3GJ7GV3V.js";import{i as $,k as u,l as w}from"./chunk-YINYF6C7.js";import{c as I,d as y,f as O}from"./chunk-PBIS2ONZ.js";import{b as m,c as d,h as f,i as p}from"./chunk-QVACE4IE.js";import{a as h,b as g}from"./chunk-57M4J2BR.js";import"./chunk-63XCSYHM.js";import{a as l}from"./chunk-XBOMWF34.js";import"./chunk-V3I6DSF4.js";import"./chunk-EEQSUBBL.js";import"./chunk-K7KKCR7V.js";import"./chunk-LVYQVJOF.js";import"./chunk-SNDFMJIX.js";import"./chunk-THDAQBQ3.js";import"./chunk-DZOBIUV6.js";import"./chunk-TL5MACSF.js";import{c as b,n as x}from"./chunk-WIPP5TWQ.js";import"./chunk-J7FLFHQJ.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";import{resolve as R}from"node:path";var P=({r:t,g:n,b:o},s)=>s?`\x1B[38;2;${t};${n};${o}m\u2588\u2588\x1B[39m `:"";function N(t,n){let o=d(n),s,e=Number.POSITIVE_INFINITY;for(let r of t){let a=(r.centre.L-o.L)**2+(r.centre.a-o.a)**2+(r.centre.b-o.b)**2;a<e&&(e=a,s=r)}return s}async function D(t,n){let{pixels:o}=await C(t.input),s=I(o);if(s.length===0)throw x(t.input);let e=t.inside?N(s,t.inside):void 0,r=e?y(o,e):s;if(t.svg)return{exitCode:0,stdout:[S(b(t.input),r,"light",e?.hex)],stderr:[]};if(n.json){let i=h(l,{source:R(t.input),...e?{inside:e.hex}:{},colours:r.map(c=>({hex:c.hex,rgb:f(c.rgb),oklch:p(c.rgb),share:c.share}))});return{exitCode:0,stdout:[JSON.stringify(i)],stderr:[]}}let a=O(r.map(i=>i.share));return{exitCode:0,stdout:r.map((i,c)=>`${P(i.rgb,n.colour)}${i.hex} ${String(a[c]).padStart(3)}%`),stderr:[]}}async function H(t,n){let o=$(t.colour);if(t.svg)return{exitCode:0,stdout:[k(t.colour,o)],stderr:[]};let s=o.map(e=>({...e,...w(e.rgb)}));if(n.json){let e=g(l,{reference:m(t.colour),steps:s.map(r=>({step:r.step,hex:r.hex,oklch:p(r.rgb),white:r.white,black:r.black}))});return{exitCode:0,stdout:[JSON.stringify(e)],stderr:[]}}return{exitCode:0,stdout:s.map(e=>`${String(e.step).padStart(4)} ${P(e.rgb,n.colour)}${e.hex} white ${e.white.toFixed(1)} ${u(e.white)} \xB7 black ${e.black.toFixed(1)} ${u(e.black)}`),stderr:[]}}export{D as runPalette,H as runScale};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as s}from"./chunk-WE6KP4FR.js";import{H as o}from"./chunk-WIPP5TWQ.js";import"./chunk-J7FLFHQJ.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";var c=["open","convert","compress","sharpen","open-pdf","preset"];function u(r){let[e,n,...i]=r;if(e==="install"||e==="remove")return{kind:e};if(e==="run"||e==="open"){if(!c.includes(n))throw o(`No menu action called "${n??""}".`);if(n==="preset"){let[t,...a]=i;if(e!=="run"||t===void 0||!s(t))throw o(`No preset called "${t??""}".`);return{kind:"run",action:n,preset:t,paths:a}}return{kind:e,action:n,paths:i}}throw o(`No menu command called "${e??""}".`)}function m(r,e){switch(r){case"convert":return{paths:e,mode:"convert",advance:!0};case"compress":return{paths:e,mode:"compress",advance:!0};case"open-pdf":return{paths:e,mode:"pdf",advance:!1};default:return{paths:[],mode:"convert",advance:!1}}}export{m as openedFor,u as parseMenuArgs};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a,b}from"./chunk-JMBEZPYC.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-WIPP5TWQ.js";import"./chunk-J7FLFHQJ.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{a as CONFIG_KEYS,b as runConfig};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a,b,c,d,e}from"./chunk-G46QQBT3.js";import"./chunk-THDAQBQ3.js";import"./chunk-WIPP5TWQ.js";import"./chunk-J7FLFHQJ.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{a as OPS,d as chainLabels,e as reasonsFor,c as stepLabel,b as withStep};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{g as a}from"./chunk-TL5MACSF.js";import"./chunk-WIPP5TWQ.js";import"./chunk-J7FLFHQJ.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{a as openable};
@@ -0,0 +1,6 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as N,b as I,c as O,d as k,e as $,f as R,h as g,i as F,j as m,k as G}from"./chunk-ZRHYGR2L.js";import{c as b}from"./chunk-PE5LAYGF.js";import"./chunk-HKINXTUW.js";import{c as S}from"./chunk-N72E43Z3.js";import{a as T,b as v,c as _,d as A,e as D}from"./chunk-63ZK5SRQ.js";import{a as P}from"./chunk-HON4OV7M.js";import{f as E}from"./chunk-DZOBIUV6.js";import{d as y}from"./chunk-WIPP5TWQ.js";import"./chunk-J7FLFHQJ.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";import{spawn as ee}from"node:child_process";import{homedir as Te}from"node:os";import{join as M,resolve as ve}from"node:path";import{appendFileSync as te,mkdirSync as C,readFileSync as ne,renameSync as re,rmSync as x,statSync as L}from"node:fs";import{join as j}from"node:path";var ie={quiet:500,cap:3e3,poll:50},oe=15e3,X=e=>new Promise(n=>setTimeout(n,e));async function H(e,n,t,r=ie){C(e,{recursive:!0});let i=j(e,`${n}.spool`),o=j(e,`${n}.lock`),s=p=>{try{return ne(p,"utf8").split(`
4
+ `).filter(Boolean)}catch{return[]}},u=()=>{try{return L(i).size}catch{return 0}};for(te(i,`${t}
5
+ `);;){try{C(o)}catch{try{Date.now()-L(o).mtimeMs>oe&&x(o,{recursive:!0,force:!0})}catch{}if(await X(r.poll),!s(i).includes(t))return null;continue}try{let p=Date.now(),l=u(),c=Date.now();for(;Date.now()-c<r.quiet&&Date.now()-p<r.cap;){await X(r.poll);let d=u();d!==l&&(l=d,c=Date.now())}let a=`${i}.${process.pid}.${Date.now()}`;try{re(i,a)}catch{return[t]}let f=[...new Set(s(a))];return x(a,{force:!0}),f}finally{x(o,{recursive:!0,force:!0})}}}import{realpathSync as se}from"node:fs";import{delimiter as ae,join as ue}from"node:path";function U(e,n,t=process.platform){let r=s=>{try{return se(s)}catch{return}},i=r(e)??e,o=t==="win32"?"node.exe":"node";for(let s of(n??"").split(ae)){if(s==="")continue;let u=ue(s,o);if(u!==e&&r(u)===i)return u}return e}import{basename as w,dirname as ce,extname as le,join as fe}from"node:path";var q={"gnome-terminal":["--"],konsole:["-e"],"xfce4-terminal":["-x"],kitty:[],alacritty:["-e"],wezterm:["start","--"],ghostty:["-e"],xterm:["-e"],"x-terminal-emulator":["-e"],"xdg-terminal-exec":[]},pe=["xdg-terminal-exec","x-terminal-emulator","gnome-terminal","konsole","xfce4-terminal","kitty","alacritty","wezterm","ghostty","xterm"];function B(e,n,t){let i=[...e!==void 0&&e in q?[e]:[],...pe].find(t);return i===void 0?void 0:[i,[...q[i]??[],...n]]}function me(e,n,t){if(t==="linux")return B(e,n,()=>!0)??["xterm",["-e",...n]];if(t==="win32")return e==="wt"?["wt.exe",["-w","new",...n]]:["conhost.exe",n];if(e==="ghostty")return["/usr/bin/open",["-na","Ghostty","--args","-e",...n]];let r=`exec ${n.map(N).join(" ")}`;return["/usr/bin/osascript",[...["on run argv",...e==="iTerm.app"?['tell application "iTerm"',"create window with default profile","tell current session of current window to write text (item 1 of argv)","activate","end tell"]:['if application "Terminal" is running then','tell application "Terminal" to do script (item 1 of argv)',"else",'tell application "Terminal" to do script (item 1 of argv) in window 1',"end if",'tell application "Terminal" to activate'],"end run"].flatMap(o=>["-e",o]),r]]}function W(e){let n=w(e,le(e));return E(fe(ce(e),`${n}-sharp.png`))}function de(e){let n=e.flatMap(o=>"output"in o?[o.output]:[]),t=e.flatMap(o=>"error"in o?[o]:[]),[r]=t;if(r===void 0)return{title:n.length===1?w(n[0]):`${n.length} files`,body:"Sharpened"};let i=r.input?w(r.input):"file";return e.length===1?{title:`${i} not sharpened`,body:r.error}:{title:`${n.length} of ${e.length} files sharpened`,body:`${i}: ${r.error}`}}function ge(e,n){let t=n.flatMap(s=>"output"in s?[s]:[]),r=n.flatMap(s=>"error"in s?[s]:[]),[i]=r;if(i===void 0){let s=t[0]?.chain??[];return{title:t.length===1?w(t[0]?.output??""):`${t.length} files`,body:[e,...s.length>0?[s.join(" \u2500\u25B8 ")]:[]].join(" \xB7 ")}}let o=i.input?w(i.input):"file";return n.length===1?{title:`${e} didn\u2019t finish`,body:`${o}: ${i.error}`}:{title:`${e} finished ${t.length} of ${n.length} files`,body:`${o}: ${i.error}`}}async function z(e,n,t,r){if(e==="preset"){if(r===void 0||t.runPreset===void 0)return;let u=[];for(let a of n){let f=await t.runPreset(r,a);u.push("error"in f?{input:a,...f}:f)}let{title:p,body:l}=ge(r,u);await t.notify(p,l);let c=u.flatMap(a=>"output"in a?[a.output]:[]).at(-1);c!==void 0&&await t.reveal(c);return}if(e==="sharpen"){let u=[];for(let f of n){let d=await t.sharpen(f);u.push("error"in d?{input:f,...d}:d)}let{title:p,body:l}=de(u);await t.notify(p,l);let a=u.flatMap(f=>"output"in f?[f.output]:[]).at(-1);a!==void 0&&await t.reveal(a);return}let i=e==="open"?[]:n,o=[...t.self,"menu","open",e,...i],s=t.platform==="linux"?B(t.terminal,o,t.has??(()=>!0)):me(t.terminal,o,t.platform);if(s===void 0)return t.notify(he,we);await t.launch(...s)}var he="Forge could not open",we="No terminal was found to open it in.";import{mkdirSync as ye,readFileSync as Me,writeFileSync as Pe}from"node:fs";import{join as Re}from"node:path";async function J(e,n){if(!n.global||!F(e.platform))return;let t=R(e);if(n.enabled===!1){t!==void 0&&await m(e);return}if(!(t!==void 0&&$(t,e))&&(await g(e),t===void 0))return e.platform==="darwin"?"Added Forge to Finder\u2019s Quick Actions":"Added Forge to the right-click menu"}async function K(e){let n=R(e);if(n===void 0)return;let{xdgConfigHome:t,...r}=e;await g({...r,...n,presets:e.presets??[]})}var V=e=>Re(e.menuDir,"terminal"),xe=new Set(["Apple_Terminal","iTerm.app","ghostty"]),Ee={WezTerm:"wezterm",ghostty:"ghostty",kitty:"kitty"};function be(e){if(e.TERM_PROGRAM)return Ee[e.TERM_PROGRAM];if(!e.TMUX){if(e.KITTY_WINDOW_ID)return"kitty";if(e.ALACRITTY_WINDOW_ID||e.ALACRITTY_SOCKET)return"alacritty";if(e.KONSOLE_VERSION)return"konsole";if(e.GNOME_TERMINAL_SCREEN||e.GNOME_TERMINAL_SERVICE)return"gnome-terminal";if(e.XTERM_VERSION)return"xterm"}}function Y(e,n){let t=e.platform==="win32"?n.WT_SESSION?"wt":"console":e.platform==="linux"?be(n):xe.has(n.TERM_PROGRAM??"")?n.TERM_PROGRAM:void 0;if(t)try{ye(e.menuDir,{recursive:!0}),Pe(V(e),t)}catch{}}function Q(e){try{return Me(V(e),"utf8").trim()||void 0}catch{return}}import{rmSync as Se}from"node:fs";async function Z(e,n){await m(e),n.out("\u2713 Removed Forge from the right-click menu");let{code:t,output:r}=await n.npm(["uninstall","--global","forge-terminal"]);return t!==0?(n.out(`\u2715 npm could not uninstall forge-terminal: ${D(r)}`),1):(n.out("\u2713 Uninstalled forge-terminal"),Se(n.forgeDir,{recursive:!0,force:!0}),n.out("\u2713 Deleted Forge\u2019s settings"),0)}var _e=()=>M(P(),"forge","menu");async function Ae(){try{let{loadPreferences:e}=await import("./preferences-3P4V2EDX.js"),{prefs:n}=await e();return(n.presets??[]).filter(t=>t.quickAction).map(t=>t.name)}catch{return[]}}async function h(e){return{platform:process.platform,home:Te(),menuDir:_e(),node:U(process.execPath,process.env.PATH),execArgv:process.execArgv,forge:v(process.argv[1])??"",...process.env.XDG_CONFIG_HOME?{xdgConfigHome:process.env.XDG_CONFIG_HOME}:{},...process.env.XDG_DATA_HOME?{xdgDataHome:process.env.XDG_DATA_HOME}:{},...process.env.XDG_CONFIG_DIRS?{xdgConfigDirs:process.env.XDG_CONFIG_DIRS}:{},...process.env.PATH?{path:process.env.PATH}:{},version:e,sharpen:await b("boost")!==void 0,presets:await Ae(),run:G}}async function mt(e){if(process.env.FORGE_NO_MENU)return;let n=await h(e);Y(n,process.env);let{loadPreferences:t}=await import("./preferences-3P4V2EDX.js"),{prefs:r}=await t();return J(n,{global:T(n.forge,n.platform),enabled:r.rightClickMenu!==!1})}async function dt(){let{isInstalled:e}=await import("./install-IDUHZTTS.js");return e(await h(""))}async function gt(e){let{VERSION:n}=await import("./theme-NAWQ77WF.js"),{savePreferences:t}=await import("./preferences-3P4V2EDX.js"),r=await h(n);e?await g(r):await m(r),await t({rightClickMenu:e})}async function ht(){if(!process.env.FORGE_NO_MENU)try{await K(await h(""))}catch{}}async function De(e){let{parseArgs:n}=await import("./args-QKAIL3E4.js"),{runIntent:t}=await import("./execute-S5WN34PS.js"),r=n([e,"--sharpen","--output",W(e)]),i=await t(r),o=i.results[0]?.job.outputs[0];if(o!==void 0)return{output:o};let s=i.failures[0]?.error;return{error:y(s)?s.detail:"It could not be sharpened."}}async function Ne(e,n){let{runPresetCommand:t}=await import("./preset-command-HMOFTZSG.js"),{loadPreferences:r}=await import("./preferences-3P4V2EDX.js"),{chainLabels:i}=await import("./continue-editing-QE5RRIMG.js");try{let o=await t({kind:"preset",inputs:[n],name:e,force:!1,recursive:!1,debug:!1,keepBoth:!0}),s=o.results[0],u=s?.job.outputs[0];if(s!==void 0&&u!==void 0){let{prefs:l}=await r(),c=l.presets?.find(f=>f.name===e)?.steps,a=s.job.sources[0]?.format;return{output:u,chain:c&&a?i(a,c):[]}}let p=o.failures[0]?.error;return{error:y(p)?p.detail:"It could not be made."}}catch(o){return{error:y(o)?o.detail:"It could not be made."}}}var Ie=(e,n)=>new Promise(t=>{let r=ee(e,n,{detached:!0,stdio:"ignore"});r.on("error",()=>t()),r.unref(),t()});async function wt(e,n){let t=await h(n);if(e.kind==="install")return await g(t),0;if(e.kind==="remove")return await m(t),0;if(e.kind!=="run")return 2;let r=e.paths.map(i=>ve(i));if(t.platform==="win32"&&r.length===1){let i=e.preset===void 0?e.action:`preset-${e.preset}`,o=await H(M(t.menuDir,"spool"),i,r[0]);if(o===null)return 0;r=o}return await z(e.action,r,{platform:t.platform,self:[t.node,...t.execArgv,t.forge],terminal:Q(t),launch:Ie,sharpen:De,runPreset:Ne,notify:(i,o)=>k(i,o,t.platform,{icon:M(t.menuDir,O({paint:"forge"}))}),has:i=>I(i,t.path),reveal:async i=>{await S(i,t.platform)}},e.preset),0}async function yt(e,n){let t=await h(e),r=i=>new Promise(o=>{let s=t.platform==="win32"?A(t.node):void 0,[u,p]=s!==void 0?[t.node,[s,...i]]:[_(t.node),i],l="",c=ee(u,p,{stdio:["ignore","pipe","pipe"]});c.stdout.setEncoding("utf8").on("data",a=>{l+=a}),c.stderr.setEncoding("utf8").on("data",a=>{l+=a}),c.on("error",a=>o({code:null,output:`${l}
6
+ ${a.message}`})),c.on("close",a=>o({code:a,output:l}))});return Z(t,{forgeDir:M(P(),"forge"),npm:r,out:n})}export{mt as menuAtStart,dt as menuIsOn,h as realMenuEnv,ht as resyncMenu,wt as runMenuCommand,yt as runUninstall,gt as switchMenu};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{c as a,d as b,e as c,f as d}from"./chunk-W6SY5PPG.js";import"./chunk-WC6SJN5Y.js";import"./chunk-OK7XOZFO.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-CKZBBDAW.js";import"./chunk-GSK2A3TN.js";import"./chunk-Y7LOIHFU.js";import"./chunk-57M4J2BR.js";import"./chunk-63XCSYHM.js";import"./chunk-PPR7B5AR.js";import"./chunk-XBOMWF34.js";import"./chunk-V3I6DSF4.js";import"./chunk-EEQSUBBL.js";import"./chunk-K7KKCR7V.js";import"./chunk-LVYQVJOF.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-SNDFMJIX.js";import"./chunk-THDAQBQ3.js";import"./chunk-DZOBIUV6.js";import"./chunk-TL5MACSF.js";import"./chunk-WIPP5TWQ.js";import"./chunk-J7FLFHQJ.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{d as execute,a as exitCodeFor,c as renderRun,b as runIntent};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{Ib as a,Jb as b,Kb as c,Lb as d,Mb as e}from"./chunk-XRI5XKEB.js";import"./chunk-YINYF6C7.js";import"./chunk-PBIS2ONZ.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-HKINXTUW.js";import"./chunk-IBPGC4N2.js";import"./chunk-U5TEGDGH.js";import"./chunk-QVACE4IE.js";import"./chunk-XBOMWF34.js";import"./chunk-EEQSUBBL.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-WIPP5TWQ.js";import"./chunk-J7FLFHQJ.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{e as ExtensionsFlow,c as byteCount,b as extensionCredits,d as extensionsChip,a as realManager};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{a as c}from"./chunk-J7FLFHQJ.js";import{c as d}from"./chunk-5B5XXH22.js";import"./chunk-TMUK2DD3.js";function f(e){let t=Object.entries(e.assets).find(([n])=>n.startsWith(`${process.platform}-`));return d(e)?.version??t?.[1]?.version??""}function y(e){return{id:e.entry.id,title:e.entry.title,summary:e.entry.summary,version:f(e.entry),licence:e.entry.licence,installed:e.installed??null,updateAvailable:e.updateAvailable,supported:e.supported,...e.reason!==void 0?{reason:e.reason}:{},...e.downloadBytes!==void 0?{downloadBytes:e.downloadBytes}:{}}}function x(e){return e.supported?e.installed===void 0?`not installed${e.downloadBytes?`, ${c(e.downloadBytes)} download`:""}`:e.updateAvailable?`installed ${e.installed}, update to ${d(e.entry)?.version} available`:`installed ${e.installed}`:`not available: ${e.reason??"unsupported here"}`}function E(e){let t=Math.max(...e.map(n=>n.entry.id.length));return e.flatMap((n,a)=>[...a>0?[""]:[],`${n.entry.id.padEnd(t)} ${n.entry.summary}`,`${" ".repeat(t)} ${x(n)}`,`${" ".repeat(t)} ${n.entry.licence}`])}async function g(e,t={}){let{installExtension:n,listExtensions:a,removeExtension:p}=await import("./manager-TEZ3V4L4.js"),i,s;if(e.action==="add"&&e.id!==void 0){let o=(await a()).find(m=>m.entry.id===e.id),l=o?.installed!==void 0&&!o.updateAvailable,u=await n(e.id,{onProgress:t.onDownload});i={id:e.id,action:l?"unchanged":"added"},s=l?`${e.id} ${u.version} is already installed`:`Installed ${e.id} ${u.version}`}else if(e.action==="remove"&&e.id!==void 0){let o=await p(e.id);i={id:e.id,action:o?"removed":"unchanged"},s=o?`Removed ${e.id}`:`${e.id} was not installed`}let r=await a();return{stdout:s===void 0?E(r):[s],data:{extensions:r.map(y),...i?{changed:i}:{}}}}export{g as runExtensions,y as toExtensionJson};
3
+ import{f as d}from"./chunk-HKINXTUW.js";import{a as c}from"./chunk-J7FLFHQJ.js";import"./chunk-TMUK2DD3.js";function y(e){let t=Object.entries(e.assets).find(([n])=>n.startsWith(`${process.platform}-`));return d(e)?.version??t?.[1]?.version??""}function x(e){return{id:e.entry.id,title:e.entry.title,summary:e.entry.summary,version:y(e.entry),licence:e.entry.licence,installed:e.installed??null,updateAvailable:e.updateAvailable,supported:e.supported,...e.reason!==void 0?{reason:e.reason}:{},...e.downloadBytes!==void 0?{downloadBytes:e.downloadBytes}:{}}}function E(e){return e.supported?e.installed===void 0?`not installed${e.downloadBytes?`, ${c(e.downloadBytes)} download`:""}`:e.updateAvailable?`installed ${e.installed}, update to ${d(e.entry)?.version} available`:`installed ${e.installed}`:`not available: ${e.reason??"unsupported here"}`}function v(e){let t=Math.max(...e.map(n=>n.entry.id.length));return e.flatMap((n,a)=>[...a>0?[""]:[],`${n.entry.id.padEnd(t)} ${n.entry.summary}`,`${" ".repeat(t)} ${E(n)}`,`${" ".repeat(t)} ${n.entry.licence}`])}async function w(e,t={}){let{installExtension:n,listExtensions:a,removeExtension:p}=await import("./manager-CQ6NNQY4.js"),i,s;if(e.action==="add"&&e.id!==void 0){let o=(await a()).find(f=>f.entry.id===e.id),l=o?.installed!==void 0&&!o.updateAvailable,u=await n(e.id,{onProgress:t.onDownload});i={id:e.id,action:l?"unchanged":"added"},s=l?`${e.id} ${u.version} is already installed`:`Installed ${e.id} ${u.version}`}else if(e.action==="remove"&&e.id!==void 0){let o=await p(e.id);i={id:e.id,action:o?"removed":"unchanged"},s=o?`Removed ${e.id}`:`${e.id} was not installed`}let{hideUnneeded:m}=await import("./needed-MYXIUZI4.js"),r=await m(await a());return{stdout:s===void 0?v(r):[s],data:{extensions:r.map(x),...i?{changed:i}:{}}}}export{w as runExtensions,x as toExtensionJson};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-K7KKCR7V.js";import"./chunk-TMUK2DD3.js";export{a as ffmpegCandidates,c as findFfmpeg,e as forceFfmpegForTests,i as frameAt,g as keyframeAtOrBefore,d as knownFfmpeg,f as probeMedia,b as readNames,j as readProgress,k as runFfmpeg,h as soundLevels};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{h as a,i as b,j as c,k as d,l as e,m as f,n as g,o as h}from"./chunk-SNDFMJIX.js";import"./chunk-THDAQBQ3.js";import"./chunk-DZOBIUV6.js";import"./chunk-TL5MACSF.js";import"./chunk-WIPP5TWQ.js";import"./chunk-J7FLFHQJ.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{c as decodeToPng,a as encode,d as encodeToBuffer,g as guessCrop,h as imageEngine,f as loadCropView,e as measureImage,b as writeAtomic};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{e as a,f as b,g as c,h as d,i as e,j as f,k as g}from"./chunk-ZRHYGR2L.js";import"./chunk-DZOBIUV6.js";import"./chunk-WIPP5TWQ.js";import"./chunk-J7FLFHQJ.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{e as hasMenu,d as installMenu,c as isInstalled,b as readState,f as removeMenu,g as runProgram,a as stateMatches};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{a,b,c,d,e,f}from"./chunk-JFJ3ZJQL.js";import"./chunk-3UEQ2OX6.js";import"./chunk-J7FLFHQJ.js";import"./chunk-M66BUNYO.js";import"./chunk-TMUK2DD3.js";export{f as installUpdate,a as installedGlobally,e as lastWords,c as npmBeside,d as npmCliBeside,b as runningScript};
3
+ import{a,b,c,d,e,f}from"./chunk-63ZK5SRQ.js";import"./chunk-WIPP5TWQ.js";import"./chunk-J7FLFHQJ.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{f as installUpdate,a as installedGlobally,e as lastWords,c as npmBeside,d as npmCliBeside,b as runningScript};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import"./chunk-TMUK2DD3.js";import{readdir as p,readFile as w,stat as g}from"node:fs/promises";import{dirname as f,join as d}from"node:path";import{fileURLToPath as h}from"node:url";async function u(t,e=!0){let n=0;for(let s of await p(t,{withFileTypes:!0}).catch(()=>[])){if(!e&&s.name==="node_modules")continue;let r=d(t,s.name);s.isDirectory()?n+=await u(r):s.isFile()&&(n+=(await g(r).catch(()=>{}))?.size??0)}return n}var c=async t=>JSON.parse(await w(d(t,"package.json"),"utf8").catch(()=>"null"))??void 0;async function y(t,e){for(let n=e;;n=f(n)){let s=d(n,"node_modules",t);if(await c(s))return s;if(f(n)===n)return}}async function b(t=f(h(import.meta.url))){for(let e=t;;e=f(e)){if((await c(e))?.name==="forge-terminal")return e;if(f(e)===e)return}}async function j(t){let e=await c(t);if(!e)return 0;let n=0;for(let a of[...e.files??[],"package.json","README.md","LICENSE"]){let o=d(t,a),i=await g(o).catch(()=>{});i?.isDirectory()?n+=await u(o):i?.isFile()&&(n+=i.size)}let s=new Set,r=[],l=(a,o)=>{for(let i of Object.keys({...a.dependencies,...a.optionalDependencies}))r.push([i,o])};for(l(e,t);r.length>0;){let[a,o]=r.shift(),i=await y(a,o);if(!i||s.has(i))continue;s.add(i),n+=await u(i,!1);let m=await c(i);m&&l(m,i)}return n}export{j as installBytes,b as packageRoot};