forge-terminal 0.5.4 → 0.5.6
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 +26 -8
- package/dist/chunks/{about-credits-WSRAKKZF.js → about-credits-TM34J3IS.js} +1 -1
- package/dist/chunks/args-7OJGCKH4.js +3 -0
- package/dist/chunks/{boot-HOUBXHJL.js → boot-5KSVFF4C.js} +1 -1
- package/dist/chunks/{chunk-YURNOHEF.js → chunk-2BPH3IL6.js} +33 -24
- package/dist/chunks/{chunk-J7GGNBDR.js → chunk-2HGBB3DQ.js} +1 -1
- package/dist/chunks/{chunk-RW4TOC5E.js → chunk-37U22UEW.js} +1 -1
- package/dist/chunks/{chunk-SBQWOZTA.js → chunk-3RH2AXJW.js} +1 -1
- package/dist/chunks/{chunk-7I2OSTBX.js → chunk-4KGC5ZBZ.js} +1 -1
- package/dist/chunks/{chunk-J6AZTW62.js → chunk-4MJEEEFA.js} +1 -1
- package/dist/chunks/{chunk-YK26E3OX.js → chunk-4RNVZQRC.js} +1 -1
- package/dist/chunks/{chunk-KOHJP7T4.js → chunk-6RCS3KBP.js} +1 -1
- package/dist/chunks/{chunk-NS5CJZ4B.js → chunk-75GYDNAQ.js} +1 -1
- package/dist/chunks/{chunk-EITGK5OI.js → chunk-7R7KDE3R.js} +1 -1
- package/dist/chunks/chunk-7XFLG32B.js +3 -0
- package/dist/chunks/{chunk-CWQCFW5J.js → chunk-CZDI37SI.js} +1 -1
- package/dist/chunks/{chunk-IE6NFN3N.js → chunk-FAUL5L2W.js} +1 -1
- package/dist/chunks/{chunk-HWCXNKIN.js → chunk-HTA25PO2.js} +1 -1
- package/dist/chunks/{chunk-BROTSQXG.js → chunk-ILQDMVJR.js} +1 -1
- package/dist/chunks/chunk-JDTDXCZE.js +3 -0
- package/dist/chunks/chunk-KQ2AHGLK.js +3 -0
- package/dist/chunks/{chunk-WE5MOCUL.js → chunk-LAJAXLGQ.js} +1 -1
- package/dist/chunks/{chunk-TYWGB767.js → chunk-LM4K7CZQ.js} +1 -1
- package/dist/chunks/chunk-N32JL4UI.js +3 -0
- package/dist/chunks/{chunk-Q7ERPAG3.js → chunk-NMECUMJD.js} +1 -1
- package/dist/chunks/chunk-POM7FXIV.js +3 -0
- package/dist/chunks/{chunk-LSVZEQVK.js → chunk-QV27SER6.js} +2 -2
- package/dist/chunks/{chunk-YO2DKGGU.js → chunk-QYAJFKQL.js} +1 -1
- package/dist/chunks/chunk-RUAEBL2F.js +4 -0
- package/dist/chunks/chunk-TFGK7IRZ.js +19 -0
- package/dist/chunks/{chunk-TFOEI5VF.js → chunk-TLHUFIXD.js} +1 -1
- package/dist/chunks/{chunk-KS4ZE3X2.js → chunk-U2XQL7AA.js} +1 -1
- package/dist/chunks/{chunk-KSWBIKCI.js → chunk-UB6YVCIS.js} +1 -1
- package/dist/chunks/chunk-V6GWPR2A.js +3 -0
- package/dist/chunks/{chunk-7UMELAOL.js → chunk-W43SUVWN.js} +1 -1
- package/dist/chunks/{chunk-ZOQA3JAR.js → chunk-W53XNVNH.js} +1 -1
- package/dist/chunks/{chunk-PLBLOIQI.js → chunk-WBV6I7UP.js} +1 -1
- package/dist/chunks/{chunk-7KYO62XK.js → chunk-WBW6G4N6.js} +1 -1
- package/dist/chunks/{chunk-MBZRADAZ.js → chunk-WNYM6NSV.js} +1 -1
- package/dist/chunks/{chunk-BB43QVW4.js → chunk-XY7C5I5T.js} +1 -1
- package/dist/chunks/{chunk-QPYAKAHI.js → chunk-XZZCVJ64.js} +2 -2
- package/dist/chunks/chunk-YJ6XLDRA.js +3 -0
- package/dist/chunks/{chunk-3FLV43Q2.js → chunk-YR7QRQ5F.js} +1 -1
- package/dist/chunks/chunk-ZBMJTIYR.js +3 -0
- package/dist/chunks/chunk-ZJ45XUJW.js +3 -0
- package/dist/chunks/clip-command-3JBZK6Q3.js +3 -0
- package/dist/chunks/{clipboard-7KSZNWWT.js → clipboard-XOIVXPVL.js} +1 -1
- package/dist/chunks/colour-CEKEW7RV.js +3 -0
- package/dist/chunks/{command-BKAPI4A5.js → command-GAGAD65W.js} +1 -1
- package/dist/chunks/{config-command-6GXRV627.js → config-command-CKPJXJEE.js} +1 -1
- package/dist/chunks/{continue-editing-4W3XWWCE.js → continue-editing-M6WESEVB.js} +1 -1
- package/dist/chunks/{decoded-SMEHAVCH.js → decoded-XWKU23RG.js} +1 -1
- package/dist/chunks/{entry-RDY5AQA5.js → entry-64GTSHV2.js} +2 -2
- package/dist/chunks/execute-3J755YKG.js +3 -0
- package/dist/chunks/extensions-QQT6OD7W.js +3 -0
- package/dist/chunks/{extensions-command-VT5CGCL5.js → extensions-command-FV3N7CBV.js} +1 -1
- package/dist/chunks/{ffmpeg-N4SJFTIP.js → ffmpeg-VGE2QCC7.js} +1 -1
- package/dist/chunks/{image-YMCS4PTS.js → image-R5C3AWHT.js} +1 -1
- package/dist/chunks/{install-LDERVCWM.js → install-KGFOAQCU.js} +1 -1
- package/dist/chunks/{install-C6XNONFF.js → install-MFYGS5TG.js} +1 -1
- package/dist/chunks/{launch-UEEW4R7F.js → launch-ATJNO6ZO.js} +5 -5
- package/dist/chunks/{lock-AFVXUDOM.js → lock-BG3CLOHA.js} +1 -1
- package/dist/chunks/manager-ROCFK7AS.js +4 -0
- package/dist/chunks/{needed-P2KDSQRO.js → needed-T722HOKD.js} +1 -1
- package/dist/chunks/{own-LYJ5WMGC.js → own-CX3EJ2AH.js} +1 -1
- package/dist/chunks/{pdfium-BAMNBCNW.js → pdfium-77L526HZ.js} +1 -1
- package/dist/chunks/{preset-command-J7RTNKQI.js → preset-command-M7SESD5C.js} +1 -1
- package/dist/chunks/{registry-WZUVZQHU.js → registry-7BJ4J2SD.js} +1 -1
- package/dist/chunks/{run-WSETTQXP.js → run-GUFPETHF.js} +1 -1
- package/dist/chunks/{server-HQC6RCTV.js → server-64H64DIC.js} +18 -18
- package/dist/chunks/{theme-NQIVXDUH.js → theme-S234JXQH.js} +1 -1
- package/dist/chunks/{transcribe-IZGN5EFT.js → transcribe-L64JHZ3U.js} +1 -1
- package/dist/chunks/{transcribe-command-TMM4RLJD.js → transcribe-command-Y3AHXLVA.js} +1 -1
- package/dist/chunks/{update-command-DJLYU6AB.js → update-command-DWEBUFT5.js} +1 -1
- package/dist/chunks/{update-note-BEM4E3NI.js → update-note-YQD2W5B2.js} +1 -1
- package/dist/chunks/{watch-command-4TATMV2T.js → watch-command-B2Z4KSWR.js} +1 -1
- package/dist/index.js +6 -6
- package/package.json +7 -3
- package/dist/chunks/args-6CKJ6KH6.js +0 -3
- package/dist/chunks/chunk-57M4J2BR.js +0 -3
- package/dist/chunks/chunk-7WZYTDFI.js +0 -3
- package/dist/chunks/chunk-BIBDLXCG.js +0 -3
- package/dist/chunks/chunk-CVNYUROW.js +0 -3
- package/dist/chunks/chunk-LJXEQGKU.js +0 -3
- package/dist/chunks/chunk-PBIS2ONZ.js +0 -3
- package/dist/chunks/chunk-QVACE4IE.js +0 -3
- package/dist/chunks/chunk-SNXX5TVZ.js +0 -4
- package/dist/chunks/chunk-U5TEGDGH.js +0 -3
- package/dist/chunks/chunk-VNZ3D7VG.js +0 -19
- package/dist/chunks/chunk-VTA6Z45X.js +0 -3
- package/dist/chunks/clip-command-S4JYPD6N.js +0 -3
- package/dist/chunks/colour-PXJ2VKHU.js +0 -3
- package/dist/chunks/execute-7NVA5QSU.js +0 -3
- package/dist/chunks/extensions-VHU2V3B6.js +0 -3
- package/dist/chunks/manager-QOSWVNWL.js +0 -4
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v}from"./chunk-
|
|
3
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v}from"./chunk-WNYM6NSV.js";import"./chunk-TMUK2DD3.js";export{t as BAR,c as DARK,d as LIGHT,g as MODE_KEYS,j as MODE_MARKERS,f as MODE_ORDER,e as NEUTRAL,b as SYMBOLS,a as VERSION,v as applyColourPreference,u as colourEnabled,s as colourProp,n as dotGradient,o as menuPalette,k as modeColours,i as modeForKey,l as modeGradient,p as modePalette,m as modeWash,q as paintsCanvas,r as paletteFor,h as tabStep};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
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,l as h,m as i,n as j,o as k,p as l,q as m,r as n}from"./chunk-
|
|
3
|
+
import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i,n as j,o as k,p as l,q as m,r as n}from"./chunk-QV27SER6.js";import"./chunk-MF3KKEFB.js";import"./chunk-I25E2XDH.js";import"./chunk-HZDYZ5RD.js";import"./chunk-W43SUVWN.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{h as appleDoes,e as chooseHearing,c as helperPaths,d as helpers,b as notesNeed,i as probeSound,l as readRefusal,m as renderPages,n as renderTranscript,k as runRead,j as runTranscribe,a as transcribeNeeds,f as transcribeStatus,g as whisperUseful};
|
|
@@ -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 x,b as W,c as X,d as $,e as Y,g as Z}from"./chunk-
|
|
3
|
+
import{a as x,b as W,c as X,d as $,e as Y,g as Z}from"./chunk-YR7QRQ5F.js";import{c as V}from"./chunk-75GYDNAQ.js";import"./chunk-CZDI37SI.js";import{a as D,b as B,c as H,e as K,f as M,j as S,n as q,o as z,p as G,q as J,r as Q}from"./chunk-QV27SER6.js";import"./chunk-U2XQL7AA.js";import"./chunk-MF3KKEFB.js";import"./chunk-I25E2XDH.js";import"./chunk-LAJAXLGQ.js";import"./chunk-HZDYZ5RD.js";import"./chunk-O7DK3GJT.js";import"./chunk-KQ2AHGLK.js";import"./chunk-EEQSUBBL.js";import"./chunk-W43SUVWN.js";import"./chunk-FAUL5L2W.js";import{a as N,d as j}from"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-TLHUFIXD.js";import"./chunk-4MJEEEFA.js";import{a as T,r as P}from"./chunk-V6GWPR2A.js";import"./chunk-WBW6G4N6.js";import{G as U,a as F,b as I,oa as A,qa as L,ra as y,ta as O,ua as R,va as C,y as g}from"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import{c as v}from"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";import{existsSync as E}from"node:fs";import{stat as ot}from"node:fs/promises";import{basename as l,dirname as tt,extname as w,join as _,resolve as p}from"node:path";function it(t){if(t.format)return t.format;let e=t.output;if(e===void 0||T(e))return"md";let r=w(e).toLowerCase();return N.find(n=>n.ext===r)?.id??"md"}function h(t,e,r,n){let i=`${t}${j(n)}`;return r===void 0?_(e,i):T(r)?_(p(r),i):p(r)}var et=t=>t.split(/\s+/).filter(Boolean).length,at=t=>t.segments.reduce((e,r)=>e+et(r.text),0);async function st(t){let{probe:e}=await import("./registry-7BJ4J2SD.js"),r=await e(t).catch(()=>{throw A(t)});return Y(r)}async function ct(t,e,r,n){if(e.to!==void 0)throw U("--to is for video and sound: a picture or PDF gives its text as it is.",`Try: forge transcribe ${l(t.path)}`);if(!(await S())?.read)throw await G();let o=h(l(t.path,w(t.path)),tt(t.path),e.output,n);if(E(o)&&!e.force)throw g(o);let c=await z(t.path,{language:e.language,signal:r.signal,onEvent:r.onProgress}),a=D(c);if(!B(a))throw O(t.path);await P(o,await J(a,n,l(t.path),{signal:r.signal,lang:e.language}));let s=t.what==="pdf"?`${t.pages} ${t.pages===1?"page":"pages"}`:w(t.path).slice(1).toUpperCase()||"picture";return r.out(`\u2713 ${v(o)} ${s} \u2192 ${et(H(a)).toLocaleString("en-US")} words`),r.finished?.({made:[{from:[t.path],to:[o]}],failed:[]}),0}async function $t(t,e){try{let r=x(t.input);if(r?.kind==="playlist")throw L("This is a playlist.",void 0,{hint:"Pass one video's link.",shellHint:"Paste one video's link."});let n,i,o,c,a=it(t);if(r===void 0){if(n=p(t.input),!(await ot(n).catch(()=>{}))?.isFile())throw I(n);let d=await V(n);if(d!=="video"&&d!=="audio"){let u=await st(n);if(u)return await ct(u,t,e,a)}}let s=await S(t.language?{locale:t.language}:{});if(s===void 0||!s.speech)throw y(K(process.platform,s?.missing));let k=t.notes&&s.notes==="available";if(t.notes&&!k){if(!t.transcript)throw y(M(process.platform,s.notes));s.notes==="off"&&e.err("\u26A0 Apple Intelligence is off, so this is the transcript only.")}if(r===void 0){if(n=p(t.input),i={title:l(n,w(n)),from:l(n)},o=h(i.title,tt(n),t.output,a),E(o)&&!t.force)throw g(o)}else{let m=new AbortController;e.signal?.addEventListener("abort",()=>m.abort(e.signal?.reason),{once:!0});let d;c=await Z(r.url,{signal:m.signal,onEvent:u=>{u.kind==="facts"&&(d=h($(u.facts.title),process.cwd(),t.output,a),E(d)&&!t.force&&m.abort(g(d)))}}),n=c.path,i={title:c.facts.title,from:r.url},o=d??h($(c.facts.title),process.cwd(),t.output,a)}let f;try{f=await q(n,{notes:k,detail:t.detail,locale:t.language,signal:e.signal,onEvent:e.onProgress})}finally{await c?.dispose()}let rt=X(f,i,{transcript:t.transcript});await P(o,await Q(rt,a,{signal:e.signal,lang:f.locale}));let b=f.notes?.parts.length,nt=b===void 0?"":` \xB7 ${b} ${b===1?"part":"parts"}`;return e.out(`\u2713 ${v(o)} ${W(f.seconds)} \u2192 ${at(f).toLocaleString("en-US")} words${nt}`),e.finished?.({made:[{from:[r===void 0?n:i.title],to:[o]}],failed:[]}),0}catch(r){let n=F(r)?r:R(r);for(let o of C(n,{debug:t.debug}))e.err(o);let i=x(t.input)===void 0?p(t.input):"";return e.finished?.({made:[],failed:[{path:i,message:n.message}]}),1}}export{$t as runTranscribeCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{
|
|
3
|
+
import{S as a}from"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";async function d(i,n={}){let e=n.check??(async()=>(await import("./check-B6NP7BEM.js")).checkNow()),s=n.install??(async r=>(await import("./install-MFYGS5TG.js")).installUpdate(r)),t=await e();if(t===void 0)throw a();let{isNewer:o}=await import("./check-B6NP7BEM.js");return o(t,i)?(n.onInstalling?.(t),await s(t),{stdout:[`\u2713 Forge ${t} is installed. It runs from your next forge.`],data:{current:i,latest:t,installed:!0}}):{stdout:[`\u2713 Forge ${i} is the latest.`],data:{current:i,latest:t,installed:!1}}}export{d as runUpdate};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{b as m,c as w,d as h,i as l,j as p,k as b}from"./chunk-SZRSAL64.js";import{c as $,d as g}from"./chunk-
|
|
3
|
+
import{b as m,c as w,d as h,i as l,j as p,k as b}from"./chunk-SZRSAL64.js";import{c as $,d as g}from"./chunk-WNYM6NSV.js";import{e as u}from"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";import{spawn as x}from"node:child_process";var P=60;function v(t,n){let e=Number.parseInt(t.slice(1),16);return`\x1B[${n};2;${e>>16&255};${e>>8&255};${e&255}m`}function C(t,n,e){let i=[" \u2191 ",`Forge ${t} is available`,` \xB7 your version ${n}`],r=[" In terminal: ","forge update"];if(e===void 0)return[i.join(""),r.join("")];let s=v(e.newTagBg,48),o=f=>v(f,38),c="\x1B[1m",a="\x1B[0m",d=f=>" ".repeat(Math.max(0,P-f.join("").length));return[`${s}${o(e.newTag)}${c}${i[0]}${o(e.fg)}${i[1]}${a}${s}${o(e.dim)}${i[2]}${d(i)}${a}`,`${s}${o(e.dim)}${r[0]}${o(e.fg)}${c}${r[1]}${a}${s}${d(r)}${a}`]}async function I(t,n){let e=n.now??Date.now(),{prefs:i}=await u();if(!h(i,n.env??process.env))return[];let r=await l();b(r,e)&&n.refresh();let s=r?.latest;if(r===void 0||s===void 0||!w(s,t))return[];let o=r.notifiedAt;if(o!==void 0&&o<=e&&e-o<=m)return[];await p({...r,notifiedAt:e}).catch(()=>{});let c=n.colour?i.theme==="light"?g:$:void 0;return C(s,t,c)}function N(t,n=process.platform,e=x){if(t!==void 0)try{e(process.execPath,[...process.execArgv,t,"__update-check"],{detached:!0,stdio:"ignore",...n==="win32"?{windowsHide:!0}:{}}).unref()}catch{}}export{I as afterCommand,C as noteLines,N as spawnRefresh};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{c as R,d as k}from"./chunk-
|
|
3
|
+
import{c as R,d as k}from"./chunk-QYAJFKQL.js";import{a as W,d as N}from"./chunk-75GYDNAQ.js";import"./chunk-2HGBB3DQ.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-XY7C5I5T.js";import"./chunk-U2XQL7AA.js";import"./chunk-WBV6I7UP.js";import"./chunk-LAJAXLGQ.js";import{d as w,e as h}from"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import{a as S}from"./chunk-WNYM6NSV.js";import"./chunk-O7DK3GJT.js";import"./chunk-KQ2AHGLK.js";import"./chunk-EEQSUBBL.js";import"./chunk-W43SUVWN.js";import"./chunk-FAUL5L2W.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-TLHUFIXD.js";import"./chunk-4MJEEEFA.js";import"./chunk-V6GWPR2A.js";import"./chunk-WBW6G4N6.js";import{G as L,a as M,b as I,va as E}from"./chunk-ZBMJTIYR.js";import{a as A}from"./chunk-J7FLFHQJ.js";import{c as a}from"./chunk-VLVNA4T3.js";import{a as F}from"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";import{readdir as T,stat as B}from"node:fs/promises";import{join as C,resolve as y}from"node:path";function K(r,t,s,n){return[`\u2713 ${r} converted${n?` to ${n}`:""}`,...t?[`${t} failed`]:[],...s?[`${s} left alone`]:[]].join(" \xB7 ")}var P=r=>{let[t,...s]=r.job.outputs,n=`${a(t??"")}${s.length?` + ${s.length} more`:""}`;return`\u2713 ${a(r.job.sources[0].path)} \u2192 ${n} ${A(r.outputBytes)}`},O=(r,t)=>`\u2715 ${a(r)} ${t.title.toLowerCase()}`,D=r=>`\u2013 ${a(r.path)} ${r.reason}`;async function v(r,t){let s=y(r.folder),n=(e,o)=>t.out(JSON.stringify({forge:S,event:e,...o}));try{let e=await B(s).catch(()=>{});if(!e)throw I(s);if(!e.isDirectory())throw L(`${a(s)} is not a folder.`,`forge watch watches a folder. Try: forge watch ${a(y(s,".."))} --to ${r.target}`)}catch(e){if(!M(e))throw e;if(t.json)n("error",{ok:!1,failures:[h({error:e})]});else for(let o of E(e,{debug:r.debug}))t.out(o);return 2}let m={target:r.target,...r.quality===void 0?{}:{quality:r.quality},dpi:r.dpi??150},$={images:m,pdfs:m,documents:m},c=r.output===void 0?void 0:y(r.output),q=F[r.target].label,p=0,i=[],u=[],b=new Set,g;if(r.newOnly)g=(await T(s,{withFileTypes:!0})).filter(o=>o.isFile()&&!W(o.name)).map(o=>C(s,o.name));else{let e=await N(s);g=e.paths;let o=await R(e,$,{destination:c});b=o.claimed;let f=[...e.failures,...o.outcome.refusals,...o.outcome.failures],j=e.kinds.flatMap(l=>l.why?[{count:l.count,why:l.why}]:[]),J=o.left.length+j.reduce((l,d)=>l+d.count,0);if(p+=o.outcome.results.length,i.push(...f),u.push(...o.left),t.json)n("converted-existing",{ok:f.length===0,results:o.outcome.results.map(w),failures:f.map(h),leftAlone:o.left});else if(e.paths.length>0){t.out(K(o.outcome.results.length,f.length,J,q));for(let l of f)t.out(O(l.path,l.error))}for(let l of j)for(let d=0;d<l.count;d++)u.push({path:"",reason:l.why})}t.json?n("watching",{folder:s,...c?{output:c}:{}}):t.out(`Watching ${a(s)} \xB7 any new files you add will be converted \xB7 ctrl-c to stop`);let x=k({dir:s,answers:$,known:g,claimed:b,destination:c,...t.settleMs===void 0?{}:{settleMs:t.settleMs},...t.pollMs===void 0?{}:{pollMs:t.pollMs},onEvent:e=>{e.type==="converted"?(p++,t.json?n("converted",{result:w(e.result)}):t.out(P(e.result))):e.type==="failed"?(i.push({path:e.path,error:e.error}),t.json?n("failed",{failure:h({path:e.path,error:e.error})}):t.out(O(e.path,e.error))):e.type==="left"&&(u.push({path:e.path,reason:e.reason}),t.json?n("left-alone",{path:e.path,reason:e.reason}):t.out(D({path:e.path,reason:e.reason})))}});return await new Promise(e=>{t.signal.aborted?e():t.signal.addEventListener("abort",()=>e(),{once:!0})}),await x.stop(),t.json?n("stopped",{converted:p,failed:i.length,leftAlone:u.length}):t.out(K(p,i.length,u.length)),i.length>0?1:0}export{v as runWatch};
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
3
3
|
const require = __forgeCreateRequire(import.meta.url);
|
|
4
|
-
import{e as x,f as S}from"./chunks/chunk-
|
|
4
|
+
import{e as x,f as S}from"./chunks/chunk-2BPH3IL6.js";import{b as g,d as C}from"./chunks/chunk-IBPGC4N2.js";import"./chunks/chunk-WBV6I7UP.js";import"./chunks/chunk-LAJAXLGQ.js";import"./chunks/chunk-HZDYZ5RD.js";import"./chunks/chunk-N32JL4UI.js";import{g as b}from"./chunks/chunk-YJ6XLDRA.js";import"./chunks/chunk-63XCSYHM.js";import{a as p}from"./chunks/chunk-WNYM6NSV.js";import{b as E}from"./chunks/chunk-O7DK3GJT.js";import"./chunks/chunk-KQ2AHGLK.js";import"./chunks/chunk-EEQSUBBL.js";import"./chunks/chunk-W43SUVWN.js";import"./chunks/chunk-FAUL5L2W.js";import"./chunks/chunk-HTA25PO2.js";import"./chunks/chunk-N6RCLJE6.js";import"./chunks/chunk-WE6KP4FR.js";import"./chunks/chunk-KH5DHZ2U.js";import"./chunks/chunk-HON4OV7M.js";import"./chunks/chunk-TLHUFIXD.js";import"./chunks/chunk-4MJEEEFA.js";import"./chunks/chunk-V6GWPR2A.js";import"./chunks/chunk-WBW6G4N6.js";import{G as $,a as w,ua as k,va as m}from"./chunks/chunk-ZBMJTIYR.js";import"./chunks/chunk-J7FLFHQJ.js";import"./chunks/chunk-VLVNA4T3.js";import"./chunks/chunk-H3DIRJFE.js";import"./chunks/chunk-KXKQDFHX.js";import"./chunks/chunk-TMUK2DD3.js";import*as j from"node:module";function v(e){return w(e)?e:k(e)}function T(e,n){return m(v(e),{debug:n})}function F(e,n){process.once("beforeExit",()=>{e()||(n(new Error("Forge stopped before it finished: it was waiting for input that never came.")),process.exitCode=1)})}E();j.enableCompileCache?.();function M({completed:e,total:n}){e===0?process.stderr.write(`Converting ${n} files
|
|
5
5
|
`):process.stderr.write(` ${e}/${n}
|
|
6
|
-
`)}async function D(){let e=process.argv.slice(2),n=e.includes("--debug"),d=x(e);try{if(e[0]==="__update-check"){let{checkNow:r}=await import("./chunks/check-B6NP7BEM.js");await r();return}if(e[0]==="menu"){let{openedForClick:r,parseMenuArgs:t}=await import("./chunks/command-
|
|
6
|
+
`)}async function D(){let e=process.argv.slice(2),n=e.includes("--debug"),d=x(e);try{if(e[0]==="__update-check"){let{checkNow:r}=await import("./chunks/check-B6NP7BEM.js");await r();return}if(e[0]==="menu"){let{openedForClick:r,parseMenuArgs:t}=await import("./chunks/command-GAGAD65W.js"),s=t(e.slice(1));if(s.kind==="open"){let{applyColourPreference:h}=await import("./chunks/theme-S234JXQH.js");h();let{bootShell:I}=await import("./chunks/boot-5KSVFF4C.js");await I(void 0,{opened:await r(s.action,s.paths)});return}let{runMenuCommand:c}=await import("./chunks/entry-64GTSHV2.js");process.exitCode=await c(s,p);return}if(e[0]==="mcp"){let{runMcpServer:r}=await import("./chunks/server-64H64DIC.js");await r(e.slice(1));return}let o=S(e);if(o.kind==="shell"){if(d)throw $("No files given.","Name a file, for example: forge photo.jpg --to webp --json");if(!process.stdout.isTTY||!process.stdin.isTTY){process.stderr.write(`Forge needs a file and a target format.
|
|
7
7
|
Try: forge photo.jpg --to webp
|
|
8
|
-
`),process.exitCode=2;return}let{applyColourPreference:r}=await import("./chunks/theme-
|
|
9
|
-
`),json:d,signal:t.signal});return}if(o.kind==="uninstall"){let{runUninstall:r}=await import("./chunks/entry-
|
|
10
|
-
`));return}let{execute:l}=await import("./chunks/execute-
|
|
8
|
+
`),process.exitCode=2;return}let{applyColourPreference:r}=await import("./chunks/theme-S234JXQH.js");r();let{bootShell:t}=await import("./chunks/boot-5KSVFF4C.js");await t(void 0,{menuNote:async()=>(await import("./chunks/entry-64GTSHV2.js")).menuAtStart(p)});return}if(o.kind==="watch"){let{runWatch:r}=await import("./chunks/watch-command-B2Z4KSWR.js"),t=new AbortController;process.once("SIGINT",()=>t.abort()),process.exitCode=await r(o,{out:s=>process.stdout.write(`${s}
|
|
9
|
+
`),json:d,signal:t.signal});return}if(o.kind==="uninstall"){let{runUninstall:r}=await import("./chunks/entry-64GTSHV2.js");process.exitCode=await r(p,t=>process.stdout.write(`${t}
|
|
10
|
+
`));return}let{execute:l}=await import("./chunks/execute-3J755YKG.js"),i,y=0,A=(r,t)=>{let s=Date.now();if(r<t&&s-y<100)return;y=s;let c=h=>(h/1e6).toFixed(1);process.stderr.write(`\r downloading ${c(r)} / ${c(t)} MB${r>=t?`
|
|
11
11
|
`:""}`)},u=!!process.stderr.isTTY&&!d,f=new AbortController;o.kind==="extension-op"&&process.once("SIGINT",()=>f.abort());let B=Date.now(),a=await l(o,{json:d,...u?{onInstalling:r=>{i=g(process.stderr,`installing Forge ${r}`)}}:{},signal:f.signal,...u?{onDownload:A}:{},colour:!!process.stdout.isTTY&&!d&&C(),onProgress:u?r=>{r.completed>0&&i?.stop(),M(r)}:void 0,...u?{onSearch:r=>{i??=g(process.stderr,"finding the smallest that fits"),i.update(r)},onEncode:r=>{i??=g(process.stderr,"encoding"),i.update(r)}}:{}});if(i?.stop(),a.stdout.length>0&&process.stdout.write(`${a.stdout.join(`
|
|
12
12
|
`)}
|
|
13
13
|
`),a.stderr.length>0&&process.stderr.write(`${a.stderr.join(`
|
|
14
14
|
`)}
|
|
15
|
-
`),process.exitCode=f.signal.aborted?130:a.exitCode,u&&a.notice&&!f.signal.aborted){let{postFinishNotice:r}=await import("./chunks/notify-NQNNOBFC.js");await r(a.notice,Date.now()-B)}if(u&&process.stdout.isTTY&&o.kind!=="update")try{let{afterCommand:r,spawnRefresh:t}=await import("./chunks/update-note-
|
|
15
|
+
`),process.exitCode=f.signal.aborted?130:a.exitCode,u&&a.notice&&!f.signal.aborted){let{postFinishNotice:r}=await import("./chunks/notify-NQNNOBFC.js");await r(a.notice,Date.now()-B)}if(u&&process.stdout.isTTY&&o.kind!=="update")try{let{afterCommand:r,spawnRefresh:t}=await import("./chunks/update-note-YQD2W5B2.js"),{runningScript:s}=await import("./chunks/install-MFYGS5TG.js"),c=await r(p,{refresh:()=>t(s(process.argv[1])),colour:C()});c.length>0&&process.stderr.write(`
|
|
16
16
|
${c.join(`
|
|
17
17
|
`)}
|
|
18
18
|
`)}catch{}}catch(o){if(w(o)){d?process.stdout.write(`${JSON.stringify(b(p,o))}
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forge-terminal",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "A terminal-native file converter for macOS, Windows and Linux",
|
|
5
5
|
"whatsNew": [
|
|
6
6
|
{
|
|
7
|
-
"title": "
|
|
8
|
-
"text": "
|
|
7
|
+
"title": "Colour cards for Figma",
|
|
8
|
+
"text": "forge card turns a palette file (design tokens, CSV, CSS or one colour a line) into a card of swatches. Paste it into Figma and each colour is its own layer, named as written."
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"title": "Agents can draw cards",
|
|
12
|
+
"text": "Forge's MCP server has forge_card, so an AI agent can turn a colour system it wrote into the same card for you to paste."
|
|
9
13
|
}
|
|
10
14
|
],
|
|
11
15
|
"keywords": [
|
|
@@ -1,3 +0,0 @@
|
|
|
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-YURNOHEF.js";import"./chunk-U5TEGDGH.js";import"./chunk-PLBLOIQI.js";import"./chunk-WE5MOCUL.js";import"./chunk-HZDYZ5RD.js";import"./chunk-QVACE4IE.js";import"./chunk-MBZRADAZ.js";import"./chunk-7WZYTDFI.js";import"./chunk-EEQSUBBL.js";import"./chunk-7UMELAOL.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 +0,0 @@
|
|
|
1
|
-
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
-
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as t}from"./chunk-63XCSYHM.js";import{resolve as s}from"node:path";function c(r,e){return{forge:r,ok:!0,palette:e,failures:[]}}function f(r,e){return{forge:r,ok:!0,scale:e,failures:[]}}function a(r){let e=t(r),n=e.sources.map(o=>s(o.path));return{op:r.job.op,source:n[0]??"",sources:n,outputs:e.outputs.map(o=>s(o)),inputBytes:e.sources.reduce((o,u)=>o+u.bytes,0),outputBytes:e.outputBytes,warnings:e.warnings.map(o=>({code:o.code,message:o.message}))}}function i(r){let{error:e}=r;return{...r.path?{path:s(r.path)}:{},code:e.code,title:e.title,detail:e.detail,...e.hint===void 0?{}:{hint:e.hint}}}function l(r,e){return{forge:r,ok:e.failures.length===0,results:e.results.map(a),failures:e.failures.map(i)}}function J(r,e){return l(r,{results:[],failures:[{error:e}]})}function m(r,e){return{forge:r,ok:!0,formats:e,failures:[]}}function b(r,e){return{forge:r,ok:e.failures.length===0,probes:e.probes,failures:e.failures.map(i)}}function x(r,e,n){return{forge:r,ok:!0,config:e,warnings:n.map(o=>({code:o.code,message:o.message})),failures:[]}}function d(r,e){return{forge:r,ok:!0,extensions:e.extensions,...e.changed?{changed:e.changed}:{},failures:[]}}export{c as a,f as b,a as c,i as d,l as e,J as f,m as g,b as h,x as i,d as j};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
-
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{c as ne,g as at,h as ct}from"./chunk-EEQSUBBL.js";import{c as le,d as ft,f as ge,g as dt,k as pt}from"./chunk-7UMELAOL.js";import{b as st,c as it}from"./chunk-IE6NFN3N.js";import{b as Ue,c as ze,d as qe,f as He,m as tt,n as ot,o as nt,t as rt}from"./chunk-TFOEI5VF.js";import{n as Ge,o as Ve,q as Ke,r as R}from"./chunk-BIBDLXCG.js";import{E as Te,F as V,G as me,I as Ne,M as Le,V as Je,a as B,aa as te,ha as We,ia as Ce,ka as J,r as Be,t as j,v as ee}from"./chunk-CVNYUROW.js";import{a as Ae}from"./chunk-J7FLFHQJ.js";import{c as A}from"./chunk-VLVNA4T3.js";import{a as S}from"./chunk-H3DIRJFE.js";import{a as Ye,b as oe,c as M,e as Ze,f as Qe,g as Xe,h as je,i as et}from"./chunk-KXKQDFHX.js";import{mkdtemp as Jt,rm as Wt}from"node:fs/promises";import{tmpdir as Ct}from"node:os";import{join as re}from"node:path";var mt=(e,t,o)=>He(e,t,o)===void 0;function ut(e,t,o=Number.POSITIVE_INFINITY,n=[2,4]){return[...n].reverse().find(s=>s<o&&mt(e,t,s))??0}async function Ut(e,t,o){if(e.op!=="boost"&&e.op!=="remove-background")throw new Error(`the extension engine cannot ${e.op}`);if(o?.aborted)throw o.reason??new Error("aborted");let n=e.sources[0],s=e.outputs[0],r=e.op,{assetFor:i,catalogEntry:a,offeredHere:f}=await import("./catalog-FMHWWMUX.js");if(!f(r,process.platform,process.arch))throw Le(a(r)?.title??r);let{installed:d,extensionsRoot:u}=await import("./paths-6OENILJ4.js"),h=await d(r);if(!h)throw Ne(r);let l=ze(h.version);if(e.op==="boost"){let v=a(r),x=qe(e.scale,h.version,v&&i(v)?.version);if(x)throw x}if(e.op==="boost"&&!mt(n.width,n.height,e.scale))throw Je(n.path,ut(n.width,n.height,Number.POSITIVE_INFINITY,l),e.scale);let{runExtension:w}=await import("./run-WSETTQXP.js"),g=[];n.frames>1&&g.push({code:"animation-flattened",message:`${A(n.path)} has ${n.frames} frames. Only the first frame was used.`});let I=await Jt(re(Ct(),"forge-ext-"));try{t({phase:"decoding"});let v=re(I,"in.png"),x=re(I,"out.png");await nt(n,v);let $=e.op==="boost"?["--in",v,"--out",x,"--scale",String(e.scale),"--cache",re(u(),"boost","cache")]:[v,x],p=e.op==="boost"&&Ue(h.version);await w({...h,serve:p},$,{subject:n.path,what:`${zt(e)} is running on ${A(n.path)}`,onWait:()=>t({phase:"waiting"}),onStart:()=>t({phase:"encoding"}),onProgress:(O,P)=>t({phase:"tiles",done:O,total:P}),...e.op==="boost"?{maxScale:ut(n.width,n.height,e.scale,l)}:{},...o===void 0?{}:{signal:o}});let y=(await oe())(x);S[e.target].hasAlpha||(y=y.flatten({background:e.options.background}));let F=await tt(y,e.target,e.options.quality).toBuffer();t({phase:"writing"});let b=await ot(F,s);return{job:e,outputBytes:b,warnings:g}}catch(v){throw B(v)?v:J(n.path,v)}finally{await Wt(I,{recursive:!0,force:!0}).catch(()=>{})}}function zt(e){return e.op!=="boost"?"Remove background":e.scale===1?"Sharpen":`Boost resolution ${e.scale}\xD7`}var lt={id:"extension",reads:new Set,writes:new Set,ops:new Set(["boost","remove-background"]),probe:()=>Promise.reject(new Error("the extension engine reads no files")),run:Ut};import{randomBytes as mo}from"node:crypto";import{rm as lo,stat as se}from"node:fs/promises";import{dirname as go,join as ho}from"node:path";import{open as qt}from"node:fs/promises";async function W(e,t){let o=await qt(e,"r");try{let n=Buffer.alloc(t),{bytesRead:s}=await o.read(n,0,t,0);return n.subarray(0,s)}finally{await o.close()}}var he="%NOISE_FLOOR%",Ht=["highpass=f=80",`afftdn=nr=12:nf=${he}`],Gt="highpass=f=80,astats=measure_perchannel=none:measure_overall=RMS_trough";function vt(e){let t=/RMS trough dB:\s*(-?[\d.]+|-?inf)/i.exec(e)?.[1],o=t===void 0?Number.NaN:Number(t);return Number.isFinite(o)?Math.min(-30,Math.max(-70,Math.round(o+8))):-50}var we="%LOUDNORM_MEASURED%",Vt={mp4:"mp4",hevc:"mp4",mov:"mov",webm:"webm",mkv:"matroska",avi:"avi",gif:"gif",mp3:"mp3",m4a:"ipod",opus:"opus",flac:"flac",wav:"wav",aiff:"aiff",ogg:"ogg"},Kt={mp4:["h264","hevc","mpeg4","av1"],mov:["h264","hevc","mpeg4","prores","av1"],mkv:["h264","hevc","mpeg4","vp8","vp9","av1"],hevc:["hevc"],webm:["vp8","vp9","av1"],avi:["mpeg4","h264","mjpeg","msmpeg4v3"]},Yt={mp4:["aac","alac","mp3"],hevc:["aac","alac","mp3"],mov:["aac","alac","mp3","pcm_s16le","pcm_s16be","pcm_s24le"],m4a:["aac","alac"],mkv:["aac","mp3","opus","vorbis","flac","ac3","eac3"],webm:["opus","vorbis"],opus:["opus"],mp3:["mp3"],flac:["flac"],wav:["pcm_s16le"],aiff:["pcm_s16be"],ogg:["vorbis","opus","flac"],avi:["mp3","ac3","aac","pcm_s16le"]},gt=[48e3,24e3,16e3,12e3,8e3];function Zt(e,t,o){let n={encoder:"opus",kbps:96,args:["-strict","-2"],rates:[48e3]};switch(e){case"webm":return o("libopus")?{encoder:"libopus",kbps:96,rates:gt}:o("libvorbis")?{encoder:"libvorbis",kbps:128}:o("opus")?n:{codec:"Opus or Vorbis",encoders:["libopus","libvorbis","opus"],sound:!0};case"opus":return o("libopus")?{encoder:"libopus",kbps:96,rates:gt}:o("opus")?n:{codec:"Opus",encoders:["libopus","opus"]};case"mp3":return o("libmp3lame")?{encoder:"libmp3lame",kbps:128}:{codec:"MP3",encoders:["libmp3lame"]};case"flac":return{encoder:"flac"};case"wav":return{encoder:"pcm_s16le"};case"aiff":return{encoder:"pcm_s16be"};case"ogg":return o("libvorbis")?{encoder:"libvorbis",kbps:128}:{encoder:"vorbis",kbps:128,args:["-strict","-2","-ac","2"]};default:return{encoder:t==="darwin"&&o("aac_at")?"aac_at":"aac",kbps:128}}}var K=e=>Math.max(2,Math.floor(e/2)*2),Qt=e=>String(Math.round(e*1e3)/1e3),Xt=e=>String(Math.ceil(e*1e3)/1e3),jt=e=>Math.round(38-(e-1)*20/99),eo=e=>Math.round(50-(e-1)*30/99),to=e=>Math.round(40-(e-1)*18/99),ht=e=>Math.round(20+e*60/100),oo=e=>Math.round(31-(e-1)*29/99);function no(e,t){let o=.15*2**((18-e)/6);return Math.max(64,Math.round(t*o/1e3))}function ro(e,t,o,n,s){let r=e.width,i=e.height;if(o)r=o.width,i=o.height;else{t.crop?.box&&(r=t.crop.box.width,i=t.crop.box.height);let a=t.resize;if(a&&"width"in a){let f=Math.min(a.width,r)/r;r*=f,i*=f}else if(a&&"height"in a){let f=Math.min(a.height,i)/i;r*=f,i*=f}else a&&(r*=a.percent/100,i*=a.percent/100)}return r*i*(n??e.fps*s)}var so="zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p";function wt(e){let t=[],o=e;for(;o>2;)t.push("atempo=2"),o/=2;for(;o<.5;)t.push("atempo=0.5"),o/=.5;return t.push(`atempo=${Math.round(o*1e3)/1e3}`),t}var io=800,ao=15,bt=32;function be(e){let{facts:t,options:o,target:n,platform:s}=e,r=o.media??{},i=t.video,a=t.audio,f=S[n].media==="sound",d=n==="gif",u=o.compress!==void 0,h=s==="darwin",l=c=>e.has===void 0||e.has.has(c),w=c=>Ce(n,c,e.os??s),g=r.cut?.start??0,I=Math.min(r.cut?.end??t.duration,t.duration),v=Math.max(0,I-g),x=r.speed??1,$=v/x,p=i!==void 0&&!f,E=a!==void 0&&!r.mute&&!d,y,F,b,O;if(r.targetBytes!==void 0&&$>0){if(p&&i){let c=at({duration:$,width:i.width,height:i.height,fps:i.fps,hasAudio:E,targetBytes:r.targetBytes});"videoKbps"in c&&(y={width:c.width,height:c.height,fps:c.fps},b=c.videoKbps,F=c.audioKbps)}else if(E){let c=Math.floor(r.targetBytes*8/$/1e3*.98);O=Math.max(bt,Math.min(320,c))}}let P=[];if(p&&i){if(i.hdr&&n!=="hevc"&&l("zscale")&&P.push(so),o.crop?.box){let c=o.crop.box;P.push(`crop=${K(c.width)}:${K(c.height)}:${c.left}:${c.top}`)}if(y)P.push(`scale=${y.width}:${y.height}`);else if(o.resize){let c=o.resize;"width"in c?P.push(`scale=trunc(min(${K(c.width)}\\,iw)/2)*2:-2`):"height"in c?P.push(`scale=-2:trunc(min(${K(c.height)}\\,ih)/2)*2`):P.push(`scale=trunc(iw*${c.percent/100}/2)*2:-2`)}if(o.rotate&&P.push(o.rotate===90?"transpose=1":o.rotate===270?"transpose=2":"hflip,vflip"),x!==1&&P.push(`setpts=PTS/${x}`),d){let c=Math.min(io,K(i.width));P.push(`fps=${Math.min(ao,i.fps)},scale=${c}:-2:flags=lanczos,split[s0][s1];[s0]palettegen=stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=4`)}}let Q=y?.fps??r.fps,Re=p&&i!==void 0&&P.length===0&&Q===void 0&&!u&&r.targetBytes===void 0&&(Kt[n]??[]).includes(i.codec),m=[],fe=!1;if(!p)m.push("-vn");else if(Re)m.push("-c:v","copy");else{if(P.length&&m.push("-vf",P.join(",")),d)m.push("-c:v","gif","-loop","0");else if(n==="webm"){if(!l("libvpx-vp9"))throw w({codec:"VP9",encoders:["libvpx-vp9"]});if(fe=b!==void 0,m.push("-c:v","libvpx-vp9","-row-mt","1","-deadline","good","-cpu-used","4"),i?.codec==="gif"&&m.push("-pix_fmt","yuva420p"),b!==void 0)m.push("-b:v",`${b}k`);else{let c=u?eo(o.quality??60):33;m.push("-crf",String(c),"-b:v","0")}}else if(n==="hevc"){let c=l("libx265"),k=h&&l("hevc_videotoolbox");if(!c&&!k)throw w({codec:"HEVC",encoders:["libx265",...h?["hevc_videotoolbox"]:[]]});if(b!==void 0)c?m.push("-c:v","libx265","-preset","fast","-b:v",`${b}k`):m.push("-c:v","hevc_videotoolbox","-b:v",`${b}k`);else if(k&&(!u||!c)){let D=u?ht(o.quality??60):60;m.push("-c:v","hevc_videotoolbox","-q:v",String(D))}else{let D=u?to(o.quality??60):26;m.push("-c:v","libx265","-crf",String(D),"-preset","fast")}m.push("-tag:v","hvc1","-pix_fmt",i?.hdr?"p010le":"yuv420p")}else{let c=u?jt(o.quality??60):21,k=()=>`${b??no(c,i?ro(i,o,y,Q,x):0)}k`;if(b===void 0&&!u&&h&&l("h264_videotoolbox"))m.push("-c:v","h264_videotoolbox","-q:v","65");else if(l("libx264"))fe=b!==void 0,b!==void 0?m.push("-c:v","libx264","-preset","medium","-b:v",`${b}k`):u?m.push("-c:v","libx264","-preset","medium","-crf",String(c)):m.push("-c:v","libx264","-preset","veryfast","-crf","21");else if(h&&l("h264_videotoolbox"))b!==void 0?m.push("-c:v","h264_videotoolbox","-b:v",k()):m.push("-c:v","h264_videotoolbox","-q:v",String(ht(o.quality??60)));else if(l("libopenh264"))m.push("-c:v","libopenh264","-b:v",k());else if(s==="win32"&&l("h264_mf"))m.push("-c:v","h264_mf","-b:v",k());else if(n==="avi")if(b!==void 0)m.push("-c:v","mpeg4","-b:v",`${b}k`);else{let D=u?oo(o.quality??60):3;m.push("-c:v","mpeg4","-q:v",String(D))}else throw w({codec:"H.264",encoders:["libx264",...h?["h264_videotoolbox"]:[],"libopenh264",...s==="win32"?["h264_mf"]:[]]});m.push("-pix_fmt","yuv420p")}Q!==void 0?m.push("-r",String(Q)):n==="avi"?m.push("-fps_mode","cfr"):d||m.push("-fps_mode","passthrough")}let $e=r.cleanup?[...Ht]:[],X=[...$e,...x!==1?wt(x):[]],N=r.loudness;N!==void 0&&X.push(`loudnorm=I=${N}:TP=-1.5:LRA=11:${we}:linear=true`);let _e=r.bitrate??F??O,ke=E&&a!==void 0&&X.length===0&&_e===void 0&&!(u&&f)&&(Yt[n]??[]).includes(a.codec),_=[];if(!E)_.push("-an");else if(ke)_.push("-c:a","copy");else{X.length&&_.push("-af",X.join(","));let c=Zt(n,s,l);if("codec"in c)throw w(c);_.push("-c:a",c.encoder);let k=_e??c.kbps;if(k!==void 0&&c.kbps!==void 0&&_.push("-b:a",`${k}k`),c.args&&_.push(...c.args),!c.args?.includes("-ac")&&F!==void 0&&F<=bt&&_.push("-ac","1"),N!==void 0&&a){let D=!c.rates||c.rates.includes(a.sampleRate);_.push("-ar",String(D?a.sampleRate:c.rates?.[0]))}}let de=[];g>0&&de.push("-ss",Xt(g)),r.cut&&de.push("-t",Qt(v));let H=[...de,"-i",e.input],G=[],pe=[...p?["-map","0:v:0"]:[],...E?["-map","0:a:0"]:[]],Me=o.keepMetadata?[]:["-map_metadata","-1"],Lt=Vt[n]??n,Oe=["mp4","hevc","mov","m4a"].includes(n)?["-movflags","+faststart"]:[],De=["-f",Lt,"-y",e.output],ue=s==="win32"?"NUL":"/dev/null",L=[];return r.cleanup&&L.push({args:[...H,...G,"-vn","-af",Gt,"-f","null",ue],measures:"noise"}),N!==void 0&&L.push({args:[...H,...G,"-vn","-af",`${[...$e,...x!==1?wt(x):[]].map(c=>`${c},`).join("")}loudnorm=I=${N}:TP=-1.5:LRA=11:print_format=json`,"-f","null",ue],measures:"loudness",pass:{at:1,of:2}}),fe?(L.push({args:[...H,...G,...pe.slice(0,2),...m,"-pass","1","-passlogfile",e.passlog,"-an","-f","null",ue],pass:{at:1,of:2}}),L.push({args:[...H,...G,...pe,...m,"-pass","2","-passlogfile",e.passlog,..._,...Me,...Oe,...De],pass:{at:2,of:2}})):L.push({args:[...H,...G,...pe,...m,..._,...Me,...Oe,...De],...N!==void 0?{pass:{at:2,of:2}}:{}}),{steps:L,duration:$,copies:{video:Re,audio:ke},...y?{fitted:y}:{}}}var C=(e,t,o)=>e.subarray(t,t+o).toString("latin1"),co=new Set(["heic","heix","hevc","hevx","heim","heis","mif1","msf1","avif","avis","crx "]),fo=new Set(["M4A ","M4B ","M4P ","F4A ","F4B "]);function po(e){let t=C(e,8,4);if(!co.has(t))return t==="qt "?"mov":fo.has(t)?"m4a":"mp4"}function yt(e){if(e.length<4)return;if(C(e,4,4)==="ftyp")return po(e);if(e[0]===26&&e[1]===69&&e[2]===223&&e[3]===163)return e.includes("webm",0,"latin1")?"webm":"mkv";let t=C(e,0,4);if(t==="RIFF"){let o=C(e,8,4);return o==="WAVE"?"wav":o==="AVI "?"avi":void 0}if(t==="FORM"){let o=C(e,8,4);return o==="AIFF"||o==="AIFC"?"aiff":void 0}if(t==="fLaC")return"flac";if(t==="OggS")return e.includes("OpusHead",0,"latin1")?"opus":"ogg";if(C(e,0,3)==="ID3"||e[0]===255&&((e[1]??0)&224)===224&&((e[1]??0)&6)===2)return"mp3"}var wo=["mp4","mov","webm","mkv","avi","gif"],Pt=["mp4","mov","hevc","webm","mkv","avi","gif","mp3","m4a","wav"],bo=["mp3","m4a","wav","aiff","flac","opus","ogg"],vo=["mp3","m4a","opus","flac","aiff","wav"];function yo(e){return W(e,64)}function xo(e,t){return t&&!t.video&&(e==="mp4"||e==="mov")?"m4a":e}async function Et(e,t){let o=yt(await yo(e));if(!o)throw new Error("not video or sound");if(o!=="mp4"&&o!=="mov"&&S[o].media!==t)throw new Error(`not ${t}`);let n=(await se(e)).size,s=await le(),r;if(s){try{r=await ge(e,s)}catch(a){throw j(e,a)}if(r.duration<=0||!r.video&&!r.audio)throw j(e,r)}let i=xo(o,r);if(S[i].media!==t)throw new Error(`not ${t}`);return{kind:"media",path:e,format:i,bytes:n,...r?{facts:r}:{}}}async function Po(){let{assetFor:e,catalogEntry:t}=await import("./catalog-FMHWWMUX.js"),o=t("video");return o!==void 0&&e(o)!==void 0}async function Eo(e,t){if(e.kind==="media"&&e.facts)return e.facts;try{return await ge(e.path,t)}catch(o){throw j(e.path,o)}}function Fo(e,t){let o=e.options.media??{},n=o.cut?.start??0,s=Math.min(o.cut?.end??t,t);return Math.max(0,s-n)/(o.speed??1)}function Ft(e,t){if(e.op!=="convert")return;let o=e.sources[0],n=o.kind==="media"?o.facts:void 0;if(!n)return;let s=e.options.media??{},r=ct({...n,duration:Fo(e,n.duration)},{soundOnly:S[e.target].media==="sound",mute:s.mute===!0||e.target==="gif"});return t<r?{floor:r}:void 0}function So(e){let t=e.slice(e.lastIndexOf("{"),e.lastIndexOf("}")+1),o=JSON.parse(t);return[`measured_I=${o.input_i}`,`measured_TP=${o.input_tp}`,`measured_LRA=${o.input_lra}`,`measured_thresh=${o.input_thresh}`,`offset=${o.target_offset}`].join(":")}async function xt(e){await Promise.all(e.map(t=>lo(t,{force:!0}).catch(()=>{})))}async function St(e,t,o){if(e.op!=="convert")throw new Error(`media engines only convert, not ${e.op}`);if(o?.aborted)throw o.reason??new Error("aborted");let n=e.sources[0],s=e.outputs[0],r=await le();if(!r)throw We(n.path,process.platform,await Po());let i=await Eo(n,r),a=mo(6).toString("hex"),f=Ge(s,a),d=ho(go(s),`.forge-pass-${a}`),u=[f,`${d}-0.log`,`${d}-0.log.temp`,`${d}-0.log.mbtree`,`${d}-0.log.mbtree.temp`],h=[],l=(p,E=e.options)=>be({input:n.path,output:f,target:e.target,facts:i,options:E,platform:p,os:process.platform,passlog:d,...r.has?{has:r.has}:{}}),w=e.options,g=l(process.platform);if(g.duration<=0)throw Te(`The cut keeps nothing of ${A(n.path)}: it starts at or after its end.`,`It is ${ne(i.duration)} long.`);await Ve(s);let I=process.platform,v=w.media?.cut;if(g.copies.video&&v&&v.start>0){let p=await dt(n.path,v.start,r);p!==void 0&&v.start-p>.05&&(w={...w,media:{...w.media,cut:{...v,start:p}}},g=l(process.platform,w),h.push({code:"media-cut-keyframe",message:`It starts at ${ne(p)}, the keyframe just before ${ne(v.start)}.`}))}let x=async p=>{let E="",y="";for(let F of p.steps){let b=F.args.map(P=>P.replace(we,E).replace(he,y)),O=await pt(b,{tools:r,signal:o,report:F.measures!==void 0,onTime:P=>t({phase:"time",done:Math.min(P,p.duration),total:p.duration,...F.pass?{pass:F.pass}:{}})});F.measures==="loudness"&&(E=So(O)),F.measures==="noise"&&(y=String(vt(O)))}};try{try{await x(g)}catch(y){if(o?.aborted||!g.steps.some(F=>F.args.some(b=>b.endsWith("_videotoolbox"))))throw y;I="linux",g=l(I,w),await x(g)}let p=w.media?.targetBytes;for(let y of[.95,.9]){if(p===void 0||(await se(f)).size<=p)break;w={...w,media:{...w.media,targetBytes:Math.floor(p*y)}},g=l(I,w),await x(g)}let E=(await se(f)).size;if(p!==void 0&&E>p)throw Be(n,e.options.media?.targetBytes??p,E);if(e.options.compress!==void 0&&E>=n.bytes)throw te(n.path,n.bytes,E);await Ke(f,s)}catch(p){throw await xt(u),o?.aborted||B(p)?p:J(n.path,p)}await xt(u.slice(1));let $=i.video;if(g.fitted&&$&&(g.fitted.width<$.width-2||g.fitted.fps<$.fps)){let p=Ae(e.options.media?.targetBytes??0);h.push({code:"media-fitted",message:`To fit ${p} it is now ${g.fitted.width}\xD7${g.fitted.height} at ${g.fitted.fps} fps.`})}return{job:e,outputBytes:(await se(s)).size,warnings:h}}function Zn(e,t){if(e.kind!=="media"||!e.facts)return;let o=ft()?.has;if(o)try{be({input:e.path,output:e.path,target:t,facts:e.facts,options:{background:"#ffffff",keepMetadata:!1},platform:process.platform,passlog:"",has:o});return}catch(n){return B(n)&&n.code==="encoder-missing"?n:void 0}}var Y=e=>new Set(e);function Io(e){let t=e.kind==="media"?e.facts:void 0,o=e.kind==="image"||t!==void 0&&t.audio===void 0;return Y(Pt.filter(n=>!(o&&S[n].media==="sound"||n==="hevc"&&t?.video?.codec==="hevc")))}var It={id:"video",reads:Y(wo),writes:Y(Pt),ops:new Set(["convert"]),probe:e=>Et(e,"video"),alone:!0,run:St,sizeTo:Ft,writesFor:Io},Rt={id:"sound",reads:Y(bo),writes:Y(vo),ops:new Set(["convert"]),probe:e=>Et(e,"sound"),alone:!0,run:St,sizeTo:Ft};import{readFile as ie,rm as Mt,stat as Ro}from"node:fs/promises";function jn(e,t){let o=e.split(",").map(r=>r.trim()).filter(r=>r!=="");if(o.length===0)throw V(e,"That selects no pages.",t);let n=new Set,s=(r,i)=>{if(!Number.isInteger(r)||r<1||r>t)throw V(i,`"${i}" is outside 1 and ${t}.`,t);return r};for(let r of o){let i=r.match(/^(\d+)\s*-\s*(\d*)$/);if(i?.[1]!==void 0){let a=s(Number(i[1]),r),f=i[2]===""?t:s(Number(i[2]),r);if(f<a)throw V(r,`"${r}" ends before it starts.`,t);for(let d=a;d<=f;d++)n.add(d-1);continue}if(!/^\d+$/.test(r))throw V(r,`"${r}" is not a page number.`,t);n.add(s(Number(r),r)-1)}return[...n].sort((r,i)=>r-i)}function $t(e){return[...new Set(e)].sort((t,o)=>t-o)}function er(e){if(e.length===0)return"";let t=[...new Set(e)].sort((r,i)=>r-i),o=[],n=t[0],s=n;for(let r of t.slice(1)){if(r===s+1){s=r;continue}o.push(n===s?`${n+1}`:`${n+1}-${s+1}`),n=r,s=r}return o.push(n===s?`${n+1}`:`${n+1}-${s+1}`),o.join(", ")}function _t(e,t){let o=[...new Set(e)].sort((r,i)=>r-i).filter(r=>r>=0&&r<t-1),n=[],s=0;for(let r of o)n.push({from:s,to:r}),s=r+1;return n.push({from:s,to:t-1}),n}var ye=Ye(()=>import("./pdf-compress-U2E3CNXG.js")),$o=new Set(["pdf","jpeg","png","webp","avif","gif","tiff"]),_o=new Set(["pdf"]);async function U(e){return(await M()).PDFDocument.load(await ie(e),{ignoreEncryption:!0})}var ko=1024,kt=Buffer.from("%PDF-","latin1");async function Mo(e){return(await W(e,ko+kt.length)).indexOf(kt)!==-1}async function Oo(e){if(!await Mo(e))throw new Error(`${e} is not a PDF`);let{surveyDocument:t}=await ye(),o=await U(e),{size:n}=await Ro(e);return{kind:"document",path:e,format:"pdf",bytes:n,pages:o.getPageCount(),encrypted:o.isEncrypted,images:t(o)}}function z(e){for(let t of e)if(t.encrypted)throw ee(t.path)}async function Do(e,t,o){let n=await oe(),s=t.format==="jpeg"||t.format==="png",r=s?(await n(o).metadata()).orientation:void 0;if(s&&(r===void 0||r===1))return t.format==="jpeg"?e.embedJpg(o):e.embedPng(o);if(t.format==="jpeg"){let i=await n(o).rotate().jpeg({quality:S.jpeg.defaultQuality,mozjpeg:!0}).toBuffer();return e.embedJpg(i)}return e.embedPng(await n(o).rotate().png().toBuffer())}async function Ao(e,t){let o=e.sources[0];if(o.kind!=="image")throw new Error("the pdf engine cannot embed a document source");let n=[];o.frames>1&&n.push({code:"animation-flattened",message:`${A(o.path)} has ${o.frames} frames, and ${S.pdf.label} cannot animate. Only the first frame was converted.`}),t({phase:"reading"});let s=await ie(o.path);t({phase:"encoding"});let i=await(await M()).PDFDocument.create(),a=await Do(i,o,s);i.addPage([a.width,a.height]).drawImage(a,{x:0,y:0,width:a.width,height:a.height}),t({phase:"writing"});let d=await R(e.outputs[0],await i.save());return{job:e,outputBytes:d,warnings:n}}async function Bo(e,t){z(e.sources.filter(i=>i.kind==="document"));let n=await(await M()).PDFDocument.create();for(let i of e.sources){t({phase:"reading"});let a=await U(i.path),f=await n.copyPages(a,a.getPageIndices());for(let d of f)n.addPage(d)}t({phase:"writing"});let s=await n.save(),r=await R(e.outputs[0],s);return{job:e,outputBytes:r,warnings:[]}}async function To(e,t){let o=e.sources[0];z([o]);let n=await M();t({phase:"reading"});let s=await U(o.path),r=_t(e.cuts,s.getPageCount()),i=[],a=0;try{for(let[f,d]of r.entries()){let u=await n.PDFDocument.create(),h=Array.from({length:d.to-d.from+1},(g,I)=>d.from+I),l=await u.copyPages(s,h);for(let g of l)u.addPage(g);let w=e.outputs[f];if(w===void 0)throw new Error(`split produced ${r.length} parts but was given ${e.outputs.length} outputs`);a+=await R(w,await u.save()),i.push(w),t({phase:"page",done:f+1,total:r.length})}}catch(f){throw await Promise.all(i.map(d=>Mt(d,{force:!0}))),f}return{job:e,outputBytes:a,warnings:[]}}async function ve(e,t){let n=await(await M()).PDFDocument.create(),s=await n.copyPages(e,t);for(let r of s)n.addPage(r);return n.save()}async function No(e,t){let o=e.sources[0];if(z([o]),e.pages.length===0)throw me("That extract selects no pages.");t({phase:"reading"});let n=await U(o.path),s=$t(e.pages),r=[],i=0;try{if(e.separate)for(let[a,f]of s.entries()){let d=e.outputs[a];i+=await R(d,await ve(n,[f])),r.push(d),t({phase:"page",done:a+1,total:s.length})}else{t({phase:"writing"});let a=e.outputs[0];i=await R(a,await ve(n,s)),r.push(a)}}catch(a){throw await Promise.all(r.map(f=>Mt(f,{force:!0}))),a}return{job:e,outputBytes:i,warnings:[]}}async function Lo(e,t){let o=e.sources[0];z([o]),t({phase:"reading"});let n=await U(o.path),s=new Set(e.pages),r=n.getPageIndices().filter(a=>!s.has(a));if(r.length===0)throw me("That would delete every page.");t({phase:"writing"});let i=await R(e.outputs[0],await ve(n,r));return{job:e,outputBytes:i,warnings:[]}}async function Jo(e,t){let o=e.sources[0];z([o]);let n=await M();t({phase:"reading"});let s=await U(o.path);for(let i of s.getPages()){let f=((i.getRotation().angle+e.turns*90)%360+360)%360;i.setRotation(n.degrees(f))}t({phase:"writing"});let r=await R(e.outputs[0],await s.save());return{job:e,outputBytes:r,warnings:[]}}async function Wo(e,t){let o=e.sources[0];z([o]);let{compressPdf:n}=await ye();t({phase:"reading"});let s=await ie(o.path);t({phase:"encoding"});let{bytes:r,recompressed:i,skipped:a,fromDpi:f,toDpi:d}=await n(s,{quality:e.options.quality??60,dpi:e.options.dpi??150});if(e.options.compress&&r.length>=o.bytes)throw te(o.path,o.bytes,r.length);t({phase:"writing"});let u=await R(e.outputs[0],r),h=w=>w===1?"":"s",l=[];return i===0&&a===0?l.push({code:"pdf-no-images",message:"This PDF has no images to re-encode, so its size is almost unchanged."}):i===0?l.push({code:"pdf-no-images",message:`None of its ${a} image${h(a)} could be re-encoded \u2014 they are not JPEG data.`}):a>0&&l.push({code:"pdf-images-skipped",message:`${i} image${h(i)} recompressed, ${a} skipped (not JPEG).`}),f!==void 0&&d!==void 0&&l.push({code:"pdf-downsampled",message:`Images reduced from ${f} to ${d} dpi. Pass --dpi ${f} to keep them.`}),{job:e,outputBytes:u,warnings:l}}async function Co(e){if(e.op!=="convert")return;let t=e.sources[0];if(t.kind!=="document")return;let{compressPdf:o}=await ye(),n=await ie(t.path);return{ladder:[e.options.dpi??150,120,96,72].map(s=>({dpi:s})),measure:async s=>(await o(n,{quality:s.quality??60,...s.dpi===void 0?{}:{dpi:s.dpi}})).bytes.byteLength}}var Ot={id:"pdf",measurer:Co,reads:$o,writes:_o,ops:new Set(["convert","merge","split","extract","delete","rotate"]),probe:Oo,async run(e,t){switch(e.op){case"convert":if(e.target!=="pdf")throw new Error("the pdf engine only converts to pdf");return e.sources[0].kind==="document"?Wo(e,t):Ao(e,t);case"merge":return Bo(e,t);case"split":return To(e,t);case"extract":return No(e,t);case"delete":return Lo(e,t);case"rotate":return Jo(e,t);default:throw new Error(`the pdf engine cannot ${e.op}`)}}};import{execFile as Uo}from"node:child_process";import{mkdtemp as zo,readFile as Se,rm as qo}from"node:fs/promises";import{tmpdir as Ho}from"node:os";import{basename as Go,extname as Vo,join as Dt,win32 as Ee}from"node:path";import{pathToFileURL as Ko}from"node:url";import{promisify as Yo}from"node:util";var Fe=Yo(Uo),q=Buffer.from([208,207,17,224,161,177,26,225]);async function Zo(e){if(e.length<q.length||!e.subarray(0,q.length).equals(q))return!1;let t=await je();try{return t.find(t.parse(e),"WordDocument")!==null}catch{return!1}}async function Qo(e){let t=await Xe();try{let o=new t(e);if(!o.getEntry("word/document.xml"))return;let n=0,s=o.getEntry("docProps/app.xml");if(s){let r=/<Pages>(\d+)<\/Pages>/.exec(o.readAsText(s));r?.[1]&&(n=Number(r[1]))}return{pages:n}}catch{return}}var At=Buffer.from([80,75,3,4]);async function Xo(e){let t=await W(e,q.length);return t.subarray(0,At.length).equals(At)||t.subarray(0,q.length).equals(q)}async function jo(e){if(!await Xo(e))throw new Error(`${e} is not a Word document`);let t=await Se(e),o=await Qo(t);if(o)return{kind:"document",path:e,format:"docx",bytes:t.byteLength,pages:o.pages,encrypted:!1};if(await Zo(t))return{kind:"document",path:e,format:"doc",bytes:t.byteLength,pages:0,encrypted:!1};throw new Error(`${e} is not a Word document`)}function en(e,t){return e==="win32"?[Ee.join(t.ProgramFiles??"C:\\Program Files","LibreOffice","program","soffice.exe"),Ee.join(t["ProgramFiles(x86)"]??"C:\\Program Files (x86)","LibreOffice","program","soffice.exe")]:["/Applications/LibreOffice.app/Contents/MacOS/soffice"]}var tn=0;async function on(){tn++;try{return await Fe("soffice",["--version"],{timeout:5e3}),"soffice"}catch{}for(let e of en(process.platform,process.env))try{return await Fe(e,["--version"],{timeout:5e3}),e}catch{}}var Bt,nn=!1,rn;async function sn(){return nn?rn:(Bt??=on(),Bt)}var Ie="\f";function ae(e){return e.split(/\r?\n/).map(t=>t.trim()).filter(t=>t.length>0)}async function an(e){if(e.format==="docx"){let o=await Ze(),{value:n}=await o.extractRawText({path:e.path});return ae(n)}if(e.format==="doc"){let o=await Qe(),s=await new o().extract(e.path);return ae(s.getBody())}return(await st(await Se(e.path))).flatMap((o,n)=>n===0?ae(o):[Ie,...ae(o)])}var xe=612,ce=792,T=54,Pe=11,Tt=14;async function cn(e){let{PDFDocument:t,StandardFonts:o}=await M(),n=await t.create(),s=await n.embedFont(o.Helvetica),r=xe-T*2,i=n.addPage([xe,ce]),a=ce-T,f=()=>{i=n.addPage([xe,ce]),a=ce-T};for(let d of e){if(d===Ie){f();continue}let u="";for(let h of d.split(/\s+/).filter(Boolean)){let l=u?`${u} ${h}`:h;u&&s.widthOfTextAtSize(l,Pe)>r?(a<T&&f(),i.drawText(u,{x:T,y:a,size:Pe,font:s}),a-=Tt,u=h):u=l}u&&(a<T&&f(),i.drawText(u,{x:T,y:a,size:Pe,font:s}),a-=Tt)}return n.save()}async function fn(e){let{Document:t,Packer:o,PageBreak:n,Paragraph:s}=await et(),r=e.map(a=>a===Ie?new s({children:[new n]}):new s(a)),i=new t({sections:[{children:r}]});return o.toBuffer(i)}var dn=new Set(["docx","doc","pdf"]),pn=new Set(["docx","pdf"]),un=new Set(["convert"]),mn={code:"word-basic-fidelity",message:"Converted with basic formatting only \u2014 tables, images, and complex layouts weren't preserved. Install LibreOffice for full-fidelity conversion: brew install --cask libreoffice"};function ln(e=process.platform){return e==="linux"?{code:"word-basic-fidelity",message:"Converted with basic formatting only \u2014 tables, images, and complex layouts weren't preserved. Install LibreOffice for full-fidelity conversion: sudo apt install libreoffice"}:e!=="win32"?mn:{code:"word-basic-fidelity",message:"Converted with basic formatting only \u2014 tables, images, and complex layouts weren't preserved. Install LibreOffice from libreoffice.org for full-fidelity conversion."}}function gn(e,t,o,n=process.platform){return[`-env:UserInstallation=${n==="win32"?Ko(Ee.join(e,"profile"),{windows:!0}).href:`file://${e}/profile`}`,"--headless","--convert-to",o,"--outdir",e,t]}async function hn(e,t,o){let n=await zo(Dt(Ho(),"forge-word-"));try{await Fe(e,gn(n,t,o),{timeout:12e4});let s=Go(t,Vo(t));return await Se(Dt(n,`${s}.${o}`))}finally{await qo(n,{recursive:!0,force:!0})}}async function wn(e,t){if(e.op!=="convert")throw new Error(`the word engine cannot ${e.op}`);let o=e.sources[0];if(o.kind!=="document")throw new Error("the word engine can only convert a document source");if(o.encrypted)throw ee(o.path);t({phase:"reading"});let n=await sn();t({phase:"encoding"});let s=[],r;try{if(n!==void 0)r=await hn(n,o.path,e.target);else{let a=await an(o);r=e.target==="pdf"?await cn(a):await fn(a),s.push(ln())}}catch(a){throw J(o.path,a)}t({phase:"writing"});let i=await R(e.outputs[0],r);return{job:e,outputBytes:i,warnings:s}}var Nt={id:"word",reads:dn,writes:pn,ops:un,probe:jo,run:wn};var Z=[rt,It,Rt,Ot,Nt,lt,it];function kr(e){return Z.find(t=>t.reads.has(e))}function Mr(e){return Z.find(t=>t.writes.has(e))}function Or(e){if(e.op==="convert"){let t=e.sources[0].format;return Z.find(o=>o.reads.has(t)&&o.writes.has(e.target))}return Z.find(t=>t.ops.has(e.op))}async function Dr(e){let t;for(let o of Z)try{return await o.probe(e)}catch(n){B(t)||(t=n)}throw t}export{jn as a,$t as b,er as c,_t as d,Zn as e,Z as f,kr as g,Mr as h,Or as i,Dr as j};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
-
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{A as E,B as l,C as S}from"./chunk-CVNYUROW.js";import{c as x}from"./chunk-H3DIRJFE.js";import{existsSync as h,statSync as w}from"node:fs";import{basename as f,dirname as T,extname as g,isAbsolute as _,join as c,relative as M,resolve as i,sep as D}from"node:path";function $(t){return t.endsWith("/")||t.endsWith(D)||h(t)&&w(t).isDirectory()?!0:g(t)===""}var O=255;function P(t,r){return r==="darwin"||r==="win32"?t.length:Buffer.byteLength(t)}function a(t,r,n=process.platform){if(P(t+r,n)<=O)return t+r;let e="";for(let s of t){if(P(e+s+r,n)>O)break;e+=s}return e+r}function nt(t,r){if(i(t)===i(r))return!0;try{let n=w(t),e=w(r);return n.dev===e.dev&&n.ino===e.ino}catch{return!1}}function L(t,r){let n=f(t),e=g(n),s=e?n.slice(0,-e.length):n;return a(s,x(r))}function b(t,r,n){if(!n)return t;let e=M(i(n),r);return!e||e.startsWith("..")?t:c(t,e)}function F(t){let r=i(t.sourcePath),n=L(r,t.target);if(!t.output)return c(i(r,".."),n);let e=_(t.output)?t.output:i(t.output);return $(t.output)?c(b(e,i(r,".."),t.sourceRoot),n):i(e)}function et(t){let r=F(t);if(t.output&&!$(t.output))return r;let n=g(r);return c(i(r,".."),a(f(r,n),`-${t.suffix}${n}`))}function it(t){if(!h(t))return t;let r=i(t,".."),n=f(t),e=g(n),s=e?n.slice(0,-e.length):n;for(let o=1;o<1e4;o++){let u=c(r,a(s,` (${o})${e}`));if(!h(u))return u}throw new Error(`no free name beside ${n}`)}function p(t){let r=i(t,".."),n=f(t),e=g(n);return{dir:r,stem:e?n.slice(0,-e.length):n,ext:e||".pdf"}}function A(t,r){let{dir:n,stem:e,ext:s}=p(i(t));return c(n,a(e,`-${r}${s}`))}function st(t,r){let{dir:n,stem:e,ext:s}=p(i(t)),o=String(r).length;return Array.from({length:r},(u,m)=>c(n,a(e,`-${String(m+1).padStart(o,"0")}${s}`)))}function ot(t,r,n,e,s){let{stem:o}=p(i(t)),u=e?b(i(e),i(t,".."),s):i(t,".."),m=x(n),I=String(Math.max(1,...r.map(d=>d+1))).length,W=r.map(d=>c(u,a(o,`-${String(d+1).padStart(I,"0")}${m}`))),[y,...R]=W;if(y===void 0)throw new Error("rasterOutputPaths requires at least one selected page");return[y,...R]}function ut(t,r,n){if(!n)return[A(t,"extract")];let{dir:e,stem:s,ext:o}=p(i(t));return r.map(u=>c(e,a(s,`-p${u+1}${o}`)))}function ct(t){let r=i(t[0]??"merged.pdf");if(new Set(t.map(e=>i(e,".."))).size===1){let e=i(r,"..");return c(e,a(f(e),"-merged.pdf"))}return A(r,"merged")}function k(t,r,n){let e=r?t.map(o=>c(r,f(o))):t,[s]=e;return!n||e.length!==1||s===void 0?e:[c(T(s),`${n}${g(s)}`)]}function at(t,r,n){return k([t],r,n)[0]??t}import{randomBytes as B}from"node:crypto";import{constants as J}from"node:fs";import{access as j,mkdir as C,rename as N,rm as U,writeFile as Y}from"node:fs/promises";import{basename as z,dirname as v,extname as G,join as K}from"node:path";function H(t,r=B(6).toString("hex")){let n=G(t);return K(v(t),a(`.forge-${r}-${z(t,n)}`,n))}async function Q(t){let r=v(t);try{await C(r,{recursive:!0})}catch(n){let e=l(t,n);throw e===n?S(t,n):e}try{await j(r,J.W_OK)}catch(n){throw E(t,n)}}var V=new Set(["EPERM","EBUSY","EACCES"]),X=5,ht=9;async function Z(t,r,n=process.platform,e=o=>new Promise(u=>setTimeout(u,o)),s=X){if(n!=="win32"){await N(t,r);return}for(let o=1;;o++)try{await N(t,r);return}catch(u){let m=u.code;if(o>=s||!m||!V.has(m))throw u;await e(Math.min(50*2**(o-1),1e3))}}async function wt(t,r){await Q(t);let n=H(t);try{return await Y(n,r),await Z(n,t),r.byteLength}catch(e){throw await U(n,{force:!0}).catch(()=>{}),l(t,e)}}export{$ as a,a as b,nt as c,F as d,et as e,it as f,A as g,st as h,ot as i,ut as j,ct as k,k as l,at as m,H as n,Q as o,ht as p,Z as q,wt as r};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
-
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as s}from"./chunk-J7FLFHQJ.js";import{c as r}from"./chunk-VLVNA4T3.js";import{a}from"./chunk-H3DIRJFE.js";import{dirname as f}from"node:path";var o=class extends Error{code;title;detail;short;hint;shellHint;constructor(t){super(`${t.title}: ${t.detail}`,t.cause===void 0?void 0:{cause:t.cause}),this.name="ForgeError",this.code=t.code,this.title=t.title,this.detail=t.detail,this.short=t.short,this.hint=t.hint,this.shellHint=t.shellHint}};function m(e){return e instanceof o}function v(e){return new o({code:"file-not-found",title:"File not found",detail:`${r(e)} could not be found.`,short:`${r(e)} could not be found.`,hint:"Check the filename and try again."})}function k(e){return new o({code:"not-a-file",title:"Not a file",detail:`${r(e)} is not a file.`,short:`${r(e)} is not a file.`,hint:"Point Forge at an image, or at a directory of images."})}function C(e){return new o({code:"permission-denied",title:"Permission denied",detail:`${r(e)} could not be read.`,short:`${r(e)} could not be read.`,hint:"Check the file permissions and try again."})}function S(e){return new o({code:"not-a-directory",title:"Invalid path",detail:`${r(e)} could not be found: part of its path is not a directory.`,short:`part of ${r(e)}'s path is not a folder.`,hint:"Check the path and try again."})}function T(e){return new o({code:"symlink-loop",title:"Too many symbolic links",detail:`${r(e)} could not be resolved: its path contains a symbolic-link loop.`,short:`${r(e)}'s path loops back on itself.`,hint:"Check for a circular symlink somewhere in the path."})}function I(e){return new o({code:"path-too-long",title:"Path too long",detail:`${r(e)}'s path is too long for the filesystem to resolve.`,short:`${r(e)}'s path is too long.`,hint:"Use a shorter path and try again."})}function N(e,t){return new o({code:"unreadable-path",title:"Could not read path",detail:`${r(e)} could not be checked.`,short:`${r(e)} could not be checked.`,hint:"Check the path and try again.",cause:t})}function P(e,t){return new o({code:"unsupported-source",title:"Unsupported file type",detail:`${r(e)} is ${t}, which Forge cannot read.`,short:`${r(e)} is ${t}, which Forge cannot read.`,hint:"Forge 0.1 handles images only."})}function H(e,t){return new o({code:"unsupported-source",title:"Not an image",detail:`${r(e)} is ${t}, not an image.`,hint:"A palette is taken from a photo, a screenshot or artwork."})}function O(e){return new o({code:"unsupported-source",title:"Nothing to take colours from",detail:`${r(e)} has no visible pixels.`})}function R(e,t=process.platform){if(t!=="darwin"){let n=t==="win32"?"Windows":t==="linux"?"Linux":"this system";return new o({code:"heic-decoder-unavailable",title:"Cannot read HEIC here",detail:`${r(e,t)} is a HEIC photo, which needs Forge's free HEIC extension on ${n}.`,short:"HEIC needs the heic extension.",hint:"Install it with: forge extensions add heic",shellHint:"Open /extensions to install it."})}return new o({code:"heic-decoder-unavailable",title:"Cannot read HEIC here",detail:`${r(e)} is a HEIC photo, which Forge decodes with the macOS sips tool.`,short:"HEIC needs sips, which could not be run.",hint:"sips could not be run. It ships with macOS at /usr/bin/sips."})}function A(e,t=process.platform){if(t!=="darwin"){let n=t==="win32"?"Windows":t==="linux"?"Linux":"this system";return new o({code:"raw-decoder-unavailable",title:"Cannot read RAW here",detail:`${r(e,t)} is a camera RAW photo, which needs Forge's free RAW extension on ${n}.`,short:"RAW needs the raw extension.",hint:"Install it with: forge extensions add raw",shellHint:"Open /extensions to install it."})}return new o({code:"raw-decoder-unavailable",title:"Cannot read RAW here",detail:`${r(e,t)} is a camera RAW photo, which Forge reads with macOS's own RAW support.`,short:"RAW needs sips, which could not be run.",hint:"sips could not be run. It ships with macOS at /usr/bin/sips."})}function U(e){return new o({code:"raw-decoder-unavailable",title:"Cannot read this RAW",detail:`${r(e)} is a camera RAW photo that this Mac cannot read.`,short:"macOS cannot read RAW photos from this camera.",hint:"A newer camera usually needs a newer macOS."})}function W(e,t){let n=r(e.path);if(t!==void 0&&t!==e.format){let i=a[t].label;return a[t].lossy?new o({code:"unsupported-compress",title:"Cannot fit that to a size",detail:`Forge cannot search ${n} \u2192 ${i} toward a size yet.`,hint:"Convert it first, then compress the result with --max-size.",shellHint:"Convert it first, then /compress the result to a size."}):new o({code:"unsupported-compress",title:"Cannot fit that to a size",detail:`${i} is lossless \u2014 there is no quality to trade away, so ${n} cannot be made to fit as ${i}.`,hint:"Drop --max-size, or choose a lossy target. forge --formats lists them.",shellHint:"Choose a lossy target to aim for a size."})}if(e.kind==="document"&&e.format==="pdf"){let i=e.images?.skipped??0;return new o({code:"unsupported-compress",title:"Nothing to compress",detail:i>0?`${n}'s images are a kind Forge cannot re-encode, so there is nothing to make smaller.`:`${n} has no images \u2014 it is text and layout, which compression cannot shrink.`,hint:"Try a page operation such as --extract to keep fewer pages, or --to <format> to turn its pages into images.",shellHint:"Try /pdf to keep fewer pages, or /convert to turn its pages into images."})}return e.kind==="document"?new o({code:"unsupported-compress",title:"Nothing to compress",detail:`${n} is ${a[e.format].label}, which has no images Forge can re-encode.`,hint:`Use --to pdf to change it to PDF instead: forge ${n} --to pdf`,shellHint:"Use /convert to change it to PDF instead."}):new o({code:"unsupported-compress",title:"Nothing to compress",detail:`${n} is ${a[e.format].label}, which is lossless \u2014 there is no quality to trade away.`,hint:"Use --to to change it to a smaller format instead. forge --formats lists them.",shellHint:"Use /convert to change it to a smaller format instead."})}function D(e){let t=r(e.path);return new o({code:"unsupported-pdf",title:"/pdf needs a PDF",detail:`${t} is ${a[e.format].label}, not a PDF.`,hint:"Converting it instead."})}function M(e,t,n){return new o({code:"unsupported-operation",title:`Cannot ${e} these files`,detail:`Not available for these files: ${t}.`,hint:n??"Page operations work on PDFs: --merge takes two or more, the others take one.",shellHint:n??"Use /pdf with a PDF staged \u2014 two or more for merge."})}function J(e,t,n){let i=e.kind==="media"?`The smallest ${r(e.path)} can get is ${s(n)}, which is still over ${s(t)}.`:`${r(e.path)} is ${s(n)} even at the lowest quality, which is still over ${s(t)}.`;return new o({code:"target-unreachable",title:"Cannot get that small",detail:i,hint:"Try a larger --max-size, or --to a smaller format.",shellHint:"Try a larger target, or /convert to a smaller format."})}function j(e,t,n){return new o({code:"unsupported-target",title:`Can't convert ${r(e.path)} to ${t}`,detail:`${r(e.path)} is a ${a[e.format].label} ${e.kind==="image"?"image":"document"}.`,hint:`Available: ${n.join(", ")}`})}function z(e,t){return new o({code:"corrupt-source",title:"Damaged file",detail:`${r(e)} could not be read. It may be damaged, or not a format Forge recognises.`,short:`${r(e)} could not be read.`,hint:"The file may be incomplete or corrupted.",cause:t})}function L(e,t,n){return new o({code:"corrupt-source",title:`Damaged ${a[t].label}`,detail:`${r(e)} is a ${a[t].label} file, but its content could not be read.`,short:`${r(e)} could not be read.`,hint:"The file may be incomplete or corrupted.",cause:n})}function q(e,t={}){let n=r(e);return new o({code:"encrypted-source",title:"This PDF is password-protected",detail:`${n} is password-protected.`,short:`${n} is password-protected.`,hint:t.attempted?"That password didn't open it. Check it and try again.":`Convert it to images instead: forge ${n} --to jpeg --password-stdin`})}var c=e=>e==="convert"||e==="boost"||e==="remove-background";function Y(e,t="convert"){return new o({code:"output-exists",title:"File already exists",detail:`${r(e)} is already there.`,hint:c(t)?"Pass --force to replace it, or choose a different --output.":"Pass --force to replace it, or move the existing file out of the way.",shellHint:"Run it again and Forge will ask before replacing it."})}function V(e,t){return new o({code:"output-collision",title:"Two files want the same output",detail:`${r(e[0])} and ${r(e[1])} would both become ${r(t)}.`,hint:"Convert them separately, or use --output to send them to different folders.",shellHint:"Convert them one at a time."})}function _(e,t){return new o({code:"output-collision",title:"One output, written twice",detail:`${r(e)} would write ${r(t)} twice, and only the second would survive.`,hint:"Every output has to be its own file. Check the selection for a repeated page."})}function X(e,t="convert"){return new o({code:"output-is-input",title:"Output would replace the original",detail:`${r(e)} is both the input and the output.`,hint:c(t)?"Choose a different --output, or pass --force to overwrite in place.":"Move or rename that file first, or pass --force to overwrite it in place.",shellHint:c(t)?"Choose a different folder to save it in.":"Move or rename that file first."})}function w(e,t){return new o({code:"permission-denied",title:"Permission denied",detail:`${r(f(e))} is not a folder you can write to.`,hint:"Choose a different --output, or check the folder permissions.",shellHint:"Choose a different folder, or check its permissions.",cause:t})}var b=new Set(["EACCES","EPERM","EROFS"]);function B(e,t){if(m(t))return t;let n=t?.code;return n!==void 0&&b.has(n)?w(e,t):t}function G(e,t){return new o({code:"output-invalid",title:"Cannot write there",detail:`${e} could not be written to.`,hint:"Check that the path is valid and that you have permission to write to it.",cause:t})}function K(e){return new o({code:"empty-directory",title:"No images found",detail:`${r(e)} contains no images Forge can convert.`,hint:"Try --recursive to look inside subfolders.",shellHint:"Only files directly inside a folder are read \u2014 drop the files themselves, or the folder that holds them."})}function Q(e,t){return new o({code:"invalid-arguments",title:"Invalid arguments",detail:e,hint:t})}function Z(e,t,n){return new o({code:"invalid-page-range",title:"Page range not understood",detail:t,hint:`This document has ${n} pages. Use numbers and spans, like "3-7, 12, 20-".`})}function ee(e){return new o({code:"empty-selection",title:"Nothing to write",detail:e,hint:"Select at least one page to keep."})}function te(e){return new o({code:"invalid-dpi",title:"Invalid resolution",detail:`${String(e)} is not a resolution Forge can use.`,hint:"Give a number between 36 and 600. The default is 150."})}function oe(e){return new o({code:"extension-missing",title:"Extension not installed",detail:`${e} is an optional extension and is not installed.`,hint:`Install it with: forge extensions add ${e}`,shellHint:"Open /extensions to install it."})}function ne(e,t,n,i){return new o({code:"extension-outdated",title:"Extension out of date",detail:`${e} ${n} cannot ${t}; that needs ${i} or later.`,hint:`Update it with: forge extensions add ${e}`,shellHint:"Open /extensions to update it."})}function re(e,t){return new o({code:"extension-corrupt",title:"Extension failed verification",detail:`${e}: ${t}`,hint:`Nothing was installed. Try again with: forge extensions add ${e}`,shellHint:"Nothing was installed. Try again from /extensions."})}function ie(e,t,n=process.platform){let i=n==="win32"?"PC":n==="darwin"?"Mac":"computer";return new o({code:"extension-unsupported",title:"Extension not available here",detail:`${e} cannot be installed on this ${i}: ${t}`,hint:"See what is available with: forge extensions",shellHint:"See what is available in /extensions."})}function ae(e,t=process.platform){let n=t==="win32"?"Windows":t==="darwin"?"macOS":t==="linux"?"Linux":"this system";return new o({code:"extension-unsupported",title:"Extension not available here",detail:`${e} is not available on ${n}.`,hint:"See what is available with: forge extensions",shellHint:"See what is available in /extensions."})}function se(e){return new o({code:"update-unavailable",title:"Cannot update this Forge",detail:`This copy of Forge was not installed with npm i -g, so ${e} cannot be installed over it.`,hint:"npm i -g forge-terminal"})}function le(e,t=process.platform){return t==="win32"?new o({code:"update-denied",title:"Forge is in use",detail:`npm could not replace Forge's files to update it to ${e}. Windows keeps them locked while Forge runs: close every Forge window, then run the command below. If Node is installed for every user, run it in a terminal opened as administrator.`,short:"Windows locks Forge while it runs: close it, then run this",hint:`npm i -g forge-terminal@${e}`}):new o({code:"update-denied",title:"npm needs permission",detail:`npm needs permission to update Forge to ${e}.`,short:"npm needs permission to update Forge",hint:`sudo npm i -g forge-terminal@${e}`})}function de(e,t){return new o({code:"update-failed",title:"Update failed",detail:`npm could not install Forge ${e}: ${t}`,short:"npm could not install the update",hint:`npm i -g forge-terminal@${e}`})}function ue(){return new o({code:"update-unreachable",title:"Could not check for updates",detail:"The npm registry could not be reached.",short:"could not reach npm",hint:"Check your connection (and HTTPS_PROXY if you use a proxy), then run: forge update",shellHint:"Check your connection, then try again."})}function ce(e,t){return new o({code:"extension-download-failed",title:"Download failed",detail:`${e}: ${t}`,hint:`Check your connection (and HTTPS_PROXY if you use a proxy), then run: forge extensions add ${e}`,shellHint:"Check your connection, then try again from /extensions."})}function pe(e,t){return new o({code:"extension-download-failed",title:"Not enough disk space",detail:`${e}: ${t}`,hint:`Free some disk space, then run: forge extensions add ${e}`,shellHint:"Free some disk space, then try again from /extensions."})}function he(e,t,n){let i=t?t.what?`${t.what} (forge, pid ${t.pid})`:`another forge (pid ${t.pid}) is using it`:"another forge is using it";return new o({code:"extension-in-use",title:"Extension in use",detail:`${e} is in use: ${i}.`,hint:n==="remove"?`Wait for that job to finish, then run: forge extensions remove ${e}`:"Wait for that job to finish, then try again.",shellHint:n==="remove"?"It can be removed when that job finishes.":"Try again when that job finishes."})}function ge(e){return new o({code:"no-subject",title:"No subject found",detail:`${r(e)} has no clear subject to cut out.`,hint:"Try a photo where the subject stands apart from the background."})}function fe(e,t,n){return n===1?new o({code:"boost-too-large",title:"Too large to sharpen",detail:`${r(e)} is too large to sharpen.`,hint:"Sharpen works on images up to 16,384 px a side and 100 megapixels."}):new o({code:"boost-too-large",title:"Too large to boost",detail:t>=2?`${r(e)} is too large to boost that far; ${t}x is the most it can take.`:`${r(e)} is already too large to boost.`,hint:t>=2?`Try --boost ${t}.`:"Boost works on images up to 100 megapixels.",shellHint:t>=2?`Choose ${t}x instead.`:void 0})}function me(e,t,n,i=process.platform){let l=n===1?"sharpen":"boost",d=i==="win32"?"PC":i==="darwin"?"Mac":"computer",u=Math.max(1,Math.round(t/60));return new o({code:"boost-too-slow",title:`Too slow to ${l}`,detail:`${r(e)} would take about ${u} ${u===1?"minute":"minutes"} to ${l} on this ${d}.`,hint:"Try a smaller photo."})}function we(e,t){return new o({code:"resize-too-large",title:"Too large to resize to",detail:`${r(e)} would be ${t.width} \xD7 ${t.height}.`,hint:"Resize works up to 16,384 px a side and 100 megapixels."})}var x={darwin:"\u2303\u21E7\u23184",win32:"Win+Shift+S"};function be(e,t=process.platform){let n=x[t];return new o({code:"no-clipboard-image",title:"No image",detail:e==="text"?"The clipboard holds text, not a picture.":"The clipboard is empty.",hint:n===void 0?"Copy a picture or a screenshot, then run forge clip again.":`Copy a picture, or take a screenshot with ${n}, then run forge clip again.`})}function xe(e=process.platform){return new o({code:"clipboard-unavailable",title:"No clipboard",detail:e==="linux"?"Forge reads the clipboard of a Wayland or X11 desktop, and not over SSH.":"Forge reads the clipboard on macOS, Windows and Linux, and not over SSH."})}function $e(e){return new o({code:"clipboard-tool-missing",title:`Clipboard needs ${e}`,detail:`Forge reaches the clipboard through ${e}, and it is not on this computer.`,short:`${e} is not on this computer`,hint:`Install it with sudo apt install ${e} (or your distribution's package manager), then try again.`})}function Fe(){return new o({code:"nothing-to-undo",title:"Nothing to undo",detail:"No copied image has been changed yet."})}function ye(e,t,n,i=!1){let l=r(e);if(i)return new o({code:"cannot-compress-more",title:"Cannot compress more",detail:`${l} is no smaller even at the lowest quality, so nothing was written.`,short:"nothing written"});let d=n>t?`would grow from ${s(t)} to ${s(n)}`:`would stay at ${s(t)}`;return new o({code:"cannot-compress-more",title:"Cannot compress more",detail:`${l} ${d}, so nothing was written.`,short:"nothing written",hint:"Try a lower --quality.",shellHint:"Try a lower quality."})}function Ee(e,t,n){return new o({code:"cannot-compress-more",title:"Already small enough",detail:`${r(e)} is ${s(t)}, already under ${s(n)}, so nothing was written.`,short:"already under that size"})}function ve(e){return new o({code:"nothing-to-trim",title:"Nothing to trim",detail:`${r(e)} has no empty edges.`,short:"no empty edges"})}function ke(e){return new o({code:"animated-trim",title:"Can't trim an animation",detail:`${r(e)} is animated; trimming works on still images.`})}function Ce(e,t){return new o({code:"nothing-to-crop",title:"Nothing to crop",detail:`${r(e)} is already ${t}.`,short:`already ${t}`})}function Se(e){return new o({code:"animated-crop",title:"Can't crop an animation",detail:`${r(e)} is animated; cropping works on still images.`})}function Te(e){return new o({code:"animated-rotate",title:"Can't rotate an animation",detail:`${r(e)} is animated; rotating works on still images.`})}function Ie(e,t=process.platform,n=!1){let i=p(t),l=n?`forge extensions add video (or ${i})`:t==="linux"?`${i} (or your distribution's package manager)`:i;return new o({code:"ffmpeg-missing",title:"Video and audio need ffmpeg",detail:`${r(e)} is a video or audio file, and ffmpeg is not on this computer.`,short:"ffmpeg is not on this computer",hint:`Install it with ${l}, then run Forge again.`})}function Ne(e,t,n=process.platform){let i=a[e].label,l=/^[AEFHILMNORSX]/.test(t.codec)?"an":"a",d=t.encoders,u=d.length>1?`${d.slice(0,-1).join(", ")} or ${d.at(-1)}`:d[0]??"",h=d.length>1?"any of them":"it",g=n==="linux"?"Install a full build of ffmpeg, then run Forge again. On Fedora, RPM Fusion's ffmpeg replaces ffmpeg-free.":n==="win32"?`Install a full build of ffmpeg, such as gyan.dev's (${p(n)}), then run Forge again.`:`Install a full build of ffmpeg (${p(n)}), then run Forge again.`;return new o({code:"encoder-missing",title:`Your ffmpeg can't write ${i}`,detail:`${i} needs ${l} ${t.codec} encoder${t.sound?" for its sound":""}: ${u}. Your ffmpeg was built without ${h}.`,short:`Your ffmpeg has no ${t.codec} encoder`,hint:g})}function p(e=process.platform){return e==="win32"?"winget install ffmpeg":e==="linux"?"sudo apt install ffmpeg":"brew install ffmpeg"}function Pe(e,t){return new o({code:"conversion-failed",title:"Conversion failed",detail:`${r(e)} could not be converted.`,hint:"Run again with --debug for the underlying error.",shellHint:"Run the same conversion with forge --debug from the command line to see why.",cause:t})}function He(e){return new o({code:"no-sound",title:"Nothing to transcribe",detail:`${r(e)} has no sound.`})}function Oe(e,t=process.platform,n=t==="darwin"?"apple":"whisper"){return n==="whisper"?new o({code:"unsupported-source",title:"Cannot transcribe this file",detail:`${r(e,t)} cannot be read by whisper.`,hint:"Video and sound files can be transcribed."}):new o({code:"unsupported-source",title:"Cannot transcribe this file",detail:`${r(e)} cannot be read by Apple's speech recogniser.`,hint:"MP4, MOV, M4A, MP3, WAV and AIFF can be transcribed; with ffmpeg (brew install ffmpeg), any video or sound file."})}function Re(e,t=process.platform,n=t==="darwin"?"apple":"whisper"){let i=n==="apple"?"Apple's speech recogniser":"The whisper extension";return new o({code:"language-unsupported",title:"Language not supported",detail:`${i} does not support ${e}.`,hint:"Pass another with --language, for example --language en-US."})}function Ae(e,t,n={}){return new o({code:"link-unavailable",title:"Cannot transcribe this link",detail:e,...n,...t===void 0?{}:{cause:t}})}function Ue(e){return new o({code:"transcribe-unavailable",title:"Transcribe is not available",detail:e})}function We(e=!1){return e?new o({code:"read-unavailable",title:"Reading text is not available",detail:"Reading text needs Forge's free read-text extension.",short:"Needs the read-text extension.",hint:"Install it with: forge extensions add read-text",shellHint:"Open /extensions to install it."}):new o({code:"read-unavailable",title:"Reading text is not available",detail:"Reading text needs macOS 26 or later.",short:"Reading text needs macOS 26 or later."})}function De(e){let t=r(e);return new o({code:"no-text",title:"No text found",detail:`No text found in ${t}`,short:`No text found in ${t}`})}function Me(e){return new o({code:"unexpected",title:"Something went wrong",detail:e instanceof Error?e.message:String(e),hint:"This was not expected. Try again \u2014 if it keeps happening, it may be worth reporting.",cause:e})}function Je(e,t={}){let n=[`\u2715 ${e.title}`,"",` ${e.detail}`];return e.hint&&n.push("",` ${e.hint}`),t.debug&&e.cause instanceof Error&&n.push("",` ${e.cause.stack??e.cause.message}`),n}export{m as a,v as b,k as c,C as d,S as e,T as f,I as g,N as h,P as i,H as j,O as k,R as l,A as m,U as n,W as o,D as p,M as q,J as r,j as s,z as t,L as u,q as v,Y as w,V as x,_ as y,X as z,w as A,B,G as C,K as D,Q as E,Z as F,ee as G,te as H,oe as I,ne as J,re as K,ie as L,ae as M,se as N,le as O,de as P,ue as Q,ce as R,pe as S,he as T,ge as U,fe as V,me as W,we as X,be as Y,xe as Z,$e as _,Fe as $,ye as aa,Ee as ba,ve as ca,ke as da,Ce as ea,Se as fa,Te as ga,Ie as ha,Ne as ia,p as ja,Pe as ka,He as la,Oe as ma,Re as na,Ae as oa,Ue as pa,We as qa,De as ra,Me as sa,Je as ta};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
-
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as w,b as I,d as k,e as m}from"./chunk-ZOQA3JAR.js";import{a as $,c as O}from"./chunk-TYWGB767.js";import{b as h,d as P,e as R}from"./chunk-SNXX5TVZ.js";import{e as x}from"./chunk-57M4J2BR.js";import{a as l}from"./chunk-MBZRADAZ.js";import{j as B}from"./chunk-7WZYTDFI.js";import{$ as v,Y as g,Z as C}from"./chunk-CVNYUROW.js";import{a as f}from"./chunk-J7FLFHQJ.js";import{b as p}from"./chunk-VLVNA4T3.js";import{a as c}from"./chunk-H3DIRJFE.js";import{dirname as S,join as q}from"node:path";async function T(t){if(t.fallback!==void 0)return t.fallback;let{loadPreferences:r,expandTilde:e}=await import("./preferences-3P4V2EDX.js");return e((await r()).prefs.defaultOutput)}function F(t){if(t.pasteboard)return t.pasteboard;if(!$())throw C();return O()}function E(t,r,e,o){let a=q(r.outDir,`Copied image${c[o].extensions[0]}`),s={inputs:[r.source],output:a,force:!1,recursive:!1,debug:t.debug},n={background:"#ffffff",keepMetadata:!1,...t.quality===void 0?{}:{quality:t.quality}};return o===e?{kind:"compress",...s,options:n,...t.quality===void 0?{}:{quality:t.quality},...t.maxBytes===void 0?{}:{maxBytes:t.maxBytes}}:{kind:"convert",...s,target:o,options:n,...t.maxBytes===void 0?{}:{maxBytes:t.maxBytes}}}async function J(t,r={}){let e=r.clip??{},o=F(e),a=await w(o,e.root);if(!a)throw g((await o.peek()).text?"text":"nothing");let s=await B(a.source),n=t.target??s.format,b=E(t,a,s.format,n),i=await P(b,r),y=i.results[0];if(!y||i.failures.length>0)return{report:i,status:"failed"};let u=y.job.outputs[0],d={report:i,output:u,source:{format:s.format,bytes:s.bytes},target:n};if(await I(o,a,u,n)==="changed")return{...d,status:"changed",saved:await m(u,await T(e))};if(t.save===void 0)return{...d,status:"placed"};let j=t.save===!0?await T(e):t.save,{expandTilde:D}=await import("./preferences-3P4V2EDX.js");return{...d,status:"placed",saved:await m(u,D(j))}}function N(t){let r=t.target===t.source.format?"":` as ${c[t.target].label}`,e=` ${f(t.source.bytes)} \u2192 ${f(t.report.outputBytes)} \xB7 ${h(t.source.bytes,t.report.outputBytes)}`;if(t.status==="changed"){let a=t.target===t.source.format?"compressed":"converted";return[`\u2713 Copied image \u2192 ${p(t.saved)}${r}`,e,"","\u26A0 Clipboard changed"," The file you uploaded is no longer in the clipboard.",` The ${a} image is saved to ${p(S(t.saved))}.`]}let o=t.saved===void 0?"":` + ${p(t.saved)}`;return[`\u2713 Copied image \u2192 clipboard${r}${o}`,e]}async function U(t){if(!await k(F(t),t.root))throw v()}async function Z(t,r){if(t.undo)return await U(r.clip??{}),{exitCode:0,stdout:r.json?[JSON.stringify({forge:l,ok:!0,clipboard:"restored"})]:["\u2713 The original is back on the clipboard"],stderr:[]};let e=await J(t,r);if(e.status==="failed")return R(e.report,r);if(r.json){let o={...x(l,e.report),clipboard:e.status,...e.saved===void 0?{}:{saved:e.saved}};return{exitCode:0,stdout:[JSON.stringify(o)],stderr:[]}}return{exitCode:0,stdout:N(e),stderr:[]}}export{J as a,N as b,U as c,Z as d};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
-
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{b as w,c as A}from"./chunk-QVACE4IE.js";var d=(e,s,r)=>(e.L[s]-r[0])**2+(e.A[s]-r[1])**2+(e.B[s]-r[2])**2;function O(e,s){let r=e.L.length,u=[0,0,0];for(let a=0;a<r;a++)u[0]+=e.L[a],u[1]+=e.A[a],u[2]+=e.B[a];let n=[[u[0]/r,u[1]/r,u[2]/r]],t=new Float64Array(r).fill(Number.POSITIVE_INFINITY);for(;n.length<s;){let a=n[n.length-1],o=0,b=-1;for(let m=0;m<r;m++){let c=d(e,m,a);c<t[m]&&(t[m]=c),t[m]>b&&(b=t[m],o=m)}n.push([e.L[o],e.A[o],e.B[o]])}return n}function G(e,s,r){let u=0,n=Number.POSITIVE_INFINITY;for(let t=0;t<r.length;t++){let a=d(e,s,r[t]);a<n&&(n=a,u=t)}return u}function E(e,s){let r=e.L.length,u=O(e,s),n=new Int32Array(r).fill(-1);for(let a=0;a<30;a++){let o=0;for(let m=0;m<r;m++){let c=G(e,m,u);n[m]!==c&&(n[m]=c,o++)}let b=u.map(()=>[0,0,0,0]);for(let m=0;m<r;m++){let c=b[n[m]];c[0]=c[0]+e.L[m],c[1]=c[1]+e.A[m],c[2]=c[2]+e.B[m],c[3]=c[3]+1}if(b.forEach(([m,c,h,i],l)=>{i&&(u[l]=[m/i,c/i,h/i])}),o===0)break}let t=u.map(a=>({centre:a,members:[]}));for(let a=0;a<r;a++)t[n[a]]?.members.push(a);return t.filter(a=>a.members.length>0)}function M(e,s){let r=e;for(;;){let u,n=s**2;for(let i=0;i<r.length;i++)for(let l=i+1;l<r.length;l++){let f=r[i].centre,g=r[l].centre,p=(f[0]-g[0])**2+(f[1]-g[1])**2+(f[2]-g[2])**2;p<n&&(n=p,u=[i,l])}if(!u)return r;let[t,a]=u,o=r[t],b=r[a],m=o.members.length,c=b.members.length,h=o.centre.map((i,l)=>(i*m+b.centre[l]*c)/(m+c));r=r.filter((i,l)=>l!==t&&l!==a),r.push({centre:h,members:[...o.members,...b.members]})}}function N(e,s,r){let u=e.L.length,n=[...s].sort((o,b)=>b.members.length-o.members.length),t=n.filter((o,b)=>b===0||o.members.length/u>=r),a=t.map(o=>o.centre);for(let o of n)if(!t.includes(o))for(let b of o.members)t[G(e,b,a)].members.push(b);return t}function y(e,s,r,u){let n=e.length;if(n===0)return[];let t={L:e,A:s,B:r},a=M(E(t,Math.min(u.k,n)),u.merge);return N(t,a,u.minShare)}var F={k:8,merge:.06,minShare:.015},L={k:4,merge:.03,minShare:.02},T=-1,C=-2,P=128,S=64,I=(e,s)=>({r:e.rgba[s*4],g:e.rgba[s*4+1],b:e.rgba[s*4+2]});function R(e,s,r){let u=s.length,n=new Float64Array(u),t=new Float64Array(u),a=new Float64Array(u);return s.forEach((o,b)=>{let m=A(I(e,o));n[b]=m.L,t[b]=m.a,a[b]=m.b}),y(n,t,a,r).map(o=>{let b=o.members[0],m=Number.POSITIVE_INFINITY;for(let h of o.members){let i=(n[h]-o.centre[0])**2+(t[h]-o.centre[1])**2+(a[h]-o.centre[2])**2;i<m&&(m=i,b=h)}let c=I(e,s[b]);return{rgb:c,hex:w(c),share:o.members.length/u,centre:{L:o.centre[0],a:o.centre[1],b:o.centre[2]},members:Uint32Array.from(o.members.map(h=>s[h])).sort()}}).sort((o,b)=>b.share-o.share||(o.hex<b.hex?-1:1))}function D(e){let s=[];for(let r=0;r<e.width*e.height;r++)e.rgba[r*4+3]>=P&&s.push(r);return R(e,s,F)}function k(e,s){return R(e,[...s.members],L)}function U(e,s){return s.members.length>=S&&k(e,s).length>1}function V(e){let s=e.map(n=>n*100),r=s.map(Math.floor),u=Math.round(s.reduce((n,t)=>n+t,0))-r.reduce((n,t)=>n+t,0);return s.map((n,t)=>[n-Math.floor(n),t]).sort((n,t)=>t[0]-n[0]||n[1]-t[1]).forEach(([,n])=>{u-- >0&&(r[n]=r[n]+1)}),r}function Y(e,s,r=24){let u=new Int32Array(e.width*e.height).fill(C);s.forEach((o,b)=>{for(let m of o.members)u[m]=b});let n=e.width>=e.height,t=n?r:Math.max(1,Math.round(r*e.width/e.height)),a=n?Math.max(1,Math.round(r*e.height/e.width)):r;return Array.from({length:a},(o,b)=>Array.from({length:t},(m,c)=>{let h=Math.min(e.width-1,Math.floor((c+.5)*e.width/t)),l=Math.min(e.height-1,Math.floor((b+.5)*e.height/a))*e.width+h;return e.rgba[l*4+3]<P?T:u[l]}))}export{T as a,C as b,D as c,k as d,U as e,V as f,Y as g};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
-
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
var m=t=>t<=.04045?t/12.92:((t+.055)/1.055)**2.4,i=t=>t<=.0031308?12.92*t:1.055*t**.4166666666666667-.055;function g(t){let n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t.trim());if(!n)return;let r=n[1],e=r.length===3?[...r].map(o=>o+o).join(""):r;return{r:Number.parseInt(e.slice(0,2),16),g:Number.parseInt(e.slice(2,4),16),b:Number.parseInt(e.slice(4,6),16)}}function x({r:t,g:n,b:r}){return`#${[t,n,r].map(e=>e.toString(16).padStart(2,"0")).join("").toUpperCase()}`}function h({r:t,g:n,b:r}){let e=m(t/255),o=m(n/255),a=m(r/255),b=Math.cbrt(.4122214708*e+.5363325363*o+.0514459929*a),u=Math.cbrt(.2119034982*e+.6806995451*o+.1073969566*a),c=Math.cbrt(.0883024619*e+.2817188376*o+.6299787005*a);return{L:.2104542553*b+.793617785*u-.0040720468*c,a:1.9779984951*b-2.428592205*u+.4505937099*c,b:.0259040371*b+.7827717662*u-.808675766*c}}function s({L:t,a:n,b:r}){let e=(t+.3963377774*n+.2158037573*r)**3,o=(t-.1055613458*n-.0638541728*r)**3,a=(t-.0894841775*n-1.291485548*r)**3;return[4.0767416621*e-3.3077115913*o+.2309699292*a,-1.2684380046*e+2.6097574011*o-.3413193965*a,-.0041960863*e-.7034186147*o+1.707614701*a]}function f(t){let[n,r,e]=s(t).map(o=>Math.round(Math.max(0,Math.min(1,i(Math.max(0,o))))*255));return{r:n,g:r,b:e}}function L(t){return s(t).every(n=>n>=-1e-4&&n<=1+1e-4)}function p({L:t,a:n,b:r}){return{L:t,C:Math.hypot(n,r),h:(Math.atan2(r,n)*180/Math.PI+360)%360}}function l({L:t,C:n,h:r}){let e=r*Math.PI/180;return{L:t,a:n*Math.cos(e),b:n*Math.sin(e)}}function M({r:t,g:n,b:r}){return`rgb(${t} ${n} ${r})`}function d(t){let{L:n,C:r,h:e}=p(h(t)),o=r<5e-4?0:e;return`oklch(${(n*100).toFixed(0)}% ${r.toFixed(3)} ${o.toFixed(0)})`}export{g as a,x as b,h as c,f as d,L as e,p as f,l as g,M as h,d as i};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
-
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{c as ie,d as ue,e as pe,g as ce,h as de}from"./chunk-RW4TOC5E.js";import{a as re,b as oe,c as se,k as ne,m as M,n as O,s as ae}from"./chunk-J7GGNBDR.js";import{b as X,c as T}from"./chunk-6RMRWBMB.js";import{a as y}from"./chunk-KSWBIKCI.js";import{b as I}from"./chunk-BB43QVW4.js";import{e as be}from"./chunk-PLBLOIQI.js";import{a as F,c as _,d as ee,e as C,f as te}from"./chunk-WE5MOCUL.js";import{e as fe,f as le,g as me,h as ge,i as he,j as ye}from"./chunk-57M4J2BR.js";import{a as g}from"./chunk-MBZRADAZ.js";import{d as $}from"./chunk-EEQSUBBL.js";import{a as Z}from"./chunk-IE6NFN3N.js";import{a as L,d as U}from"./chunk-TFOEI5VF.js";import{a as Y,c as K,d as E,e as Q}from"./chunk-BIBDLXCG.js";import{E as N,F as V,I as G,a as P,o as z,q as k,s as q,ta as H,v as J}from"./chunk-CVNYUROW.js";import{a as h,b as W}from"./chunk-J7FLFHQJ.js";import{b as x,c as w}from"./chunk-VLVNA4T3.js";import{a as R}from"./chunk-H3DIRJFE.js";import{readFile as Te}from"node:fs/promises";import{dirname as Oe,resolve as Me}from"node:path";async function we(e){let r=[],t=[...e.resolved.failures];for(let o of e.resolved.sources){let s=F(o);if(!s.includes(e.target)){t.push({path:o.path,error:q(o,e.target,s)});continue}let a={sourcePath:o.path,target:e.target,output:e.output,sourceRoot:e.resolved.roots.get(o.path)},n=E(a);K(n,o.path)&&e.target!==o.format&&(n=Q({...a,suffix:e.target})),r.push({op:"convert",sources:[o],outputs:[n],target:e.target,options:e.options})}return{jobs:r,failures:t}}import{resolve as je}from"node:path";function Be(e,r=new Set){let t={path:je(e.path),kind:e.kind,format:e.format,bytes:e.bytes},o=e.kind==="document"&&e.encrypted===!0,s={targets:F(e).filter(a=>!o||C(a)),actions:ce([e],r).filter(a=>!o||a.id===O.id).map(a=>a.id)};if(e.kind==="image")return{...t,width:e.width,height:e.height,...s};if(e.kind==="media"){let a=e.facts;return{...t,...a?{duration:a.duration}:{},...a?.video?{width:a.video.width,height:a.video.height,fps:a.video.fps}:{},...s}}return{...t,pages:e.pages,encrypted:e.encrypted,...s}}async function Ie(e){let r=await y(e,{recursive:!1}),{installedExtensionIds:t}=await import("./available-TNMISSBA.js"),o=await t();return{probes:r.sources.map(s=>Be(s,o)),failures:r.failures}}import{dirname as Se}from"node:path";var j=e=>({cwd:e.cwd??process.cwd(),...e.home===void 0?{}:{home:e.home}});function ve(e,r){let t=x(Se(e),j(r));return t==="."?"":` in ${t.endsWith("/")?t:`${t}/`}`}function xe(e,r){let{pct:t,direction:o}=W(e,r);return o==="same"?"same size":`${t}% ${o}`}function Pe(e,r={}){let t=e.results[0];if(!t)return[];let o=t.job.sources[0],s=t.job.outputs;if(s.length>1){let n=[`\u2713 ${w(o.path)} \u2192 ${s.length} files${ve(s[0],r)}`,` ${s.map(i=>w(i)).join(", ")}`,` ${h(o.bytes)} \u2192 ${h(t.outputBytes)} total`];for(let i of t.warnings)n.push("",`\u26A0 ${i.message}`);return n}let a=[`\u2713 ${w(o.path)} \u2192 ${x(s[0],j(r))}`,` ${h(o.bytes)} \u2192 ${h(t.outputBytes)} \xB7 ${xe(o.bytes,t.outputBytes)}`];for(let n of t.warnings)a.push("",`\u26A0 ${n.message}`);return a}function ke(e,r={}){let t=[`\u2713 ${e.results.length} converted`,` ${h(e.inputBytes)} \u2192 ${h(e.outputBytes)} \xB7 ${xe(e.inputBytes,e.outputBytes)}`];for(let s of e.results)for(let a of s.job.outputs)t.push(` ${x(a,j(r))}`);let o=e.results.flatMap(s=>s.warnings);if(o.length>0){t.push("");for(let s of o)t.push(`\u26A0 ${s.message}`)}return t}function $e(e,r={}){let t=e.results.flatMap(u=>u.job.outputs),o=t.map(u=>w(u)).join(", "),s=t.length===1?"file":"files",a=t[0]===void 0?"":ve(t[0],r),n=[`\u2713 ${t.length} ${s} \xB7 ${o}${a}`],i=e.results.flatMap(u=>u.warnings);for(let u of i)n.push("",`\u26A0 ${u.message}`);return n}function B(e,r){if(e.length===0)return[];let t=[];for(let o of e)t.push(...H(o.error,{debug:r.debug}),"");return t}function Re(){let e=new Set(_()),r=new Set(ee()),t=["Formats",""];for(let s of e){let a=R[s],n=r.has(s)?"read and write":"read only";t.push(` ${a.label.padEnd(6)} ${a.extensions.join(" ").padEnd(12)} ${n}`)}let o=[...e].filter(s=>!r.has(s)).map(s=>R[s].label);if(o.length>0){let s=o.join(", "),[a,n]=o.length===1?["is","it"]:["are","them"];t.push("",`${s} ${a} read only because Forge cannot yet write ${n}.`)}return t}function Ee(e,r={}){let t=[R[e.format].label,h(e.bytes)];return e.duration!==void 0&&t.push($(e.duration)),e.width!==void 0&&e.height!==void 0&&t.push(`${e.width}\xD7${e.height}`),e.fps!==void 0&&t.push(`${e.fps} fps`),e.pages!==void 0&&t.push(`${e.pages} ${e.pages===1?"page":"pages"}`),e.encrypted&&t.push("password-protected"),[`${x(e.path,j(r))} \xB7 ${t.join(" \xB7 ")}`,` converts to ${e.targets.join(", ")}`,` actions ${e.actions.join(", ")}`]}import{createInterface as Fe}from"node:readline";import{PassThrough as Je}from"node:stream";function Ne(e){return new Promise(r=>{let t=Fe({input:e,terminal:!1}),o=!1,s=a=>{if(o)return;o=!0,t.close(),e.pause(),e.unref?.(),r(a.replace(/\r$/,""))};t.once("line",s),t.once("close",()=>s(""))})}async function Ce(e){if(e.stdin)return Ne(process.stdin);if(!process.stdin.isTTY)return;let r=new Je,t=Fe({input:process.stdin,output:r,terminal:!0});try{return process.stderr.write("Password: "),await new Promise(o=>t.question("",o))}finally{process.stderr.write(`
|
|
4
|
-
`),t.close()}}function Ae(e){return e.kind==="preset"?e.name:e.kind==="pageop"?"PDF":e.kind==="compress"?"Compress":e.kind==="convert"?"Convert":"Edit"}function A(e){return e.length===0?0:e.some(r=>r.error.code==="invalid-arguments")?2:1}function De(e,r){if(e.action==="merge")return{};if(e.action==="rotate")return{degrees:e.rotate};if(e.action==="extract")return{pages:e.pages,separate:e.separate?"many":"one"};if(e.action==="delete")return{pages:e.pages};let t=r.find(n=>n.kind==="document"),o=t?.pages??0,s=e.split;if(!s)throw N("--split needs a mode: every-page, every=N or at=N,N.");if(s.mode==="every-page")return{cuts:ie(o)};if(s.mode==="every-n")return{cuts:ue(o,s.n)};let a=Math.max(o-1,0);for(let n of s.after)if(!Number.isInteger(n)||n<1||n>a)throw V(String(n),`"${n}" is outside 1 and ${a} \u2014 ${t?w(t.path):"the document"} has ${o} pages.`,o);return{cuts:s.after.map(n=>n-1)}}function We(e,r){let t;return()=>r?(t??=Ce({stdin:e}).then(o=>e&&o===""?void 0:o),t):Promise.resolve(void 0)}async function ze(e,r,t,o){let s;if(e.encrypted){if(s=r.password??await t(),s===void 0)return{failure:{path:e.path,error:J(e.path)}};let i;try{i=await Z(await Te(e.path),s)}catch{return{failure:{path:e.path,error:J(e.path,{attempted:!0})}}}i.destroy()}let a;try{a=O.plan([e],{target:r.target,background:r.options.background,keepMetadata:r.options.keepMetadata,dpi:String(r.dpi??150),...r.options.quality===void 0?{}:{quality:r.options.quality},...r.pages===void 0?{}:{pages:r.pages},...r.output===void 0?{}:{destination:r.output},...o===void 0?{}:{sourceRoot:o}})}catch(i){if(!P(i))throw i;return{failure:{path:e.path,error:i}}}let n=a[0];if(n?.op!=="convert")throw new Error(`convertAction.plan() did not return a convert job for ${e.path}`);return s!==void 0&&(n.options.password=s),{job:n}}function S(e,r){return t=>{if(t.type==="search:attempt"){r||e.onSearch?.(t.rung.dpi===void 0?`attempt ${t.attempt} of ${t.of}`:`${t.rung.dpi} dpi \xB7 attempt ${t.attempt} of ${t.of}`);return}if(t.type==="search:settled"){r&&e.onSearch?.(`${t.completed} of ${t.total} searched`);return}if(!r&&t.type==="job:phase"&&t.progress.phase==="time"){let o=t.progress,s=`${$(o.done)} of ${$(o.total)}`;e.onEncode?.(o.pass?`pass ${o.pass.at} of 2 \xB7 ${s}`:s);return}r&&(t.type==="job:done"||t.type==="job:error")&&e.onProgress?.({completed:t.completed,total:t.total})}}var b=(e,r)=>({kind:e,results:[],failures:r,inputBytes:0,outputBytes:0});async function qe(e){let r=await y(e.inputs,{recursive:!1});if(r.sources.length===0)return b("pageop",r.failures);let t=pe.find(n=>n.id===e.action);if(!t)throw new Error(`no action registered for "${e.action}"`);let o=r.sources[0]?.path??"";if(!t.appliesTo(r.sources)){let n=de(t,r.sources)??"not available for these files";return b("pageop",[...r.failures,{path:o,error:k(e.action,n)}])}let s;try{s=t.plan(r.sources,De(e,r.sources))}catch(n){if(!P(n))throw n;return b("pageop",[...r.failures,{path:o,error:n}])}let a=await I(s,{force:e.force});return{kind:"pageop",results:a.results,failures:[...r.failures,...a.refusals,...a.failures],inputBytes:a.inputBytes,outputBytes:a.outputBytes}}async function Ve(e,r){let t=await y(e.inputs,{recursive:e.recursive}),o=[],s=[];for(let i of t.sources){if(!M.appliesTo([i])){s.push({path:i.path,error:z(i)});continue}let u=e.output!==void 0&&!Y(e.output)?Me(e.output):void 0,f=e.output===void 0||u!==void 0?Oe(i.path):Oe(E({sourcePath:i.path,target:i.format,output:e.output,sourceRoot:t.roots.get(i.path)})),[d]=M.plan([i],{mode:e.maxBytes===void 0?"quality":"size",...e.quality===void 0?{}:{quality:e.quality},...e.options.media??{},destination:f});d?.op==="convert"&&(u!==void 0&&(d.outputs=[u]),e.dpi!==void 0&&(d.options.dpi=e.dpi),o.push(d))}let a=o.length>1;a&&r.onProgress?.({completed:0,total:o.length});let n=await I(o,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},...e.maxBytes===void 0?{}:{targetBytes:e.maxBytes},onEvent:S(r,a)});return{kind:"compress",results:n.results,failures:[...t.failures,...s,...n.refusals,...n.unreachable.map(i=>({path:i.job.sources[0].path,error:i.error})),...n.failures],inputBytes:n.inputBytes,outputBytes:n.outputBytes}}async function Ge(e,r){let t=e.kind,o=e.op==="remove-background"?L(e.target):void 0;if(o)return b(t,[{path:"",error:o}]);let{installed:s}=await import("./paths-6OENILJ4.js"),a=await s(e.op);if(!a)return b(t,[{path:"",error:G(e.op)}]);if(e.op==="boost"&&e.scale!==void 0){let{assetFor:l,catalogEntry:p}=await import("./catalog-FMHWWMUX.js"),m=p("boost"),v=m&&l(m)?.version,D=U(e.scale,a.version,v);if(D)return b(t,[{path:"",error:D}])}let n=await y(e.inputs,{recursive:e.recursive}),i=e.op==="boost"?oe:se,u=[],f=[];for(let l of n.sources){if(!i.appliesTo([l])){f.push({path:l.path,error:k(e.op,"it works on images, not documents","Try an image such as a JPEG, PNG, WebP or HEIC file.")});continue}let p=re(l,e.target);if(p){f.push({path:l.path,error:p});continue}u.push(...i.plan([l],{target:e.target,background:e.options.background,keepMetadata:e.options.keepMetadata,...e.scale===void 0?{}:{scale:e.scale},...e.options.quality===void 0?{}:{quality:e.options.quality},...e.output===void 0?{}:{output:e.output},roots:n.roots}))}let d=u.length>1;d&&r.onProgress?.({completed:0,total:u.length});let c=await I(u,{force:e.force,concurrency:1,...r.signal===void 0?{}:{signal:r.signal},onEvent:S(r,d)});return{kind:t,results:c.results,failures:[...n.failures,...f,...c.refusals,...c.failures],inputBytes:c.inputBytes,outputBytes:c.outputBytes}}async function He(e,r){let t=e.crop!==void 0?"crop":e.resize!==void 0?"resize":"trim",o=e.target===void 0?void 0:be(e.target,t);if(o)return b(e.kind,[{path:"",error:o}]);let s=await y(e.inputs,{recursive:e.recursive}),a=[],n=[],i=[];for(let p of s.sources)p.kind==="image"&&e.media===void 0?a.push(p):p.kind==="media"&&!e.trim?n.push(p):p.kind==="image"?i.push({path:p.path,error:k("cut","it works on video and sound, not images","Try a video or sound file, such as a MOV, MP4 or WAV.")}):i.push({path:p.path,error:k(t,"it works on images, not documents","Try an image such as a JPEG, PNG, WebP or HEIC file.")});let u=ne(n,{...e.media===void 0?{}:{media:e.media},...e.crop===void 0?{}:{crop:e.crop},...e.resize===void 0?{}:{resize:e.resize},...e.target===void 0?{}:{target:e.target},...e.output===void 0?{}:{output:e.output},roots:s.roots}),d=[...ae(a,{trim:e.trim,...e.crop===void 0?{}:{crop:e.crop},...e.resize===void 0?{}:{resize:e.resize},...e.target===void 0?{}:{target:e.target},...e.output===void 0?{}:{output:e.output},roots:s.roots,background:e.options.background,keepMetadata:e.options.keepMetadata,...e.options.quality===void 0?{}:{quality:e.options.quality}}),...u],c=d.length>1;c&&r.onProgress?.({completed:0,total:d.length});let l=await I(d,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},onEvent:S(r,c)});return{kind:e.kind,results:l.results,failures:[...s.failures,...i,...l.refusals,...l.failures],inputBytes:l.inputBytes,outputBytes:l.outputBytes}}async function Le(e,r){let t=await y(e.inputs,{recursive:e.recursive}),o=m=>m.kind==="document"&&m.format==="pdf",s=C(e.target),a=s?t.sources.filter(o):[],n=s?t.sources.filter(m=>!o(m)):t.sources,i=[],u=[],f=We(e.passwordStdin??!1,r.interactive??!0);for(let m of a){let v=await ze(m,e,f,t.roots.get(m.path));"failure"in v?u.push(v.failure):i.push(v.job)}let d=await we({resolved:{sources:n,failures:[],roots:t.roots},target:e.target,options:e.options,force:e.force,...e.output===void 0?{}:{output:e.output}}),c=[...d.jobs,...i],l=c.length>1;l&&r.onProgress?.({completed:0,total:c.length});let p=await I(c,{force:e.force,...e.concurrency===void 0?{}:{concurrency:e.concurrency},...e.maxBytes===void 0?{}:{targetBytes:e.maxBytes},onEvent:S(r,l)});return{kind:"convert",results:p.results,failures:[...t.failures,...u,...d.failures,...p.refusals,...p.unreachable.map(m=>({path:m.job.sources[0].path,error:m.error})),...p.failures],inputBytes:p.inputBytes,outputBytes:p.outputBytes}}async function Ue(e,r={}){try{if(e.kind==="pageop")return await qe(e);if(e.kind==="extension-op")return await Ge(e,r);if(e.kind==="edit")return await He(e,r);if(e.kind==="preset"){let{runPresetCommand:t}=await import("./preset-command-J7RTNKQI.js");return await t(e)}return e.kind==="compress"?await Ve(e,r):await Le(e,r)}catch(t){if(!P(t))throw t;return b(e.kind,[{path:"",error:t}])}}function Ye(e,r){let t=A(e.failures);if(r.json)return{exitCode:t,stdout:[JSON.stringify(fe(g,e))],stderr:[]};let o=e.results.length===0?[]:e.kind==="pageop"?$e(e):e.results.length===1?Pe(e):ke(e);return{exitCode:t,stdout:o,stderr:B(e.failures,{debug:r.debug})}}function Ke(e,r){let t=[{path:"",error:e}],o=A(t);return r.json?{exitCode:o,stdout:[JSON.stringify(le(g,e))],stderr:[]}:{exitCode:o,stdout:[],stderr:B(t,{debug:r.debug})}}async function Qe(e,r){let{runConfig:t}=await import("./config-command-6GXRV627.js"),o=await t(e);return r?{exitCode:0,stdout:[JSON.stringify(he(g,o.config,o.warnings))],stderr:[]}:{exitCode:0,stdout:o.stdout,stderr:[]}}async function zt(e,r={}){let t=r.json??!1,o="debug"in e?e.debug:!1;try{if(e.kind==="config")return await Qe(e,t);if(e.kind==="clip"){let{runClipCommand:n}=await import("./clip-command-S4JYPD6N.js");return await n(e,{...r,json:t,debug:o})}if(e.kind==="update"){let{runUpdate:n}=await import("./update-command-DJLYU6AB.js"),i=await n(g,{...r.onInstalling?{onInstalling:r.onInstalling}:{}});return{exitCode:0,stdout:t?[JSON.stringify({forge:g,ok:!0,...i.data})]:i.stdout,stderr:[]}}if(e.kind==="uninstall"){let{runUninstall:n}=await import("./entry-RDY5AQA5.js"),i=[];return{exitCode:await n(g,f=>i.push(f)),stdout:i,stderr:[]}}if(e.kind==="extensions"){let{runExtensions:n}=await import("./extensions-command-VT5CGCL5.js"),i=await n(e,{onDownload:r.onDownload});return{exitCode:0,stdout:t?[JSON.stringify(ye(g,i.data))]:i.stdout,stderr:[]}}if(e.kind==="formats")return t?{exitCode:0,stdout:[JSON.stringify(me(g,te()))],stderr:[]}:{exitCode:0,stdout:Re(),stderr:[]};if(e.kind==="probe"){let{probes:n,failures:i}=await Ie(e.inputs),u=A(i);return t?{exitCode:u,stdout:[JSON.stringify(ge(g,{probes:n,failures:i}))],stderr:[]}:{exitCode:u,stdout:n.flatMap((f,d)=>[...d>0?[""]:[],...Ee(f)]),stderr:B(i,{debug:o})}}if(e.kind==="palette"||e.kind==="scale"){let{runPalette:n,runScale:i}=await import("./colour-PXJ2VKHU.js"),u={json:t,colour:r.colour??!1};return e.kind==="palette"?await n(e,u):await i(e,u)}if(e.kind==="transcribe"){let{runTranscribeCommand:n}=await import("./transcribe-command-TMM4RLJD.js"),i=[],u=[],f;return{exitCode:await n(e,{out:c=>i.push(c),err:c=>u.push(c),finished:c=>{f=T("Transcribe",c)}}),stdout:i,stderr:u,...f?{notice:f}:{}}}if(e.kind==="shell")return{exitCode:0,stdout:[],stderr:[]};if(e.kind==="watch")throw N("forge watch runs in a terminal until ctrl-c.","Try: forge watch ./images --to webp");let s=await Ue(e,r),a=T(Ae(e),X(s.results,s.failures));return{...Ye(s,{json:t,debug:o}),...a?{notice:a}:{}}}catch(s){if(!P(s))throw s;return Ke(s,{json:t,debug:o})}}export{Ie as a,xe as b,A as c,Ue as d,Ye as e,zt as f};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
-
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{d as t,g as p}from"./chunk-QVACE4IE.js";var h={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},y={"cloudy blue":"#acc2d9","dark pastel green":"#56ae57",dust:"#b2996e","electric lime":"#a8ff04","fresh green":"#69d84f","light eggplant":"#894585","nasty green":"#70b23f","really light blue":"#d4ffff",tea:"#65ab7c","warm purple":"#952e8f","yellowish tan":"#fcfc81",cement:"#a5a391","dark grass green":"#388004","dusty teal":"#4c9085","grey teal":"#5e9b8a","macaroni and cheese":"#efb435","pinkish tan":"#d99b82",spruce:"#0a5f38","strong blue":"#0c06f7","toxic green":"#61de2a","windows blue":"#3778bf","blue blue":"#2242c7","blue with a hint of purple":"#533cc6",booger:"#9bb53c","bright sea green":"#05ffa6","dark green blue":"#1f6357","deep turquoise":"#017374","green teal":"#0cb577","strong pink":"#ff0789",bland:"#afa88b","deep aqua":"#08787f","lavender pink":"#dd85d7","light moss green":"#a6c875","light seafoam green":"#a7ffb5","olive yellow":"#c2b709","pig pink":"#e78ea5","deep lilac":"#966ebd",desert:"#ccad60","dusty lavender":"#ac86a8","purpley grey":"#947e94",purply:"#983fb2","candy pink":"#ff63e9","light pastel green":"#b2fba5","boring green":"#63b365","kiwi green":"#8ee53f","light grey green":"#b7e1a1","orange pink":"#ff6f52","tea green":"#bdf8a3","very light brown":"#d3b683","egg shell":"#fffcc4","eggplant purple":"#430541","powder pink":"#ffb2d0","reddish grey":"#997570","baby shit brown":"#ad900d",liliac:"#c48efd","stormy blue":"#507b9c","ugly brown":"#7d7103",custard:"#fffd78","darkish pink":"#da467d","deep brown":"#410200","greenish beige":"#c9d179",manilla:"#fffa86","off blue":"#5684ae","battleship grey":"#6b7c85","browny green":"#6f6c0a",bruise:"#7e4071","kelley green":"#009337","sickly yellow":"#d0e429","sunny yellow":"#fff917",azul:"#1d5dec",darkgreen:"#054907","green/yellow":"#b5ce08",lichen:"#8fb67b","light light green":"#c8ffb0","pale gold":"#fdde6c","sun yellow":"#ffdf22","tan green":"#a9be70",burple:"#6832e3",butterscotch:"#fdb147",toupe:"#c7ac7d","dark cream":"#fff39a","indian red":"#850e04","light lavendar":"#efc0fe","poison green":"#40fd14","baby puke green":"#b6c406","bright yellow green":"#9dff00","charcoal grey":"#3c4142",squash:"#f2ab15",cinnamon:"#ac4f06","light pea green":"#c4fe82","radioactive green":"#2cfa1f","raw sienna":"#9a6200","baby purple":"#ca9bf7",cocoa:"#875f42","light royal blue":"#3a2efe",orangeish:"#fd8d49","rust brown":"#8b3103","sand brown":"#cba560",swamp:"#698339","tealish green":"#0cdc73","burnt siena":"#b75203",camo:"#7f8f4e","dusk blue":"#26538d",fern:"#63a950","old rose":"#c87f89","pale light green":"#b1fc99","peachy pink":"#ff9a8a","rosy pink":"#f6688e","light bluish green":"#76fda8","light bright green":"#53fe5c","light neon green":"#4efd54","light seafoam":"#a0febf","tiffany blue":"#7bf2da","washed out green":"#bcf5a6","browny orange":"#ca6b02","nice blue":"#107ab0",sapphire:"#2138ab","greyish teal":"#719f91","orangey yellow":"#fdb915",parchment:"#fefcaf",straw:"#fcf679","very dark brown":"#1d0200",terracota:"#cb6843","ugly blue":"#31668a","clear blue":"#247afd",creme:"#ffffb6","foam green":"#90fda9","grey/green":"#86a17d","light gold":"#fddc5c","seafoam blue":"#78d1b6",topaz:"#13bbaf","violet pink":"#fb5ffc",wintergreen:"#20f986","yellow tan":"#ffe36e","dark fuchsia":"#9d0759","indigo blue":"#3a18b1","light yellowish green":"#c2ff89","pale magenta":"#d767ad","rich purple":"#720058","sunflower yellow":"#ffda03","green/blue":"#01c08d",leather:"#ac7434","racing green":"#014600","vivid purple":"#9900fa","dark royal blue":"#02066f",hazel:"#8e7618","muted pink":"#d1768f","booger green":"#96b403",canary:"#fdff63","cool grey":"#95a3a6","dark taupe":"#7f684e","darkish purple":"#751973","true green":"#089404","coral pink":"#ff6163","dark sage":"#598556","dark slate blue":"#214761","flat blue":"#3c73a8",mushroom:"#ba9e88","rich blue":"#021bf9","dirty purple":"#734a65",greenblue:"#23c48b","icky green":"#8fae22","light khaki":"#e6f2a2","warm blue":"#4b57db","dark hot pink":"#d90166","deep sea blue":"#015482",carmine:"#9d0216","dark yellow green":"#728f02","pale peach":"#ffe5ad","plum purple":"#4e0550","golden rod":"#f9bc08","neon red":"#ff073a","old pink":"#c77986","very pale blue":"#d6fffe","blood orange":"#fe4b03",grapefruit:"#fd5956","sand yellow":"#fce166","clay brown":"#b2713d","dark blue grey":"#1f3b4d","flat green":"#699d4c","light green blue":"#56fca2","warm pink":"#fb5581","dodger blue":"#3e82fc","gross green":"#a0bf16",ice:"#d6fffa","metallic blue":"#4f738e","pale salmon":"#ffb19a","sap green":"#5c8b15",algae:"#54ac68","bluey grey":"#89a0b0","greeny grey":"#7ea07a","highlighter green":"#1bfc06","light light blue":"#cafffb","light mint":"#b6ffbb","raw umber":"#a75e09","vivid blue":"#152eff","deep lavender":"#8d5eb7","dull teal":"#5f9e8f","light greenish blue":"#63f7b4","mud green":"#606602",pinky:"#fc86aa","red wine":"#8c0034","shit green":"#758000","tan brown":"#ab7e4c",darkblue:"#030764",rosa:"#fe86a4",lipstick:"#d5174e","pale mauve":"#fed0fc",claret:"#680018",dandelion:"#fedf08",orangered:"#fe420f","poop green":"#6f7c00",ruby:"#ca0147",dark:"#1b2431","greenish turquoise":"#00fbb0","pastel red":"#db5856","piss yellow":"#ddd618","bright cyan":"#41fdfe","dark coral":"#cf524e","algae green":"#21c36f","darkish red":"#a90308","reddy brown":"#6e1005","blush pink":"#fe828c","camouflage green":"#4b6113","lawn green":"#4da409",putty:"#beae8a","vibrant blue":"#0339f8","dark sand":"#a88f59","purple/blue":"#5d21d0",saffron:"#feb209",twilight:"#4e518b","warm brown":"#964e02",bluegrey:"#85a3b2","bubble gum pink":"#ff69af","duck egg blue":"#c3fbf4","greenish cyan":"#2afeb7",petrol:"#005f6a",royal:"#0c1793",butter:"#ffff81","dusty orange":"#f0833a","off yellow":"#f1f33f","pale olive green":"#b1d27b",orangish:"#fc824a",leaf:"#71aa34","light blue grey":"#b7c9e2","dried blood":"#4b0101","lightish purple":"#a552e6","rusty red":"#af2f0d","lavender blue":"#8b88f8","light grass green":"#9af764","light mint green":"#a6fbb2",sunflower:"#ffc512",velvet:"#750851","brick orange":"#c14a09","lightish red":"#fe2f4a","pure blue":"#0203e2","twilight blue":"#0a437a","violet red":"#a50055","yellowy brown":"#ae8b0c",carnation:"#fd798f","muddy yellow":"#bfac05","dark seafoam green":"#3eaf76","deep rose":"#c74767","dusty red":"#b9484e","grey/blue":"#647d8e","lemon lime":"#bffe28","purple/pink":"#d725de","brown yellow":"#b29705","purple brown":"#673a3f",wisteria:"#a87dc2","banana yellow":"#fafe4b","lipstick red":"#c0022f","water blue":"#0e87cc","brown grey":"#8d8468","vibrant purple":"#ad03de","baby green":"#8cff9e","barf green":"#94ac02","eggshell blue":"#c4fff7","sandy yellow":"#fdee73","cool green":"#33b864",pale:"#fff9d0","blue/grey":"#758da3","hot magenta":"#f504c9",greyblue:"#77a1b5",purpley:"#8756e4","baby shit green":"#889717","brownish pink":"#c27e79","dark aquamarine":"#017371",diarrhea:"#9f8303","light mustard":"#f7d560","pale sky blue":"#bdf6fe","turtle green":"#75b84f","bright olive":"#9cbb04","dark grey blue":"#29465b","greeny brown":"#696006","lemon green":"#adf802","light periwinkle":"#c1c6fc","seaweed green":"#35ad6b","sunshine yellow":"#fffd37","ugly purple":"#a442a0","medium pink":"#f36196","puke brown":"#947706","very light pink":"#fff4f2",viridian:"#1e9167",bile:"#b5c306","faded yellow":"#feff7f","very pale green":"#cffdbc","vibrant green":"#0add08","bright lime":"#87fd05",spearmint:"#1ef876","light aquamarine":"#7bfdc7","light sage":"#bcecac",yellowgreen:"#bbf90f","baby poo":"#ab9004","dark seafoam":"#1fb57a","deep teal":"#00555a",heather:"#a484ac","rust orange":"#c45508","dirty blue":"#3f829d","fern green":"#548d44","bright lilac":"#c95efb","weird green":"#3ae57f","peacock blue":"#016795","avocado green":"#87a922","faded orange":"#f0944d","grape purple":"#5d1451","hot green":"#25ff29","lime yellow":"#d0fe1d",mango:"#ffa62b",shamrock:"#01b44c",bubblegum:"#ff6cb5","purplish brown":"#6b4247","vomit yellow":"#c7c10c","pale cyan":"#b7fffa","key lime":"#aeff6e","tomato red":"#ec2d01",lightgreen:"#76ff7b",merlot:"#730039","night blue":"#040348","purpleish pink":"#df4ec8",apple:"#6ecb3c","baby poop green":"#8f9805","green apple":"#5edc1f",heliotrope:"#d94ff5","yellow/green":"#c8fd3d","almost black":"#070d0d","cool blue":"#4984b8","leafy green":"#51b73b","mustard brown":"#ac7e04",dusk:"#4e5481","dull brown":"#876e4b","frog green":"#58bc08","vivid green":"#2fef10","bright light green":"#2dfe54","fluro green":"#0aff02",kiwi:"#9cef43",seaweed:"#18d17b","navy green":"#35530a","ultramarine blue":"#1805db",iris:"#6258c4","pastel orange":"#ff964f","yellowish orange":"#ffab0f",perrywinkle:"#8f8ce7",tealish:"#24bca8","dark plum":"#3f012c",pear:"#cbf85f","pinkish orange":"#ff724c","midnight purple":"#280137","light urple":"#b36ff6","dark mint":"#48c072","greenish tan":"#bccb7a","light burgundy":"#a8415b","turquoise blue":"#06b1c4","ugly pink":"#cd7584",sandy:"#f1da7a","electric pink":"#ff0490","muted purple":"#805b87","mid green":"#50a747",greyish:"#a8a495","neon yellow":"#cfff04",banana:"#ffff7e","carnation pink":"#ff7fa7",tomato:"#ef4026",sea:"#3c9992","muddy brown":"#886806","turquoise green":"#04f489",buff:"#fef69e",fawn:"#cfaf7b","muted blue":"#3b719f","pale rose":"#fdc1c5","dark mint green":"#20c073",amethyst:"#9b5fc0","blue/green":"#0f9b8e",chestnut:"#742802","sick green":"#9db92c",pea:"#a4bf20","rusty orange":"#cd5909",stone:"#ada587","rose red":"#be013c","pale aqua":"#b8ffeb","deep orange":"#dc4d01",earth:"#a2653e","mossy green":"#638b27","grassy green":"#419c03","pale lime green":"#b1ff65","light grey blue":"#9dbcd4","pale grey":"#fdfdfe",asparagus:"#77ab56",blueberry:"#464196","purple red":"#990147","pale lime":"#befd73","greenish teal":"#32bf84",caramel:"#af6f09","deep magenta":"#a0025c","light peach":"#ffd8b1","milk chocolate":"#7f4e1e",ocher:"#bf9b0c","off green":"#6ba353","purply pink":"#f075e6",lightblue:"#7bc8f6","dusky blue":"#475f94",golden:"#f5bf03","light beige":"#fffeb6","butter yellow":"#fffd74","dusky purple":"#895b7b","french blue":"#436bad","ugly yellow":"#d0c101","greeny yellow":"#c6f808","orangish red":"#f43605","shamrock green":"#02c14d","orangish brown":"#b25f03","tree green":"#2a7e19","deep violet":"#490648",gunmetal:"#536267","blue/purple":"#5a06ef",cherry:"#cf0234","sandy brown":"#c4a661","warm grey":"#978a84","dark indigo":"#1f0954",midnight:"#03012d","bluey green":"#2bb179","grey pink":"#c3909b","soft purple":"#a66fb5",blood:"#770001","brown red":"#922b05","medium grey":"#7d7f7c",berry:"#990f4b",poo:"#8f7303","purpley pink":"#c83cb9","light salmon":"#fea993",snot:"#acbb0d","easter purple":"#c071fe","light yellow green":"#ccfd7f","dark navy blue":"#00022e",drab:"#828344","light rose":"#ffc5cb",rouge:"#ab1239","purplish red":"#b0054b","slime green":"#99cc04","baby poop":"#937c00","irish green":"#019529","pink/purple":"#ef1de7","dark navy":"#000435","greeny blue":"#42b395","light plum":"#9d5783","pinkish grey":"#c8aca9","dirty orange":"#c87606","rust red":"#aa2704","pale lilac":"#e4cbff","orangey red":"#fa4224","primary blue":"#0804f9","kermit green":"#5cb200","brownish purple":"#76424e","murky green":"#6c7a0e",wheat:"#fbdd7e","very dark purple":"#2a0134","bottle green":"#044a05",watermelon:"#fd4659","deep sky blue":"#0d75f8","fire engine red":"#fe0002","yellow ochre":"#cb9d06","pumpkin orange":"#fb7d07","pale olive":"#b9cc81","light lilac":"#edc8ff","lightish green":"#61e160","carolina blue":"#8ab8fe",mulberry:"#920a4e","shocking pink":"#fe02a2",auburn:"#9a3001","bright lime green":"#65fe08",celadon:"#befdb7","pinkish brown":"#b17261","poo brown":"#885f01","bright sky blue":"#02ccfe",celery:"#c1fd95","dirt brown":"#836539",strawberry:"#fb2943","dark lime":"#84b701",copper:"#b66325","medium brown":"#7f5112","muted green":"#5fa052","robin's egg":"#6dedfd","bright aqua":"#0bf9ea","bright lavender":"#c760ff",ivory:"#ffffcb","very light purple":"#f6cefc","light navy":"#155084","pink red":"#f5054f","olive brown":"#645403","poop brown":"#7a5901","mustard green":"#a8b504","ocean green":"#3d9973","very dark blue":"#000133","dusty green":"#76a973","light navy blue":"#2e5a88","minty green":"#0bf77d",adobe:"#bd6c48",barney:"#ac1db8","jade green":"#2baf6a","bright light blue":"#26f7fd","light lime":"#aefd6c","dark khaki":"#9b8f55","orange yellow":"#ffad01",ocre:"#c69c04",maize:"#f4d054","faded pink":"#de9dac","british racing green":"#05480d",sandstone:"#c9ae74","mud brown":"#60460f","light sea green":"#98f6b0","robin egg blue":"#8af1fe","aqua marine":"#2ee8bb","dark sea green":"#11875d","soft pink":"#fdb0c0","orangey brown":"#b16002","cherry red":"#f7022a","burnt yellow":"#d5ab09","brownish grey":"#86775f",camel:"#c69f59","purplish grey":"#7a687f",marine:"#042e60","greyish pink":"#c88d94","pale turquoise":"#a5fbd5","pastel yellow":"#fffe71","bluey purple":"#6241c7","canary yellow":"#fffe40","faded red":"#d3494e",sepia:"#985e2b",coffee:"#a6814c","bright magenta":"#ff08e8",mocha:"#9d7651",ecru:"#feffca",purpleish:"#98568d",cranberry:"#9e003a","darkish green":"#287c37","brown orange":"#b96902","dusky rose":"#ba6873",melon:"#ff7855","sickly green":"#94b21c",silver:"#c5c9c7","purply blue":"#661aee","purpleish blue":"#6140ef","hospital green":"#9be5aa","shit brown":"#7b5804","mid blue":"#276ab3",amber:"#feb308","easter green":"#8cfd7e","soft blue":"#6488ea","cerulean blue":"#056eee","golden brown":"#b27a01","bright turquoise":"#0ffef9","red pink":"#fa2a55","red purple":"#820747","greyish brown":"#7a6a4f",vermillion:"#f4320c",russet:"#a13905","steel grey":"#6f828a","lighter purple":"#a55af4","bright violet":"#ad0afd","prussian blue":"#004577","slate green":"#658d6d","dirty pink":"#ca7b80","dark blue green":"#005249",pine:"#2b5d34","yellowy green":"#bff128","dark gold":"#b59410",bluish:"#2976bb","darkish blue":"#014182","dull red":"#bb3f3f","pinky red":"#fc2647",bronze:"#a87900","pale teal":"#82cbb2","military green":"#667c3e","barbie pink":"#fe46a5","bubblegum pink":"#fe83cc","pea soup green":"#94a617","dark mustard":"#a88905",shit:"#7f5f00","medium purple":"#9e43a2","very dark green":"#062e03",dirt:"#8a6e45","dusky pink":"#cc7a8b","red violet":"#9e0168","lemon yellow":"#fdff38",pistachio:"#c0fa8b","dull yellow":"#eedc5b","dark lime green":"#7ebd01","denim blue":"#3b5b92","teal blue":"#01889f","lightish blue":"#3d7afd","purpley blue":"#5f34e7","light indigo":"#6d5acf","swamp green":"#748500","brown green":"#706c11","dark maroon":"#3c0008","hot purple":"#cb00f5","dark forest green":"#002d04","faded blue":"#658cbb","drab green":"#749551","light lime green":"#b9ff66","snot green":"#9dc100",yellowish:"#faee66","light blue green":"#7efbb3",bordeaux:"#7b002c","light mauve":"#c292a1",ocean:"#017b92",marigold:"#fcc006","muddy green":"#657432","dull orange":"#d8863b",steel:"#738595","electric purple":"#aa23ff","fluorescent green":"#08ff08","yellowish brown":"#9b7a01",blush:"#f29e8e","soft green":"#6fc276","bright orange":"#ff5b00",lemon:"#fdff52","purple grey":"#866f85","acid green":"#8ffe09","pale lavender":"#eecffe","violet blue":"#510ac9","light forest green":"#4f9153","burnt red":"#9f2305","khaki green":"#728639",cerise:"#de0c62","faded purple":"#916e99",apricot:"#ffb16d","dark olive green":"#3c4d03","grey brown":"#7f7053","green grey":"#77926f","true blue":"#010fcc","pale violet":"#ceaefa","periwinkle blue":"#8f99fb","light sky blue":"#c6fcff",blurple:"#5539cc","green brown":"#544e03",bluegreen:"#017a79","bright teal":"#01f9c6","brownish yellow":"#c9b003","pea soup":"#929901",forest:"#0b5509","barney purple":"#a00498",ultramarine:"#2000b1",purplish:"#94568c","puke yellow":"#c2be0e","bluish grey":"#748b97","dark periwinkle":"#665fd1","dark lilac":"#9c6da5",reddish:"#c44240","light maroon":"#a24857","dusty purple":"#825f87","terra cotta":"#c9643b",avocado:"#90b134","marine blue":"#01386a","teal green":"#25a36f","slate grey":"#59656d","lighter green":"#75fd63","electric green":"#21fc0d","dusty blue":"#5a86ad","golden yellow":"#fec615","bright yellow":"#fffd01","light lavender":"#dfc5fe",umber:"#b26400",poop:"#7f5e00","dark peach":"#de7e5d","jungle green":"#048243",eggshell:"#ffffd4",denim:"#3b638c","yellow brown":"#b79400","dull purple":"#84597e","chocolate brown":"#411900","wine red":"#7b0323","neon blue":"#04d9ff","dirty green":"#667e2c","light tan":"#fbeeac","ice blue":"#d7fffe","cadet blue":"#4e7496","dark mauve":"#874c62","very light blue":"#d5ffff","grey purple":"#826d8c","pastel pink":"#ffbacd","very light green":"#d1ffbd","dark sky blue":"#448ee4",evergreen:"#05472a","dull pink":"#d5869d",aubergine:"#3d0734",mahogany:"#4a0100","reddish orange":"#f8481c","deep green":"#02590f","vomit green":"#89a203","purple pink":"#e03fd8","dusty pink":"#d58a94","faded green":"#7bb274","camo green":"#526525","pinky purple":"#c94cbe","pink purple":"#db4bda","brownish red":"#9e3623","dark rose":"#b5485d",mud:"#735c12",brownish:"#9c6d57","emerald green":"#028f1e","pale brown":"#b1916e","dull blue":"#49759c","burnt umber":"#a0450e","medium green":"#39ad48",clay:"#b66a50","light aqua":"#8cffdb","light olive green":"#a4be5c","brownish orange":"#cb7723","dark aqua":"#05696b","purplish pink":"#ce5dae","dark salmon":"#c85a53","greenish grey":"#96ae8d",jade:"#1fa774","ugly green":"#7a9703","dark beige":"#ac9362",emerald:"#01a049","pale red":"#d9544d","light magenta":"#fa5ff7",sky:"#82cafc","light cyan":"#acfffc","yellow orange":"#fcb001","reddish purple":"#910951","reddish pink":"#fe2c54",orchid:"#c875c4","dirty yellow":"#cdc50a","orange red":"#fd411e","deep red":"#9a0200","orange brown":"#be6400","cobalt blue":"#030aa7","neon pink":"#fe019a","rose pink":"#f7879a","greyish purple":"#887191",raspberry:"#b00149","aqua green":"#12e193","salmon pink":"#fe7b7c",tangerine:"#ff9408","brownish green":"#6a6e09","red brown":"#8b2e16","greenish brown":"#696112",pumpkin:"#e17701","pine green":"#0a481e",charcoal:"#343837","baby pink":"#ffb7ce",cornflower:"#6a79f7","blue violet":"#5d06e9",chocolate:"#3d1c02","greyish green":"#82a67d",scarlet:"#be0119","green yellow":"#c9ff27","dark olive":"#373e02",sienna:"#a9561e","pastel purple":"#caa0ff",terracotta:"#ca6641","aqua blue":"#02d8e9","sage green":"#88b378","blood red":"#980002","deep pink":"#cb0162",grass:"#5cac2d",moss:"#769958","pastel blue":"#a2bffe","bluish green":"#10a674","green blue":"#06b48b","dark tan":"#af884a","greenish blue":"#0b8b87","pale orange":"#ffa756",vomit:"#a2a415","forrest green":"#154406","dark lavender":"#856798","dark violet":"#34013f","purple blue":"#632de9","dark cyan":"#0a888a","olive drab":"#6f7632",pinkish:"#d46a7e",cobalt:"#1e488f","neon purple":"#bc13fe","light turquoise":"#7ef4cc","apple green":"#76cd26","dull green":"#74a662",wine:"#80013f","powder blue":"#b1d1fc","off white":"#ffffe4","electric blue":"#0652ff","dark turquoise":"#045c5a","blue purple":"#5729ce",azure:"#069af3","bright red":"#ff000d","pinkish red":"#f10c45","cornflower blue":"#5170d7","light olive":"#acbf69",grape:"#6c3461","greyish blue":"#5e819d","purplish blue":"#601ef9","yellowish green":"#b0dd16","greenish yellow":"#cdfd02","medium blue":"#2c6fbb","dusty rose":"#c0737a","light violet":"#d6b4fc","midnight blue":"#020035","bluish purple":"#703be7","red orange":"#fd3c06","dark magenta":"#960056",greenish:"#40a368","ocean blue":"#03719c",coral:"#fc5a50",cream:"#ffffc2","reddish brown":"#7f2b0a","burnt sienna":"#b04e0f",brick:"#a03623",sage:"#87ae73","grey green":"#789b73",white:"#ffffff","robin's egg blue":"#98eff9","moss green":"#658b38","steel blue":"#5a7d9a",eggplant:"#380835","light yellow":"#fffe7a","leaf green":"#5ca904","light grey":"#d8dcd6",puke:"#a5a502","pinkish purple":"#d648d7","sea blue":"#047495","pale purple":"#b790d4","slate blue":"#5b7c99","blue grey":"#607c8e","hunter green":"#0b4008",fuchsia:"#ed0dd9",crimson:"#8c000f","pale yellow":"#ffff84",ochre:"#bf9005","mustard yellow":"#d2bd0a","light red":"#ff474c",cerulean:"#0485d1","pale pink":"#ffcfdc","deep blue":"#040273",rust:"#a83c09","light teal":"#90e4c1",slate:"#516572",goldenrod:"#fac205","dark yellow":"#d5b60a","dark grey":"#363737","army green":"#4b5d16","grey blue":"#6b8ba4",seafoam:"#80f9ad",puce:"#a57e52","spring green":"#a9f971","dark orange":"#c65102",sand:"#e2ca76","pastel green":"#b0ff9d",mint:"#9ffeb0","light orange":"#fdaa48","bright pink":"#fe01b1",chartreuse:"#c1f80a","deep purple":"#36013f","dark brown":"#341c02",taupe:"#b9a281","pea green":"#8eab12","puke green":"#9aae07","kelly green":"#02ab2e","seafoam green":"#7af9ab","blue green":"#137e6d",khaki:"#aaa662",burgundy:"#610023","dark teal":"#014d4e","brick red":"#8f1402","royal purple":"#4b006e",plum:"#580f41","mint green":"#8fff9f",gold:"#dbb40c","baby blue":"#a2cffe","yellow green":"#c0fb2d","bright purple":"#be03fd","dark red":"#840000","pale blue":"#d0fefe","grass green":"#3f9b0b",navy:"#01153e",aquamarine:"#04d8b2","burnt orange":"#c04e01","neon green":"#0cff0c","bright blue":"#0165fc",rose:"#cf6275","light pink":"#ffd1df",mustard:"#ceb301",indigo:"#380282",lime:"#aaff32","sea green":"#53fca1",periwinkle:"#8e82fe","dark pink":"#cb416b","olive green":"#677a04",peach:"#ffb07c","pale green":"#c7fdb5","light brown":"#ad8150","hot pink":"#ff028d",black:"#000000",lilac:"#cea2fd","navy blue":"#001146","royal blue":"#0504aa",beige:"#e6daa6",salmon:"#ff796c",olive:"#6e750e",maroon:"#650021","bright green":"#01ff07","dark purple":"#35063e",mauve:"#ae7181","forest green":"#06470c",aqua:"#13eac9",cyan:"#00ffff",tan:"#d1b26f","dark blue":"#00035b",lavender:"#c79fef",turquoise:"#06c2ac","dark green":"#033500",violet:"#9a0eea","light purple":"#bf77f6","lime green":"#89fe05",grey:"#929591","sky blue":"#75bbfd",yellow:"#ffff14",magenta:"#c20078","light green":"#96f97b",orange:"#f97306",teal:"#029386","light blue":"#95d0fc",red:"#e50000",brown:"#653700",pink:"#ff81c0",blue:"#0343df",green:"#15b01a",purple:"#7e1e9c"};function A(e){let a=e.trim().toLowerCase().replace(/\s+/g," ");if(a!=="")return q(a)??C(a)??z(a)}function q(e){let a=/^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(e);if(!a)return;let r=a[1],l=r.length<=4?[...r].map(f=>f+f).join(""):r,n=f=>Number.parseInt(l.slice(f,f+2),16),d={r:n(0),g:n(2),b:n(4)};return l.length===8?{rgb:d,alpha:n(6)/255}:{rgb:d}}function m(e){let a=/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(%|deg|grad|rad|turn)?$/.exec(e);return a?{n:Number(a[1]),unit:a[2]??""}:void 0}var b=(e,a,r)=>e>=a&&e<=r?e:void 0;function M(e){return e.unit==="%"?b(e.n/100,0,1):e.unit===""?b(e.n,0,1):void 0}function o(e){return e.unit==="%"?b(e.n,0,100)===void 0?void 0:Math.round(e.n*2.55):e.unit===""&&b(e.n,0,255)!==void 0?Math.round(e.n):void 0}function k(e){let r={"":1,deg:1,grad:.9,rad:180/Math.PI,turn:360}[e.unit];return r===void 0?void 0:(e.n*r%360+360)%360}function w(e){return e.unit==="%"?b(e.n/100,0,1):void 0}function v(e){return e.unit==="%"?b(e.n/100,0,1):e.unit===""?b(e.n,0,1):void 0}function s(e){return e.unit==="%"?e.n/100*.4:e.unit===""?e.n:void 0}function x(e,a){let r,l;if(e.includes(",")){if(!a||e.includes("/")||(r=e.split(",").map(f=>f.trim()),r.some(f=>f===""||f.includes(" "))))return;r.length===4&&(l=r.pop())}else{let f=e.split("/").map(u=>u.trim());if(f.length>2||(r=f[0].split(" ").filter(u=>u!==""),f.length===2&&(l=f[1],l===""||l.includes(" "))))return}if(r.length!==3)return;let n=r.map(m);if(n.some(f=>f===void 0))return;if(l===void 0)return{parts:n};let d=m(l);return d?{parts:n,alpha:d}:void 0}function R(e,a,r){let l=n=>{let d=(n+e/30)%12;return r-a*Math.min(r,1-r)*Math.max(-1,Math.min(d-3,9-d,1))};return{r:Math.round(l(0)*255),g:Math.round(l(8)*255),b:Math.round(l(4)*255)}}function C(e){let a=/^([a-z]+) ?\((.*)\)$/.exec(e);if(!a)return;let r=a[1],l=a[2],n=x(l,r==="rgb"||r==="rgba"||r==="hsl"||r==="hsla");if(!n)return;let[d,f,u]=n.parts,c;if(n.alpha&&(c=M(n.alpha),c===void 0))return;let g=S(r,d,f,u);if(g)return c===void 0?{rgb:g}:{rgb:g,alpha:c}}function S(e,a,r,l){switch(e){case"rgb":case"rgba":{let n=o(a),d=o(r),f=o(l);return n===void 0||d===void 0||f===void 0?void 0:{r:n,g:d,b:f}}case"hsl":case"hsla":{let n=k(a),d=w(r),f=w(l);return n===void 0||d===void 0||f===void 0?void 0:R(n,d,f)}case"oklch":{let n=v(a),d=s(r),f=k(l);return n===void 0||d===void 0||d<0||f===void 0?void 0:t(p({L:n,C:d,h:f}))}case"oklab":{let n=v(a),d=s(r),f=s(l);return n===void 0||d===void 0||f===void 0?void 0:t({L:n,a:d,b:f})}default:return}}var N=e=>e.toLowerCase().replace(/[\s_-]+/g,""),i;function j(){if(i)return i;i=new Map;for(let e of[h,y])for(let[a,r]of Object.entries(e)){let l=N(a);i.has(l)||i.set(l,r)}return i}function z(e){let a=j().get(N(e)),r=a===void 0?void 0:q(a)?.rgb;return r&&{rgb:r}}export{A as a};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
-
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as $,h as at,i as _}from"./chunk-VTA6Z45X.js";import{b as d,c as R,d as P,f as v,g as H,h as X}from"./chunk-QVACE4IE.js";import{j as st}from"./chunk-7WZYTDFI.js";import{g as ot}from"./chunk-7KYO62XK.js";import{a as tt,j as et,t as nt}from"./chunk-CVNYUROW.js";import{a as Z}from"./chunk-H3DIRJFE.js";import{b as rt}from"./chunk-KXKQDFHX.js";var xt=[[15,"rose"],[45,"red"],[70,"orange"],[95,"amber"],[120,"yellow"],[140,"lime"],[165,"green"],[185,"teal"],[215,"cyan"],[250,"sky"],[280,"blue"],[295,"indigo"],[315,"violet"],[340,"purple"],[355,"pink"],[360,"rose"]];function w(t){let{C:e,h:n}=v(R(t));return e<.03?"grey":D(n)}function D(t){let e=(t%360+360)%360;return(xt.find(([n])=>e<n)??[360,"rose"])[1]}var Ft=["full","mono","analogous","opposite","split","triad","pastel"],it={full:"Full set",mono:"Monochromatic",analogous:"Analogous",opposite:"Complementary",split:"Split complementary",triad:"Triadic",pastel:"Pastel"},B={brightness:0,saturation:0,hue:0,contrast:0},vt=t=>!!(t.brightness||t.saturation||t.hue||t.contrast),G=[{name:"red",hex:{r:251,g:44,b:54},role:"danger"},{name:"orange",hex:{r:255,g:105,b:0}},{name:"yellow",hex:{r:239,g:177,b:0},role:"warning"},{name:"green",hex:{r:0,g:201,b:80},role:"success"},{name:"teal",hex:{r:0,g:187,b:167}},{name:"blue",hex:{r:43,g:127,b:255},role:"info"},{name:"purple",hex:{r:173,g:70,b:255}},{name:"pink",hex:{r:246,g:51,b:154}}],bt={analogous:[-30,0,30],opposite:[0,180],split:[0,150,210],triad:[0,120,240]},dt=.553,$t=.024,b=t=>v(R(t)),C=(t,e,n)=>P(H({L:t,C:Math.max(0,e),h:(n+360)%360})),K=(t,e)=>(t-e+540)%360-180;function lt(t,e,n){let r=H({L:t,C:e,h:n}),o=R(P(r));return Math.hypot(o.L-r.L,o.a-r.a,o.b-r.b)<.003}function L(t,e){let n=0,r=.4;for(let o=0;o<30;o++){let a=(n+r)/2;lt(t,a,e)?n=a:r=a}return n}function W({L:t,C:e,h:n}){let r=L(t,n);return r>0?Math.min(1,e/r):0}var A=(t,e)=>e>=0?t+(.98-t)*(e/100):t+(t-.05)*(e/100),q=(t,e,n)=>n>=0?t+(Math.max(t,e)-t)*(n/100):t*(1+n/100);function T(t,e){if(!(e.brightness||e.saturation||e.hue))return t;let{L:n,C:r,h:o}=b(t),a=A(n,e.brightness),i=(o+e.hue+360)%360,l=q(r,L(a,i),e.saturation);for(let s=0;s<40&&l>0&&!lt(a,l,i);s++)l-=.005;return C(a,l,i)}function k(t,e,n,r){let o=A(t,r.brightness),a=(n+r.hue+360)%360,i=L(o,a);return C(o,Math.min(i,q(e,i,r.saturation)),a)}function Y(t,e,n){if(!e)return t;let r=b(t[n].rgb).L;return t.map((o,a)=>{if(a===n)return o;let i=b(o.rgb),l=Math.max(.02,Math.min(.995,r+(i.L-r)*(1+e/100))),s=C(l,Math.min(i.C,L(l,i.h)),i.h);return{...o,rgb:s,hex:d(s)}})}function Tt(t,e,n,r){return Y(t(T(e,n)),n.contrast,r)}function ct(t,e){let n=b(t),r=G.map(s=>b(s.hex)),o=0;r.forEach((s,c)=>{Math.abs(K(n.h,s.h))<Math.abs(K(n.h,r[o].h))&&(o=c)});let a=r[o],i=Math.max(-10,Math.min(10,K(n.h,a.h)/2)),l=W(n);return G.map((s,c)=>{if(c===o)return{name:s.name,role:s.role,rgb:T(t,e),yours:!0};let h=r[c],p=n.L>=a.L?h.L+(n.L-a.L)*(1-h.L)/(1-a.L):h.L*n.L/a.L,f=A(p,e.brightness),g=(h.h+i+e.hue+360)%360,x=L(f,g),u=Math.min(1,W(h)),S=Math.min(x,q(l*u*x,x,e.saturation));return{name:s.name,role:s.role,rgb:C(f,S,g),yours:!1}})}function wt(t,e,n){let r=b(t),o=w(t);if(e==="mono")return[{name:o,rgb:T(t,n),yours:!0},{name:`${o} soft`,rgb:k(r.L,r.C*.5,r.h,n),yours:!1},{name:`${o} dusty`,rgb:k(r.L,r.C*.22,r.h,n),yours:!1}];if(e==="pastel")return ct(t,B).map((l,s)=>{let c=b(l.rgb),h=c.C<.01?b(G[s].hex).h:c.h;return{...l,rgb:k(.86,Math.min(.1,L(.86,h))*.85,h,n)}});let a=W(r);return(bt[e]??[0]).map(l=>{if(l===0)return{name:o,rgb:T(t,n),yours:!0};let s=(r.h+l+360)%360,c=a*L(r.L,s);return{name:a>0?D(s):w(k(r.L,c,s,B)),rgb:k(r.L,c,s,n),yours:!1}}).sort((l,s)=>Number(s.yours)-Number(l.yours))}function yt(t,e,n){let r=b(t).h+e.hue,o=Math.max(0,$t*(1+e.saturation/100));return _(C(A(dt,e.brightness),o,r),n)}function At(t,e,n=B,r=$){let o=at(r);return{rows:(e==="full"?ct(t,n):wt(t,e,n)).map(({name:l,role:s,rgb:c,yours:h})=>({name:l,...s?{role:s}:{},steps:Y(_(c,r),n.contrast,o),yours:h})),neutral:Y(yt(t,n,r),n.contrast,o)}}var M=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),E=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"colour",y='font-family="Inter"',O=t=>`${t[0]?.toUpperCase()??""}${t.slice(1)}`;function ht(t){let e=t==="dark";return{ink:e?"#FAFAFA":"#111111",grey:e?"#A1A1AA":"#71717A",edge:e?"#FFFFFF":"#000000",paper:e?"#18181B":"#FFFFFF"}}var St=`<defs><pattern id="checker" width="16" height="16" patternUnits="userSpaceOnUse"><rect width="16" height="16" fill="#FFFFFF"/><rect width="8" height="8" fill="#E5E5E5"/><rect x="8" y="8" width="8" height="8" fill="#E5E5E5"/></pattern></defs>
|
|
4
|
-
`;function I(t,e,n,r="light"){let{ink:o,grey:a,edge:i,paper:l}=ht(r),s=n.length>8?64:104,c=10,h=48+n.length*s+Math.max(0,n.length-1)*c,p=84+s+56,f=s>80?12:10,g=`<text id="title" x="24" y="38" ${y} font-size="15" font-weight="600" fill="${o}">${M(t)}</text><text id="subtitle" x="24" y="58" ${y} font-size="12" fill="${a}">${M(e)}</text>`,x=n.map((u,S)=>`<g id="${E(u.id)}" transform="translate(${24+S*(s+c)} 80)">`+(u.alpha===void 0?"":`<rect id="checker" width="${s}" height="${s}" rx="${f}" fill="url(#checker)"/>`)+`<rect id="swatch" width="${s}" height="${s}" rx="${f}" fill="${u.hex}"`+(u.alpha===void 0?"":` fill-opacity="${u.alpha.toFixed(3)}"`)+` stroke="${i}" stroke-opacity="0.08"/><text id="name" x="1" y="${s+22}" ${y} font-size="13" font-weight="600" fill="${o}">${M(u.name)}</text><text id="value" x="1" y="${s+40}" ${y} font-size="11" fill="${a}">${M(u.value)}</text></g>`).join(`
|
|
5
|
-
`);return`<svg xmlns="http://www.w3.org/2000/svg" width="${h}" height="${p}" viewBox="0 0 ${h} ${p}">
|
|
6
|
-
`+(n.some(u=>u.alpha!==void 0)?St:"")+`<g id="${E(t)}">
|
|
7
|
-
<rect id="card" width="${h}" height="${p}" rx="0" fill="${l}"/>
|
|
8
|
-
${g}
|
|
9
|
-
${x}
|
|
10
|
-
</g>
|
|
11
|
-
</svg>`}function Ut(t,e,n="light",r){let o=t.replace(/\.[^.]+$/,""),a=e.length;return I(t,r?`${a} shade${a===1?"":"s"} of ${r}`:`${a} colour${a===1?"":"s"}, most of the image first`,e.map((i,l)=>({id:`${o}-${l+1}`,name:i.hex,value:X(i.rgb),hex:i.hex})),n)}function N(t){if(t.set==="radix")return"Radix 1\u201312";if(t.set==="even")return`${t.start}\u2013${t.end}, ${t.count} even steps`;let e=$;return t.start===e.start&&t.end===e.end?"50\u2013950":`Tailwind ${t.start}\u2013${t.end}`}function jt(t,e,n="light",r=$){let o=w(t);return I(O(o),`from ${d(t)} \xB7 ${N(r)} in OKLCH`,e.map(a=>({id:`${o}-${a.step}`,name:String(a.step),value:a.hex,hex:a.hex})),n)}function Pt(t,e,n,r=$,o="light"){let{ink:a,grey:i,edge:l,paper:s}=ht(o),c=`${O(w(t))} palette`,h=`from ${d(t)} \xB7 ${it[n]} \xB7 ${N(r)} in OKLCH`,p=[...e.rows.map(m=>({name:m.name,steps:m.steps})),{name:"neutral",steps:e.neutral}],f=p[0]?.steps.map(m=>m.step)??[],g=44,x=6,u=g+10,S=92,z=24+Math.max(92,...p.map(m=>m.name.length*8+12)),ut=z+f.length*g+Math.max(0,f.length-1)*x+24,U=Math.max(ut,48+Math.ceil(h.length*6.5)),j=S+p.length*u+24+10,mt=`<text id="title" x="24" y="38" ${y} font-size="15" font-weight="600" fill="${a}">${M(c)}</text><text id="subtitle" x="24" y="58" ${y} font-size="12" fill="${i}">${M(h)}</text>`,gt=f.map((m,F)=>`<text id="step-${m}" x="${z+F*(g+x)+1}" y="${S-10}" ${y} font-size="11" font-weight="600" fill="${i}">${m}</text>`).join(""),pt=p.map((m,F)=>{let J=S+F*u+(F===p.length-1?10:0),Q=E(m.name);return`<g id="${Q}"><text id="name" x="24" y="${J+g/2+4}" ${y} font-size="13" font-weight="600" fill="${a}">${M(m.name)}</text>`+m.steps.map((V,ft)=>`<g id="${Q}-${V.step}"><rect id="swatch" x="${z+ft*(g+x)}" y="${J}" width="${g}" height="${g}" rx="8" fill="${V.hex}" stroke="${l}" stroke-opacity="0.08"/></g>`).join("")+"</g>"}).join(`
|
|
12
|
-
`);return`<svg xmlns="http://www.w3.org/2000/svg" width="${U}" height="${j}" viewBox="0 0 ${U} ${j}">
|
|
13
|
-
<g id="${E(c)}">
|
|
14
|
-
<rect id="card" width="${U}" height="${j}" rx="0" fill="${s}"/>
|
|
15
|
-
${mt}
|
|
16
|
-
<g id="steps">${gt}</g>
|
|
17
|
-
${pt}
|
|
18
|
-
</g>
|
|
19
|
-
</svg>`}function Ht(t,e,n,r="light",o=$){return I(`${O(w(t))} neutral`,`from ${d(t)} \xB7 ${n} tint \xB7 ${N(o)} in OKLCH`,e.map(a=>({id:`neutral-${a.step}`,name:String(a.step),value:a.hex,hex:a.hex})),r)}function _t(t,e,n,r="light",o=$){let a=w(t);return I(`${O(a)} alpha`,`from ${d(t)} \xB7 over ${n} \xB7 ${N(o)}`,e.map(i=>({id:`${a}-alpha-${i.step}`,name:String(i.step),value:i.hex8,hex:d(i.rgb),alpha:i.a})),r)}async function qt(t,e=192){let n=await st(t);if(n.kind!=="image")throw et(t,`a ${Z[n.format].label}`);let r=await ot(t,n.format);try{let o=await rt(),{data:a,info:i}=await o(r,{animated:!1}).rotate().resize(e,e,{fit:"inside",withoutEnlargement:!0}).ensureAlpha().raw().toBuffer({resolveWithObject:!0});return{source:n,pixels:{width:i.width,height:i.height,rgba:new Uint8Array(a.buffer,a.byteOffset,a.length)}}}catch(o){throw tt(o)?o:nt(t,o)}}export{Ft as a,it as b,B as c,vt as d,Tt as e,At as f,I as g,Ut as h,jt as i,Pt as j,Ht as k,_t as l,qt as m};
|