forge-terminal 0.5.5 → 0.5.7
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 +28 -10
- package/dist/chunks/{about-credits-VRRE6342.js → about-credits-4DHA4HMT.js} +1 -1
- package/dist/chunks/args-5CQKOHYO.js +3 -0
- package/dist/chunks/{boot-MX7UP2M2.js → boot-XX2TLD3Q.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-HYMPLIHW.js → chunk-4YK4XWYS.js} +1 -1
- package/dist/chunks/{chunk-UGATQHEE.js → chunk-6FXF6ALB.js} +1 -1
- package/dist/chunks/{chunk-D4R7UACU.js → chunk-6HQKTDGG.js} +1 -1
- package/dist/chunks/{chunk-TRJXZLR6.js → chunk-6RCS3KBP.js} +1 -1
- package/dist/chunks/{chunk-OUXPGAQL.js → chunk-7MC3LDNP.js} +1 -1
- package/dist/chunks/chunk-7XFLG32B.js +3 -0
- package/dist/chunks/{chunk-R7BEV6PR.js → chunk-AET63NOB.js} +1 -1
- package/dist/chunks/{chunk-HACM3MAD.js → chunk-FAUL5L2W.js} +1 -1
- package/dist/chunks/{chunk-7IWX5VSI.js → chunk-GBA5DFEO.js} +1 -1
- package/dist/chunks/chunk-GYERZAZU.js +4 -0
- 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-MMLROWBQ.js → chunk-JMIKUWLY.js} +2 -2
- package/dist/chunks/{chunk-KDBKDURW.js → chunk-L57UZTYE.js} +2 -2
- package/dist/chunks/{chunk-BONMSCKD.js → chunk-MPSLPE4C.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-ZBETH6BR.js → chunk-NRMLO5TP.js} +33 -24
- package/dist/chunks/{chunk-BU4YYGUJ.js → chunk-OXDRJO4V.js} +1 -1
- package/dist/chunks/{chunk-HVMQTKP6.js → chunk-P6JX5ZQT.js} +1 -1
- package/dist/chunks/chunk-POM7FXIV.js +3 -0
- package/dist/chunks/chunk-PUGNBNSV.js +3 -0
- package/dist/chunks/chunk-RM3XA72H.js +3 -0
- package/dist/chunks/{chunk-MES4FVLR.js → chunk-RRVD63NF.js} +1 -1
- package/dist/chunks/chunk-SM735FG7.js +81 -0
- package/dist/chunks/{chunk-JJV2YXZQ.js → chunk-SUB2JM7G.js} +1 -1
- package/dist/chunks/chunk-TFGK7IRZ.js +19 -0
- package/dist/chunks/{chunk-OGYSMKRM.js → chunk-TLHUFIXD.js} +1 -1
- package/dist/chunks/{chunk-SZCSV3PX.js → chunk-U3D3EU33.js} +1 -1
- package/dist/chunks/{chunk-L5JBHB4G.js → chunk-UGYBXR4V.js} +1 -1
- package/dist/chunks/{chunk-RLOJSZ6W.js → chunk-V6GWPR2A.js} +1 -1
- package/dist/chunks/{chunk-BI2E72HM.js → chunk-VDQMK2B2.js} +1 -1
- package/dist/chunks/{chunk-HGJXGAGJ.js → chunk-W53XNVNH.js} +1 -1
- package/dist/chunks/{chunk-7KYO62XK.js → chunk-WBW6G4N6.js} +1 -1
- package/dist/chunks/{chunk-2ZZXIDYX.js → chunk-WMK3IKW6.js} +1 -1
- package/dist/chunks/{chunk-WCOFUMZU.js → chunk-X6PZIFFX.js} +1 -1
- package/dist/chunks/chunk-YJ6XLDRA.js +3 -0
- package/dist/chunks/chunk-ZBMJTIYR.js +3 -0
- package/dist/chunks/clip-command-3CMQ6A5D.js +3 -0
- package/dist/chunks/{clipboard-3VFHDKYE.js → clipboard-IZJTBTSW.js} +1 -1
- package/dist/chunks/colour-VBHJAKAX.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-7GW4RIK2.js → entry-SOHEQPXT.js} +2 -2
- package/dist/chunks/execute-KTLXJTU2.js +3 -0
- package/dist/chunks/extensions-YF2KGD66.js +3 -0
- package/dist/chunks/{extensions-command-VXZL55KR.js → extensions-command-VT4M2JQW.js} +1 -1
- package/dist/chunks/{ffmpeg-Z7JQT53Y.js → ffmpeg-Q2WJH2OP.js} +1 -1
- package/dist/chunks/{image-FYCF2AVH.js → image-R5C3AWHT.js} +1 -1
- package/dist/chunks/{install-5YXQ6YV3.js → install-KGFOAQCU.js} +1 -1
- package/dist/chunks/{install-C6XNONFF.js → install-MFYGS5TG.js} +1 -1
- package/dist/chunks/{launch-U63VZQXC.js → launch-SOQTCV2D.js} +5 -5
- package/dist/chunks/{lock-AFVXUDOM.js → lock-BG3CLOHA.js} +1 -1
- package/dist/chunks/manager-HBAXHJL4.js +4 -0
- package/dist/chunks/{needed-X5D4E5X5.js → needed-GMZEKBH4.js} +1 -1
- package/dist/chunks/{own-5JN35AUV.js → own-IICGHC4K.js} +1 -1
- package/dist/chunks/{pdfium-GKF4ES7K.js → pdfium-77L526HZ.js} +1 -1
- package/dist/chunks/{preset-command-H6G22SZD.js → preset-command-4OVFEH7Y.js} +1 -1
- package/dist/chunks/{registry-LLAHKI4G.js → registry-TO6HJQJ4.js} +1 -1
- package/dist/chunks/{run-WSETTQXP.js → run-GUFPETHF.js} +1 -1
- package/dist/chunks/{server-CIGFNW7X.js → server-6275TY3O.js} +19 -19
- package/dist/chunks/{theme-HAB66OAL.js → theme-ISNQEBTS.js} +1 -1
- package/dist/chunks/{transcribe-FVCOCTGA.js → transcribe-QC2E7ETQ.js} +1 -1
- package/dist/chunks/{transcribe-command-XCBGAQMI.js → transcribe-command-GAKYFBWQ.js} +1 -1
- package/dist/chunks/{update-command-DJLYU6AB.js → update-command-DWEBUFT5.js} +1 -1
- package/dist/chunks/{update-note-47IPWQKY.js → update-note-T4LVCD25.js} +1 -1
- package/dist/chunks/{watch-command-VL6LOERU.js → watch-command-EYEZKROF.js} +1 -1
- package/dist/index.js +6 -6
- package/package.json +5 -5
- package/dist/chunks/args-5BPKCNTL.js +0 -3
- package/dist/chunks/chunk-2NSUAERD.js +0 -3
- package/dist/chunks/chunk-3YWAVKDZ.js +0 -19
- package/dist/chunks/chunk-45BFQHJB.js +0 -80
- package/dist/chunks/chunk-57M4J2BR.js +0 -3
- package/dist/chunks/chunk-CVNYUROW.js +0 -3
- package/dist/chunks/chunk-HFQOGB4T.js +0 -4
- package/dist/chunks/chunk-PBIS2ONZ.js +0 -3
- package/dist/chunks/chunk-QVACE4IE.js +0 -3
- package/dist/chunks/chunk-U5TEGDGH.js +0 -3
- package/dist/chunks/chunk-VTA6Z45X.js +0 -3
- package/dist/chunks/clip-command-WJ5P4DTN.js +0 -3
- package/dist/chunks/colour-5YBDFXXX.js +0 -3
- package/dist/chunks/execute-LBGFY5TG.js +0 -3
- package/dist/chunks/extensions-HTBACHMC.js +0 -3
- package/dist/chunks/manager-QUTR3RYR.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-P6JX5ZQT.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-JMIKUWLY.js";import"./chunk-MF3KKEFB.js";import"./chunk-I25E2XDH.js";import"./chunk-HZDYZ5RD.js";import"./chunk-MPSLPE4C.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-GBA5DFEO.js";import{c as V}from"./chunk-6FXF6ALB.js";import"./chunk-WMK3IKW6.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-JMIKUWLY.js";import"./chunk-UGYBXR4V.js";import"./chunk-MF3KKEFB.js";import"./chunk-I25E2XDH.js";import"./chunk-U3D3EU33.js";import"./chunk-HZDYZ5RD.js";import"./chunk-O7DK3GJT.js";import"./chunk-RRVD63NF.js";import"./chunk-EEQSUBBL.js";import"./chunk-MPSLPE4C.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-TO6HJQJ4.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-P6JX5ZQT.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-SUB2JM7G.js";import{a as W,d as N}from"./chunk-6FXF6ALB.js";import"./chunk-VDQMK2B2.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-X6PZIFFX.js";import"./chunk-UGYBXR4V.js";import"./chunk-6HQKTDGG.js";import"./chunk-U3D3EU33.js";import{d as w,e as h}from"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import{a as S}from"./chunk-P6JX5ZQT.js";import"./chunk-O7DK3GJT.js";import"./chunk-RRVD63NF.js";import"./chunk-EEQSUBBL.js";import"./chunk-MPSLPE4C.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-NRMLO5TP.js";import{b as g,d as C}from"./chunks/chunk-IBPGC4N2.js";import"./chunks/chunk-6HQKTDGG.js";import"./chunks/chunk-U3D3EU33.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-P6JX5ZQT.js";import{b as E}from"./chunks/chunk-O7DK3GJT.js";import"./chunks/chunk-RRVD63NF.js";import"./chunks/chunk-EEQSUBBL.js";import"./chunks/chunk-MPSLPE4C.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-ISNQEBTS.js");h();let{bootShell:I}=await import("./chunks/boot-XX2TLD3Q.js");await I(void 0,{opened:await r(s.action,s.paths)});return}let{runMenuCommand:c}=await import("./chunks/entry-SOHEQPXT.js");process.exitCode=await c(s,p);return}if(e[0]==="mcp"){let{runMcpServer:r}=await import("./chunks/server-6275TY3O.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-ISNQEBTS.js");r();let{bootShell:t}=await import("./chunks/boot-XX2TLD3Q.js");await t(void 0,{menuNote:async()=>(await import("./chunks/entry-SOHEQPXT.js")).menuAtStart(p)});return}if(o.kind==="watch"){let{runWatch:r}=await import("./chunks/watch-command-EYEZKROF.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-SOHEQPXT.js");process.exitCode=await r(p,t=>process.stdout.write(`${t}
|
|
10
|
+
`));return}let{execute:l}=await import("./chunks/execute-KTLXJTU2.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-T4LVCD25.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,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forge-terminal",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
4
4
|
"description": "A terminal-native file converter for macOS, Windows and Linux",
|
|
5
5
|
"whatsNew": [
|
|
6
6
|
{
|
|
7
|
-
"title": "
|
|
8
|
-
"text": "
|
|
7
|
+
"title": "Agents copy the card",
|
|
8
|
+
"text": "An AI agent using Forge can now put a colour card straight on your clipboard, the same card c copies in the app, ready to paste into Figma."
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
|
-
"title": "
|
|
12
|
-
"text": "
|
|
11
|
+
"title": "Cards from any colour",
|
|
12
|
+
"text": "Agents can now get the card for a scale or an image's palette too, not only the numbers."
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
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-ZBETH6BR.js";import"./chunk-U5TEGDGH.js";import"./chunk-D4R7UACU.js";import"./chunk-SZCSV3PX.js";import"./chunk-HZDYZ5RD.js";import"./chunk-QVACE4IE.js";import"./chunk-HVMQTKP6.js";import"./chunk-MES4FVLR.js";import"./chunk-EEQSUBBL.js";import"./chunk-BONMSCKD.js";import"./chunk-HACM3MAD.js";import"./chunk-HWCXNKIN.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-OGYSMKRM.js";import"./chunk-J6AZTW62.js";import"./chunk-RLOJSZ6W.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 w,b as I,d as k,e as m}from"./chunk-HGJXGAGJ.js";import{a as $,c as O}from"./chunk-45BFQHJB.js";import{b as h,d as P,e as R}from"./chunk-HFQOGB4T.js";import{e as x}from"./chunk-57M4J2BR.js";import{a as l}from"./chunk-HVMQTKP6.js";import{j as B}from"./chunk-MES4FVLR.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,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-MES4FVLR.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};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
-
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{r as E}from"./chunk-RLOJSZ6W.js";import{_ as O}from"./chunk-CVNYUROW.js";import{execFile as F,spawn as W}from"node:child_process";import{createHash as v}from"node:crypto";import{mkdir as k,mkdtemp as P,open as D,readFile as J,rename as A,rm as w,writeFile as $}from"node:fs/promises";import{tmpdir as h}from"node:os";import{join as m}from"node:path";import{promisify as B}from"node:util";var H=B(F),U=async(t,e)=>{let{stdout:c}=await H("osascript",["-l","JavaScript","-e",t,...e],{timeout:5e3});return c.trim()},S={darwin:{images:[{type:"public.png",ext:"png",format:"png"},{type:"public.jpeg",ext:"jpg",format:"jpeg"},{type:"org.webmproject.webp",ext:"webp",format:"webp"},{type:"public.heic",ext:"heic",format:"heic"},{type:"public.avif",ext:"avif",format:"avif"},{type:"com.compuserve.gif",ext:"gif",format:"gif"},{type:"public.tiff",ext:"tiff",format:"tiff"}],file:"public.file-url",standIn:"public.tiff",text:["public.utf8-plain-text"]},win32:{images:[{type:"PNG",ext:"png",format:"png"},{type:"image/png",ext:"png",format:"png"},{type:"JFIF",ext:"jpg",format:"jpeg"},{type:"image/jpeg",ext:"jpg",format:"jpeg"},{type:"image/webp",ext:"webp",format:"webp"},{type:"image/heic",ext:"heic",format:"heic"},{type:"image/avif",ext:"avif",format:"avif"},{type:"GIF",ext:"gif",format:"gif"},{type:"image/gif",ext:"gif",format:"gif"},{type:"Bitmap",ext:"png",format:"png"}],file:"FileDrop",standIn:"Bitmap",text:["UnicodeText","Text"]},linux:{images:[{type:"image/png",ext:"png",format:"png"},{type:"image/jpeg",ext:"jpg",format:"jpeg"},{type:"image/webp",ext:"webp",format:"webp"},{type:"image/heic",ext:"heic",format:"heic"},{type:"image/avif",ext:"avif",format:"avif"},{type:"image/gif",ext:"gif",format:"gif"},{type:"image/tiff",ext:"tiff",format:"tiff"}],file:"text/uri-list",standIn:null,text:["text/plain;charset=utf-8","UTF8_STRING","text/plain","STRING","TEXT"]}};function _(t,e){let c=t.includes(e.file);return e.images.find(i=>t.includes(i.type)&&!(c&&i.type===e.standIn))}function T(t,e){return e.text.some(c=>t.includes(c))}function bt(t=process.platform,e=process.env){return e.SSH_CONNECTION||e.SSH_TTY?!1:t==="linux"?j(e).length>0:t==="darwin"||t==="win32"}var M=Object.fromEntries(S.darwin.images.map(t=>[t.format,t.type]));function Y(t){return M[t]??"public.data"}var I={changeCount:-1,image:null,text:!1};function y(t,e){return v("sha256").update(t.join(`
|
|
4
|
-
`)).update("\0").update(e).digest().readUIntBE(0,6)}function x(t){return v("sha256").update(t).digest("hex")}async function L(t,e){let{default:c}=await import("sharp"),i=m(e,"Copied image.png");return await c(t).keepIccProfile().png().toFile(`${i}.part`),await A(`${i}.part`,i),await w(t,{force:!0}),i}var X=`ObjC.import('AppKit')
|
|
5
|
-
const pb = $.NSPasteboard.generalPasteboard
|
|
6
|
-
JSON.stringify({ types: ObjC.deepUnwrap(pb.types) || [], count: Number(pb.changeCount) })`,K=`function run(argv) {
|
|
7
|
-
ObjC.import('AppKit')
|
|
8
|
-
const pb = $.NSPasteboard.generalPasteboard
|
|
9
|
-
const data = pb.dataForType(argv[0])
|
|
10
|
-
if (data.isNil()) return JSON.stringify({ ok: false })
|
|
11
|
-
const ok = data.writeToFileAtomically(argv[1], true)
|
|
12
|
-
return JSON.stringify({ ok: ok, count: Number(pb.changeCount) })
|
|
13
|
-
}`,q=`function run(argv) {
|
|
14
|
-
ObjC.import('AppKit')
|
|
15
|
-
const pb = $.NSPasteboard.generalPasteboard
|
|
16
|
-
const item = $.NSPasteboardItem.alloc.init
|
|
17
|
-
item.setDataForType($.NSData.dataWithContentsOfFile(argv[0]), argv[1])
|
|
18
|
-
item.setStringForType($.NSURL.fileURLWithPath(argv[0]).absoluteString, 'public.file-url')
|
|
19
|
-
pb.clearContents
|
|
20
|
-
pb.writeObjects($.NSArray.arrayWithObject(item))
|
|
21
|
-
return JSON.stringify({ count: Number(pb.changeCount) })
|
|
22
|
-
}`,z=`function run(argv) {
|
|
23
|
-
ObjC.import('AppKit')
|
|
24
|
-
const pb = $.NSPasteboard.generalPasteboard
|
|
25
|
-
const read = (p) => $.NSString.stringWithContentsOfFileEncodingError(p, $.NSUTF8StringEncoding, null)
|
|
26
|
-
const item = $.NSPasteboardItem.alloc.init
|
|
27
|
-
item.setStringForType(read(argv[0]), 'public.utf8-plain-text')
|
|
28
|
-
item.setStringForType(read(argv[1]), 'public.html')
|
|
29
|
-
pb.clearContents
|
|
30
|
-
pb.writeObjects($.NSArray.arrayWithObject(item))
|
|
31
|
-
return JSON.stringify({ count: Number(pb.changeCount) })
|
|
32
|
-
}`;function Q(t=U){let e=S.darwin,c=async()=>{try{let{types:i,count:p}=JSON.parse(await t(X,[]));return{changeCount:p,image:_(i,e)?.type??null,text:T(i,e)}}catch{return I}};return{peek:c,async read(i){let{image:p}=await c(),n=e.images.find(g=>g.type===p);if(!n)return null;await k(i,{recursive:!0});let r=m(i,`Copied image.${n.ext}`),a=JSON.parse(await t(K,[n.type,r]));return!a.ok||a.count===void 0?null:n.format!=="tiff"?{path:r,changeCount:a.count}:{path:await L(r,i),changeCount:a.count}},async write(i,p){let{count:n}=JSON.parse(await t(q,[i,Y(p)]));return n},async writeText(i,p){let n=await P(m(h(),"forge-text-"));try{let r=m(n,"text.txt"),a=m(n,"text.html");await $(r,i,"utf8"),await $(a,p,"utf8");let{count:g}=JSON.parse(await t(z,[r,a]));return g}finally{await w(n,{recursive:!0,force:!0})}}}}function R(t,e,c){return new Promise((i,p)=>{F(t,e,{...c,encoding:"buffer"},(n,r)=>n?p(n):i(r))})}var V=async(t,e)=>(await R("powershell.exe",["-NoProfile","-NonInteractive","-STA","-EncodedCommand",Buffer.from(t,"utf16le").toString("base64")],{env:{...process.env,...e},timeout:15e3,windowsHide:!0})).toString("utf8").trim(),Z=`$ErrorActionPreference = 'Stop'
|
|
33
|
-
[Console]::OutputEncoding = [Text.Encoding]::UTF8
|
|
34
|
-
Add-Type -AssemblyName System.Windows.Forms, System.Drawing
|
|
35
|
-
$data = [Windows.Forms.Clipboard]::GetDataObject()
|
|
36
|
-
$types = @()
|
|
37
|
-
if ($null -ne $data) { $types = @($data.GetFormats()) }
|
|
38
|
-
$file = $types -contains $env:FORGE_CLIP_FILE
|
|
39
|
-
$pick = $null
|
|
40
|
-
foreach ($t in $env:FORGE_CLIP_ORDER.Split('|')) {
|
|
41
|
-
if (($types -contains $t) -and -not ($file -and $t -eq $env:FORGE_CLIP_STAND_IN)) { $pick = $t; break }
|
|
42
|
-
}
|
|
43
|
-
$digest = ''
|
|
44
|
-
if ($null -ne $pick) {
|
|
45
|
-
$bytes = $null
|
|
46
|
-
if ($pick -eq 'Bitmap') {
|
|
47
|
-
$image = [Windows.Forms.Clipboard]::GetImage()
|
|
48
|
-
if ($null -ne $image) {
|
|
49
|
-
$stream = New-Object IO.MemoryStream
|
|
50
|
-
$image.Save($stream, [Drawing.Imaging.ImageFormat]::Png)
|
|
51
|
-
$bytes = $stream.ToArray()
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
$value = $data.GetData($pick)
|
|
55
|
-
if ($value -is [IO.MemoryStream]) { $bytes = $value.ToArray() }
|
|
56
|
-
elseif ($value -is [byte[]]) { $bytes = $value }
|
|
57
|
-
}
|
|
58
|
-
if ($null -eq $bytes -or $bytes.Length -eq 0) { $pick = $null }
|
|
59
|
-
else {
|
|
60
|
-
$digest = [BitConverter]::ToString([Security.Cryptography.SHA256]::Create().ComputeHash($bytes)).Replace('-', '')
|
|
61
|
-
if ($env:FORGE_CLIP_PATH) { [IO.File]::WriteAllBytes($env:FORGE_CLIP_PATH, $bytes) }
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
ConvertTo-Json -Compress @{ types = $types; image = $pick; digest = $digest }`,tt=`$ErrorActionPreference = 'Stop'
|
|
65
|
-
Add-Type -AssemblyName System.Windows.Forms, System.Drawing
|
|
66
|
-
$path = $env:FORGE_CLIP_PATH
|
|
67
|
-
$bytes = [IO.File]::ReadAllBytes($path)
|
|
68
|
-
$data = New-Object Windows.Forms.DataObject
|
|
69
|
-
foreach ($t in $env:FORGE_CLIP_TYPES.Split('|')) {
|
|
70
|
-
$data.SetData($t, $false, (New-Object IO.MemoryStream(, $bytes)))
|
|
71
|
-
}
|
|
72
|
-
try { $data.SetImage([Drawing.Image]::FromStream((New-Object IO.MemoryStream(, $bytes)))) } catch {}
|
|
73
|
-
$files = New-Object Collections.Specialized.StringCollection
|
|
74
|
-
[void]$files.Add($path)
|
|
75
|
-
$data.SetFileDropList($files)
|
|
76
|
-
[Windows.Forms.Clipboard]::SetDataObject($data, $true)`,et=`$ErrorActionPreference = 'Stop'
|
|
77
|
-
Add-Type -AssemblyName System.Windows.Forms
|
|
78
|
-
$text = [IO.File]::ReadAllText($env:FORGE_CLIP_TEXT, [Text.Encoding]::UTF8)
|
|
79
|
-
[Windows.Forms.Clipboard]::SetText($text)`;function nt(t){return Array.isArray(t)?t.map(String):typeof t=="string"?[t]:[]}function rt(t=V){let e=S.win32,c={FORGE_CLIP_ORDER:e.images.map(n=>n.type).join("|"),FORGE_CLIP_FILE:e.file,FORGE_CLIP_STAND_IN:e.standIn??""},i=async n=>{let r=JSON.parse(await t(Z,{...c,...n===void 0?{}:{FORGE_CLIP_PATH:n}})),a=nt(r.types),g=typeof r.image=="string"&&r.image!==""?r.image:null;return{types:a,image:g,digest:typeof r.digest=="string"?r.digest:""}},p=async()=>{try{let n=await i();return{changeCount:y(n.types,n.digest),image:n.image,text:T(n.types,e)}}catch{return I}};return{peek:p,async read(n){await k(n,{recursive:!0});let r=m(n,".Copied image.part"),a=await i(r),g=e.images.find(s=>s.type===a.image);if(!g)return await w(r,{force:!0}),null;let u=m(n,`Copied image.${g.ext}`);return await A(r,u),{path:u,changeCount:y(a.types,a.digest)}},async write(n,r){let a=e.images.filter(g=>g.format===r&&g.type!==e.standIn);return await t(tt,{FORGE_CLIP_PATH:n,FORGE_CLIP_TYPES:(a.length>0?a.map(g=>g.type):[`image/${r}`]).join("|")}),(await p()).changeCount},async writeText(n){let r=await P(m(h(),"forge-text-"));try{let a=m(r,"text.txt");return await $(a,n,"utf8"),await t(et,{FORGE_CLIP_TEXT:a}),(await p()).changeCount}finally{await w(r,{recursive:!0,force:!0})}}}}var it={run(t,e){return R(t,e,{maxBuffer:512*1024*1024,timeout:5e3})},async copy(t,e,c){let i=await D(c,"r");try{await new Promise((p,n)=>{let r=W(t,e,{stdio:[i.fd,"ignore","ignore"],detached:!0});r.on("error",n),r.on("exit",a=>a===0?p():n(new Error(`${t} exited with ${a}`)))})}finally{await i.close()}}},at={name:"wayland",tool:"wl-clipboard",types:["wl-paste",["--list-types"]],read:t=>["wl-paste",["--type",t]],write:t=>["wl-copy",["--type",t]]},ot={name:"x11",tool:"xclip",types:["xclip",["-selection","clipboard","-t","TARGETS","-o"]],read:t=>["xclip",["-selection","clipboard","-t",t,"-o"]],write:t=>["xclip",["-selection","clipboard","-t",t,"-i"]]};function j(t=process.env){return[...t.WAYLAND_DISPLAY?[at]:[],...t.DISPLAY?[ot]:[]]}var st=40,ct=50;function C(t){return t?.code==="ENOENT"}function pt(t=process.env,e=it){let c=S.linux,i=j(t),p,n=async u=>{if(p)return u(p);for(let s of i)try{let o=await u(s);return p=s,o}catch(o){if(!C(o))throw p=s,o}throw O(i[0]?.tool??"xclip")},r=async u=>{try{return(await e.run(...u.types)).toString("utf8").split(`
|
|
80
|
-
`).map(o=>o.trim()).filter(o=>o!=="")}catch(s){if(C(s))throw s;return[]}},a=u=>n(async s=>{let o=await r(s),l=_(o,c),f=l&&u?await e.run(...s.read(l.type)):void 0;return{types:o,image:l,bytes:f}}),g=async()=>{try{let{types:u,image:s,bytes:o}=await a(!0);return{changeCount:y(u,o?x(o):""),image:s?.type??null,text:T(u,c)}}catch{return I}};return{peek:g,async read(u){let{types:s,image:o,bytes:l}=await a(!0);if(!o||!l||l.length===0)return null;let f=m(u,`Copied image.${o.ext}`);await E(f,l);let d=y(s,x(l));return o.format!=="tiff"?{path:f,changeCount:d}:{path:await L(f,u),changeCount:d}},async write(u,s){let o=c.images.find(d=>d.format===s)?.type??`image/${s}`;await n(d=>e.copy(...d.write(o),u));let l=x(await J(u)),f=-1;for(let d=0;d<st;d++){let b=await a(!0).catch(()=>null),N=b?.bytes?x(b.bytes):"";if(b&&(f=y(b.types,N)),N===l)return f;await new Promise(G=>setTimeout(G,ct))}return f},async writeText(u){let s=await P(m(h(),"forge-text-"));try{let o=m(s,"text.txt");return await $(o,u,"utf8"),await n(l=>e.copy(...l.write(l.name==="x11"?"UTF8_STRING":"text/plain;charset=utf-8"),o)),(await g()).changeCount}finally{await w(s,{recursive:!0,force:!0})}}}}function xt(t=process.platform,e=process.env){return t==="win32"?rt():t==="linux"?pt(e):Q()}export{bt as a,j as b,xt as c};
|
|
@@ -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{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,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-OUXPGAQL.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-BI2E72HM.js";import{b as X,c as T}from"./chunk-6RMRWBMB.js";import{a as y}from"./chunk-HYMPLIHW.js";import{b as I}from"./chunk-WCOFUMZU.js";import{e as be}from"./chunk-D4R7UACU.js";import{a as F,c as _,d as ee,e as C,f as te}from"./chunk-SZCSV3PX.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-HVMQTKP6.js";import{d as $}from"./chunk-EEQSUBBL.js";import{a as Z}from"./chunk-HACM3MAD.js";import{a as L,d as U}from"./chunk-OGYSMKRM.js";import{a as Y,c as K,d as E,e as Q}from"./chunk-RLOJSZ6W.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 ${o.pass.of} \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-H6G22SZD.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-WJ5P4DTN.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-7GW4RIK2.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-VXZL55KR.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-5YBDFXXX.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-XCBGAQMI.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{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,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,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
-
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{b as g,c as R,d as T,e as E,f as w,g as d}from"./chunk-QVACE4IE.js";import{E as y}from"./chunk-CVNYUROW.js";var L={set:"tailwind",start:50,end:950,count:11},D=["tailwind","even","radix"],I=[0,50,100,150,200,250,300,350,400,450],$=[550,600,650,700,750,800,850,900,950,1e3],N=Array.from({length:19},(e,t)=>t+3),P=[20,50,100,150,200,260,330,420,500,560,750,920],_=8;function W({set:e,start:t,end:n,count:r}){if(!D.includes(e))return`The set must be tailwind, even or radix; got ${e}.`;if(e!=="radix"){if(!I.includes(t))return t%50===0?`The start must be from 0 to 450, so the colour (500) stays in the scale; got ${t}.`:`The start must be a multiple of 50; got ${t}.`;if(!$.includes(n))return n%50===0?`The end must be from 550 to 1000, so the colour (500) stays in the scale; got ${n}.`:`The end must be a multiple of 50; got ${n}.`;if(e==="even"&&!N.includes(r))return`An even set has 3 to 21 steps; got ${r}.`}}function x(e){let{set:t,start:n,end:r,count:a}=e;if(t==="radix")return P.map((o,u)=>({step:u+1,at:o}));if(t==="tailwind"){let o=new Set([n,r,500]);for(let u=Math.ceil((n+1)/100)*100;u<r;u+=100)o.add(u);return[...o].sort((u,s)=>u-s).map(u=>({step:u,at:u}))}let i=a-1,l=Math.round(i*(500-n)/(r-n)),f=Math.max(1,Math.min(i-1,l)),h=i-f,c=[];for(let o=0;o<=f;o++)c.push(n+(500-n)*o/f);for(let o=1;o<=h;o++)c.push(500+(r-500)*o/h);for(let o of[10,5,1]){let u=c.map(s=>Math.round(s/o)*o);if(new Set(u).size===u.length)return c.map((s,p)=>({step:u[p],at:s}))}return c.map(o=>({step:o,at:o}))}function F(e){return x(e).map(t=>t.step)}var Y=F(L);function q(e){return e.set==="radix"?_:x(e).findIndex(t=>t.at===500)}var H=[[50,1],[100,.86],[200,.68],[300,.46],[400,.22],[500,0]],U=[[500,0],[600,.2],[700,.4],[800,.6],[900,.8],[950,1]];function M(e,t){for(let n=1;n<e.length;n++){let[r,a]=e[n-1],[i,l]=e[n];if(t<=i)return a+(l-a)*(t-r)/(i-r)}return e[e.length-1][1]}var j=.995,k=.35,B=5e-4;function J(e,t=L){let n=W(t);if(n)throw y(n,"Try: Tailwind, from 50 to 950.");let{L:r,C:a,h:i}=w(R(e)),l=a<B,f=Math.max(.975,r),h=r<.16?.42*r:Math.max(.16,.42*r),c=x(t),o=c[c.length-1]?.at===1e3;return c.map(({step:u,at:s})=>{if(s===500)return{step:u,at:s,rgb:{...e},hex:g(e),reference:!0};let p,b;if(s>=50&&s<500){let m=M(H,s);p=r+(f-r)*m,b=a*(1-.88*m)}else if(s<50){let m=(50-s)/50;p=f+(Math.max(j,f)-f)*m,b=a*.12*(1-m)}else if(s<=950||o){let m=o?(s-500)/500:M(U,s);p=r-(r-h)*m,b=a*(1-.45*m)}else{let m=(s-950)/50;p=h*(1-k*m),b=a*.55*(1-.4*m)}for(l&&(b=0);b>0&&!E(d({L:p,C:b,h:i}));)b-=.002;let A=T(d({L:p,C:Math.max(0,b),h:i}));return{step:u,at:s,rgb:A,hex:g(A),reference:!1}})}var S=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},C=({r:e,g:t,b:n})=>.2126*S(e)+.7152*S(t)+.0722*S(n);function O(e,t){let[n,r]=[C(e),C(t)].sort((a,i)=>i-a);return(n+.05)/(r+.05)}function V(e){return e>=7?"AAA":e>=4.5?"AA":e>=3?"large":"fails"}var G={r:255,g:255,b:255},X={r:0,g:0,b:0},v=e=>Math.floor(e*10)/10;function Z(e){return{white:v(O(e,G)),black:v(O(e,X))}}export{L as a,D as b,I as c,$ as d,N as e,x as f,F as g,q as h,J as i,O as j,V as k,Z as l};
|