forge-terminal 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/chunks/{about-credits-FZ35HUFP.js → about-credits-DBQHH5HA.js} +1 -1
- package/dist/chunks/args-TZMA4ZR6.js +3 -0
- package/dist/chunks/{boot-PCZBPNFR.js → boot-E57BKWEC.js} +1 -1
- package/dist/chunks/chunk-3CLPUPJT.js +55 -0
- package/dist/chunks/chunk-3GHHQNR6.js +3 -0
- package/dist/chunks/chunk-4YFFT5CZ.js +66 -0
- package/dist/chunks/{chunk-BD3OLIVT.js → chunk-5IZBFF6Y.js} +1 -1
- package/dist/chunks/{chunk-S2M4XESA.js → chunk-5YUOG3A5.js} +1 -1
- package/dist/chunks/{chunk-X26WUHWB.js → chunk-6LMVOQQA.js} +1 -1
- package/dist/chunks/chunk-6RMRWBMB.js +3 -0
- package/dist/chunks/{chunk-63ZK5SRQ.js → chunk-7I2OSTBX.js} +1 -1
- package/dist/chunks/chunk-7KYO62XK.js +3 -0
- package/dist/chunks/{chunk-HCLEHCAR.js → chunk-7VR6LODN.js} +1 -1
- package/dist/chunks/{chunk-3KWAO2N2.js → chunk-AFEYLHDD.js} +1 -1
- package/dist/chunks/{chunk-YNZIN42P.js → chunk-AIINYKXW.js} +1 -1
- package/dist/chunks/{chunk-DZOBIUV6.js → chunk-BIBDLXCG.js} +1 -1
- package/dist/chunks/{chunk-G46QQBT3.js → chunk-BROTSQXG.js} +1 -1
- package/dist/chunks/chunk-CVNYUROW.js +3 -0
- package/dist/chunks/{chunk-QXNB5DQ2.js → chunk-E2BYNETT.js} +1 -1
- package/dist/chunks/{chunk-SK2UZ25Y.js → chunk-EITGK5OI.js} +1 -1
- package/dist/chunks/chunk-EPDF4NQI.js +3 -0
- package/dist/chunks/{chunk-JOIHR724.js → chunk-EURVTBPH.js} +1 -1
- package/dist/chunks/{chunk-MTDCDKPU.js → chunk-FLMQ5VFR.js} +2 -2
- package/dist/chunks/{chunk-JMBEZPYC.js → chunk-HWCXNKIN.js} +1 -1
- package/dist/chunks/{chunk-XURW53YK.js → chunk-IE6NFN3N.js} +1 -1
- package/dist/chunks/chunk-IJRLRAC5.js +3 -0
- package/dist/chunks/chunk-IKZTH2RL.js +3 -0
- package/dist/chunks/chunk-ITJZ7ODJ.js +4 -0
- package/dist/chunks/{chunk-THDAQBQ3.js → chunk-J6AZTW62.js} +1 -1
- package/dist/chunks/chunk-MNI6IKIU.js +3 -0
- package/dist/chunks/chunk-N3X3H4IZ.js +3 -0
- package/dist/chunks/chunk-NHMACTW3.js +82 -0
- package/dist/chunks/chunk-O7DK3GJT.js +3 -0
- package/dist/chunks/chunk-Q7ERPAG3.js +7 -0
- package/dist/chunks/{chunk-2CX33C6H.js → chunk-QPJ2LNXB.js} +1 -1
- package/dist/chunks/chunk-TDYKRRZH.js +3 -0
- package/dist/chunks/chunk-TFOEI5VF.js +3 -0
- package/dist/chunks/{chunk-EKTUUKDP.js → chunk-TYWGB767.js} +1 -1
- package/dist/chunks/chunk-VLVNA4T3.js +3 -0
- package/dist/chunks/{chunk-YINYF6C7.js → chunk-VTA6Z45X.js} +1 -1
- package/dist/chunks/{chunk-GLAD7GP2.js → chunk-YK26E3OX.js} +1 -1
- package/dist/chunks/chunk-Z2H2GT2X.js +36 -0
- package/dist/chunks/{chunk-C4UCCBCX.js → chunk-ZOQA3JAR.js} +1 -1
- package/dist/chunks/chunk-ZYIW4MAG.js +3 -0
- package/dist/chunks/clip-command-QPLYCGJ2.js +3 -0
- package/dist/chunks/clipboard-7KSZNWWT.js +3 -0
- package/dist/chunks/colour-PZOAKNTH.js +3 -0
- package/dist/chunks/command-DMGGGAPS.js +3 -0
- package/dist/chunks/config-command-6GXRV627.js +3 -0
- package/dist/chunks/continue-editing-4W3XWWCE.js +3 -0
- package/dist/chunks/decoded-SMEHAVCH.js +3 -0
- package/dist/chunks/{entry-2XJD7UCY.js → entry-REXB6JNP.js} +2 -2
- package/dist/chunks/execute-GKO4THUK.js +3 -0
- package/dist/chunks/extensions-UV4X2UUA.js +3 -0
- package/dist/chunks/{extensions-command-MGPRISPH.js → extensions-command-TLW53BUK.js} +1 -1
- package/dist/chunks/{ffmpeg-2UZXAB3C.js → ffmpeg-32EEMAZS.js} +1 -1
- package/dist/chunks/image-YMCS4PTS.js +3 -0
- package/dist/chunks/install-7ZRVQKCF.js +3 -0
- package/dist/chunks/install-C6XNONFF.js +3 -0
- package/dist/chunks/launch-IVBMNYNY.js +17 -0
- package/dist/chunks/lock-AFVXUDOM.js +3 -0
- package/dist/chunks/manager-XPO4ZIRY.js +4 -0
- package/dist/chunks/{needed-YEXRZMZX.js → needed-NOGBHTHE.js} +1 -1
- package/dist/chunks/notify-YEBP67MP.js +3 -0
- package/dist/chunks/{own-WOK6H277.js → own-G4G4MRGM.js} +1 -1
- package/dist/chunks/pdfium-BAMNBCNW.js +3 -0
- package/dist/chunks/preset-command-XXKLUJOS.js +3 -0
- package/dist/chunks/registry-PKOPEG3Z.js +3 -0
- package/dist/chunks/run-WSETTQXP.js +3 -0
- package/dist/chunks/{server-QNWPC2CC.js → server-AR73FWWG.js} +3 -3
- package/dist/chunks/{theme-EHFY7DT6.js → theme-D4AMWFFW.js} +1 -1
- package/dist/chunks/transcribe-EFVJPBPG.js +3 -0
- package/dist/chunks/transcribe-command-Q4J3WTOB.js +3 -0
- package/dist/chunks/update-command-DJLYU6AB.js +3 -0
- package/dist/chunks/{update-note-GYJWUDFS.js → update-note-2YR3TLPK.js} +1 -1
- package/dist/chunks/watch-command-2D7NLDAM.js +3 -0
- package/dist/index.js +13 -13
- package/package.json +7 -11
- package/dist/chunks/args-FSQFXDIX.js +0 -3
- package/dist/chunks/chunk-2J2PTA5O.js +0 -3
- package/dist/chunks/chunk-2MLASXG5.js +0 -3
- package/dist/chunks/chunk-5TEAR5XH.js +0 -3
- package/dist/chunks/chunk-63BBFKT2.js +0 -4
- package/dist/chunks/chunk-655UG277.js +0 -3
- package/dist/chunks/chunk-72TNSFL5.js +0 -36
- package/dist/chunks/chunk-AYB5AJ4E.js +0 -3
- package/dist/chunks/chunk-C32KGH4S.js +0 -3
- package/dist/chunks/chunk-LBDSFSYP.js +0 -3
- package/dist/chunks/chunk-OY4EGSPE.js +0 -3
- package/dist/chunks/chunk-UXRQ4UBQ.js +0 -66
- package/dist/chunks/chunk-WIPP5TWQ.js +0 -3
- package/dist/chunks/chunk-WZWK3PEZ.js +0 -3
- package/dist/chunks/chunk-ZRHYGR2L.js +0 -134
- package/dist/chunks/clip-command-NZNC46H2.js +0 -3
- package/dist/chunks/clipboard-GICOXMMN.js +0 -3
- package/dist/chunks/colour-GSDOHCFK.js +0 -3
- package/dist/chunks/command-GYCYLUHN.js +0 -3
- package/dist/chunks/config-command-6YUMMZF3.js +0 -3
- package/dist/chunks/continue-editing-QE5RRIMG.js +0 -3
- package/dist/chunks/decoded-NBZ335RZ.js +0 -3
- package/dist/chunks/execute-FYEXZ7EY.js +0 -3
- package/dist/chunks/extensions-V5O4NIHI.js +0 -3
- package/dist/chunks/image-3CMUB2P4.js +0 -3
- package/dist/chunks/install-IDUHZTTS.js +0 -3
- package/dist/chunks/install-L5C2UT6M.js +0 -3
- package/dist/chunks/launch-GUHDBMSJ.js +0 -17
- package/dist/chunks/lock-UQJ66TZ3.js +0 -3
- package/dist/chunks/manager-UKTMRXKE.js +0 -4
- package/dist/chunks/pdfium-LYHOU6WV.js +0 -3
- package/dist/chunks/preset-command-6A2C6VPQ.js +0 -3
- package/dist/chunks/registry-2YU7NW4P.js +0 -3
- package/dist/chunks/run-U2CU6VGE.js +0 -5
- package/dist/chunks/transcribe-SCL3LFZU.js +0 -3
- package/dist/chunks/transcribe-command-BX2VVUI3.js +0 -3
- package/dist/chunks/update-command-JCTCRPCS.js +0 -3
- package/dist/chunks/watch-command-ZLZAWTNJ.js +0 -3
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{c as he}from"./chunk-MF3KKEFB.js";import{b as je}from"./chunk-I25E2XDH.js";import{b as mt}from"./chunk-HZDYZ5RD.js";import{c as He}from"./chunk-E2BYNETT.js";import{f as dt,g as ee,h as gt,i as ht,j as pt}from"./chunk-KH5DHZ2U.js";import{ka as ge,la as $e,ma as Te,na as ct,pa as _e,qa as Re}from"./chunk-CVNYUROW.js";import{c as lt,i as ut}from"./chunk-KXKQDFHX.js";import{spawn as rn}from"node:child_process";import{existsSync as Ie}from"node:fs";import{mkdtemp as st,readFile as ot,rm as at,writeFile as _r}from"node:fs/promises";import{tmpdir as ft}from"node:os";import{dirname as on,join as O}from"node:path";import{createInterface as jr}from"node:readline";import{fileURLToPath as Hr}from"node:url";var hn=new RegExp("\\p{M}","u"),Be=new RegExp("\\p{L}","u"),pn=new RegExp("\\p{Nd}","u");function ze(e){let n=String.fromCodePoint(e);return hn.test(n)?"NSM":e>=1632&&e<=1641||e===1643||e===1644?"AN":pn.test(n)?"EN":e>=1424&&e<=1535||e>=64285&&e<=64335?Be.test(n)?"R":"ON":e>=1536&&e<=1791||e>=1792&&e<=1983||e>=1872&&e<=1919||e>=2208&&e<=2303||e>=64336&&e<=65023||e>=65136&&e<=65279?Be.test(n)?"AL":"ON":Be.test(n)?"L":e===43||e===45?"ES":e===35||e===36||e===37||e===162||e===163||e===176?"ET":e===44||e===46||e===58||e===47||e===160?"CS":n===" "||n===" "||e===12288?"WS":"ON"}var mn={"(":")",")":"(","[":"]","]":"[","{":"}","}":"{","<":">",">":"<","\xAB":"\xBB","\xBB":"\xAB"};function pe(e){for(let n of e){let t=ze(n.codePointAt(0)??0);if(t==="R"||t==="AL")return!0;if(t==="L")return!1}return!1}function bn(e){for(let n of e){let t=ze(n.codePointAt(0)??0);if(t==="R"||t==="AL"||t==="AN")return!0}return!1}function bt(e,n){let t=[...e];if(!n&&!bn(e))return e;let i=t.length,r=t.map(a=>ze(a.codePointAt(0)??0)),o=n?1:0,s=o?"R":"L";for(let a=0;a<i;a++){r[a]==="NSM"&&(r[a]=a>0?r[a-1]??"ON":o?"R":"L");let u=r[a];u==="L"||u==="R"||u==="AL"?s=u:u==="EN"&&s==="AL"&&(r[a]="AN")}for(let a=0;a<i;a++)r[a]==="AL"&&(r[a]="R");for(let a=1;a<i-1;a++){let u=r[a],l=r[a-1],g=r[a+1];(u==="ES"||u==="CS")&&l==="EN"&&g==="EN"?r[a]="EN":u==="CS"&&l==="AN"&&g==="AN"&&(r[a]="AN")}for(let a=0;a<i;a++){if(r[a]!=="ET")continue;let u=a;for(;u<i&&r[u]==="ET";)u++;if(r[a-1]==="EN"||r[u]==="EN")for(let l=a;l<u;l++)r[l]="EN";a=u-1}for(let a=0;a<i;a++)(r[a]==="ES"||r[a]==="ET"||r[a]==="CS")&&(r[a]="ON");let f=o?"R":"L";for(let a=0;a<i;a++)r[a]==="L"||r[a]==="R"?f=r[a]:r[a]==="EN"&&f==="L"&&(r[a]="L");let c=a=>a==="L"?"L":a==="R"||a==="EN"||a==="AN"?"R":void 0;for(let a=0;a<i;a++){if(r[a]!=="WS"&&r[a]!=="ON")continue;let u=a;for(;u<i&&(r[u]==="WS"||r[u]==="ON");)u++;let l=a>0?c(r[a-1]):o?"R":"L",g=u<i?c(r[u]):o?"R":"L",m=l!==void 0&&l===g?l:o?"R":"L";for(let S=a;S<u;S++)r[S]=m;a=u-1}let d=r.map(a=>o===0?a==="R"?1:a==="EN"||a==="AN"?2:0:a==="L"||a==="EN"||a==="AN"?2:1),h=t.map((a,u)=>u),p=Math.max(...d),b=Math.min(...d.filter(a=>a%2===1),Number.POSITIVE_INFINITY);for(let a=p;a>=b&&a>0;a--)for(let u=0;u<i;u++){if((d[h[u]]??0)<a)continue;let l=u;for(;l<i&&(d[h[l]]??0)>=a;)l++;let g=h.slice(u,l).reverse();h.splice(u,l-u,...g),u=l-1}return h.map(a=>{let u=t[a];return(d[a]??0)%2===1?mn[u]??u:u}).join("")}var xn=(e,n)=>{let t=e[0]+e[2]/2,i=e[1]+e[3]/2;return t>=n[0]&&t<=n[0]+n[2]&&i>=n[1]&&i<=n[1]+n[3]};function yn(e){let n=e.filter(t=>t.kind!=="text").map(t=>t.box);return e.filter(t=>t.kind!=="text"||!n.some(i=>xn(t.box,i)))}var wn=.002;function wt(e,n){let t=f=>f.box[n],i=f=>f.box[n]+(n===0?f.box[2]:f.box[3]),r=[...e].sort((f,c)=>t(f)-t(c)),o=[],s=-1;for(let f of r){let c=o[o.length-1];c&&t(f)<=s+wn?(c.push(f),s=Math.max(s,i(f))):(o.push([f]),s=i(f))}return o}function Sn(e){let n=wt(e,1);if(n.length<2)return;let t=o=>Math.max(...o.map(s=>s.box[1]+s.box[3])),i=o=>Math.min(...o.map(s=>s.box[1])),r=1;for(let o=2;o<n.length;o++){let s=f=>i(n[f]??[])-t(n[f-1]??[]);s(o)>s(r)&&(r=o)}return[n.slice(0,r).flat(),n.slice(r).flat()]}function We(e){if(e.length<=1)return[...e];let n=wt(e,0);if(n.length>1)return n.flatMap(We);let t=Sn(e);return t?t.flatMap(We):[...e].sort((i,r)=>i.box[1]-r.box[1]||i.box[0]-r.box[0])}function An(e){let n=[];for(let t of e){let i=n[n.length-1],r=Math.max(t.lineHeight,i?.lineHeight??0);if(!(i!==void 0&&t.box[1]-(i.box[1]+i.box[3])<r&&Math.abs(t.box[0]-i.box[0])<2*r)){n.push({...t});continue}let s=Math.max(i.box[0]+i.box[2],t.box[0]+t.box[2]),f=t.box[1]+t.box[3];n[n.length-1]={...i,text:`${i.text} ${t.text}`,lines:i.lines+1,box:[i.box[0],i.box[1],s-i.box[0],f-i.box[1]]}}return n}function kn(e){let n=e.flatMap(t=>Array(Math.max(1,t.lines)).fill(t.lineHeight));return n.sort((t,i)=>t-i),n[Math.floor(n.length/2)]??0}var Pn=1.2,En=80,Ge=e=>e.replace(/\s*\n\s*/g," ").trim();function Tn(e,n,t){if(e.kind==="list")return{kind:"list",ordered:e.items.some(s=>s.marker==="decimal"||s.marker==="lowercase"||s.marker==="uppercase"),items:e.items.map(s=>Ge(s.text))};if(e.kind==="table"){let s=Math.max(...e.rows.map(f=>f.length));return{kind:"table",rows:e.rows.map(f=>Array.from({length:s},(c,d)=>Ge(f[d]??"")))}}let i=Ge(e.text);return!t&&e.lineHeight>=n*Pn&&e.lines===1&&i.length<=En&&!/[.,;:!?]$/.test(i)?{kind:"heading",level:e.title?1:2,text:i}:{kind:"paragraph",text:i}}function ci(e){return e.map(n=>{let t=We(yn(n.blocks.filter(o=>o.kind!=="text"||o.text.trim()!=="")));n.lines&&(t=An(t.filter(o=>o.kind==="text")));let i=t.filter(o=>o.kind==="text"),r=kn(i);return t.map(o=>Tn(o,r,t.length===1))})}var li=e=>e.some(n=>n.length>0);function Ke(e){return e.replace(/[\\`*[\]<]/g,n=>`\\${n}`).replace(/(^|[^\p{L}\p{N}])_|_(?=[^\p{L}\p{N}]|$)/gu,n=>n.replace("_","\\_"))}function Rn(e){return e.replace(/^(#|>|[-+](?= )|(?<=^\d+)\.(?= ))/,"\\$1").replace(/^(\d+)\.(?= )/,"$1\\.")}var xt=e=>Rn(Ke(e));function Fn(e){if(e.kind==="heading")return`${"#".repeat(e.level)} ${Ke(e.text)}`;if(e.kind==="paragraph")return xt(e.text);if(e.kind==="list")return e.items.map((o,s)=>`${e.ordered?`${s+1}.`:"-"} ${xt(o)}`).join(`
|
|
4
|
+
`);let n=o=>Ke(o).replace(/\|/g,"\\|"),t=o=>`| ${o.map(n).join(" | ")} |`,[i=[],...r]=e.rows;return[t(i),`| ${i.map(()=>"---").join(" | ")} |`,...r.map(t)].join(`
|
|
5
|
+
`)}var Ve=e=>e.filter(n=>n.length>0);function St(e){let n=Ve(e).map(t=>t.map(Fn).join(`
|
|
6
|
+
|
|
7
|
+
`));return n.length?`${n.join(`
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
`)}
|
|
12
|
+
`:""}function Nn(e){return e.kind==="heading"||e.kind==="paragraph"?e.text:e.kind==="list"?e.items.map((n,t)=>`${e.ordered?`${t+1}.`:"-"} ${n}`).join(`
|
|
13
|
+
`):e.rows.map(n=>n.join(" ")).join(`
|
|
14
|
+
`)}function At(e){let n=Ve(e).map(t=>t.map(Nn).join(`
|
|
15
|
+
|
|
16
|
+
`));return n.length?`${n.join(`
|
|
17
|
+
|
|
18
|
+
`)}
|
|
19
|
+
`:""}var vn="table{border-collapse:collapse;width:100%;margin:0 0 8pt}th,td{border:1px solid #c7c7cc;padding:2pt 6pt;text-align:left;vertical-align:top}ol{margin:0 0 8pt}",yt='<p style="margin:0;font-size:5pt"> </p>';function Un(e){if(e.kind==="heading")return`<h${e.level}>${ee(e.text)}</h${e.level}>`;if(e.kind==="paragraph")return`<p>${ee(e.text)}</p>`;if(e.kind==="list"){let o=e.ordered?"ol":"ul";return`<${o}>${e.items.map(s=>`<li>${ee(s)}</li>`).join("")}</${o}>`}let[n=[],...t]=e.rows,i=(o,s)=>`<tr>${o.map(f=>`<${s}>${ee(f)}</${s}>`).join("")}</tr>`,r=`<table>${i(n,"th")}${t.map(o=>i(o,"td")).join("")}</table>`;return`${yt}${r}${yt}`}function kt(e,n){let t=Ve(e).map(i=>i.map(Un).join(`
|
|
20
|
+
`));return["<!doctype html>",`<html><head><meta charset="utf-8"><title>${ee(n)}</title><style>${gt}${vn}</style></head><body>`,t.join(`
|
|
21
|
+
<hr>
|
|
22
|
+
`),"</body></html>"].join(`
|
|
23
|
+
`)}var Ln=[[65,90,"latin"],[97,122,"latin"],[170,170,"latin"],[186,186,"latin"],[192,591,"latin"],[7680,7935,"latin"],[11360,11391,"latin"],[42784,43007,"latin"],[65313,65338,"latin"],[65345,65370,"latin"],[880,1023,"greek"],[7936,8191,"greek"],[1024,1327,"cyrillic"],[7296,7311,"cyrillic"],[11744,11775,"cyrillic"],[42560,42655,"cyrillic"],[1328,1423,"armenian"],[1424,1535,"hebrew"],[64285,64335,"hebrew"],[1536,1791,"arabic"],[1872,1919,"arabic"],[2208,2303,"arabic"],[64336,65023,"arabic"],[65136,65279,"arabic"],[1792,1871,"syriac"],[1920,1983,"thaana"],[2304,2431,"devanagari"],[2432,2559,"bengali"],[2560,2687,"gurmukhi"],[2688,2815,"gujarati"],[2816,2943,"oriya"],[2944,3071,"tamil"],[3072,3199,"telugu"],[3200,3327,"kannada"],[3328,3455,"malayalam"],[3456,3583,"sinhala"],[3584,3711,"thai"],[3712,3839,"lao"],[3840,4095,"tibetan"],[4096,4255,"myanmar"],[4256,4351,"georgian"],[4352,4607,"hangul"],[4608,5023,"ethiopic"],[6016,6143,"khmer"],[6144,6319,"mongolian"],[12352,12447,"kana"],[12448,12543,"kana"],[12784,12799,"kana"],[65382,65439,"kana"],[110592,110959,"kana"],[12592,12687,"hangul"],[43360,43391,"hangul"],[44032,55295,"hangul"],[65440,65500,"hangul"],[11904,12255,"han"],[12288,12351,"han"],[12544,12591,"han"],[12704,12735,"han"],[12800,13311,"han"],[13312,19903,"han"],[19968,40959,"han"],[63744,64255,"han"],[65072,65103,"han"],[65281,65312,"han"],[65371,65381,"han"],[65504,65510,"han"],[131072,205743,"han"],[127744,129791,"emoji"],[9728,10175,"symbols"]];function te(e){if(e<128)return e>=65&&e<=90||e>=97&&e<=122?"latin":void 0;for(let[n,t,i]of Ln)if(e>=n&&e<=t)return i}var Mn=new Set(["latin","greek","cyrillic","han","kana","hangul","armenian","georgian","ethiopic","emoji","symbols"]),Pt=new Set([...Mn,"arabic","hebrew","thai","lao"]),In={latin:"Latin",greek:"Greek",cyrillic:"Cyrillic",han:"Chinese",kana:"Japanese",hangul:"Korean",arabic:"Arabic",hebrew:"Hebrew",thai:"Thai",lao:"Lao",armenian:"Armenian",georgian:"Georgian",devanagari:"Devanagari",bengali:"Bengali",gurmukhi:"Gurmukhi",gujarati:"Gujarati",oriya:"Odia",tamil:"Tamil",telugu:"Telugu",kannada:"Kannada",malayalam:"Malayalam",sinhala:"Sinhala",tibetan:"Tibetan",myanmar:"Burmese",khmer:"Khmer",ethiopic:"Ethiopic",mongolian:"Mongolian",syriac:"Syriac",thaana:"Thaana",emoji:"emoji",symbols:"symbols"};function Et(e){return In[e]}function Dn(e){let n=new Set;for(let t of e){let i=te(t.codePointAt(0)??0);i!==void 0&&n.add(i)}return[...n]}function Je(e,n){let t=n?.toLowerCase().replace("_","-");if(t?.startsWith("ja"))return"ja";if(t?.startsWith("ko"))return"ko";if(t==="zh-tw"||t==="zh-hant"||t==="zh-hk")return"zh-TW";if(t?.startsWith("zh"))return"zh";let i=Dn(e);return i.includes("kana")?"ja":i.includes("hangul")?"ko":"zh"}var Cn={ja:"ja-JP",ko:"ko-KR",zh:"zh-CN","zh-TW":"zh-TW"},On={arabic:"ar-SA",hebrew:"he-IL",thai:"th-TH",lao:"lo-LA",devanagari:"hi-IN",bengali:"bn-IN",gurmukhi:"pa-IN",gujarati:"gu-IN",oriya:"or-IN",tamil:"ta-IN",telugu:"te-IN",kannada:"kn-IN",malayalam:"ml-IN",sinhala:"si-LK",khmer:"km-KH",myanmar:"my-MM",tibetan:"bo-CN",armenian:"hy-AM",georgian:"ka-GE",ethiopic:"am-ET",syriac:"syr-SY",thaana:"dv-MV"},$n=new Set(["latin","greek","cyrillic","armenian","georgian","ethiopic","mongolian","emoji","symbols"]);function _n(e){return e===void 0?"neutral":e==="han"||e==="kana"||e==="hangul"?"eastAsia":$n.has(e)?"latin":"complex"}var jn=new Set(["arabic","hebrew","syriac","thaana"]);function Tt(e,n){let t=Cn[Je(e,n)],i=[],r="";for(let o of e){let s=te(o.codePointAt(0)??0),f=_n(s);if(f==="neutral"){let p=i.at(-1);p?p.text+=o:r+=o;continue}let c=s!==void 0&&jn.has(s),d=f==="eastAsia"?t:f==="complex"&&s?On[s]:void 0,h=i.at(-1);h&&h.kind===f&&h.rtl===c&&h.lang===d?h.text+=o:i.push({text:r+o,kind:f,rtl:c,...d?{lang:d}:{}}),r=""}return r&&i.push({text:r,kind:"latin",rtl:!1}),i}import{existsSync as dr,readFileSync as gr}from"node:fs";import{dirname as hr,join as be}from"node:path";import{fileURLToPath as pr}from"node:url";import{gunzipSync as mr}from"node:zlib";var ne=new Map;function Hn(){let e=new Map,n=[[64336,64511],[65152,65276]];for(let[t,i]of n)for(let r=t;r<=i;r++){let o=String.fromCodePoint(r).normalize("NFKD");if(o===String.fromCodePoint(r))continue;let s=e.get(o);s?s.push(r):e.set(o,[r])}for(let[t,i]of e)i.length===4?ne.set(t,{isolated:i[0]??0,final:i[1]??0,initial:i[2]??0,medial:i[3]??0}):i.length===2&&ne.set(t,{isolated:i[0]??0,final:i[1]??0,initial:0,medial:0})}Hn();var Rt=e=>e>=1611&&e<=1631||e===1648||e>=1750&&e<=1756||e>=1759&&e<=1764||e===1767||e===1768||e>=1770&&e<=1773,Ft=1604,Bn=new Set([1570,1571,1573,1575]),vt=e=>ne.has(String.fromCodePoint(e)),Nt=e=>(ne.get(String.fromCodePoint(e))?.initial??0)!==0;function Ut(e){for(let n of e)if(vt(n.codePointAt(0)??0))return!0;return!1}function Lt(e,n=()=>!0){let t=[...e].map(o=>o.codePointAt(0)??0),i=[],r=!1;for(let o=0;o<t.length;o++){let s=t[o]??0;if(s===8204||s===8205){r=s===8205?r:!1,i.push(s);continue}if(Rt(s)){i.push(s);continue}let f=ne.get(String.fromCodePoint(s));if(!f){r=!1,i.push(s);continue}let c=t[o+1]??0;if(s===Ft&&Bn.has(c)){let a=ne.get(String.fromCodePoint(Ft,c)),u=a?r?a.final:a.isolated:0;if(u!==0&&n(u)){i.push(u),r=!1,o++;continue}}let d=o+1;for(;d<t.length&&Rt(t[d]??0);)d++;let h=t[d]??0,p=Nt(s)&&h!==8204&&(vt(h)||h===8205),b=r?p?f.medial:f.final:p?f.initial:f.isolated;i.push(b!==0&&n(b)?b:s),r=Nt(s)}return String.fromCodePoint(...i)}function Mt(e){return String.fromCodePoint(e).normalize("NFKD")}import{execFile as Qn}from"node:child_process";import{existsSync as er,readdirSync as tr,readFileSync as nr,statSync as rr}from"node:fs";import{homedir as ir}from"node:os";import{posix as Xe,win32 as Kt}from"node:path";var v={charset:15,encoding:16,charStrings:17,private:18,subrs:19,ros:1230,fdArray:1236,fdSelect:1237};function Y(e,n){let t=(e[n]??0)*256+(e[n+1]??0);if(t===0)return{items:[],end:n+2};let i=e[n+2]??1,r=[],o=n+3;for(let c=0;c<=t;c++){let d=0;for(let h=0;h<i;h++)d=d*256+(e[o+h]??0);r.push(d),o+=i}let s=o-1,f=[];for(let c=0;c<t;c++)f.push(e.subarray(s+(r[c]??0),s+(r[c+1]??0)));return{items:f,end:s+(r[t]??1)}}function X(e){if(e.length===0)return new Uint8Array([0,0]);let n=e.reduce((f,c)=>f+c.length,0)+1,t=n<256?1:n<65536?2:n<16777216?3:4,i=new Uint8Array(3+(e.length+1)*t+n-1);i[0]=e.length>>8,i[1]=e.length&255,i[2]=t;let r=1,o=3,s=f=>{for(let c=t-1;c>=0;c--)i[o++]=f>>8*c&255};s(r);for(let f of e)r+=f.length,s(r);for(let f of e)i.set(f,o),o+=f.length;return i}function Ye(e){let n=[],t=[],i=0,r=0;for(;r<e.length;){let o=e[r]??0;if(o<=21){let s=o;r++,o===12&&(s=1200+(e[r]??0),r++),n.push({op:s,operands:t,raw:e.subarray(i,r)}),t=[],i=r}else if(o===28)t.push(((e[r+1]??0)<<8|(e[r+2]??0))<<16>>16),r+=3;else if(o===29)t.push((e[r+1]??0)<<24|(e[r+2]??0)<<16|(e[r+3]??0)<<8|(e[r+4]??0)),r+=5;else if(o===30){for(r++;r<e.length&&((e[r]??0)&15)!==15&&(e[r]??0)>>4!==15;)r++;r++,t.push(0)}else o>=32&&o<=246?(t.push(o-139),r++):o>=247&&o<=250?(t.push((o-247)*256+(e[r+1]??0)+108),r+=2):o>=251&&o<=254?(t.push(-(o-251)*256-(e[r+1]??0)-108),r+=2):r++}return n}function zn(e){return[29,e>>24&255,e>>16&255,e>>8&255,e&255]}function Gn(e){return e>=1200?[12,e-1200]:[e]}function W(e,n){return Uint8Array.from([...n.flatMap(zn),...Gn(e)])}function Fe(e){let n=new Uint8Array(e.reduce((i,r)=>i+r.length,0)),t=0;for(let i of e)n.set(i,t),t+=i.length;return n}var q=(e,n)=>e.find(t=>t.op===n);function It(e){return e<1240?107:e<33900?1131:32768}function Dt(e){let n=e[2]??4,t=Y(e,n),i=Y(e,t.end),r=Y(e,i.end),o=Y(e,r.end),s=Ye(i.items[0]??new Uint8Array),f=q(s,v.ros)!==void 0,c=q(s,v.charStrings)?.operands[0]??0,d=Y(e,c),h=d.items.length,p=q(s,v.charset)?.operands[0]??0,b=new Array(h).fill(0);if(p<=2)for(let w=0;w<h;w++)b[w]=w;else{let w=e[p]??0,x=p+1,E=1;if(w===0)for(;E<h;E++,x+=2)b[E]=(e[x]??0)<<8|(e[x+1]??0);else for(;E<h;){let T=(e[x]??0)<<8|(e[x+1]??0),R=e[x+2]??0;x+=3,w===2&&(R=R<<8|(e[x]??0),x++);for(let I=0;I<=R&&E<h;I++,E++)b[E]=T+I}}let a=q(s,v.fdArray)?.operands[0],u=q(s,v.fdSelect)?.operands[0],l=a===void 0?[]:Y(e,a).items.map(Ye),g=new Array(h).fill(0);if(u!==void 0)if((e[u]??0)===0)for(let x=0;x<h;x++)g[x]=e[u+1+x]??0;else{let x=(e[u+1]??0)<<8|(e[u+2]??0),E=u+3;for(let T=0;T<x;T++,E+=3){let R=(e[E]??0)<<8|(e[E+1]??0),I=(e[E+3]??0)<<8|(e[E+4]??0);for(let D=R;D<I&&D<h;D++)g[D]=e[E+2]??0}}let m=w=>{let[x,E]=q(w,v.private)?.operands??[];if(x===void 0||E===void 0)return{dict:[],subrs:[]};let T=Ye(e.subarray(E,E+x)),R=q(T,v.subrs)?.operands[0];return{dict:T,subrs:R===void 0?[]:Y(e,E+R).items}},S=m(s),A=l.length>0?l.map(m):[S];return{cidKeyed:f,glyphCount:h,codeOf:w=>f?b[w]??0:w,subset(w){let x=new Set([0]);for(let y of w)y>=0&&y<h&&x.add(y);let E=Math.max(...x)+1,T=new Map;for(let y of x){let N=Vn(d.items[y]??new Uint8Array,(A[g[y]??0]??S).subrs,o.items);if(!N){T.clear();break}T.set(y,N)}let R=T.size===x.size,I=A.map(()=>new Set),D=new Set;if(!R)for(let y of x)Jn(d.items[y]??new Uint8Array,A[g[y]??0]??S,{local:I[g[y]??0]??new Set,global:D,gsubrs:o.items});let K=y=>R?T.get(y):d.items[y],Q=new Uint8Array([14]),k=new Uint8Array([11]),P=f?[...x].sort((y,N)=>y-N):Array.from({length:E},(y,N)=>N),z=(y,N)=>{if(N.size===0)return[];let B=y.length>=33900?33900:y.length>=1240?1240:0,J=Math.max(...N)+1;return y.slice(0,Math.max(J,B)).map((de,Ce)=>N.has(Ce)?de:k)},U=X(R?[]:z(o.items,D)),C=X(P.map(y=>x.has(y)?K(y)??Q:Q)),M=Wn(P.map(y=>b[y]??0)),j=l.length>0?Kn(P.map(y=>g[y]??0)):void 0,G=A.map((y,N)=>{let B=X(R?[]:z(y.subrs,I[N]??new Set)),J=y.dict.filter(Oe=>Oe.op!==v.subrs).map(Oe=>Oe.raw),de=!R&&y.subrs.length>0,Ce=de?W(v.subrs,[0]):new Uint8Array,gn=Fe([...J]).length+Ce.length;return{dict:Fe([...J,...de?[W(v.subrs,[gn])]:[]]),subrs:de?B:new Uint8Array}}),se=Uint8Array.from([1,0,4,4]),ae=X(t.items),fe=X(r.items),we=y=>{let N=[];for(let B of s)B.op===v.charset?N.push(W(v.charset,[y.charset])):B.op===v.charStrings?N.push(W(v.charStrings,[y.charStrings])):B.op===v.fdArray?N.push(W(v.fdArray,[y.fdArray])):B.op===v.fdSelect?N.push(W(v.fdSelect,[y.fdSelect])):B.op===v.private?N.push(W(v.private,[...y.priv])):B.op===v.encoding?N.push(W(v.encoding,[0])):N.push(B.raw);return X([Fe(N)])},Se=we({charset:0,charStrings:0,fdArray:0,fdSelect:0,priv:[0,0]}).length,H=se.length+ae.length+Se+fe.length+U.length,Ae=H;H+=M.length;let ke=H;H+=j?.length??0;let Pe=H;H+=C.length;let ce=y=>X(l.map((N,B)=>Fe(N.map(J=>J.op===v.private?W(v.private,[...y[B]??[0,0]]):J.raw)))),Ee=H;H+=l.length>0?ce(l.map(()=>[0,0])).length:0;let F=[];for(let y of G)F.push([y.dict.length,H]),H+=y.dict.length+y.subrs.length;let $=we({charset:Ae,charStrings:Pe,fdArray:Ee,fdSelect:ke,priv:F[0]??[0,0]}),le=[se,ae,$,fe,U,M,...j?[j]:[],C,...l.length>0?[ce(F)]:[],...G.flatMap(y=>[y.dict,y.subrs])],ue=new Uint8Array(le.reduce((y,N)=>y+N.length,0)),V=0;for(let y of le)ue.set(y,V),V+=y.length;return ue}}}function Wn(e){let n=[2],t=1;for(;t<e.length;){let o=e[t]??0,s=0;for(;t+s+1<e.length&&(e[t+s+1]??0)===o+s+1;)s++;n.push(o>>8,o&255,s>>8,s&255),t+=s+1}let i=1+2*Math.max(0,e.length-1);if(n.length<=i)return Uint8Array.from(n);let r=[0];for(let o=1;o<e.length;o++)r.push((e[o]??0)>>8,(e[o]??0)&255);return Uint8Array.from(r)}function Kn(e){let n=[],t=-1,i=0;return e.forEach((r,o)=>{r!==t&&(n.push(o>>8,o&255,r),t=r,i++)}),Uint8Array.from([3,i>>8,i&255,...n,e.length>>8,e.length&255])}function Vn(e,n,t){let i=[],r=[],o=[],s=[],f=0,c=!1,d=()=>{r.length=0,o.length=0,s.length=0},h=(a,u)=>{r.push(i.length),o.push(u.length),s.push(a),i.push(...u)},p=(a,u)=>{if(u>10)return c=!0,!0;let l=0;for(;l<a.length&&!c;){let g=a[l]??0;if(l++,g===28){let m=[28,a[l]??0,a[l+1]??0];h(((a[l]??0)<<8|(a[l+1]??0))<<16>>16,m),l+=2}else if(g>=32&&g<=246)h(g-139,[g]);else if(g>=247&&g<=250)h((g-247)*256+(a[l]??0)+108,[g,a[l]??0]),l++;else if(g>=251&&g<=254)h(-(g-251)*256-(a[l]??0)-108,[g,a[l]??0]),l++;else if(g===255)h(0,[255,a[l]??0,a[l+1]??0,a[l+2]??0,a[l+3]??0]),l+=4;else if(g===10||g===29){let m=g===10?n:t,S=s.pop(),A=r.pop(),w=o.pop();if(S===void 0||A===void 0||w===void 0||A+w!==i.length)return c=!0,!0;let x=m[S+It(m.length)];if(x===void 0)return c=!0,!0;if(i.length=A,p(x,u+1))return!0}else{if(g===11)return!1;if(g===14)return i.push(14),!0;if(g===1||g===3||g===18||g===23)f+=s.length>>1,d(),i.push(g);else if(g===19||g===20){f+=s.length>>1,d();let m=f+7>>3;i.push(g,...Array.from(a.subarray(l,l+m))),l+=m}else if(g===12){let m=a[l++]??0;if(m>=34&&m<=37)d(),i.push(12,m);else return c=!0,!0}else d(),i.push(g)}}return!1},b=p(e,0);if(!c)return b||i.push(14),Uint8Array.from(i)}function Jn(e,n,t){let i=new Set,r=!1,o=0,s=[],f=(c,d)=>{if(d>10)return r=!0,!0;let h=0;for(;h<c.length;){let p=c[h]??0;if(h++,p>=32||p===28){p===28?(s.push(((c[h]??0)<<8|(c[h+1]??0))<<16>>16),h+=2):p<=246?s.push(p-139):p<=250?s.push((p-247)*256+(c[h++]??0)+108):p<=254?s.push(-(p-251)*256-(c[h++]??0)-108):(s.push(((c[h]??0)<<24|(c[h+1]??0)<<16|(c[h+2]??0)<<8|(c[h+3]??0))/65536),h+=4);continue}if(p===10||p===29){let b=p===10?n.subrs:t.gsubrs,a=s.pop();if(a===void 0)return r=!0,!0;let u=a+It(b.length),l=b[u];if(l===void 0)return r=!0,!0;let g=`${p}:${u}:${o}`;if(!i.has(g)&&(i.add(g),(p===10?t.local:t.global).add(u),f(l,d+1)))return!0;continue}if(p===11)return!1;if(p===14)return!0;if(p===1||p===3||p===18||p===23){o+=s.length>>1,s.length=0;continue}if(p===19||p===20){o+=s.length>>1,s.length=0,h+=o+7>>3;continue}if(p===12){let b=c[h++]??0;if(b>=34&&b<=37)s.length=0;else return r=!0,!0;continue}s.length=0}return!1};f(e,0),r&&(n.subrs.forEach((c,d)=>{t.local.add(d)}),t.gsubrs.forEach((c,d)=>{t.global.add(d)}))}var Ot=32,$t=1,_t=8,jt=64,Ht=128;function Bt(e){let n=new DataView(e.buffer,e.byteOffset,e.byteLength);return String.fromCharCode(...e.subarray(0,4))==="ttcf"?n.getUint32(8):1}function Ne(e,n=0){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=String.fromCharCode(...e.subarray(0,4))==="ttcf"?t.getUint32(12+n*4):0,r=new Map,o=t.getUint16(i+4);for(let k=0;k<o;k++){let P=i+12+k*16,z=String.fromCharCode(...e.subarray(P,P+4));r.set(z,{offset:t.getUint32(P+8),length:t.getUint32(P+12)})}let s=k=>{let P=r.get(k);if(!P)throw new Error(`font has no ${k} table`);return P},f=s("head").offset,c=t.getUint16(f+18),d=t.getInt16(f+50)===1,h=[t.getInt16(f+36),t.getInt16(f+38),t.getInt16(f+40),t.getInt16(f+42)],p=s("hhea").offset,b=t.getInt16(p+4),a=t.getInt16(p+6),u=t.getUint16(p+34),l=t.getUint16(s("maxp").offset+4),g=s("hmtx").offset,m=r.get("OS/2"),S=m&&t.getUint16(m.offset)>=2?t.getInt16(m.offset+88):Math.round(c*.714),A=Xn(t,s("cmap").offset),w=k=>t.getUint16(g+Math.min(k,u-1)*4),x=k=>k<u?t.getInt16(g+k*4+2):t.getInt16(g+u*4+(k-u)*2),E=k=>{let P=A(k);return P===void 0||P===0||P>=l?void 0:P},T=k=>{let P=s(k);return e.subarray(P.offset,P.offset+P.length)},R=r.get("CFF ");if(R){let k=Dt(e.subarray(R.offset,R.offset+R.length));return{unitsPerEm:c,ascent:b,descent:a,capHeight:S,bbox:h,outlines:"cff",variable:r.has("fvar"),cidKeyed:k.cidKeyed,glyphOf:E,codeOf:P=>k.codeOf(P),advance:w,subset:P=>({data:k.subset(P)})}}let I=s("loca").offset,D=s("glyf"),K=k=>d?[t.getUint32(I+k*4),t.getUint32(I+k*4+4)]:[t.getUint16(I+k*2)*2,t.getUint16(I+k*2+2)*2],Q=k=>{let[P,z]=K(k);if(z<=P)return[];let U=D.offset+P;if(t.getInt16(U)>=0)return[];let C=[],M=U+10;for(;;){let j=t.getUint16(M);if(C.push(t.getUint16(M+2)),M+=4+(j&$t?4:2),j&_t?M+=2:j&jt?M+=4:j&Ht&&(M+=8),!(j&Ot))break}return C};return{unitsPerEm:c,ascent:b,descent:a,capHeight:S,bbox:h,outlines:"glyf",variable:r.has("fvar"),cidKeyed:!1,glyphOf:E,codeOf:k=>k,advance:w,subset(k){let P=new Set,z=[0,...k];for(let F=z.pop();F!==void 0;F=z.pop())P.has(F)||(P.add(F),z.push(...Q(F)));let U=[...P].sort((F,$)=>F-$),C=new Map(U.map((F,$)=>[F,$])),M=new Uint32Array(U.length+1),j=[],G=0;U.forEach((F,$)=>{M[$]=G;let[le,ue]=K(F);if(ue>le){let V=Uint8Array.from(e.subarray(D.offset+le,D.offset+ue));new DataView(V.buffer).getInt16(0)<0&&Yn(V,C),j.push(V),G+=V.length;let y=(4-G%4)%4;y&&(j.push(new Uint8Array(y)),G+=y)}}),M[U.length]=G;let se=new Uint8Array(G),ae=0;for(let F of j)se.set(F,ae),ae+=F.length;let fe=new Uint8Array((U.length+1)*4),we=new DataView(fe.buffer);M.forEach((F,$)=>{we.setUint32($*4,F)});let Se=new Uint8Array(U.length*4),H=new DataView(Se.buffer);U.forEach((F,$)=>{H.setUint16($*4,w(F)),H.setInt16($*4+2,x(F))});let Ae=Uint8Array.from(e.subarray(f,f+s("head").length)),ke=new DataView(Ae.buffer);ke.setUint32(8,0),ke.setInt16(50,1);let Pe=Uint8Array.from(T("hhea"));new DataView(Pe.buffer).setUint16(34,U.length);let ce=Uint8Array.from(T("maxp"));new DataView(ce.buffer).setUint16(4,U.length);let Ee=new Uint16Array((U.at(-1)??0)+1);for(let[F,$]of C)Ee[F]=$;return{data:Zn([["glyf",se],["head",Ae],["hhea",Pe],["hmtx",Se],["loca",fe],["maxp",ce]]),cidToGid:Ee}}}}function Yn(e,n){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=10;for(;;){let r=t.getUint16(i);if(t.setUint16(i+2,n.get(t.getUint16(i+2))??0),i+=4+(r&$t?4:2),r&_t?i+=2:r&jt?i+=4:r&Ht&&(i+=8),!(r&Ot))break}}function Ct(e,n){let t=0,i=e.length-1,r=-1;for(;t<=i;){let o=t+i>>1;(e[o]??0)<=n?(r=o,t=o+1):i=o-1}return r}function Xn(e,n){let t=e.getUint16(n+2),i;for(let r=0;r<t;r++){let o=e.getUint16(n+4+r*8),s=e.getUint16(n+4+r*8+2),f=n+e.getUint32(n+4+r*8+4),c=e.getUint16(f);if(o===3&&(s===1||s===10)||o===0){if(c===12){let h=e.getUint32(f+12),p=new Uint32Array(h);for(let b=0;b<h;b++)p[b]=e.getUint32(f+16+b*12);return b=>{let a=Ct(p,b);if(a<0)return;let u=e.getUint32(f+16+a*12+4);if(!(b>u))return e.getUint32(f+16+a*12+8)+(b-(p[a]??0))}}if(c===4&&i===void 0){let h=e.getUint16(f+6)/2,p=f+14,b=p+h*2+2,a=b+h*2,u=a+h*2,l=new Uint32Array(h);for(let g=0;g<h;g++)l[g]=e.getUint16(b+g*2);i=g=>{if(g>65535)return;let m=Ct(l,g);if(m<0||g>e.getUint16(p+m*2))return;let S=e.getUint16(u+m*2);if(S===0)return g+e.getInt16(a+m*2)&65535;let A=e.getUint16(u+m*2+S+(g-(l[m]??0))*2);return A===0?void 0:A+e.getInt16(a+m*2)&65535}}}}if(i)return i;throw new Error("font has no Unicode cmap")}function qn(e){let n=new Uint8Array(Math.ceil(e.length/4)*4);n.set(e);let t=new DataView(n.buffer),i=0;for(let r=0;r<n.length;r+=4)i=i+t.getUint32(r)>>>0;return i}function Zn(e){let n=[...e].sort(([c],[d])=>c<d?-1:1),t=12+n.length*16,i=n.reduce((c,[,d])=>c+Math.ceil(d.length/4)*4,t),r=new Uint8Array(i),o=new DataView(r.buffer);o.setUint32(0,65536),o.setUint16(4,n.length);let s=Math.floor(Math.log2(n.length));o.setUint16(6,2**s*16),o.setUint16(8,s),o.setUint16(10,n.length*16-2**s*16);let f=t;return n.forEach(([c,d],h)=>{let p=12+h*16;r.set(new TextEncoder().encode(c),p),o.setUint32(p+4,qn(d)),o.setUint32(p+8,f),o.setUint32(p+12,d.length),r.set(d,f),f+=Math.ceil(d.length/4)*4}),r}var ve={platform:process.platform,env:process.env,home:ir(),exists:e=>er(e),list:e=>{try{return tr(e)}catch{return[]}},run:(e,n)=>new Promise(t=>{Qn(e,n,{timeout:5e3,windowsHide:!0,maxBuffer:4e6},(i,r)=>t(i?void 0:r))}),read:e=>{try{return rr(e).size>1e8?void 0:nr(e)}catch{return}}},or={zh:[["msyh.ttc",0],["simsun.ttc",0],["simhei.ttf",0],["Deng.ttf",0],["arialuni.ttf",0]],"zh-TW":[["msjh.ttc",0],["mingliu.ttc",0],["msyh.ttc",0],["arialuni.ttf",0]],ja:[["YuGothR.ttc",0],["YuGothM.ttc",0],["meiryo.ttc",0],["msgothic.ttc",0],["msmincho.ttc",0],["arialuni.ttf",0]],ko:[["malgun.ttf",0],["gulim.ttc",0],["batang.ttc",0],["arialuni.ttf",0]],arabic:[["segoeui.ttf",0],["arial.ttf",0],["tahoma.ttf",0],["times.ttf",0],["arialuni.ttf",0]],hebrew:[["segoeui.ttf",0],["arial.ttf",0],["tahoma.ttf",0],["times.ttf",0],["arialuni.ttf",0]],thai:[["LeelawUI.ttf",0],["leelawad.ttf",0],["tahoma.ttf",0],["arialuni.ttf",0]],other:[["seguisym.ttf",0],["segoeui.ttf",0],["arial.ttf",0],["arialuni.ttf",0],["malgun.ttf",0],["msyh.ttc",0]]},sr={zh:[["PingFang.ttc",0],["STHeiti Light.ttc",1],["Hiragino Sans GB.ttc",0],["Arial Unicode.ttf",0]],"zh-TW":[["PingFang.ttc",2],["STHeiti Light.ttc",0],["Hiragino Sans GB.ttc",0],["Arial Unicode.ttf",0]],ja:[["\u30D2\u30E9\u30AE\u30CE\u89D2\u30B4\u30B7\u30C3\u30AF W3.ttc",0],["Hiragino Sans GB.ttc",0],["AquaKana.ttc",0],["Arial Unicode.ttf",0]],ko:[["AppleSDGothicNeo.ttc",0],["Arial Unicode.ttf",0]],arabic:[["GeezaPro.ttc",0],["SFArabic.ttf",0],["Arial Unicode.ttf",0]],hebrew:[["ArialHB.ttc",0],["Arial Unicode.ttf",0]],thai:[["Thonburi.ttc",0],["Arial Unicode.ttf",0]],other:[["Arial Unicode.ttf",0],["Apple Symbols.ttf",0],["Arial.ttf",0]]},zt={zh:[["NotoSansCJK-Regular.ttc",2],["NotoSansCJKsc-Regular.otf",0],["wqy-zenhei.ttc",0],["wqy-microhei.ttc",0],["DroidSansFallbackFull.ttf",0],["DroidSansFallback.ttf",0]],"zh-TW":[["NotoSansCJK-Regular.ttc",3],["NotoSansCJKtc-Regular.otf",0],["wqy-zenhei.ttc",0],["DroidSansFallbackFull.ttf",0]],ja:[["NotoSansCJK-Regular.ttc",0],["NotoSansCJKjp-Regular.otf",0],["DroidSansFallbackFull.ttf",0],["TakaoGothic.ttf",0]],ko:[["NotoSansCJK-Regular.ttc",1],["NotoSansCJKkr-Regular.otf",0],["NanumGothic.ttf",0],["DroidSansFallbackFull.ttf",0]],arabic:[["NotoSansArabic-Regular.ttf",0],["NotoNaskhArabic-Regular.ttf",0],["DejaVuSans.ttf",0],["FreeSans.ttf",0]],hebrew:[["NotoSansHebrew-Regular.ttf",0],["DejaVuSans.ttf",0],["FreeSans.ttf",0]],thai:[["NotoSansThai-Regular.ttf",0],["Garuda.ttf",0],["Loma.ttf",0],["DejaVuSans.ttf",0]],other:[["DejaVuSans.ttf",0],["NotoSansSymbols-Regular.ttf",0],["NotoSansSymbols2-Regular.ttf",0],["FreeSans.ttf",0],["LiberationSans-Regular.ttf",0]]},ar={zh:"zh-cn","zh-TW":"zh-tw",ja:"ja",ko:"ko",arabic:"ar",hebrew:"he",thai:"th"};function fr(e){return e.script==="han"||e.script==="kana"||e.script==="hangul"?e.script==="kana"?"ja":e.script==="hangul"?"ko":e.lang??"zh":e.script==="arabic"||e.script==="hebrew"||e.script==="thai"?e.script:"other"}var qe=e=>e.platform==="win32"?Kt:Xe;function cr(e){let n=Kt.join,t=e.env.WINDIR??e.env.SystemRoot??"C:\\Windows";return[n(t,"Fonts"),...e.env.LOCALAPPDATA?[n(e.env.LOCALAPPDATA,"Microsoft","Windows","Fonts")]:[]]}function lr(e){let n=Xe.join;return["/System/Library/Fonts","/System/Library/Fonts/Supplemental","/Library/Fonts",n(e.home,"Library","Fonts")]}function ur(e){let n=Xe.join,t=e.env.XDG_DATA_HOME??n(e.home,".local","share");return["/usr/share/fonts","/usr/local/share/fonts","/usr/share/fonts/opentype/noto","/usr/share/fonts/truetype",n(t,"fonts"),n(e.home,".fonts")]}function Vt(e,n,t,i=3){let{join:r}=qe(t),o=t.list(e),s=n.toLowerCase(),f=o.find(c=>c.toLowerCase()===s);if(f)return r(e,f);if(i!==0)for(let c of o){if(c.includes("."))continue;let d=Vt(r(e,c),n,t,i-1);if(d)return d}}async function Gt(e,n){let t=await n.run("fc-match",["-s","-f",`%{file} %{index}
|
|
24
|
+
`,e]);return t===void 0?[]:t.split(`
|
|
25
|
+
`).map(i=>i.split(" ")).filter(([i])=>i!==void 0&&i!=="").slice(0,8).map(([i,r])=>({path:i,index:(Number(r)||0)&65535}))}async function Jt(e,n=ve){let t=fr(e),{join:i}=qe(n),r=[],o=f=>{f&&!r.some(c=>c.path===f.path&&c.index===f.index)&&r.push(f)};if(n.platform==="win32"||n.platform==="darwin"){let f=n.platform==="win32"?or:sr,c=n.platform==="win32"?cr(n):lr(n);for(let[d,h]of f[t]??f.other??[])for(let p of c){let b=i(p,d);if(n.exists(b)){o({path:b,index:h});break}}return r}let s=ar[t];if(s)for(let f of await Gt(`:lang=${s}`,n))o(f);else if(e.codePoint!==void 0)for(let f of await Gt(`:charset=${e.codePoint.toString(16)}`,n))o(f);for(let[f,c]of zt[t]??zt.other??[])for(let d of ur(n)){let h=Vt(d,f,n);if(h){o({path:h,index:c});break}}return r}var Wt=new WeakMap;function Yt(e,n=ve){let t=Wt.get(n)??new Map;Wt.set(n,t);let i=`${e.path}#${e.index}`,r=qe(n).basename(e.path).replace(/\.[^.]+$/,""),o=t.get(i);if(o!==void 0)return o===null?void 0:{font:o,ref:e,name:r};try{let s=n.read(e.path);if(!s)throw new Error("unreadable");let f=Ne(s,Math.min(e.index,Math.max(0,Bt(s)-1)));return t.set(i,f),{font:f,ref:e,name:r}}catch{t.set(i,null);return}}var Zt=595.28,Me=841.89,re=72,me=Zt-2*re,Ze=Me-2*re,Z={size:11,leading:16,after:8},br={size:20,leading:26,before:0,after:6},xr={size:15,leading:20,before:18,after:6},yr=4,wr=24,L={size:10,leading:14,padX:6,padY:3},Sr=12,Ue=.114,Ar=.78,kr=.95,Xt={regular:"NotoSans-Regular.ttf.gz",bold:"NotoSans-Bold.ttf.gz"};function Pr(e){return[be(e,"fonts"),be(e,"..","fonts"),be(e,"..","..","assets","fonts")]}var Le;function Er(){if(Le)return Le;let e=Pr(hr(pr(import.meta.url))).find(t=>dr(be(t,Xt.regular)));if(e===void 0)throw new Error("the PDF fonts are missing from this install");let n=t=>Ne(mr(gr(be(e,Xt[t]))));return Le={regular:n("regular"),bold:n("bold")},Le}var ie=class{constructor(n,t,i,r,o){this.font=n;this.resource=t;this.name=i;this.synthetic=r;this.isBold=o}font;resource;name;synthetic;isBold;used=new Map;widths=new Map;advance(n){let t=this.widths.get(n);return t===void 0&&(t=this.font.advance(n)/this.font.unitsPerEm,this.widths.set(n,t)),t}code(n,t){let i=this.font.codeOf(n);return this.used.has(i)||this.used.set(i,{gid:n,text:t}),i}},et=class{fonts=[];picks=new Map;count=0;missing=new Set;notdef;constructor(n){let t={regular:new ie(n.regular,this.next(),"NotoSans-Regular",!1,!1),bold:new ie(n.bold,this.next(),"NotoSans-Bold",!1,!0)};this.fonts.push(t),this.notdef=t}next(){return`F${++this.count}`}get primary(){return this.notdef.regular.font}all(){return this.fonts.flatMap(n=>[n.regular,n.bold])}add(n,t){this.fonts.push({regular:new ie(t,this.next(),n,!1,!1),bold:new ie(t,this.next(),n,!0,!0)}),this.picks.clear()}get fontCount(){return this.fonts.length}has(n){return this.fonts.some(t=>t.regular.font.glyphOf(n)!==void 0)}pick(n,t){let i=this.picks.get(n);if(i===void 0){i=null;for(let o=0;o<this.fonts.length;o++){let s=this.fonts[o]?.regular.font.glyphOf(n);if(s!==void 0){i=[o,s];break}}this.picks.set(n,i)}if(i===null)return this.missing.add(te(n)??"other"),{pf:t?this.notdef.bold:this.notdef.regular,gid:0};let r=this.fonts[i[0]];return{pf:(t?r?.bold:r?.regular)??this.notdef.regular,gid:i[1]}}width(n,t,i){let r=0;for(let o of n){let{pf:s,gid:f}=this.pick(o.codePointAt(0)??0,i);r+=s.advance(f)}return r*t}runs(n,t){let i=[];for(let r of n){let o=r.codePointAt(0)??0,{pf:s,gid:f}=this.pick(o,t),c=f===0?"\uFFFD":o>=64336&&o<=65279?Mt(o):r,d=s.code(f,c).toString(16).padStart(4,"0"),h=i.at(-1);h&&h.pf===s?(h.hex+=d,h.width+=s.advance(f)):i.push({pf:s,hex:d,width:s.advance(f)})}return i}},Tr=/[\u00AD\u200B\u200E\u200F\u2028\u2029\u202A-\u202E\u2060\u2066-\u2069\uFEFF]/g,Rr=/[\t\u00A0\u2000-\u200A\u202F\u205F\u3000]/g,Fr=/[^\P{Cc}\n]/gu;function Qt(e){return e.replace(Rr," ").replace(Tr,"").replace(Fr,"").normalize("NFC")}function Nr(e,n){let t=Qt(e);Ut(t)&&(t=Lt(t,n)),t=t.replace(/[\u200C\u200D]/g,"");let i=[];for(let r of t){let o=r.codePointAt(0)??0;if(r===`
|
|
26
|
+
`||n(o)){i.push(r);continue}let s=r.normalize("NFKD").replace(new RegExp("\\p{M}","gu"),"");i.push(s!==""&&[...s].every(f=>n(f.codePointAt(0)??0))?s:r)}return i.join("")}var vr=new Set(["han","kana","hangul"]),Ur=new Set([12289,12290,65292,65294,65306,65307,65281,65311,65289,65341,65373,12309,12297,12299,12301,12303,12305,12313,12311,12319,8217,8221,8252,12540,12293,12539,8230,8229,37,12445,12446,12541,12542].map(e=>String.fromCodePoint(e))),Lr=new Set([65288,65339,65371,12308,12296,12298,12300,12302,12304,12312,12310,12317,8216,8220].map(e=>String.fromCodePoint(e)));function Qe(e,n,t,i,r){let o=[],s=f=>n.width(f,i,t);for(let f of e.split(`
|
|
27
|
+
`)){let c="",d=0,h=s(" ");for(let p of f.split(" ").filter(Boolean)){let b=s(p),a=[...p].some(u=>vr.has(te(u.codePointAt(0)??0)));if(b>r||a&&c!==""&&d+h+b>r){c!==""&&(d+h+s([...p][0]??"")<=r?(c+=" ",d+=h):(o.push(c),c="",d=0));for(let u of p){let l=s(u),g=[...c].at(-1),m=Ur.has(u)&&d+l<=r*1.15;d+l>r&&c!==""&&!m&&(g!==void 0&&Lr.has(g)?(o.push([...c].slice(0,-1).join("")),c=g,d=s(g)):(o.push(c),c="",d=0)),c+=u,d+=l}}else c===""?(c=p,d=b):d+h+b<=r?(c+=` ${p}`,d+=h+b):(o.push(c),c=p,d=b)}o.push(c)}return o}var _=e=>(Math.round(e*100)/100).toString(),tt=class{constructor(n){this.chain=n}chain;pages=[];ops=[];y=0;owed=0;get remaining(){return Ze-this.y}get atTop(){return this.y===0}newPage(){this.ops=[`${_(Ue)} g ${_(Ue)} G`],this.pages.push(this.ops),this.y=0,this.owed=0}gap(n){this.y>0&&(this.y+=Math.max(this.owed,n)),this.owed=0}bottom(n){this.owed=n}advance(n){this.y+=n}text(n,t,i,r,o,s,f){if(s==="")return;let{primary:c}=this.chain,d=(c.ascent-c.descent)*t/c.unitsPerEm,h=o+(i-d)/2+c.ascent*t/c.unitsPerEm,p=this.chain.runs(bt(s,f),n),b=p.reduce((l,g)=>l+g.width,0)*t,a=re+(f?r.left+r.width-b:r.left),u=_(Me-re-h);for(let l of p){let g=l.pf.synthetic?`2 Tr ${_(t*.035)} w `:"",m=l.pf.synthetic?" 0 Tr":"";this.ops.push(`BT /${l.pf.resource} ${_(t)} Tf ${g}${_(a)} ${u} Td <${l.hex}> Tj${m} ET`),a+=l.width*t}}rect(n,t,i,r,o){let s=`${_(re+n)} ${_(Me-re-t-r)} ${_(i)} ${_(r)} re`;o==="fill"?this.ops.push(`${_(kr)} g ${s} f ${_(Ue)} g`):this.ops.push(`${_(Ar)} G 0.5 w ${s} S ${_(Ue)} G`)}lines(n,t,i,r,o,s){let f=pe(o),c=s?.indent??0,d={left:f?r.left:r.left+c,width:r.width-c};Qe(o,this.chain,n,t,d.width).forEach((h,p)=>{if(this.remaining<i&&this.newPage(),p===0&&s!==void 0){let b=this.chain.width(s.text,t,n),a=f?{left:r.left+r.width-b,width:b}:{left:d.left-b,width:b};this.text(n,t,i,a,this.y,s.text,!1)}this.text(n,t,i,d,this.y,h,f),this.advance(i)})}heading(n,t){let i=n===1?br:xr,r=Qe(t,this.chain,!0,i.size,me);this.gap(i.before),this.remaining<r.length*i.leading+i.after+2*Z.leading&&this.newPage(),this.lines(!0,i.size,i.leading,{left:0,width:me},t),this.bottom(i.after)}paragraph(n){this.gap(0),this.lines(!1,Z.size,Z.leading,{left:0,width:me},n),this.bottom(Z.after)}list(n,t){this.gap(0),t.forEach((i,r)=>{r>0&&this.advance(yr);let o=n?`${r+1}. `:"\u2022 ";this.lines(!1,Z.size,Z.leading,{left:0,width:me},i,{text:o,indent:wr})}),this.bottom(Z.after)}table(n){if(n.length===0)return;this.gap(0);let t=Math.max(...n.map(a=>a.length)),i=L.padX*2,r=Array(t).fill(0),o=Array(t).fill(0);for(let[a,u]of n.entries()){let l=a===0;for(let g=0;g<t;g++){let m=u[g]??"";r[g]=Math.max(r[g]??0,this.chain.width(m.replace(/\n/g," "),L.size,l)+i);let S=Math.max(0,...m.split(/\s+/).map(A=>Math.min(this.chain.width(A,L.size,l),L.size*3)));o[g]=Math.max(o[g]??0,S+i)}}let s=Mr(r,o,me),f=s.map((a,u)=>s.slice(0,u).reduce((l,g)=>l+g,0)),c=a=>s.map((u,l)=>Qe(n[a]?.[l]??"",this.chain,a===0,L.size,u-i)),d=c(0),h=Math.max(...d.map(a=>a.length))*L.leading+2*L.padY,p=(a,u,l,g)=>{let m=g*L.leading+2*L.padY;for(let S=0;S<t;S++){let A=f[S]??0,w=s[S]??0;a===0&&this.rect(A,this.y,w,m,"fill"),this.rect(A,this.y,w,m,"stroke");let x=n[a]?.[S]??"",E=pe(x);(u[S]??[]).slice(l,l+g).forEach((T,R)=>{this.text(a===0,L.size,L.leading,{left:A+L.padX,width:w-i},this.y+L.padY+R*L.leading,T,E)})}this.advance(m)},b=a=>{this.newPage(),a>0&&h<Ze/2&&p(0,d,0,Math.max(...d.map(u=>u.length)))};for(let a=0;a<n.length;a++){let u=a===0?d:c(a),l=Math.max(...u.map(m=>m.length)),g=0;for(;g<l;){let m=Math.floor((this.remaining-2*L.padY)/L.leading),S=(l-g)*L.leading+2*L.padY;if(m<1||m<l-g&&!this.atTop&&S<=Ze-h){b(a);continue}let A=Math.min(l-g,m);p(a,u,g,A),g+=A,g<l&&b(a)}}this.bottom(Sr)}};function Mr(e,n,t){let i=e.reduce((s,f)=>s+f,0);if(i<=t)return e.map(s=>s*t/i);let r=n.reduce((s,f)=>s+f,0);if(r>=t)return n.map(s=>s*t/r);let o=(t-r)/(i-r);return e.map((s,f)=>(n[f]??0)+(s-(n[f]??0))*o)}function Ir(e){return e.flatMap(n=>n.flatMap(t=>t.kind==="heading"||t.kind==="paragraph"?[t.text]:t.kind==="list"?t.items:t.rows.flat()))}var qt=8;async function Dr(e,n,t,i){let r=new Map;for(let f of new Set(n)){let c=f.codePointAt(0)??0;if(c<128||f===`
|
|
28
|
+
`||e.has(c)||c>=64336&&c<=65279)continue;let d=te(c)??"other";if(d!=="other"&&d!=="symbols"&&d!=="emoji"&&!Pt.has(d)){e.missing.add(d);continue}r.set(d,[...r.get(d)??[],c])}let o=Je(n,t),s=0;for(let[f,c]of r){let d=c,h={script:f,lang:o,codePoint:c[0]??0},p=[],b=a=>{let u=d.filter(l=>a.font.glyphOf(l)!==void 0);u.length!==0&&(e.add(a.name,a.font),s++,d=d.filter(l=>!u.includes(l)))};for(let a of await Jt(h,i)){if(d.length===0||s>=qt)break;let u=Yt(a,i);u&&(u.font.variable?p.push(u):b(u))}for(let a of p){if(d.length===0||s>=qt)break;b(a)}}}async function nt(e,n){let{PDFDocument:t,PDFName:i,PDFString:r}=await lt(),o=new et(Er()),s=Ir(e).map(Qt).join(`
|
|
29
|
+
`);await Dr(o,s,n.lang,n.fonts??ve);let f=new tt(o),c=l=>Nr(l,g=>o.has(g)),d=l=>{l.kind==="heading"?f.heading(l.level,c(l.text)):l.kind==="paragraph"?f.paragraph(c(l.text)):l.kind==="list"?f.list(l.ordered,l.items.map(c)):f.table(l.rows.map(g=>g.map(c)))};for(let l of e.filter(g=>g.length>0)){f.newPage();for(let g of l)d(g)}f.pages.length===0&&f.newPage();let h=await t.create({updateMetadata:!1});h.setTitle(n.title),h.setProducer("Forge"),h.setCreator("Forge");let{context:p}=h,b=new Map,a=new Map,u=0;for(let l of o.all()){if(l.used.size===0)continue;let g=p.nextRef();b.set(l,g);let{font:m}=l,S=[...l.used.keys()].sort((C,M)=>C-M),A=S.map(C=>l.used.get(C)?.gid??0),w=l.synthetic?a.get(m):void 0,x=1e3/m.unitsPerEm,E=`F${String.fromCharCode(65+(u>>8)%26,65+(u>>4)%26,65+(u>>2)%26,65+u%26,65+u*7%26)}`;u++;let T=`${E}+${l.name.replace(/[^A-Za-z0-9-]/g,"")}`,{data:R,cidToGid:I}=m.subset(A),D=m.outlines==="cff",K=p.register(D?p.flateStream(R,{Subtype:"CIDFontType0C"}):p.flateStream(R,{Length1:R.length})),Q=p.register(p.obj({Type:"FontDescriptor",FontName:T,Flags:4,FontBBox:m.bbox.map(C=>Math.round(C*x)),ItalicAngle:0,Ascent:Math.round(m.ascent*x),Descent:Math.round(m.descent*x),CapHeight:Math.round(m.capHeight*x),StemV:l.isBold?140:80,...D?{FontFile3:K}:{FontFile2:K}})),k=S.flatMap((C,M)=>[C,[Math.round(m.advance(A[M]??0)*x)]]),P=I?p.register(p.flateStream(new Uint8Array(new Uint16Array(Or(I)).buffer))):void 0,z=p.register(p.obj({Type:"Font",Subtype:D?"CIDFontType0":"CIDFontType2",BaseFont:T,CIDSystemInfo:p.obj({Registry:r.of("Adobe"),Ordering:r.of("Identity"),Supplement:0}),FontDescriptor:Q,DW:0,W:k,...D?{}:{CIDToGIDMap:P??"Identity"}})),U=p.register(p.flateStream($r(l.used)));p.assign(g,p.obj({Type:"Font",Subtype:"Type0",BaseFont:T,Encoding:"Identity-H",DescendantFonts:[z],ToUnicode:U})),l.synthetic||a.set(m,l)}for(let l of f.pages){let g=h.addPage([Zt,Me]);for(let[m,S]of b)g.node.setFontDictionary(i.of(m.resource),S);g.node.set(i.of("Contents"),p.register(p.flateStream(l.join(`
|
|
30
|
+
`))))}return o.missing.size>0&&n.onMissing?.([...o.missing].map(Cr)),Buffer.from(await h.save())}var Cr=e=>e==="other"?"symbols":Et(e);function Or(e){let n=new Uint16Array(e.length);for(let t=0;t<e.length;t++)n[t]=((e[t]??0)&255)<<8|(e[t]??0)>>8;return n}function $r(e){let n=[...e].sort(([o],[s])=>o-s),t=o=>o.toString(16).padStart(4,"0"),i=o=>[...o].flatMap(s=>{let f=s.codePointAt(0)??65533;if(f<65536)return[t(f)];let c=f-65536;return[t(55296+(c>>10)),t(56320+(c&1023))]}).join(""),r=[];for(let o=0;o<n.length;o+=100){let s=n.slice(o,o+100);r.push(`${s.length} beginbfchar
|
|
31
|
+
${s.map(([f,c])=>`<${t(f)}> <${i(c.text)}>`).join(`
|
|
32
|
+
`)}
|
|
33
|
+
endbfchar`)}return["/CIDInit /ProcessSet findresource begin","12 dict begin","begincmap","/CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def","/CMapName /Adobe-Identity-UCS def","/CMapType 2 def",`1 begincodespacerange
|
|
34
|
+
<0000> <FFFF>
|
|
35
|
+
endcodespacerange`,...r,"endcmap","CMapName currentdict /CMap defineresource pop","end","end"].join(`
|
|
36
|
+
`)}var De="forge-transcribe",rt="forge-transcribe-whisper.mjs",Br=["darwin","win32","linux"];function zr(e=process.platform,n=["whisper"]){let t=n.includes("whisper")||!n.includes("ffmpeg"),i=n.includes("ffmpeg"),r=[t&&"the whisper extension (forge extensions add whisper, or /extensions)",i&&(e==="darwin"?"ffmpeg (brew install ffmpeg)":e==="win32"?"ffmpeg (winget install ffmpeg)":"ffmpeg on your PATH")].filter(Boolean);return e==="darwin"?`Transcribe on this Mac needs ${r.join(" and ")}.`:e==="win32"?`Transcribe on Windows needs ${r.join(" and ")}.`:e==="linux"?`Transcribe on Linux needs ${r.join(" and ")}.`:"Transcribe needs macOS, Windows or Linux."}function Zi(e=process.platform,n=e==="darwin"?"off":"unsupported"){return n==="off"?"Summary and notes need Apple Intelligence, and it is off.":`Summary and notes need Apple Intelligence, which this ${je(e)} does not have.`}function Gr(e){return{apple:[O(e,"helpers",De),O(e,"..","helpers",De),O(e,"..","..","dist","helpers",De)],whisper:[O(e,"helpers",rt),O(e,"..","helpers",rt),O(e,"..","..","helpers","transcribe",rt)]}}function xe(e=process.platform,n=process.env){let t=n.FORGE_TRANSCRIBE_HELPER;if(t!==void 0)return Ie(t)?t.endsWith(".mjs")?{whisper:t}:{apple:t}:{};if(!Br.includes(e))return{};let i=Gr(on(Hr(import.meta.url))),r=e==="darwin"?i.apple.find(s=>Ie(s)):void 0,o=i.whisper.find(s=>Ie(s));return{...r?{apple:r}:{},...o?{whisper:o}:{}}}async function Wr(e){return e.apple!==void 0&&e.whisper===void 0?{path:e.apple,kind:"apple"}:e.apple!==void 0&&await e.appleHears(e.apple).catch(()=>!1)?{path:e.apple,kind:"apple"}:e.whisper===void 0?void 0:{path:e.whisper,kind:"whisper"}}var en=new Map;function ye(e,n={}){let{apple:t}=xe();if(t===void 0)return Promise.resolve(void 0);let i=`${t}\0${e??""}`,r=n.fresh?void 0:en.get(i);if(r)return r;let o=["status",...e?["--locale",e]:[]],s=oe({path:t,kind:"apple"},o,"").catch(()=>{});return en.set(i,s),s}var it;function Kr(){return process.env.FORGE_TRANSCRIBE_HELPER!==void 0&&(it=void 0),it??=Wr({...xe(),appleHears:async()=>(await ye())?.speech===!0}),it}function Vr(e){let{apple:n}=xe();if(n===void 0)throw e();return{path:n,kind:"apple"}}async function Jr(){let e={...process.env,FORGE_HELPER_STOP_ON_EOF:"1"};if(!e.FORGE_FFMPEG){let n=await He().catch(()=>{});n&&(e.FORGE_FFMPEG=n.ffmpeg)}if(!e.FORGE_WHISPER_CLI){let n=await he("whisper");n&&(e.FORGE_WHISPER_CLI=n.entry)}if(!e.FORGE_WHISPER_MODEL){let n=await he("whisper"),t=n&&O(on(n.entry),"model.bin");t&&Ie(t)&&(e.FORGE_WHISPER_MODEL=t)}return e}var Yr=5e3;async function oe(e,n,t,i={}){let{signal:r}=i;if(r?.aborted)throw r.reason??new Error("aborted");let o=e.kind==="whisper",s=o?await Jr():process.env;if(r?.aborted)throw r.reason??new Error("aborted");return new Promise((f,c)=>{let d=/\.[cm]?js$/.test(e.path),[h,p]=d?[process.execPath,[e.path,...n]]:[e.path,n],b=rn(h,p,{stdio:[o?"pipe":"ignore","pipe","ignore"],env:s,windowsHide:!0});b.stdin?.on("error",()=>{});let a,u=!1,l=m=>{u||(u=!0,r?.removeEventListener("abort",g),m())},g=()=>{o&&b.stdin?(b.stdin.end(),setTimeout(()=>b.kill("SIGKILL"),Yr).unref()):b.kill("SIGKILL"),l(()=>c(r?.reason??new Error("aborted")))};r?.addEventListener("abort",g,{once:!0}),jr({input:b.stdout}).on("line",m=>{let S;try{S=JSON.parse(m)}catch{return}"ok"in S?a=S:i.onLine?.(S)}),b.on("error",m=>l(()=>c(ge(t,m)))),b.on("close",()=>l(()=>{if(a===void 0)return c(ge(t,new Error(`${De} gave no result`)));if(a.ok===!0)return f(a);c(Xr(String(a.code??""),String(a.message??""),t,n,e.kind))}))})}function Xr(e,n,t,i,r){if(e==="no-sound")return $e(t);if(e==="unreadable")return Te(t,process.platform,r);if(e==="locale"){let o=i.indexOf("--locale");return ct(o>=0?i[o+1]??"this language":`this ${je()}'s language`,process.platform,r)}return e==="unsupported"||e==="runtime"?_e(n):ge(t,new Error(`${e}: ${n}`))}var qr=["whisper","ffmpeg"];async function Zr(e={}){let n=xe();if(n.apple===void 0&&n.whisper===void 0)return;let t=await ye(e.locale,{fresh:!0}),r={read:t?.read===!0||await he("read-text")!==void 0};if(t?.speech===!0)return{speech:!0,hears:"apple",locale:typeof t.locale=="string"?t.locale:null,notes:t.notes==="available"||t.notes==="off"?t.notes:"unsupported",...r};if(n.whisper===void 0)return t===void 0?void 0:{speech:!1,locale:null,notes:"unsupported",...r};let o=["status",...e.locale?["--locale",e.locale]:[]],s=await oe({path:n.whisper,kind:"whisper"},o,""),f=Array.isArray(s.missing)?qr.filter(c=>s.missing.includes(c)):[];return{speech:s.speech===!0,...s.speech===!0?{hears:"whisper"}:{},locale:typeof s.locale=="string"?s.locale:null,notes:"unsupported",...r,...f.length>0?{missing:f}:{}}}async function Qi(e=process.platform){return e!=="darwin"?!0:(await Zr().catch(()=>{}))?.hears!=="apple"}async function eo(e=process.platform){if(e!=="darwin")return{hears:!1,reads:!1};let n=await ye().catch(()=>{});return{hears:n?.speech===!0,reads:n?.read===!0}}async function sn(){let e=await Kr();if(e===void 0)throw _e(zr());return e}var Qr=new Set(["mp4","mov","m4a","mp3","wav","aiff"]);async function an(e,n){if(e.kind!=="apple")return;let{probe:t}=await import("./registry-PKOPEG3Z.js"),i=await t(n).catch(()=>{});if(i===void 0||i.kind!=="media"||Qr.has(i.format))return;let r=await He().catch(()=>{});return r?{tools:r}:void 0}async function ei(e,n,t){let i=await st(O(ft(),"forge-sound-")),r=()=>at(i,{recursive:!0,force:!0}),o=O(i,"sound.wav");try{return await new Promise((s,f)=>{let c=rn(n,["-nostdin","-v","error","-i",e,"-vn","-ac","1","-ar","16000","-c:a","pcm_s16le",o],{stdio:["ignore","ignore","pipe"],windowsHide:!0}),d="";c.stderr?.setEncoding("utf8").on("data",p=>{d+=p});let h=()=>c.kill("SIGKILL");t?.addEventListener("abort",h,{once:!0}),c.on("error",f),c.on("close",p=>{if(t?.removeEventListener("abort",h),t?.aborted)return f(t.reason??new Error("aborted"));p===0?s():f(ge(e,new Error(`ffmpeg: ${d.trim()}`)))})}),{path:o,cleanup:r}}catch(s){throw await r(),s}}async function to(e){let n=await sn(),t=await an(n,e);if(t){let{probeMedia:r}=await import("./ffmpeg-32EEMAZS.js"),o=await r(e,t.tools).catch(()=>{});if(o===void 0)throw Te(e);if(o.audio===void 0)throw $e(e);return{seconds:o.duration}}let i=await oe(n,["probe",e],e);return{seconds:Number(i.seconds)}}async function no(e,n){let t=await sn(),i=await an(t,e),r=i?await ei(e,i.tools.ffmpeg,n.signal):void 0;try{return await ti(t,r?.path??e,e,n)}finally{await r?.cleanup()}}async function ti(e,n,t,i){let r=["run",n,...i.locale?["--locale",i.locale]:[],...i.notes?["--notes"]:[],...i.notes&&i.detail&&i.detail!==mt?["--detail",i.detail]:[]],o=await oe(e,r,t,{signal:i.signal,onLine:s=>{let f=ni(s);f&&i.onEvent?.(f)}});return{locale:String(o.locale),seconds:Number(o.seconds),segments:o.segments,...o.notes?{notes:o.notes}:{}}}function ni(e){if(e.event==="model")return{kind:"model",fraction:Number(e.fraction)};if(e.event==="heard")return{kind:"heard",seconds:Number(e.seconds),of:Number(e.of)};if(e.event==="notes")return{kind:"notes",part:Number(e.part),of:Number(e.of)}}async function ro(e,n={}){if((await ye())?.read!==!0)return ii(e,n);let t=["read",e,...n.language?["--language",n.language]:[]];return(await oe(Vr(Re),t,e,{signal:n.signal,onLine:r=>{r.event==="page"&&n.onEvent?.({kind:"page",page:Number(r.page),of:Number(r.of)})}})).pages??[]}var ri=200,tn=4e3;async function io(){return Re(await fn())}async function fn(){let{catalogEntry:e,assetFor:n}=await import("./catalog-FMHWWMUX.js"),t=e("read-text");return t!==void 0&&n(t)!==void 0}async function ii(e,n){let t=await he("read-text");if(t===void 0)throw Re(await fn());let[{probe:i},{decodedInput:r},{loadSharp:o},{runExtension:s}]=await Promise.all([import("./registry-PKOPEG3Z.js"),import("./decoded-SMEHAVCH.js"),import("./libs-EK64ACG3.js"),import("./run-WSETTQXP.js")]),f=await o(),c=await i(e),d=await st(O(ft(),"forge-read-")),h={width:tn,height:tn,fit:"inside",withoutEnlargement:!0};try{let p=[];if(c.kind==="document"&&c.format==="pdf"){let{openPdf:m}=await import("./pdfium-BAMNBCNW.js"),S=await m(await ot(e));try{for(let A=0;A<c.pages;A++){let w=await S.getPage(A).render({scale:ri/72,render:"bitmap"}),x=O(d,`page-${A+1}.png`);await f(Buffer.from(w.data),{raw:{width:w.width,height:w.height,channels:4}}).flatten({background:"#ffffff"}).resize(h).png().toFile(x),p.push(x)}}finally{S.destroy()}}else if(c.kind==="image"){let m=O(d,"page-1.png");await f(await r(e,c.format)).rotate().flatten({background:"#ffffff"}).resize(h).png().toFile(m),p.push(m)}else throw Te(e);let a=(await s({id:"read-text",entry:t.entry,kind:t.kind},p.flatMap(m=>["--in",m]),{subject:e,what:`Reading the text of ${e}`,...n.signal?{signal:n.signal}:{},onLine:m=>{m.event==="page"&&n.onEvent?.({kind:"page",page:Number(m.page),of:Number(m.of)})}})).pages??[];if(!(c.kind==="document"&&c.format==="pdf"))return a;let[{extractPdfText:u},{mendPage:l}]=await Promise.all([import("./pdfium-BAMNBCNW.js"),import("./text-layer-LHZNDMPZ.js")]),g=await u(await ot(e)).catch(()=>[]);return a.map((m,S)=>l(m,g[S]??""))}finally{await at(d,{recursive:!0,force:!0})}}async function cn(){let{apple:e}=xe();if(!(e===void 0||await ye()===void 0))return{path:e,kind:"apple"}}async function ln(e,n,t,i){let r=await st(O(ft(),"forge-render-"));try{let o=O(r,"transcript.html"),s=O(r,`transcript.${t}`);return await _r(o,n,"utf8"),await oe(e,["render",o,s,"--as",t],s,{signal:i.signal}),await ot(s)}finally{await at(r,{recursive:!0,force:!0})}}var nn=9026;async function un(e,n){let t=await ut(),{Document:i,Packer:r,Paragraph:o,TextRun:s,Table:f,TableRow:c,TableCell:d,HeadingLevel:h}=t,p="forge-numbers",b=0,a=(A,w=!1)=>Tt(A,n).map(x=>new s({text:x.text,...w?{bold:!0}:{},...x.kind==="eastAsia"?{font:{hint:"eastAsia"},language:x.lang?{eastAsia:x.lang}:{}}:{},...x.kind==="complex"?{font:{hint:"cs"},...x.rtl?{rightToLeft:!0}:{},...w?{boldComplexScript:!0}:{},...x.lang?{language:{bidirectional:x.lang}}:{}}:{}})),u=A=>pe(A)?{bidirectional:!0}:{},l=A=>A.flatMap(w=>{if(w.kind==="heading")return[new o({children:a(w.text),heading:w.level===1?h.HEADING_1:h.HEADING_2,...u(w.text)})];if(w.kind==="paragraph")return[new o({children:a(w.text),spacing:{after:160},...u(w.text)})];if(w.kind==="list"){let E=++b;return w.items.map(T=>w.ordered?new o({children:a(T),numbering:{reference:p,level:0,instance:E},...u(T)}):new o({children:a(T),bullet:{level:0},...u(T)}))}let x=w.rows[0]?.length??1;return[new f({width:{size:100,type:t.WidthType.PERCENTAGE},columnWidths:Array(x).fill(Math.floor(nn/x)),margins:{top:40,bottom:40,left:100,right:100},rows:w.rows.map((E,T)=>new c({tableHeader:T===0,children:E.map(R=>new d({width:{size:Math.floor(nn/x),type:t.WidthType.DXA},children:[new o({children:a(R,T===0),...u(R)})]}))}))}),new o({text:""})]}),m=e.filter(A=>A.length>0).flatMap((A,w)=>[...w>0?[new o({children:[new t.PageBreak]})]:[],...l(A)]),S=new i({numbering:{config:[{reference:p,levels:[{level:0,format:t.LevelFormat.DECIMAL,text:"%1.",alignment:t.AlignmentType.START}]}]},sections:[{children:m}]});return r.toBuffer(S)}var dn=e=>({...e.lang!==void 0?{lang:e.lang}:{},...e.onMissing!==void 0?{onMissing:e.onMissing}:{}});async function oo(e,n,t,i={}){if(n==="md")return Buffer.from(St(e),"utf8");if(n==="txt")return Buffer.from(At(e),"utf8");if(n==="docx")return un(e,i.lang);let r=await cn();return r?ln(r,kt(e,t),"pdf",i):nt(e,{title:t,...dn(i)})}function oi(e){for(let n of e.flat())if(n.kind==="heading"&&n.level===1)return n.text;return"Transcript"}async function so(e,n,t={}){if(n==="md")return Buffer.from(e,"utf8");if(n==="txt")return Buffer.from(dt(e),"utf8");let i=await cn();if(i)return ln(i,pt(e),n,t);let r=ht(e);return n==="docx"?un(r,t.lang):nt(r,{title:oi(r),...dn(t)})}export{ci as a,li as b,At as c,kt as d,zr as e,Zi as f,Gr as g,xe as h,Wr as i,Zr as j,Qi as k,eo as l,to as m,no as n,ro as o,io as p,oo as q,so as r};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{f as p,q as g,r as f}from"./chunk-
|
|
3
|
+
import{f as p,q as g,r as f}from"./chunk-BIBDLXCG.js";import{randomBytes as l}from"node:crypto";import{copyFile as P,mkdir as w,readdir as h,readFile as y,rename as C,rm as u,stat as k}from"node:fs/promises";import{tmpdir as x}from"node:os";import{extname as c,join as o}from"node:path";function m(){return o(x(),"forge-clip")}var v=5,d={".png":"png",".jpg":"jpeg",".jpeg":"jpeg",".webp":"webp",".heic":"heic",".avif":"avif",".gif":"gif",".tiff":"tiff"};async function O(e,a=m()){let t=`${Date.now().toString(36)}-${l(3).toString("hex")}`,i=o(a,t),r=await e.read(o(i,"in"));if(!r)return await u(i,{recursive:!0,force:!0}),null;let n=o(i,"out");await w(n,{recursive:!0}),await F(a,r.path);let s=o(i,"in","Copied image");return await C(r.path,s),await T(a,t),{source:s,outDir:n,changeCount:r.changeCount}}async function F(e,a){let t=o(e,"last"),i=`Copied image${c(a)}`,r=o(e,`.last-${l(4).toString("hex")}`);await w(r,{recursive:!0}),await P(a,o(r,i)),await u(t,{recursive:!0,force:!0}),await g(r,t)}async function T(e,a){let t=await h(e,{withFileTypes:!0}).catch(()=>[]),r=(await Promise.all(t.filter(n=>n.isDirectory()&&n.name!=="last"&&!n.name.startsWith(".")).map(async n=>({name:n.name,at:(await k(o(e,n.name)).catch(()=>null))?.mtimeMs??0})))).filter(n=>n.name!==a).sort((n,s)=>s.at-n.at).slice(v-1);await Promise.all(r.map(n=>u(o(e,n.name),{recursive:!0,force:!0})))}async function b(e=m()){let a=o(e,"last"),t=(await h(a).catch(()=>[])).find(i=>d[c(i).toLowerCase()]!==void 0);return t===void 0?null:{path:o(a,t),format:d[c(t).toLowerCase()]}}async function S(e,a,t,i){let{changeCount:r}=await e.peek();return r!==a.changeCount?"changed":(await e.write(t,i),"placed")}async function A(e,a,t,i){let{changeCount:r}=await e.peek();return r!==a.changeCount?"changed":(await e.writeText(t,i),"placed")}async function E(e,a=m()){let t=await b(a);return t?(await e.write(t.path,t.format),!0):!1}async function _(e,a){let t=p(o(a,`Copied image${c(e)}`));return await f(t,await y(e)),t}export{O as a,S as b,A as c,E as d,_ as e};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{b as B,c as C,d as U}from"./chunk-IJRLRAC5.js";import{i as q}from"./chunk-EPDF4NQI.js";import{c as T}from"./chunk-BIBDLXCG.js";import{a as x,aa as E,ba as A,ka as R,o as I,r as k,w as J,x as P,y as M,z as w}from"./chunk-CVNYUROW.js";function D(e=1,t=100){let o=Math.max(1,t-e+1);return 1+Math.max(0,Math.ceil(Math.log2(o)))}async function O(e){let t=e.min??1,o=e.max??100,c=D(t,o),a=0,n=async f=>(a+=1,e.onAttempt?.(a,c),e.encode(f)),s=()=>e.signal?.aborted===!0,u=await n(o);if(s())return{quality:o,bytes:u,missed:!1,cancelled:!0};if(u<=e.targetBytes)return{quality:o,bytes:u,missed:!1};let d=t,p=o,m;for(;d<=p;){let f=Math.floor((d+p)/2),g=await n(f);if(s())return{quality:f,bytes:g,missed:!1,cancelled:!0};g<=e.targetBytes?(m={quality:f,bytes:g,missed:!1},d=f+1):p=f-1}if(m)return m;let b=await e.encode(t);return{quality:t,bytes:b,missed:!0}}import{existsSync as L}from"node:fs";import{resolve as v}from"node:path";function N(e){let t=e.sources[0]?.path??e.outputs[0]??"",o=new Set;for(let c of e.outputs){let a=v(c);if(o.has(a))return{output:c,error:M(t,c)};o.add(a)}}function W(e,t,o){let c=N(e);if(c)return c;let a=e.sources[0]?.path??e.outputs[0]??"";for(let n of e.outputs){let s=v(n);if(e.sources.some(d=>T(d.path,s))&&!o)return{output:n,error:w(n,e.op)};let u=t.get(s);if(u){let d=u.sources[0]?.path??u.outputs[0]??"";return{output:n,error:P([d,a],n)}}if(L(s)&&!o)return{output:n,error:J(n,e.op)}}}function _(e,t){let o=[],c=[],a=new Map;for(let n of e){let s=W(n,a,t.force);if(s){let u=n.sources[0]?.path??s.output;c.push({path:u,error:s.error});continue}for(let u of n.outputs)a.set(v(u),n);o.push(n)}return{jobs:o,failures:c}}async function z(e,t,o,c,a,n){let s=e.sources[0].path,u=r=>({kind:"failed",failure:{path:s,error:x(r)?r:R(s,r)}}),d=o(e);if(d?.sizeTo){let r=e.sources[0],i=e.options.compress!==void 0;if(i&&r.bytes<=t)return{kind:"failed",failure:{path:s,error:A(s,r.bytes,t)}};let l=t,h=d.sizeTo(e,l);return h&&i&&h.floor>=r.bytes?{kind:"failed",failure:{path:s,error:E(s,r.bytes,h.floor,!0)}}:h?{kind:"unreachable",entry:{job:e,smallest:h.floor,settings:{quality:1,media:{...e.options.media,targetBytes:h.floor}},error:k(r,t,h.floor)}}:(e.options={...e.options,media:{...e.options.media,targetBytes:l}},{kind:"ready"})}let p;try{p=await o(e)?.measurer?.(e)}catch(r){return u(r)}if(!p||p.ladder.length===0)return{kind:"refused",failure:{path:s,error:I(e.sources[0],e.target)}};let m=p,b=e.sources[0],f=e.options.compress!==void 0&&b.bytes<=t,g=f?b.bytes-1:t;if(a?.aborted)return{kind:"cancelled"};let F=Number.POSITIVE_INFINITY,y;try{for(let r of m.ladder){let i=await O({encode:l=>m.measure({...e.options,...r,quality:l}),targetBytes:g,...n===void 0?{}:{max:n},onAttempt:(l,h)=>c({type:"search:attempt",job:e,attempt:l,of:h,rung:r}),...a===void 0?{}:{signal:a}});if(i.cancelled)return{kind:"cancelled"};if(i.bytes<F&&(F=i.bytes,y={...r,quality:i.quality}),!i.missed)return e.options={...e.options,...r,quality:i.quality},{kind:"ready"}}}catch(r){return u(r)}return f?{kind:"failed",failure:{path:s,error:E(s,b.bytes,F,!0)}}:{kind:"unreachable",entry:{job:e,smallest:F,settings:y??{quality:1},error:k(e.sources[0],t,F)}}}async function te(e,t){let o=t.onEvent??(()=>{}),c=t.engineFor??q,a=t.targetBytes,n=_(e,{force:t.force}),s=a===void 0?0:n.jobs.filter(r=>r.op==="convert").length,u=[],d=0;await C(n.jobs,B(t.concurrency),async(r,i)=>{if(a===void 0||r.op!=="convert"){u[i]={kind:"ready"};return}if(t.signal?.aborted){u[i]={kind:"cancelled"};return}let l=await z(r,a,c,o,t.signal,t.maxQuality);u[i]=l,l.kind!=="cancelled"&&(d+=1,o({type:"search:settled",job:r,completed:d,total:s}))});let p=[...n.failures],m=[],b=[],f=[],g=!1;for(let[r,i]of n.jobs.entries()){let l=u[r]??{kind:"ready"};l.kind==="ready"?f.push(i):l.kind==="refused"?p.push(l.failure):l.kind==="failed"?b.push(l.failure):l.kind==="unreachable"?m.push(l.entry):g=!0}if(g)return{results:[],refusals:p,unreachable:[],failures:[],inputBytes:0,outputBytes:0,cancelled:!0};let F=new Set,y=await U(f,{...t.concurrency===void 0?{}:{concurrency:t.concurrency},...t.engineFor===void 0?{}:{engineFor:t.engineFor},...t.signal===void 0?{}:{signal:t.signal},onEvent:r=>{r.type==="job:error"&&!t.signal?.aborted&&F.add(r.failure),o(r)}}),S=f.length-y.results.length;if(t.signal?.aborted&&S>0){let r=y.failures.filter(i=>F.has(i));return{...y,refusals:p,unreachable:m,failures:[...b,...r],cancelled:!0}}return{results:y.results,refusals:p,unreachable:m,failures:[...b,...y.failures],inputBytes:y.inputBytes,outputBytes:y.outputBytes}}export{_ as a,te as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a,b,c,d}from"./chunk-N3X3H4IZ.js";import"./chunk-ZOQA3JAR.js";import"./chunk-TYWGB767.js";import"./chunk-ITJZ7ODJ.js";import"./chunk-EURVTBPH.js";import"./chunk-3GHHQNR6.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-6RMRWBMB.js";import"./chunk-IKZTH2RL.js";import"./chunk-ZYIW4MAG.js";import"./chunk-IJRLRAC5.js";import"./chunk-7VR6LODN.js";import"./chunk-5IZBFF6Y.js";import"./chunk-57M4J2BR.js";import"./chunk-63XCSYHM.js";import"./chunk-AFEYLHDD.js";import"./chunk-O7DK3GJT.js";import"./chunk-EPDF4NQI.js";import"./chunk-EEQSUBBL.js";import"./chunk-E2BYNETT.js";import"./chunk-IE6NFN3N.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-TFOEI5VF.js";import"./chunk-J6AZTW62.js";import"./chunk-BIBDLXCG.js";import"./chunk-7KYO62XK.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{b as clipLines,a as runClip,d as runClipCommand,c as runUndo};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a,b,c}from"./chunk-EITGK5OI.js";import"./chunk-TYWGB767.js";import"./chunk-BIBDLXCG.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{a as copy,c as linuxText,b as paste};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{h as S,i as k,m as C}from"./chunk-FLMQ5VFR.js";import{i as $,k as u,l as w}from"./chunk-VTA6Z45X.js";import{c as I,d as y,f as O}from"./chunk-PBIS2ONZ.js";import{b as m,c as d,h as f,i as p}from"./chunk-QVACE4IE.js";import{a as h,b as g}from"./chunk-57M4J2BR.js";import"./chunk-63XCSYHM.js";import{a as l}from"./chunk-AFEYLHDD.js";import"./chunk-EPDF4NQI.js";import"./chunk-EEQSUBBL.js";import"./chunk-E2BYNETT.js";import"./chunk-IE6NFN3N.js";import"./chunk-TFOEI5VF.js";import"./chunk-J6AZTW62.js";import"./chunk-BIBDLXCG.js";import"./chunk-7KYO62XK.js";import{k as x}from"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import{c as b}from"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";import{resolve as R}from"node:path";var P=({r:t,g:n,b:o},s)=>s?`\x1B[38;2;${t};${n};${o}m\u2588\u2588\x1B[39m `:"";function N(t,n){let o=d(n),s,e=Number.POSITIVE_INFINITY;for(let r of t){let a=(r.centre.L-o.L)**2+(r.centre.a-o.a)**2+(r.centre.b-o.b)**2;a<e&&(e=a,s=r)}return s}async function D(t,n){let{pixels:o}=await C(t.input),s=I(o);if(s.length===0)throw x(t.input);let e=t.inside?N(s,t.inside):void 0,r=e?y(o,e):s;if(t.svg)return{exitCode:0,stdout:[S(b(t.input),r,"light",e?.hex)],stderr:[]};if(n.json){let i=h(l,{source:R(t.input),...e?{inside:e.hex}:{},colours:r.map(c=>({hex:c.hex,rgb:f(c.rgb),oklch:p(c.rgb),share:c.share}))});return{exitCode:0,stdout:[JSON.stringify(i)],stderr:[]}}let a=O(r.map(i=>i.share));return{exitCode:0,stdout:r.map((i,c)=>`${P(i.rgb,n.colour)}${i.hex} ${String(a[c]).padStart(3)}%`),stderr:[]}}async function H(t,n){let o=$(t.colour);if(t.svg)return{exitCode:0,stdout:[k(t.colour,o)],stderr:[]};let s=o.map(e=>({...e,...w(e.rgb)}));if(n.json){let e=g(l,{reference:m(t.colour),steps:s.map(r=>({step:r.step,hex:r.hex,oklch:p(r.rgb),white:r.white,black:r.black}))});return{exitCode:0,stdout:[JSON.stringify(e)],stderr:[]}}return{exitCode:0,stdout:s.map(e=>`${String(e.step).padStart(4)} ${P(e.rgb,n.colour)}${e.hex} white ${e.white.toFixed(1)} ${u(e.white)} \xB7 black ${e.black.toFixed(1)} ${u(e.black)}`),stderr:[]}}export{D as runPalette,H as runScale};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a as s}from"./chunk-WE6KP4FR.js";import{E as o}from"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";var c=["open","convert","compress","sharpen","open-pdf","preset"];function u(r){let[e,n,...i]=r;if(e==="install"||e==="remove")return{kind:e};if(e==="run"||e==="open"){if(!c.includes(n))throw o(`No menu action called "${n??""}".`);if(n==="preset"){let[t,...a]=i;if(e!=="run"||t===void 0||!s(t))throw o(`No preset called "${t??""}".`);return{kind:"run",action:n,preset:t,paths:a}}return{kind:e,action:n,paths:i}}throw o(`No menu command called "${e??""}".`)}function m(r,e){switch(r){case"convert":return{paths:e,mode:"convert",advance:!0};case"compress":return{paths:e,mode:"compress",advance:!0};case"open-pdf":return{paths:e,mode:"pdf",advance:!1};default:return{paths:[],mode:"convert",advance:!1}}}export{m as openedFor,u as parseMenuArgs};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a,b}from"./chunk-HWCXNKIN.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{a as CONFIG_KEYS,b as runConfig};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a,b,c,d,e}from"./chunk-BROTSQXG.js";import"./chunk-J6AZTW62.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{a as OPS,d as chainLabels,e as reasonsFor,c as stepLabel,b as withStep};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{g as a,h as b,i as c,j as d}from"./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 clearDecodedCacheForTests,a as decodedInput,c as idleDecodedCacheForTests,d as limitDecodedCacheForTests};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as
|
|
3
|
+
import{a as $,b as R,d as g,e as F,f as m,g as G}from"./chunk-NHMACTW3.js";import{H as k,a as N,i as I,j as O}from"./chunk-3CLPUPJT.js";import"./chunk-6RMRWBMB.js";import{c as b}from"./chunk-MF3KKEFB.js";import"./chunk-I25E2XDH.js";import{c as S}from"./chunk-N72E43Z3.js";import{a as T,b as v,c as _,d as A,e as D}from"./chunk-7I2OSTBX.js";import{a as P}from"./chunk-HON4OV7M.js";import{f as E}from"./chunk-BIBDLXCG.js";import{a as y}from"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";import{spawn as ee}from"node:child_process";import{homedir as Te}from"node:os";import{join as M,resolve as ve}from"node:path";import{appendFileSync as te,mkdirSync as C,readFileSync as ne,renameSync as re,rmSync as x,statSync as L}from"node:fs";import{join as j}from"node:path";var ie={quiet:500,cap:3e3,poll:50},oe=15e3,X=e=>new Promise(n=>setTimeout(n,e));async function H(e,n,t,r=ie){C(e,{recursive:!0});let i=j(e,`${n}.spool`),o=j(e,`${n}.lock`),s=p=>{try{return ne(p,"utf8").split(`
|
|
4
4
|
`).filter(Boolean)}catch{return[]}},u=()=>{try{return L(i).size}catch{return 0}};for(te(i,`${t}
|
|
5
|
-
`);;){try{C(o)}catch{try{Date.now()-L(o).mtimeMs>oe&&x(o,{recursive:!0,force:!0})}catch{}if(await X(r.poll),!s(i).includes(t))return null;continue}try{let p=Date.now(),l=u(),c=Date.now();for(;Date.now()-c<r.quiet&&Date.now()-p<r.cap;){await X(r.poll);let d=u();d!==l&&(l=d,c=Date.now())}let a=`${i}.${process.pid}.${Date.now()}`;try{re(i,a)}catch{return[t]}let f=[...new Set(s(a))];return x(a,{force:!0}),f}finally{x(o,{recursive:!0,force:!0})}}}import{realpathSync as se}from"node:fs";import{delimiter as ae,join as ue}from"node:path";function U(e,n,t=process.platform){let r=s=>{try{return se(s)}catch{return}},i=r(e)??e,o=t==="win32"?"node.exe":"node";for(let s of(n??"").split(ae)){if(s==="")continue;let u=ue(s,o);if(u!==e&&r(u)===i)return u}return e}import{basename as w,dirname as ce,extname as le,join as fe}from"node:path";var q={"gnome-terminal":["--"],konsole:["-e"],"xfce4-terminal":["-x"],kitty:[],alacritty:["-e"],wezterm:["start","--"],ghostty:["-e"],xterm:["-e"],"x-terminal-emulator":["-e"],"xdg-terminal-exec":[]},pe=["xdg-terminal-exec","x-terminal-emulator","gnome-terminal","konsole","xfce4-terminal","kitty","alacritty","wezterm","ghostty","xterm"];function B(e,n,t){let i=[...e!==void 0&&e in q?[e]:[],...pe].find(t);return i===void 0?void 0:[i,[...q[i]??[],...n]]}function me(e,n,t){if(t==="linux")return B(e,n,()=>!0)??["xterm",["-e",...n]];if(t==="win32")return e==="wt"?["wt.exe",["-w","new",...n]]:["conhost.exe",n];if(e==="ghostty")return["/usr/bin/open",["-na","Ghostty","--args","-e",...n]];let r=`exec ${n.map(N).join(" ")}`;return["/usr/bin/osascript",[...["on run argv",...e==="iTerm.app"?['tell application "iTerm"',"create window with default profile","tell current session of current window to write text (item 1 of argv)","activate","end tell"]:['if application "Terminal" is running then','tell application "Terminal" to do script (item 1 of argv)',"else",'tell application "Terminal" to do script (item 1 of argv) in window 1',"end if",'tell application "Terminal" to activate'],"end run"].flatMap(o=>["-e",o]),r]]}function W(e){let n=w(e,le(e));return E(fe(ce(e),`${n}-sharp.png`))}function de(e){let n=e.flatMap(o=>"output"in o?[o.output]:[]),t=e.flatMap(o=>"error"in o?[o]:[]),[r]=t;if(r===void 0)return{title:n.length===1?w(n[0]):`${n.length} files`,body:"Sharpened"};let i=r.input?w(r.input):"file";return e.length===1?{title:`${i} not sharpened`,body:r.error}:{title:`${n.length} of ${e.length} files sharpened`,body:`${i}: ${r.error}`}}function ge(e,n){let t=n.flatMap(s=>"output"in s?[s]:[]),r=n.flatMap(s=>"error"in s?[s]:[]),[i]=r;if(i===void 0){let s=t[0]?.chain??[];return{title:t.length===1?w(t[0]?.output??""):`${t.length} files`,body:[e,...s.length>0?[s.join(" \u2500\u25B8 ")]:[]].join(" \xB7 ")}}let o=i.input?w(i.input):"file";return n.length===1?{title:`${e} didn\u2019t finish`,body:`${o}: ${i.error}`}:{title:`${e} finished ${t.length} of ${n.length} files`,body:`${o}: ${i.error}`}}async function z(e,n,t,r){if(e==="preset"){if(r===void 0||t.runPreset===void 0)return;let u=[];for(let a of n){let f=await t.runPreset(r,a);u.push("error"in f?{input:a,...f}:f)}let{title:p,body:l}=ge(r,u);await t.notify(p,l);let c=u.flatMap(a=>"output"in a?[a.output]:[]).at(-1);c!==void 0&&await t.reveal(c);return}if(e==="sharpen"){let u=[];for(let f of n){let d=await t.sharpen(f);u.push("error"in d?{input:f,...d}:d)}let{title:p,body:l}=de(u);await t.notify(p,l);let a=u.flatMap(f=>"output"in f?[f.output]:[]).at(-1);a!==void 0&&await t.reveal(a);return}let i=e==="open"?[]:n,o=[...t.self,"menu","open",e,...i],s=t.platform==="linux"?B(t.terminal,o,t.has??(()=>!0)):me(t.terminal,o,t.platform);if(s===void 0)return t.notify(he,we);await t.launch(...s)}var he="Forge could not open",we="No terminal was found to open it in.";import{mkdirSync as ye,readFileSync as Me,writeFileSync as Pe}from"node:fs";import{join as Re}from"node:path";async function J(e,n){if(!n.global||!F(e.platform))return;let t=R(e);if(n.enabled===!1){t!==void 0&&await m(e);return}if(!(t!==void 0&&$(t,e))&&(await g(e),t===void 0))return e.platform==="darwin"?"Added Forge to Finder\u2019s Quick Actions":"Added Forge to the right-click menu"}async function K(e){let n=R(e);if(n===void 0)return;let{xdgConfigHome:t,...r}=e;await g({...r,...n,presets:e.presets??[]})}var V=e=>Re(e.menuDir,"terminal"),xe=new Set(["Apple_Terminal","iTerm.app","ghostty"]),Ee={WezTerm:"wezterm",ghostty:"ghostty",kitty:"kitty"};function be(e){if(e.TERM_PROGRAM)return Ee[e.TERM_PROGRAM];if(!e.TMUX){if(e.KITTY_WINDOW_ID)return"kitty";if(e.ALACRITTY_WINDOW_ID||e.ALACRITTY_SOCKET)return"alacritty";if(e.KONSOLE_VERSION)return"konsole";if(e.GNOME_TERMINAL_SCREEN||e.GNOME_TERMINAL_SERVICE)return"gnome-terminal";if(e.XTERM_VERSION)return"xterm"}}function Y(e,n){let t=e.platform==="win32"?n.WT_SESSION?"wt":"console":e.platform==="linux"?be(n):xe.has(n.TERM_PROGRAM??"")?n.TERM_PROGRAM:void 0;if(t)try{ye(e.menuDir,{recursive:!0}),Pe(V(e),t)}catch{}}function Q(e){try{return Me(V(e),"utf8").trim()||void 0}catch{return}}import{rmSync as Se}from"node:fs";async function Z(e,n){await m(e),n.out("\u2713 Removed Forge from the right-click menu");let{code:t,output:r}=await n.npm(["uninstall","--global","forge-terminal"]);return t!==0?(n.out(`\u2715 npm could not uninstall forge-terminal: ${D(r)}`),1):(n.out("\u2713 Uninstalled forge-terminal"),Se(n.forgeDir,{recursive:!0,force:!0}),n.out("\u2713 Deleted Forge\u2019s settings"),0)}var _e=()=>M(P(),"forge","menu");async function Ae(){try{let{loadPreferences:e}=await import("./preferences-3P4V2EDX.js"),{prefs:n}=await e();return(n.presets??[]).filter(t=>t.quickAction).map(t=>t.name)}catch{return[]}}async function h(e){return{platform:process.platform,home:Te(),menuDir:_e(),node:U(process.execPath,process.env.PATH),execArgv:process.execArgv,forge:v(process.argv[1])??"",...process.env.XDG_CONFIG_HOME?{xdgConfigHome:process.env.XDG_CONFIG_HOME}:{},...process.env.XDG_DATA_HOME?{xdgDataHome:process.env.XDG_DATA_HOME}:{},...process.env.XDG_CONFIG_DIRS?{xdgConfigDirs:process.env.XDG_CONFIG_DIRS}:{},...process.env.PATH?{path:process.env.PATH}:{},version:e,sharpen:await b("boost")!==void 0,presets:await Ae(),run:G}}async function mt(e){if(process.env.FORGE_NO_MENU)return;let n=await h(e);Y(n,process.env);let{loadPreferences:t}=await import("./preferences-3P4V2EDX.js"),{prefs:r}=await t();return J(n,{global:T(n.forge,n.platform),enabled:r.rightClickMenu!==!1})}async function dt(){let{isInstalled:e}=await import("./install-
|
|
5
|
+
`);;){try{C(o)}catch{try{Date.now()-L(o).mtimeMs>oe&&x(o,{recursive:!0,force:!0})}catch{}if(await X(r.poll),!s(i).includes(t))return null;continue}try{let p=Date.now(),l=u(),c=Date.now();for(;Date.now()-c<r.quiet&&Date.now()-p<r.cap;){await X(r.poll);let d=u();d!==l&&(l=d,c=Date.now())}let a=`${i}.${process.pid}.${Date.now()}`;try{re(i,a)}catch{return[t]}let f=[...new Set(s(a))];return x(a,{force:!0}),f}finally{x(o,{recursive:!0,force:!0})}}}import{realpathSync as se}from"node:fs";import{delimiter as ae,join as ue}from"node:path";function U(e,n,t=process.platform){let r=s=>{try{return se(s)}catch{return}},i=r(e)??e,o=t==="win32"?"node.exe":"node";for(let s of(n??"").split(ae)){if(s==="")continue;let u=ue(s,o);if(u!==e&&r(u)===i)return u}return e}import{basename as w,dirname as ce,extname as le,join as fe}from"node:path";var q={"gnome-terminal":["--"],konsole:["-e"],"xfce4-terminal":["-x"],kitty:[],alacritty:["-e"],wezterm:["start","--"],ghostty:["-e"],xterm:["-e"],"x-terminal-emulator":["-e"],"xdg-terminal-exec":[]},pe=["xdg-terminal-exec","x-terminal-emulator","gnome-terminal","konsole","xfce4-terminal","kitty","alacritty","wezterm","ghostty","xterm"];function B(e,n,t){let i=[...e!==void 0&&e in q?[e]:[],...pe].find(t);return i===void 0?void 0:[i,[...q[i]??[],...n]]}function me(e,n,t){if(t==="linux")return B(e,n,()=>!0)??["xterm",["-e",...n]];if(t==="win32")return e==="wt"?["wt.exe",["-w","new",...n]]:["conhost.exe",n];if(e==="ghostty")return["/usr/bin/open",["-na","Ghostty","--args","-e",...n]];let r=`exec ${n.map(N).join(" ")}`;return["/usr/bin/osascript",[...["on run argv",...e==="iTerm.app"?['tell application "iTerm"',"create window with default profile","tell current session of current window to write text (item 1 of argv)","activate","end tell"]:['if application "Terminal" is running then','tell application "Terminal" to do script (item 1 of argv)',"else",'tell application "Terminal" to do script (item 1 of argv) in window 1',"end if",'tell application "Terminal" to activate'],"end run"].flatMap(o=>["-e",o]),r]]}function W(e){let n=w(e,le(e));return E(fe(ce(e),`${n}-sharp.png`))}function de(e){let n=e.flatMap(o=>"output"in o?[o.output]:[]),t=e.flatMap(o=>"error"in o?[o]:[]),[r]=t;if(r===void 0)return{title:n.length===1?w(n[0]):`${n.length} files`,body:"Sharpened"};let i=r.input?w(r.input):"file";return e.length===1?{title:`${i} not sharpened`,body:r.error}:{title:`${n.length} of ${e.length} files sharpened`,body:`${i}: ${r.error}`}}function ge(e,n){let t=n.flatMap(s=>"output"in s?[s]:[]),r=n.flatMap(s=>"error"in s?[s]:[]),[i]=r;if(i===void 0){let s=t[0]?.chain??[];return{title:t.length===1?w(t[0]?.output??""):`${t.length} files`,body:[e,...s.length>0?[s.join(" \u2500\u25B8 ")]:[]].join(" \xB7 ")}}let o=i.input?w(i.input):"file";return n.length===1?{title:`${e} didn\u2019t finish`,body:`${o}: ${i.error}`}:{title:`${e} finished ${t.length} of ${n.length} files`,body:`${o}: ${i.error}`}}async function z(e,n,t,r){if(e==="preset"){if(r===void 0||t.runPreset===void 0)return;let u=[];for(let a of n){let f=await t.runPreset(r,a);u.push("error"in f?{input:a,...f}:f)}let{title:p,body:l}=ge(r,u);await t.notify(p,l);let c=u.flatMap(a=>"output"in a?[a.output]:[]).at(-1);c!==void 0&&await t.reveal(c);return}if(e==="sharpen"){let u=[];for(let f of n){let d=await t.sharpen(f);u.push("error"in d?{input:f,...d}:d)}let{title:p,body:l}=de(u);await t.notify(p,l);let a=u.flatMap(f=>"output"in f?[f.output]:[]).at(-1);a!==void 0&&await t.reveal(a);return}let i=e==="open"?[]:n,o=[...t.self,"menu","open",e,...i],s=t.platform==="linux"?B(t.terminal,o,t.has??(()=>!0)):me(t.terminal,o,t.platform);if(s===void 0)return t.notify(he,we);await t.launch(...s)}var he="Forge could not open",we="No terminal was found to open it in.";import{mkdirSync as ye,readFileSync as Me,writeFileSync as Pe}from"node:fs";import{join as Re}from"node:path";async function J(e,n){if(!n.global||!F(e.platform))return;let t=R(e);if(n.enabled===!1){t!==void 0&&await m(e);return}if(!(t!==void 0&&$(t,e))&&(await g(e),t===void 0))return e.platform==="darwin"?"Added Forge to Finder\u2019s Quick Actions":"Added Forge to the right-click menu"}async function K(e){let n=R(e);if(n===void 0)return;let{xdgConfigHome:t,...r}=e;await g({...r,...n,presets:e.presets??[]})}var V=e=>Re(e.menuDir,"terminal"),xe=new Set(["Apple_Terminal","iTerm.app","ghostty"]),Ee={WezTerm:"wezterm",ghostty:"ghostty",kitty:"kitty"};function be(e){if(e.TERM_PROGRAM)return Ee[e.TERM_PROGRAM];if(!e.TMUX){if(e.KITTY_WINDOW_ID)return"kitty";if(e.ALACRITTY_WINDOW_ID||e.ALACRITTY_SOCKET)return"alacritty";if(e.KONSOLE_VERSION)return"konsole";if(e.GNOME_TERMINAL_SCREEN||e.GNOME_TERMINAL_SERVICE)return"gnome-terminal";if(e.XTERM_VERSION)return"xterm"}}function Y(e,n){let t=e.platform==="win32"?n.WT_SESSION?"wt":"console":e.platform==="linux"?be(n):xe.has(n.TERM_PROGRAM??"")?n.TERM_PROGRAM:void 0;if(t)try{ye(e.menuDir,{recursive:!0}),Pe(V(e),t)}catch{}}function Q(e){try{return Me(V(e),"utf8").trim()||void 0}catch{return}}import{rmSync as Se}from"node:fs";async function Z(e,n){await m(e),n.out("\u2713 Removed Forge from the right-click menu");let{code:t,output:r}=await n.npm(["uninstall","--global","forge-terminal"]);return t!==0?(n.out(`\u2715 npm could not uninstall forge-terminal: ${D(r)}`),1):(n.out("\u2713 Uninstalled forge-terminal"),Se(n.forgeDir,{recursive:!0,force:!0}),n.out("\u2713 Deleted Forge\u2019s settings"),0)}var _e=()=>M(P(),"forge","menu");async function Ae(){try{let{loadPreferences:e}=await import("./preferences-3P4V2EDX.js"),{prefs:n}=await e();return(n.presets??[]).filter(t=>t.quickAction).map(t=>t.name)}catch{return[]}}async function h(e){return{platform:process.platform,home:Te(),menuDir:_e(),node:U(process.execPath,process.env.PATH),execArgv:process.execArgv,forge:v(process.argv[1])??"",...process.env.XDG_CONFIG_HOME?{xdgConfigHome:process.env.XDG_CONFIG_HOME}:{},...process.env.XDG_DATA_HOME?{xdgDataHome:process.env.XDG_DATA_HOME}:{},...process.env.XDG_CONFIG_DIRS?{xdgConfigDirs:process.env.XDG_CONFIG_DIRS}:{},...process.env.PATH?{path:process.env.PATH}:{},version:e,sharpen:await b("boost")!==void 0,presets:await Ae(),run:G}}async function mt(e){if(process.env.FORGE_NO_MENU)return;let n=await h(e);Y(n,process.env);let{loadPreferences:t}=await import("./preferences-3P4V2EDX.js"),{prefs:r}=await t();return J(n,{global:T(n.forge,n.platform),enabled:r.rightClickMenu!==!1})}async function dt(){let{isInstalled:e}=await import("./install-7ZRVQKCF.js");return e(await h(""))}async function gt(e){let{VERSION:n}=await import("./theme-D4AMWFFW.js"),{savePreferences:t}=await import("./preferences-3P4V2EDX.js"),r=await h(n);e?await g(r):await m(r),await t({rightClickMenu:e})}async function ht(){if(!process.env.FORGE_NO_MENU)try{await K(await h(""))}catch{}}async function De(e){let{parseArgs:n}=await import("./args-TZMA4ZR6.js"),{runIntent:t}=await import("./execute-GKO4THUK.js"),r=n([e,"--sharpen","--output",W(e)]),i=await t(r),o=i.results[0]?.job.outputs[0];if(o!==void 0)return{output:o};let s=i.failures[0]?.error;return{error:y(s)?s.detail:"It could not be sharpened."}}async function Ne(e,n){let{runPresetCommand:t}=await import("./preset-command-XXKLUJOS.js"),{loadPreferences:r}=await import("./preferences-3P4V2EDX.js"),{chainLabels:i}=await import("./continue-editing-4W3XWWCE.js");try{let o=await t({kind:"preset",inputs:[n],name:e,force:!1,recursive:!1,debug:!1,keepBoth:!0}),s=o.results[0],u=s?.job.outputs[0];if(s!==void 0&&u!==void 0){let{prefs:l}=await r(),c=l.presets?.find(f=>f.name===e)?.steps,a=s.job.sources[0]?.format;return{output:u,chain:c&&a?i(a,c):[]}}let p=o.failures[0]?.error;return{error:y(p)?p.detail:"It could not be made."}}catch(o){return{error:y(o)?o.detail:"It could not be made."}}}var Ie=(e,n)=>new Promise(t=>{let r=ee(e,n,{detached:!0,stdio:"ignore"});r.on("error",()=>t()),r.unref(),t()});async function wt(e,n){let t=await h(n);if(e.kind==="install")return await g(t),0;if(e.kind==="remove")return await m(t),0;if(e.kind!=="run")return 2;let r=e.paths.map(i=>ve(i));if(t.platform==="win32"&&r.length===1){let i=e.preset===void 0?e.action:`preset-${e.preset}`,o=await H(M(t.menuDir,"spool"),i,r[0]);if(o===null)return 0;r=o}return await z(e.action,r,{platform:t.platform,self:[t.node,...t.execArgv,t.forge],terminal:Q(t),launch:Ie,sharpen:De,runPreset:Ne,notify:(i,o)=>k(i,o,t.platform,{icon:M(t.menuDir,O({paint:"forge"}))}),has:i=>I(i,t.path),reveal:async i=>{await S(i,t.platform)}},e.preset),0}async function yt(e,n){let t=await h(e),r=i=>new Promise(o=>{let s=t.platform==="win32"?A(t.node):void 0,[u,p]=s!==void 0?[t.node,[s,...i]]:[_(t.node),i],l="",c=ee(u,p,{stdio:["ignore","pipe","pipe"]});c.stdout.setEncoding("utf8").on("data",a=>{l+=a}),c.stderr.setEncoding("utf8").on("data",a=>{l+=a}),c.on("error",a=>o({code:null,output:`${l}
|
|
6
6
|
${a.message}`})),c.on("close",a=>o({code:a,output:l}))});return Z(t,{forgeDir:M(P(),"forge"),npm:r,out:n})}export{mt as menuAtStart,dt as menuIsOn,h as realMenuEnv,ht as resyncMenu,wt as runMenuCommand,yt as runUninstall,gt as switchMenu};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{c as a,d as b,e as c,f as d}from"./chunk-ITJZ7ODJ.js";import"./chunk-EURVTBPH.js";import"./chunk-3GHHQNR6.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-6RMRWBMB.js";import"./chunk-IKZTH2RL.js";import"./chunk-ZYIW4MAG.js";import"./chunk-IJRLRAC5.js";import"./chunk-7VR6LODN.js";import"./chunk-5IZBFF6Y.js";import"./chunk-57M4J2BR.js";import"./chunk-63XCSYHM.js";import"./chunk-AFEYLHDD.js";import"./chunk-O7DK3GJT.js";import"./chunk-EPDF4NQI.js";import"./chunk-EEQSUBBL.js";import"./chunk-E2BYNETT.js";import"./chunk-IE6NFN3N.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-TFOEI5VF.js";import"./chunk-J6AZTW62.js";import"./chunk-BIBDLXCG.js";import"./chunk-7KYO62XK.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{d as execute,a as exitCodeFor,c as renderRun,b as runIntent};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{Jb as a,Kb as b,Lb as c,Mb as d,Nb as e}from"./chunk-4YFFT5CZ.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-VTA6Z45X.js";import"./chunk-PBIS2ONZ.js";import"./chunk-I25E2XDH.js";import"./chunk-IBPGC4N2.js";import"./chunk-U5TEGDGH.js";import"./chunk-QVACE4IE.js";import"./chunk-AFEYLHDD.js";import"./chunk-EEQSUBBL.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{e as ExtensionsFlow,c as byteCount,b as extensionCredits,d as extensionsChip,a as realManager};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{f as d}from"./chunk-I25E2XDH.js";import{a as c}from"./chunk-J7FLFHQJ.js";import"./chunk-TMUK2DD3.js";function y(e){let t=Object.entries(e.assets).find(([n])=>n.startsWith(`${process.platform}-`));return d(e)?.version??t?.[1]?.version??""}function x(e){return{id:e.entry.id,title:e.entry.title,summary:e.entry.summary,version:y(e.entry),licence:e.entry.licence,installed:e.installed??null,updateAvailable:e.updateAvailable,supported:e.supported,...e.reason!==void 0?{reason:e.reason}:{},...e.downloadBytes!==void 0?{downloadBytes:e.downloadBytes}:{}}}function E(e){return e.supported?e.installed===void 0?`not installed${e.downloadBytes?`, ${c(e.downloadBytes)} download`:""}`:e.updateAvailable?`installed ${e.installed}, update to ${d(e.entry)?.version} available`:`installed ${e.installed}`:`not available: ${e.reason??"unsupported here"}`}function v(e){let t=Math.max(...e.map(n=>n.entry.id.length));return e.flatMap((n,a)=>[...a>0?[""]:[],`${n.entry.id.padEnd(t)} ${n.entry.summary}`,`${" ".repeat(t)} ${E(n)}`,`${" ".repeat(t)} ${n.entry.licence}`])}async function w(e,t={}){let{installExtension:n,listExtensions:a,removeExtension:p}=await import("./manager-
|
|
3
|
+
import{f as d}from"./chunk-I25E2XDH.js";import{a as c}from"./chunk-J7FLFHQJ.js";import"./chunk-TMUK2DD3.js";function y(e){let t=Object.entries(e.assets).find(([n])=>n.startsWith(`${process.platform}-`));return d(e)?.version??t?.[1]?.version??""}function x(e){return{id:e.entry.id,title:e.entry.title,summary:e.entry.summary,version:y(e.entry),licence:e.entry.licence,installed:e.installed??null,updateAvailable:e.updateAvailable,supported:e.supported,...e.reason!==void 0?{reason:e.reason}:{},...e.downloadBytes!==void 0?{downloadBytes:e.downloadBytes}:{}}}function E(e){return e.supported?e.installed===void 0?`not installed${e.downloadBytes?`, ${c(e.downloadBytes)} download`:""}`:e.updateAvailable?`installed ${e.installed}, update to ${d(e.entry)?.version} available`:`installed ${e.installed}`:`not available: ${e.reason??"unsupported here"}`}function v(e){let t=Math.max(...e.map(n=>n.entry.id.length));return e.flatMap((n,a)=>[...a>0?[""]:[],`${n.entry.id.padEnd(t)} ${n.entry.summary}`,`${" ".repeat(t)} ${E(n)}`,`${" ".repeat(t)} ${n.entry.licence}`])}async function w(e,t={}){let{installExtension:n,listExtensions:a,removeExtension:p}=await import("./manager-XPO4ZIRY.js"),i,s;if(e.action==="add"&&e.id!==void 0){let o=(await a()).find(f=>f.entry.id===e.id),l=o?.installed!==void 0&&!o.updateAvailable,u=await n(e.id,{onProgress:t.onDownload});i={id:e.id,action:l?"unchanged":"added"},s=l?`${e.id} ${u.version} is already installed`:`Installed ${e.id} ${u.version}`}else if(e.action==="remove"&&e.id!==void 0){let o=await p(e.id);i={id:e.id,action:o?"removed":"unchanged"},s=o?`Removed ${e.id}`:`${e.id} was not installed`}let{hideUnneeded:m}=await import("./needed-NOGBHTHE.js"),r=await m(await a());return{stdout:s===void 0?v(r):[s],data:{extensions:r.map(x),...i?{changed:i}:{}}}}export{w as runExtensions,x as toExtensionJson};
|
|
@@ -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}from"./chunk-
|
|
3
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-E2BYNETT.js";import"./chunk-TMUK2DD3.js";export{a as ffmpegCandidates,c as findFfmpeg,e as forceFfmpegForTests,i as frameAt,g as keyframeAtOrBefore,d as knownFfmpeg,f as probeMedia,b as readNames,j as readProgress,k as runFfmpeg,h as soundLevels};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{m as a,n as b,o as c,p as d,q as e,r as f,s as g,t as h}from"./chunk-TFOEI5VF.js";import"./chunk-J6AZTW62.js";import"./chunk-BIBDLXCG.js";import"./chunk-7KYO62XK.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{c as decodeToPng,a as encode,d as encodeToBuffer,g as guessCrop,h as imageEngine,f as loadCropView,e as measureImage,b as writeAtomic};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a,b,c,d,e,f,g}from"./chunk-NHMACTW3.js";import"./chunk-3CLPUPJT.js";import"./chunk-6RMRWBMB.js";import"./chunk-BIBDLXCG.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{e as hasMenu,d as installMenu,c as isInstalled,b as readState,f as removeMenu,g as runProgram,a as stateMatches};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
+
import{a,b,c,d,e,f}from"./chunk-7I2OSTBX.js";import"./chunk-CVNYUROW.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";export{f as installUpdate,a as installedGlobally,e as lastWords,c as npmBeside,d as npmCliBeside,b as runningScript};
|