forge-terminal 0.5.1 → 0.5.3
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 +7 -6
- package/dist/chunks/{about-credits-FZ35HUFP.js → about-credits-DBQHH5HA.js} +1 -1
- package/dist/chunks/args-TZMA4ZR6.js +3 -0
- package/dist/chunks/{boot-PCZBPNFR.js → boot-E57BKWEC.js} +1 -1
- package/dist/chunks/chunk-3CLPUPJT.js +55 -0
- package/dist/chunks/chunk-3GHHQNR6.js +3 -0
- package/dist/chunks/chunk-4YFFT5CZ.js +66 -0
- package/dist/chunks/{chunk-BD3OLIVT.js → chunk-5IZBFF6Y.js} +1 -1
- package/dist/chunks/{chunk-S2M4XESA.js → chunk-5YUOG3A5.js} +1 -1
- package/dist/chunks/{chunk-X26WUHWB.js → chunk-6LMVOQQA.js} +1 -1
- package/dist/chunks/chunk-6RMRWBMB.js +3 -0
- package/dist/chunks/{chunk-63ZK5SRQ.js → chunk-7I2OSTBX.js} +1 -1
- package/dist/chunks/chunk-7KYO62XK.js +3 -0
- package/dist/chunks/{chunk-HCLEHCAR.js → chunk-7VR6LODN.js} +1 -1
- package/dist/chunks/{chunk-3KWAO2N2.js → chunk-AFEYLHDD.js} +1 -1
- package/dist/chunks/{chunk-YNZIN42P.js → chunk-AIINYKXW.js} +1 -1
- package/dist/chunks/{chunk-DZOBIUV6.js → chunk-BIBDLXCG.js} +1 -1
- package/dist/chunks/{chunk-G46QQBT3.js → chunk-BROTSQXG.js} +1 -1
- package/dist/chunks/chunk-CVNYUROW.js +3 -0
- package/dist/chunks/{chunk-QXNB5DQ2.js → chunk-E2BYNETT.js} +1 -1
- package/dist/chunks/{chunk-SK2UZ25Y.js → chunk-EITGK5OI.js} +1 -1
- package/dist/chunks/chunk-EPDF4NQI.js +3 -0
- package/dist/chunks/{chunk-JOIHR724.js → chunk-EURVTBPH.js} +1 -1
- package/dist/chunks/{chunk-MTDCDKPU.js → chunk-FLMQ5VFR.js} +2 -2
- package/dist/chunks/{chunk-JMBEZPYC.js → chunk-HWCXNKIN.js} +1 -1
- package/dist/chunks/{chunk-XURW53YK.js → chunk-IE6NFN3N.js} +1 -1
- package/dist/chunks/chunk-IJRLRAC5.js +3 -0
- package/dist/chunks/chunk-IKZTH2RL.js +3 -0
- package/dist/chunks/chunk-ITJZ7ODJ.js +4 -0
- package/dist/chunks/{chunk-THDAQBQ3.js → chunk-J6AZTW62.js} +1 -1
- package/dist/chunks/chunk-MNI6IKIU.js +3 -0
- package/dist/chunks/chunk-N3X3H4IZ.js +3 -0
- package/dist/chunks/chunk-NHMACTW3.js +82 -0
- package/dist/chunks/chunk-O7DK3GJT.js +3 -0
- package/dist/chunks/chunk-Q7ERPAG3.js +7 -0
- package/dist/chunks/{chunk-2CX33C6H.js → chunk-QPJ2LNXB.js} +1 -1
- package/dist/chunks/chunk-TDYKRRZH.js +3 -0
- package/dist/chunks/chunk-TFOEI5VF.js +3 -0
- package/dist/chunks/{chunk-EKTUUKDP.js → chunk-TYWGB767.js} +1 -1
- package/dist/chunks/chunk-VLVNA4T3.js +3 -0
- package/dist/chunks/{chunk-YINYF6C7.js → chunk-VTA6Z45X.js} +1 -1
- package/dist/chunks/{chunk-GLAD7GP2.js → chunk-YK26E3OX.js} +1 -1
- package/dist/chunks/chunk-Z2H2GT2X.js +36 -0
- package/dist/chunks/{chunk-C4UCCBCX.js → chunk-ZOQA3JAR.js} +1 -1
- package/dist/chunks/chunk-ZYIW4MAG.js +3 -0
- package/dist/chunks/clip-command-QPLYCGJ2.js +3 -0
- package/dist/chunks/clipboard-7KSZNWWT.js +3 -0
- package/dist/chunks/colour-PZOAKNTH.js +3 -0
- package/dist/chunks/command-DMGGGAPS.js +3 -0
- package/dist/chunks/config-command-6GXRV627.js +3 -0
- package/dist/chunks/continue-editing-4W3XWWCE.js +3 -0
- package/dist/chunks/decoded-SMEHAVCH.js +3 -0
- package/dist/chunks/{entry-2XJD7UCY.js → entry-REXB6JNP.js} +2 -2
- package/dist/chunks/execute-GKO4THUK.js +3 -0
- package/dist/chunks/extensions-UV4X2UUA.js +3 -0
- package/dist/chunks/{extensions-command-MGPRISPH.js → extensions-command-TLW53BUK.js} +1 -1
- package/dist/chunks/{ffmpeg-2UZXAB3C.js → ffmpeg-32EEMAZS.js} +1 -1
- package/dist/chunks/image-YMCS4PTS.js +3 -0
- package/dist/chunks/install-7ZRVQKCF.js +3 -0
- package/dist/chunks/install-C6XNONFF.js +3 -0
- package/dist/chunks/launch-IVBMNYNY.js +17 -0
- package/dist/chunks/lock-AFVXUDOM.js +3 -0
- package/dist/chunks/manager-XPO4ZIRY.js +4 -0
- package/dist/chunks/{needed-YEXRZMZX.js → needed-NOGBHTHE.js} +1 -1
- package/dist/chunks/notify-YEBP67MP.js +3 -0
- package/dist/chunks/{own-WOK6H277.js → own-G4G4MRGM.js} +1 -1
- package/dist/chunks/pdfium-BAMNBCNW.js +3 -0
- package/dist/chunks/preset-command-XXKLUJOS.js +3 -0
- package/dist/chunks/registry-PKOPEG3Z.js +3 -0
- package/dist/chunks/run-WSETTQXP.js +3 -0
- package/dist/chunks/{server-QNWPC2CC.js → server-AR73FWWG.js} +3 -3
- package/dist/chunks/{theme-EHFY7DT6.js → theme-D4AMWFFW.js} +1 -1
- package/dist/chunks/transcribe-EFVJPBPG.js +3 -0
- package/dist/chunks/transcribe-command-Q4J3WTOB.js +3 -0
- package/dist/chunks/update-command-DJLYU6AB.js +3 -0
- package/dist/chunks/{update-note-GYJWUDFS.js → update-note-2YR3TLPK.js} +1 -1
- package/dist/chunks/watch-command-2D7NLDAM.js +3 -0
- package/dist/index.js +13 -13
- package/package.json +7 -11
- package/dist/chunks/args-FSQFXDIX.js +0 -3
- package/dist/chunks/chunk-2J2PTA5O.js +0 -3
- package/dist/chunks/chunk-2MLASXG5.js +0 -3
- package/dist/chunks/chunk-5TEAR5XH.js +0 -3
- package/dist/chunks/chunk-63BBFKT2.js +0 -4
- package/dist/chunks/chunk-655UG277.js +0 -3
- package/dist/chunks/chunk-72TNSFL5.js +0 -36
- package/dist/chunks/chunk-AYB5AJ4E.js +0 -3
- package/dist/chunks/chunk-C32KGH4S.js +0 -3
- package/dist/chunks/chunk-LBDSFSYP.js +0 -3
- package/dist/chunks/chunk-OY4EGSPE.js +0 -3
- package/dist/chunks/chunk-UXRQ4UBQ.js +0 -66
- package/dist/chunks/chunk-WIPP5TWQ.js +0 -3
- package/dist/chunks/chunk-WZWK3PEZ.js +0 -3
- package/dist/chunks/chunk-ZRHYGR2L.js +0 -134
- package/dist/chunks/clip-command-NZNC46H2.js +0 -3
- package/dist/chunks/clipboard-GICOXMMN.js +0 -3
- package/dist/chunks/colour-GSDOHCFK.js +0 -3
- package/dist/chunks/command-GYCYLUHN.js +0 -3
- package/dist/chunks/config-command-6YUMMZF3.js +0 -3
- package/dist/chunks/continue-editing-QE5RRIMG.js +0 -3
- package/dist/chunks/decoded-NBZ335RZ.js +0 -3
- package/dist/chunks/execute-FYEXZ7EY.js +0 -3
- package/dist/chunks/extensions-V5O4NIHI.js +0 -3
- package/dist/chunks/image-3CMUB2P4.js +0 -3
- package/dist/chunks/install-IDUHZTTS.js +0 -3
- package/dist/chunks/install-L5C2UT6M.js +0 -3
- package/dist/chunks/launch-GUHDBMSJ.js +0 -17
- package/dist/chunks/lock-UQJ66TZ3.js +0 -3
- package/dist/chunks/manager-UKTMRXKE.js +0 -4
- package/dist/chunks/pdfium-LYHOU6WV.js +0 -3
- package/dist/chunks/preset-command-6A2C6VPQ.js +0 -3
- package/dist/chunks/registry-2YU7NW4P.js +0 -3
- package/dist/chunks/run-U2CU6VGE.js +0 -5
- package/dist/chunks/transcribe-SCL3LFZU.js +0 -3
- package/dist/chunks/transcribe-command-BX2VVUI3.js +0 -3
- package/dist/chunks/update-command-JCTCRPCS.js +0 -3
- package/dist/chunks/watch-command-ZLZAWTNJ.js +0 -3
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ That puts `forge` on your `PATH`, so it works from any directory. Verify:
|
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
forge --version
|
|
53
|
-
# 0.5.
|
|
53
|
+
# 0.5.3
|
|
54
54
|
|
|
55
55
|
forge photo.jpg --to webp
|
|
56
56
|
```
|
|
@@ -888,7 +888,7 @@ forge <inputs...> --to <format> [options]
|
|
|
888
888
|
| `--keep-metadata` | preserve EXIF/GPS instead of stripping it |
|
|
889
889
|
| `--recursive` | descend into subdirectories |
|
|
890
890
|
| `--force` | allow overwriting an existing output file |
|
|
891
|
-
| `--concurrency <n>` | batch parallelism (default
|
|
891
|
+
| `--concurrency <n>` | batch parallelism (default: one per core, at most 8) |
|
|
892
892
|
| `--debug` | include stack traces in error output |
|
|
893
893
|
| `--formats` | print the capability matrix |
|
|
894
894
|
| `-V, --version` / `-h, --help` | the usual |
|
|
@@ -1117,7 +1117,7 @@ photo.png · PNG · 122 KB · 2756×774
|
|
|
1117
1117
|
With `--json`:
|
|
1118
1118
|
|
|
1119
1119
|
```json
|
|
1120
|
-
{"forge":"0.5.
|
|
1120
|
+
{"forge":"0.5.3","ok":true,"probes":[{"path":"/Users/me/photo.png","kind":"image","format":"png","bytes":122449,"width":2756,"height":774,"targets":["jpeg","png","webp","avif","gif","tiff","pdf"],"actions":["convert"]}],"failures":[]}
|
|
1121
1121
|
```
|
|
1122
1122
|
|
|
1123
1123
|
`targets` and `actions` come from the engines' own capabilities, so they are
|
|
@@ -1143,7 +1143,7 @@ succeeded) and `failures`. A conversion, compression or page operation adds
|
|
|
1143
1143
|
|
|
1144
1144
|
```jsonc
|
|
1145
1145
|
{
|
|
1146
|
-
"forge": "0.5.
|
|
1146
|
+
"forge": "0.5.3",
|
|
1147
1147
|
"ok": false,
|
|
1148
1148
|
"results": [
|
|
1149
1149
|
{
|
|
@@ -1441,8 +1441,9 @@ These apply automatically, unconditionally, unless a flag opts out:
|
|
|
1441
1441
|
4. **Never drop animation silently.** An animated source converting to a
|
|
1442
1442
|
format that can't animate keeps only the first frame — and attaches a
|
|
1443
1443
|
warning to the result, rather than converting quietly and losing frames.
|
|
1444
|
-
5. **Bounded concurrency.** Batches run
|
|
1445
|
-
time,
|
|
1444
|
+
5. **Bounded concurrency.** Batches run one conversion per core, at most
|
|
1445
|
+
8 at a time, and Forge gives Sharp's threadpool a thread for each, so
|
|
1446
|
+
neither waits on the other. Video and sound encode one at a time.
|
|
1446
1447
|
|
|
1447
1448
|
Writes are atomic: output goes to a temp file in the destination directory
|
|
1448
1449
|
and is renamed into place only on success, so a crash mid-encode never
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
3
|
import"./chunk-TMUK2DD3.js";import{readFile as x}from"node:fs/promises";import{dirname as m,join as u}from"node:path";import{fileURLToPath as C}from"node:url";var c=[{name:"sharp \xB7 libvips",licence:"Apache-2.0 \xB7 LGPL-3.0",does:"images",packages:["sharp"]},{name:"PDFium",licence:"BSD-3-Clause",does:"PDF pages",packages:[]},{name:"pdf-lib",licence:"MIT",does:"writing PDFs",packages:["pdf-lib"]},{name:"mammoth \xB7 docx",licence:"BSD-2-Clause \xB7 MIT",does:"Word documents",packages:["mammoth","docx"]},{name:"Ink \xB7 React",licence:"MIT",does:"this screen",packages:["ink","react"]}],g=[{name:"@hyzyla/pdfium",licence:"MIT"}],h=[{name:"Noto Sans",licence:"OFL-1.1"},{name:"xkcd colour survey",licence:"CC0-1.0"}];function l(n){let t=[];for(let e of n.split(`
|
|
4
|
-
`)){let i=/^((?:@[^/\s]+\/)?[^@\s]+)@\S+ — (.+)$/.exec(e);i&&t.push({name:i[1],licence:i[2].replace(/^\((.*)\)$/,"$1")})}return t}var d=n=>n.name.replace(/^@/,"");function p({bundled:n,extensions:t}){let e=new Set(c.flatMap(s=>s.packages)),i=[...n.filter(s=>!e.has(s.name)),...g,...h].sort((s,r)=>d(s).localeCompare(d(r)));return[{title:"App",credits:c.map(({packages:s,...r})=>r)},...t.length>0?[{title:"Extensions",credits:t}]:[],{title:"Others",credits:i}]}var f="third-party-licenses.txt";function y(n){let t=[],e=m(n);for(let i=0;i<4;i++)t.push(u(e,f),u(e,"dist",f)),e=m(e);return t}async function k(n){for(let t of y(C(n))){let e=await x(t,"utf8").catch(()=>{});if(e!==void 0)return{path:t,text:e}}}async function F({from:n=import.meta.url,list:t=async()=>(await import("./manager-
|
|
4
|
+
`)){let i=/^((?:@[^/\s]+\/)?[^@\s]+)@\S+ — (.+)$/.exec(e);i&&t.push({name:i[1],licence:i[2].replace(/^\((.*)\)$/,"$1")})}return t}var d=n=>n.name.replace(/^@/,"");function p({bundled:n,extensions:t}){let e=new Set(c.flatMap(s=>s.packages)),i=[...n.filter(s=>!e.has(s.name)),...g,...h].sort((s,r)=>d(s).localeCompare(d(r)));return[{title:"App",credits:c.map(({packages:s,...r})=>r)},...t.length>0?[{title:"Extensions",credits:t}]:[],{title:"Others",credits:i}]}var f="third-party-licenses.txt";function y(n){let t=[],e=m(n);for(let i=0;i<4;i++)t.push(u(e,f),u(e,"dist",f)),e=m(e);return t}async function k(n){for(let t of y(C(n))){let e=await x(t,"utf8").catch(()=>{});if(e!==void 0)return{path:t,text:e}}}async function F({from:n=import.meta.url,list:t=async()=>(await import("./manager-XPO4ZIRY.js")).listExtensions()}={}){let[e,i]=await Promise.all([k(n),t().catch(()=>[])]),{extensionCredits:s}=await import("./extensions-UV4X2UUA.js"),r=i.filter(o=>o.installed!==void 0).flatMap(o=>s(o.entry)),a=p({bundled:l(e?.text??""),extensions:r});return e?{sections:a,file:e.path}:{sections:a}}export{F as loadCredits};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a,b,c,d,e,f}from"./chunk-AIINYKXW.js";import"./chunk-U5TEGDGH.js";import"./chunk-7VR6LODN.js";import"./chunk-5IZBFF6Y.js";import"./chunk-HZDYZ5RD.js";import"./chunk-QVACE4IE.js";import"./chunk-AFEYLHDD.js";import"./chunk-EPDF4NQI.js";import"./chunk-EEQSUBBL.js";import"./chunk-E2BYNETT.js";import"./chunk-IE6NFN3N.js";import"./chunk-HWCXNKIN.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-TFOEI5VF.js";import"./chunk-J6AZTW62.js";import"./chunk-BIBDLXCG.js";import"./chunk-7KYO62XK.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{b as COMMANDS_HELP,a as EXIT_CODES_HELP,d as colourUsage,c as commandsHelp,f as parseArgs,e as wantsJson};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{r as a}from"./chunk-
|
|
3
|
+
import{r as a}from"./chunk-AFEYLHDD.js";import{e as l}from"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";var c={loadPreferences:l,loadShell:()=>import("./launch-IVBMNYNY.js")};async function f(e=c,n={}){let t=e.loadShell();t.catch(()=>{});let{prefs:o,warning:r}=await e.loadPreferences(),s=a(o.theme),{launchShell:i}=await t;await i({prefs:o,palette:s,...r===void 0?{}:{warning:r},...n})}export{f as bootShell};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a as y}from"./chunk-6RMRWBMB.js";import{execFile as C}from"node:child_process";import{accessSync as v,constants as k}from"node:fs";import{isAbsolute as A,join as a}from"node:path";var S=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function $(e,t){if(typeof e=="string")return`${t}<string>${S(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(o=>$(o,`${t} `)).join(`
|
|
5
|
+
`)}
|
|
6
|
+
${t}</array>`;let n=Object.entries(e).map(([o,i])=>`${t} <key>${S(o)}</key>
|
|
7
|
+
${$(i,`${t} `)}`);return n.length===0?`${t}<dict/>`:`${t}<dict>
|
|
8
|
+
${n.join(`
|
|
9
|
+
`)}
|
|
10
|
+
${t}</dict>`}var h=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
|
+
${$(e,"")}
|
|
14
|
+
</plist>
|
|
15
|
+
`,T={image:"public.image",folder:"public.folder",pdf:"com.adobe.pdf"};function P(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 u=e=>`'${e.replace(/'/g,"'\\''")}'`,w="forge",D=e=>e.preset===void 0?`com.forge-terminal.menu.${e.action}`:`com.forge-terminal.menu.preset.${e.preset}`,Y="com.forge-terminal.menu.",N="runWorkflowAsService",G=e=>`${D(e)} - ${e.label} - ${N}`,E=`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 Q(e){return[e.osascript??"/usr/bin/osascript",["-l","JavaScript","-e",E,e.domain??"pbs",...e.on.map(t=>`+${t}`),...e.off.map(t=>`-${t}`)]]}function z(e,t){let n=h({CFBundleDevelopmentRegion:"English",CFBundleIdentifier:D(e),CFBundleInfoDictionaryVersion:"6.0",CFBundleName:e.label,CFBundlePackageType:"BNDL",CFBundleShortVersionString:"1.0",CFBundleVersion:"1",NSServices:[{NSIconName:w,NSMenuItem:{default:e.label},NSMessage:N,NSRequiredContext:{NSApplicationIdentifier:"com.apple.finder"},NSSendFileTypes:e.kinds.map(s=>T[s])}]}),o=e.preset===void 0?"":` ${u(e.preset)}`,i=`${u(t)} ${e.action}${o} "$@"`,r=h({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:P(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 m="forge-terminal-menu";function oe(e){let t=o=>o&&A(o)?o:void 0,n=(e.xdgConfigDirs??"").split(":").filter(o=>A(o));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 x(e,t=process.env.PATH){for(let n of(t??"").split(":"))if(n!=="")try{return v(a(n,e),k.X_OK),!0}catch{}return!1}var I={image:"image/*",folder:"inode/directory",pdf:"application/pdf"},U=e=>e.map(t=>`${I[t]};`).join(""),M=e=>`${e.paint}.png`,ie=e=>a(e.dataHome,"nautilus","scripts","Forge"),f=e=>e.preset===void 0?e.action:`preset-${e.preset}`,g=e=>e.preset===void 0?e.action:`preset ${e.preset}`,re=e=>e.label;function se(e,t){return`#!/bin/sh
|
|
31
|
+
# ${m}: 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 ${u(t)} ${g(e)} "$@"
|
|
39
|
+
`}var ae=e=>a(e.dataHome,"nemo","actions"),ce=(e,t)=>`forge-${e.preset===void 0?t.indexOf(e.action)+1:t.length+1}-${f(e)}.nemo_action`,l=e=>e.replace(/%/g,"%%");function ue(e,t){return`[Nemo Action]
|
|
40
|
+
# ${m}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.
|
|
41
|
+
Name=${l(e.label)}
|
|
42
|
+
Comment=${l(e.label)}
|
|
43
|
+
Exec=${l(u(t))} ${g(e)} %F
|
|
44
|
+
Selection=notnone
|
|
45
|
+
Mimetypes=${U(e.kinds)}
|
|
46
|
+
`}var pe=e=>a(e.dataHome,"kio","servicemenus"),le=e=>`forge-${e}.desktop`,me=["image","folder","pdf"],_=e=>l(`"${e.replace(/[\\"`$]/g,"\\$&")}"`).replace(/\\/g,"\\\\");function fe(e,t,n){let o=t.filter(c=>c.kinds.includes(e));if(o.length===0)return;let i=o.length>1,r=["[Desktop Entry]",`# ${m}: 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=${I[e]};`,`Actions=${o.map(c=>`${f(c)};`).join("")}`,"X-KDE-Priority=TopLevel",...i?["X-KDE-Submenu=Forge",`Icon=${a(n.menuDir,"forge.png")}`]:[]],s=o.map(c=>["",`[Desktop Action ${f(c)}]`,`Name=${c.label}`,`Icon=${a(n.menuDir,M(c))}`,`Exec=${_(n.launcher)} ${g(c)} %F`].join(`
|
|
47
|
+
`));return`${[...r,...s].join(`
|
|
48
|
+
`)}
|
|
49
|
+
`}var ge=e=>a(e.configHome,"Thunar","uca.xml"),de=e=>e.configDirs.map(t=>a(t,"Thunar","uca.xml")),$e=`<?xml version="1.0" encoding="UTF-8"?>
|
|
50
|
+
<actions>
|
|
51
|
+
</actions>
|
|
52
|
+
`,L=e=>`${m}-${f(e)}`,p=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),O={image:{patterns:["*"],type:"image-files"},folder:{patterns:["*"],type:"directories"},pdf:{patterns:["*.pdf","*.PDF"],type:"other-files"}};function xe(e,t){return e.map(n=>{let o=n.kinds.map(s=>O[s]),i=[...new Set(o.flatMap(s=>s.patterns))],r=i.includes("*")?["*"]:i;return["<action>",` <icon>${p(a(t.menuDir,M(n)))}</icon>`,` <name>${p(n.label)}</name>`,` <submenu>${n.kinds.includes("pdf")?"":"Forge"}</submenu>`,` <unique-id>${L(n)}</unique-id>`,` <command>${p(l(u(t.launcher)))} ${g(n)} %F</command>`,` <description>${p(n.label)}</description>`," <range></range>",` <patterns>${p(r.join(";"))}</patterns>`,...o.map(s=>` <${s.type}/>`),"</action>"].join(`
|
|
53
|
+
`)}).map(n=>`${n}
|
|
54
|
+
`).join("")}var j=/[ \t]*<action>[\s\S]*?<\/action>[ \t]*\r?\n?/g;function R(e){return e.replace(j,t=>t.includes(`<unique-id>${m}-`)?"":t)}function ye(e,t){let n=R(e),o=n.lastIndexOf("</actions>");if(o===-1||!/<actions>/.test(n))return;let i=n.lastIndexOf(`
|
|
55
|
+
`,o)+1;return/^[ \t]*$/.test(n.slice(i,o))&&(o=i),`${n.slice(0,o)}${t}${n.slice(o)}`}var Se=(e,t,n)=>x("thunar",t)||n(a(e.configHome,"Thunar"));var B="ForgeTerminal.Forge",F=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),K=e=>e.replace(/['‘’‚‛]/g,"$&$&"),b=K;function H(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">${b(F(e))}</text><text id="2">${b(F(t))}</text></binding></visual></toast>')`,`[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('${B}').Show([Windows.UI.Notifications.ToastNotification]::new($x))`].join("; ")}function W(e,t,n=process.platform){return n==="win32"?["powershell.exe",["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",H(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 d=e=>`"${e.replace(/[\\"]/g,"\\$&").replace(/\n/g,"\\n")}"`;function X(e,t,n={}){let o=n.has??(i=>x(i));if(o("notify-send"))return["notify-send",["--app-name=Forge",...n.icon?[`--icon=${n.icon}`]:[],"--",e,t]];if(o("gdbus"))return["gdbus",["call","--session","--dest","org.freedesktop.Notifications","--object-path","/org/freedesktop/Notifications","--method","org.freedesktop.Notifications.Notify",d("Forge"),"0",d(n.icon??""),d(e),d(t),"[]","{}","-1"]]}function V(e,t,n=process.platform,o={}){let i=n==="linux"?X(e,t,o):W(e,t,n);return new Promise(r=>{if(i===void 0)return r();try{C(i[0],i[1],{timeout:1e4,windowsHide:!0},()=>r())}catch{r()}})}var q=(e,t)=>new Promise((n,o)=>C(e,t,{timeout:2e3},(i,r)=>i?o(i):n(r)));async function J(e,t=q){let n=(await t("lsappinfo",["front"])).trim();return(await t("lsappinfo",["info","-only","bundleid",n])).match(/bundleID="([^"]*)"/)?.[1]===e}async function Ie(e,t,n={}){if(e===void 0||!y(t))return;let o=n.platform??process.platform,i=n.env??process.env;if(i.FORGE_NO_NOTIFY||i.SSH_CONNECTION||i.SSH_TTY)return;let r=i.__CFBundleIdentifier;o==="darwin"&&r&&await J(r,n.ask).catch(()=>!1)||await(n.post??((s,c)=>V(s,c,o)))(e.title,e.body)}export{u as a,w as b,Y as c,G as d,Q as e,z as f,m as g,oe as h,x as i,M as j,ie as k,re as l,se as m,ae as n,ce as o,ue as p,pe as q,le as r,me as s,fe as t,ge as u,de as v,$e as w,xe as x,R as y,ye as z,Se as A,B,K as C,H as D,W as E,d as F,X as G,V as H,J as I,Ie 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 b,c as G}from"./chunk-Q6KQWJ4J.js";import{d as W,f as y,g as K}from"./chunk-7VR6LODN.js";import{a as Q,b as X,e as w}from"./chunk-5IZBFF6Y.js";import{a as H,b as P}from"./chunk-EPDF4NQI.js";import{a as h,d as R}from"./chunk-N6RCLJE6.js";import{i as F,j as U,k as g}from"./chunk-TFOEI5VF.js";import{d as I,l as z}from"./chunk-J6AZTW62.js";import{b as B,c as J,d as L,e as u,i as _,m as O}from"./chunk-BIBDLXCG.js";import{E as k,s as N}from"./chunk-CVNYUROW.js";import{a as s,b as D,c as $}from"./chunk-H3DIRJFE.js";var M=t=>t.length>0&&t.every(e=>e.kind==="image")?t:void 0;function Gt(t,e){let n=Q(t);return n.includes(e)?void 0:N(t,e,n)}function V(t){return{target:t.target??"png",background:typeof t.background=="string"?t.background:"#ffffff",keepMetadata:t.keepMetadata===!0,...typeof t.output=="string"?{output:t.output}:{},...t.roots instanceof Map?{roots:t.roots}:{},...typeof t.quality=="number"?{quality:t.quality}:{}}}var Y=()=>({kind:"select",id:"target",label:"Save as",default:"png",choices:[{value:"png",label:"PNG",hint:s.png.hint}]}),dt=t=>t===1?"sharp":`${t}x`,ut=t=>t===1||t===3||t===4?t:2,Ht={id:"boost",label:"Boost resolution",verb:"Boosting",hint:"sharper, at its size or at 2\xD7, 3\xD7 or 4\xD7",requires:"boost",appliesTo:t=>M(t)!==void 0,unavailable:()=>"images only",options:()=>[{kind:"select",id:"scale",label:"Scale",default:"2",choices:[{value:"1",label:"Sharpen",hint:"the same size, sharper"},{value:"2",label:"2\xD7",hint:"twice the width and height"},{value:"3",label:"3\xD7",hint:"three times the width and height"},{value:"4",label:"4\xD7",hint:"four times the width and height"}]},Y()],plan(t,e){let n=M(t);if(!n)return[];let o=V(e),i=ut(Number(e.scale??2));return n.map(r=>({op:"boost",sources:[r],outputs:[u({sourcePath:r.path,target:o.target,suffix:dt(i),...o.output===void 0?{}:{output:o.output},...o.roots?.get(r.path)===void 0?{}:{sourceRoot:o.roots.get(r.path)}})],scale:i,target:o.target,options:{background:o.background,keepMetadata:o.keepMetadata,...o.quality===void 0?{}:{quality:o.quality}}}))}},Wt={id:"remove-background",label:"Remove background",verb:"Removing",hint:"cut out the subject",requires:"remove-background",appliesTo:t=>M(t)!==void 0,unavailable:()=>"images only",options:()=>[Y()],plan(t,e){let n=M(t);if(!n)return[];let o=V(e);return n.map(i=>({op:"remove-background",sources:[i],outputs:[u({sourcePath:i.path,target:o.target,suffix:"cutout",...o.output===void 0?{}:{output:o.output},...o.roots?.get(i.path)===void 0?{}:{sourceRoot:o.roots.get(i.path)}})],target:o.target,options:{background:o.background,keepMetadata:o.keepMetadata,...o.quality===void 0?{}:{quality:o.quality}}}))}};var ft=[{degrees:90,label:"90\xB0 right",suffix:"rotated-right"},{degrees:180,label:"180\xB0",suffix:"rotated-180"},{degrees:270,label:"90\xB0 left",suffix:"rotated-left"}],S=t=>t===90||t===180||t===270,Vt=(t,e)=>e===180?{...t}:{width:t.height,height:t.width},T=t=>ft.find(e=>e.degrees===t).suffix;import{dirname as ct,join as Z}from"node:path";var q="Same location",v="New subfolder";function mt(t,e,n){return t===e?q:t===h("Desktop")?"Desktop":t===h("Downloads")?"Downloads":e!==void 0&&n!==void 0&&t===Z(e,n)?v:b(t)||t}function A(t,e,n={}){return lt(ct(t.path),e,n)}function lt(t,e,{subfolder:n}={}){let o=R(e.defaultOutput),i=e.lastOutput?R(e.lastOutput):void 0,r=f=>({label:mt(f,t,n),path:f}),a=[r(o),...i?[r(i)]:[],r(h("Desktop")),...t===void 0?[]:[{label:q,path:t}],r(h("Downloads")),...n!==void 0&&t!==void 0?[{label:v,path:Z(t,n)}]:[]],p=new Set,d=a.filter(f=>p.has(f.path)?!1:(p.add(f.path),!0));return{kind:"path",id:"destination",label:"Save to",default:o,presets:d,...i&&i!==o?{last:i}:{}}}var c=t=>typeof t=="string"&&t!==""?t:void 0;var pe=[2,1.5,1.25,.75,.5],gt=.25,ht=4,tt=-16;function nt(t){return{wav:"m4a",aiff:"m4a",flac:"m4a",avi:"mp4",ogg:"opus"}[t]??t}var et=t=>t.length===1&&t[0]?.kind==="media"?t[0]:void 0,bt=t=>t==="cut"||t==="mute"||t==="speed"||t==="resize"||t==="crop"||t==="rotate"||t==="loudness"||t==="extract"||t==="cleanup";function yt(t,e){let n=e.media??{},o=t.facts?.video,i=[];return e.extract&&i.push("audio"),n.cut&&i.push("trimmed"),n.mute&&i.push("muted"),n.cleanup?i.push("cleaned"):n.loudness!==void 0&&i.push("levelled"),n.speed!==void 0&&i.push(`${n.speed}x`),n.fps!==void 0&&i.push(`${n.fps}fps`),n.bitrate!==void 0&&i.push(`${n.bitrate}k`),e.crop&&i.push(z(e.crop.aspect)),e.resize&&i.push(o?y(g(o,e.resize)):"resized"),e.rotate&&i.push(T(e.rotate)),i.length===1?i[0]:"edited"}function St(t,e){return t.map(n=>{let o=e.target??n.format,i={background:"#ffffff",keepMetadata:!1};e.media&&Object.keys(e.media).length&&(i.media=e.media),e.resize&&(i.resize=e.resize),e.rotate&&(i.rotate=e.rotate);let r=n.facts?.video;e.crop&&r&&(i.crop={aspect:e.crop.aspect,box:e.crop.box??I(r,e.crop.aspect)});let a=e.roots?.get(n.path),p=u({sourcePath:n.path,target:o,suffix:yt(n,e),...e.output===void 0?{}:{output:e.output},...a===void 0?{}:{sourceRoot:a}});return{op:"convert",sources:[n],outputs:[O(p,c(e.destination),c(e.name))],target:o,options:i}})}function x(t){let e={},n=t.cut;return n&&typeof n.start=="number"&&(e.cut={start:n.start,...typeof n.end=="number"?{end:n.end}:{}}),t.mute===!0&&(e.mute=!0),typeof t.speed=="number"&&(e.speed=t.speed),typeof t.fps=="number"&&(e.fps=t.fps),typeof t.bitrate=="number"&&(e.bitrate=t.bitrate),typeof t.loudness=="number"&&(e.loudness=t.loudness),t.cleanup===!0&&(e.cleanup=!0),Object.keys(e).length?e:void 0}var de={id:"media-edit",label:"Edit",verb:"Editing",hint:"trim, mute, speed, resize, rotate, crop",appliesTo:t=>et(t)!==void 0,unavailable:()=>"one video or audio file",options:()=>[],plan(t,e){let n=et(t);if(!n||!bt(e.tool))return[];let o=e.tool,i={...typeof e.output=="string"?{output:e.output}:{},destination:e.destination,name:e.name};if(o==="cut"){let r=x(e)?.cut;if(!r)return[];i.media={cut:r}}if(o==="mute"&&(i.media={mute:!0}),o==="speed"){let r=e.speed;if(typeof r!="number"||r===1||r<gt||r>ht)return[];i.media={speed:r}}if(o==="loudness"&&(i.media={loudness:typeof e.loudness=="number"?e.loudness:tt}),o==="cleanup"){if(!n.facts?.audio)return[];i.media={cleanup:!0,loudness:tt}}if(o==="extract"){let r=n.facts?.audio;if(!r||!n.facts?.video)return[];i.extract=!0,i.target=G(r.codec)}if(o==="resize"){if(typeof e.resize!="object"||e.resize===null)return[];i.resize=e.resize}if(o==="rotate"){if(!n.facts?.video||!S(e.turn))return[];i.rotate=e.turn}if(o==="crop"){let r=e.crop;if(!r?.aspect||!n.facts?.video)return[];i.crop=r}return St([n],i)}};import{dirname as xt,join as kt}from"node:path";var It=t=>s[t.format].media==="video",zt=t=>t.length===1&&t[0]?.kind==="image"?t[0]:void 0,Ot=t=>t.length===1&&t[0]?.kind==="document"?t[0]:void 0,Mt="-small",m={min:30,max:100,step:35},Tt=t=>{let e=Math.ceil((t-m.min)/m.step);return Math.min(m.max,m.min+Math.max(0,e)*m.step)},ye={id:"compress",label:"Compress",verb:"Compressing",hint:"make it smaller",appliesTo:t=>{if(t.length===1&&t[0]?.kind==="media")return!0;let e=zt(t);if(e!==void 0){let o=s[e.format];return o.lossy||o.quantisable===!0}return(Ot(t)?.images?.compressible??0)>0},options(t,e,n){let o=t[0];if(!o)return[];let i=[{kind:"select",id:"mode",label:`Compress ${b(o.path)??"this file"}`,choices:[o.kind==="media"?{value:"quality",label:"By quality"}:{value:"quality",label:"By quality",hint:"pick a level, see the result"},{value:"size",label:"To a target size",hint:"smallest quality that fits"}],default:"quality"}];if(e.mode==="quality"&&o.kind==="media"&&!It(o))i.push({kind:"slider",id:"bitrate",label:"Quality",min:32,max:320,step:32,default:96});else if(e.mode==="quality"){let r=o.kind==="image"&&s[o.format].quantisable===!0;i.push(r?{kind:"slider",id:"quality",label:"Quality",...m,default:Tt(n.quality),points:!0}:{kind:"slider",id:"quality",label:"Quality",min:1,max:100,step:5,default:n.quality})}else if(e.mode==="size")i.push({kind:"text",id:"size",label:"Target size",placeholder:"e.g. 500kb or 2mb"});else return i;return i.push(A(o,n)),i},plan(t,e){let n=e.mode;if(n!=="quality"&&n!=="size")throw k(`compressAction.plan() needs a mode of "quality" or "size", got ${JSON.stringify(n)}.`,"This is a caller bug, not a user-facing condition: walk options() before calling plan().");let o=t[0];if(!o)return[];let i=(b(o.path)??"file").replace(/\.[^.]+$/,""),r=typeof e.destination=="string"?e.destination:xt(o.path),a=o.kind==="media"?nt(o.format):o.format,p=kt(r,B(i,`${Mt}${$(a)}`)),d=o.kind==="media"?x(e):void 0;return[{op:"convert",sources:[o],target:a,outputs:[p],options:{background:"#ffffff",keepMetadata:!1,...n==="quality"&&typeof e.quality=="number"?{quality:e.quality}:{},compress:{dither:e.dither===!0},...d?{media:d}:{}}}]}};function At(t){return{kind:"select",id:"pages",label:"Pages",default:"all",choices:[{value:"all",label:"All pages",hint:`${t.pages} pages`},{value:"first",label:"First page only"},{value:"choose",label:"Choose pages",hint:"pick which ones"}]}}function Ft(){return{kind:"select",id:"dpi",label:"Resolution",default:"150",choices:[{value:"72",label:"72 dpi",hint:"screen"},{value:"150",label:"150 dpi",badge:"default"},{value:"300",label:"300 dpi",hint:"print"}]}}function Rt(t,e){return Array.isArray(e)?P(e):e==="first"?[0]:typeof e=="string"&&e!=="all"&&e!==""?P(H(e,t.pages)):Array.from({length:t.pages},(n,o)=>o)}function wt(t,e){let n=s[t.format].lossy,o=s[e].lossy;if(n&&!o)return{hint:"likely bigger",tone:"warn"};if(!n&&o)return{hint:"likely smaller",tone:"ok"}}function Pt(t){let e=X(t).filter(o=>o.id!==t.format),n=e[0];return{kind:"select",id:"target",label:`Convert ${s[t.format].label} to`,choices:e.map(o=>{let i=wt(t,o.id);return{value:o.id,label:o.label,hint:i?.hint??o.hint,...i===void 0?{}:{tone:i.tone}}}),default:n?n.id:""}}function Et(t){return{kind:"slider",id:"bitrate",label:"Quality",min:64,max:320,step:32,default:t==="opus"?96:128}}var Ct=t=>typeof t=="object"&&t!==null&&("percent"in t||"width"in t||"height"in t);function jt(t){let e=t.target,n=typeof e=="string"?D(e):void 0;if(!n)throw k(`convertAction.plan() requires a valid target format, got ${JSON.stringify(e)}.`,"This is a caller bug, not a user-facing condition: call options() and pass one of the target select choices before calling plan().");return n}var Ae={id:"convert",label:"Convert",verb:"Converting",hint:"to another format",appliesTo:t=>t.length>=1,options(t,e,n){let o=t[0];if(!o)return[];let i=[Pt(o)],r=e.target;if(typeof r!="string")return i;o.kind==="document"&&w(r)&&i.push(At(o),Ft());let a=s[r];return o.kind==="media"?a?.media==="sound"&&a.lossy&&i.push(Et(r)):a?.lossy&&a.media===void 0&&i.push({kind:"slider",id:"quality",label:"Quality",min:1,max:100,step:5,default:n.quality}),i.push(A(o,n)),i},plan(t,e){let n=t[0];if(!n)return[];let o=jt(e),i=o.id,r={background:typeof e.background=="string"?e.background:"#ffffff",keepMetadata:e.keepMetadata===!0};if(o.lossy&&typeof e.quality=="number"&&(r.quality=e.quality),n.kind==="media"){let d=x(e);d&&(r.media=d),Ct(e.resize)&&(r.resize=e.resize)}let a=typeof e.destination=="string"?e.destination:void 0;if(n.kind==="document"&&w(i)){let d=Number(e.dpi);r.dpi=Number.isFinite(d)&&d>0?d:150;let f=Rt(n,e.pages);r.pages=f;let st=typeof e.sourceRoot=="string"?e.sourceRoot:void 0,pt=_(n.path,f,i,a,st);return[{op:"convert",sources:[n],outputs:pt,target:i,options:r}]}let p=L({sourcePath:n.path,target:i,...a===void 0?{}:{output:`${a}/`}});return J(p,n.path)&&(p=u({sourcePath:n.path,target:i,suffix:i,...a===void 0?{}:{output:`${a}/`}})),[{op:"convert",sources:[n],outputs:[p],target:i,options:r}]}};var Dt=[16,4,2],E=t=>typeof t=="number"&&Dt.includes(t),ot=t=>`dithered-${t}`,we=t=>`${t} colours`,it=t=>s[t.format].quantisable?t.format:"png",C=t=>!(t.frames>1)||t.format==="gif";function $t(t,e){if(e.dither)return ot(e.dither);if(e.deband)return U(e.deband);if(!e.rotate)return rt(t,e);let n=T(e.rotate);return e.trim||e.crop||e.resize?`${rt(t,e)}-${n}`:n}function rt(t,e){if(e.crop){let n=z(e.crop.aspect);if(!e.resize)return n;let o=e.crop.box??I(t,e.crop.aspect);return`${n}-${y(g(o,e.resize))}`}return e.trim&&e.resize?`trimmed-${K(e.resize)}`:e.resize?y(g(t,e.resize)):"trimmed"}function Nt(t,e){if(e.trim&&e.crop)throw new Error("planEdit cannot trim and crop the same image");return t.map(n=>{let o=e.target??(e.dither?it(n):W(n)),i={background:e.background,keepMetadata:e.keepMetadata,...e.quality===void 0?{}:{quality:e.quality},...e.trim?{trim:!0}:{},...e.resize?{resize:e.resize}:{},...e.crop?{crop:e.crop}:{},...e.rotate?{rotate:e.rotate}:{},...e.dither?{dither:e.dither}:{},...e.deband?{deband:e.deband}:{},...e.deband&&e.quality===void 0&&s[o].lossy?{quality:95}:{}},r=e.roots?.get(n.path),a=u({sourcePath:n.path,target:o,suffix:$t(n,e),...e.output===void 0?{}:{output:e.output},...r===void 0?{}:{sourceRoot:r}});return{op:"convert",sources:[n],outputs:[O(a,c(e.destination),c(e.name))],target:o,options:i}})}var j=t=>t.length>0&&t.every(e=>e.kind==="image")?t:void 0,Bt=t=>typeof t=="object"&&t!==null&&("percent"in t||"width"in t||"height"in t),at=t=>typeof t=="object"&&t!==null&&"aspect"in t&&typeof t.aspect=="object"&&t.aspect!==null&&"w"in t.aspect&&"h"in t.aspect;function l(t,e,n,o){return{id:t,label:e,verb:n,hint:o,appliesTo:i=>j(i)?.every(r=>t==="resize"?!0:t==="dither"?C(r):r.frames<=1)===!0,unavailable:i=>j(i)?"animated":"images only",options:()=>[],plan(i,r){let a=j(i);return a?t==="crop"&&!at(r.crop)?[]:t==="turn"&&!S(r.turn)?[]:t==="deband"&&(!F(r.deband)||a.some(p=>p.frames>1))?[]:t==="dither"&&(!E(r.dither)||!a.every(C))?[]:Nt(a,{trim:t==="trim"||r.trim===!0,...S(r.turn)?{rotate:r.turn}:{},...t==="dither"&&E(r.dither)?{dither:r.dither}:{},...t==="deband"&&F(r.deband)?{deband:r.deband}:{},...Bt(r.resize)?{resize:r.resize}:{},...at(r.crop)?{crop:r.crop}:{},...typeof r.target=="string"?{target:r.target}:{},...typeof r.output=="string"?{output:r.output}:{},...r.roots instanceof Map?{roots:r.roots}:{},destination:r.destination,name:r.name,background:typeof r.background=="string"?r.background:"#ffffff",keepMetadata:r.keepMetadata===!0,...typeof r.quality=="number"?{quality:r.quality}:{}}):[]}}}var Le=l("trim","Trim edges","Trimming edges","cut empty borders"),_e=l("resize","Resize","Resizing","smaller or larger"),Ue=l("crop","Crop to shape","Cropping","change the shape"),Qe=l("turn","Rotate","Rotating","turn it"),Xe=l("dither","Dither","Dithering","fewer colours, scattered"),Ge=l("deband","Remove banding","Removing banding","smooth out stripes");export{Gt as a,Ht as b,Wt as c,v as d,A as e,lt as f,c as g,ft as h,Vt as i,pe as j,St as k,de as l,ye as m,Ae as n,Dt as o,we as p,it as q,C as r,Nt as s,Le as t,_e as u,Ue as v,Qe as w,Xe as x,Ge as y};
|