forge-terminal 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/README.md +7 -6
  2. package/dist/chunks/{about-credits-FZ35HUFP.js → about-credits-VZQJAWG3.js} +1 -1
  3. package/dist/chunks/args-FZXEZBPA.js +3 -0
  4. package/dist/chunks/{boot-PCZBPNFR.js → boot-NYKO3NLR.js} +1 -1
  5. package/dist/chunks/chunk-2AFHW44W.js +36 -0
  6. package/dist/chunks/{chunk-S2M4XESA.js → chunk-63ZZRDSV.js} +1 -1
  7. package/dist/chunks/{chunk-63ZK5SRQ.js → chunk-7I2OSTBX.js} +1 -1
  8. package/dist/chunks/chunk-7KYO62XK.js +3 -0
  9. package/dist/chunks/{chunk-DZOBIUV6.js → chunk-BIBDLXCG.js} +1 -1
  10. package/dist/chunks/{chunk-G46QQBT3.js → chunk-BROTSQXG.js} +1 -1
  11. package/dist/chunks/chunk-CVNYUROW.js +3 -0
  12. package/dist/chunks/chunk-CW2Y2KDQ.js +3 -0
  13. package/dist/chunks/chunk-DYIATUFE.js +3 -0
  14. package/dist/chunks/{chunk-SK2UZ25Y.js → chunk-EITGK5OI.js} +1 -1
  15. package/dist/chunks/chunk-GRWOJKQB.js +3 -0
  16. package/dist/chunks/{chunk-X26WUHWB.js → chunk-GT6U6HV3.js} +1 -1
  17. package/dist/chunks/{chunk-JMBEZPYC.js → chunk-HWCXNKIN.js} +1 -1
  18. package/dist/chunks/chunk-IED6VBE6.js +3 -0
  19. package/dist/chunks/{chunk-2CX33C6H.js → chunk-ITW5FG4K.js} +1 -1
  20. package/dist/chunks/{chunk-MTDCDKPU.js → chunk-IVBSXPNS.js} +2 -2
  21. package/dist/chunks/chunk-J2UQI544.js +4 -0
  22. package/dist/chunks/{chunk-THDAQBQ3.js → chunk-J6AZTW62.js} +1 -1
  23. package/dist/chunks/chunk-JGJU3AW5.js +3 -0
  24. package/dist/chunks/{chunk-XURW53YK.js → chunk-K6ERQTUQ.js} +1 -1
  25. package/dist/chunks/chunk-KMLT45OJ.js +66 -0
  26. package/dist/chunks/{chunk-QXNB5DQ2.js → chunk-LA5JVBFP.js} +1 -1
  27. package/dist/chunks/chunk-M6LYLTFH.js +3 -0
  28. package/dist/chunks/chunk-O7DK3GJT.js +3 -0
  29. package/dist/chunks/chunk-Q7ERPAG3.js +7 -0
  30. package/dist/chunks/{chunk-HCLEHCAR.js → chunk-R24JCIZ5.js} +1 -1
  31. package/dist/chunks/{chunk-3KWAO2N2.js → chunk-RK3WGALB.js} +1 -1
  32. package/dist/chunks/chunk-RXI6QLNY.js +82 -0
  33. package/dist/chunks/chunk-SNFUGJ3M.js +3 -0
  34. package/dist/chunks/chunk-T37DEXUI.js +3 -0
  35. package/dist/chunks/chunk-TARDT6LZ.js +55 -0
  36. package/dist/chunks/{chunk-EKTUUKDP.js → chunk-TYWGB767.js} +1 -1
  37. package/dist/chunks/chunk-VLVNA4T3.js +3 -0
  38. package/dist/chunks/{chunk-YINYF6C7.js → chunk-VTA6Z45X.js} +1 -1
  39. package/dist/chunks/{chunk-JOIHR724.js → chunk-W2QJA73Q.js} +1 -1
  40. package/dist/chunks/{chunk-BD3OLIVT.js → chunk-XPATZLEH.js} +1 -1
  41. package/dist/chunks/chunk-XUKYIVJC.js +3 -0
  42. package/dist/chunks/{chunk-GLAD7GP2.js → chunk-YK26E3OX.js} +1 -1
  43. package/dist/chunks/{chunk-YNZIN42P.js → chunk-ZFLFBNIK.js} +1 -1
  44. package/dist/chunks/{chunk-655UG277.js → chunk-ZHNPBRCX.js} +1 -1
  45. package/dist/chunks/{chunk-C4UCCBCX.js → chunk-ZOQA3JAR.js} +1 -1
  46. package/dist/chunks/clip-command-SLSAWJF4.js +3 -0
  47. package/dist/chunks/clipboard-7KSZNWWT.js +3 -0
  48. package/dist/chunks/colour-LMZO2EE6.js +3 -0
  49. package/dist/chunks/command-DMGGGAPS.js +3 -0
  50. package/dist/chunks/config-command-6GXRV627.js +3 -0
  51. package/dist/chunks/continue-editing-4W3XWWCE.js +3 -0
  52. package/dist/chunks/decoded-SMEHAVCH.js +3 -0
  53. package/dist/chunks/{entry-2XJD7UCY.js → entry-TV4FJQDR.js} +2 -2
  54. package/dist/chunks/execute-NEDE4JM6.js +3 -0
  55. package/dist/chunks/extensions-4UJRQ32J.js +3 -0
  56. package/dist/chunks/{extensions-command-MGPRISPH.js → extensions-command-VROVGVD4.js} +1 -1
  57. package/dist/chunks/{ffmpeg-2UZXAB3C.js → ffmpeg-OIVMTPY7.js} +1 -1
  58. package/dist/chunks/image-J5WDYORX.js +3 -0
  59. package/dist/chunks/install-5XLVERRR.js +3 -0
  60. package/dist/chunks/install-C6XNONFF.js +3 -0
  61. package/dist/chunks/launch-5JMWS5CI.js +17 -0
  62. package/dist/chunks/lock-AFVXUDOM.js +3 -0
  63. package/dist/chunks/manager-T3WDLUKR.js +4 -0
  64. package/dist/chunks/{needed-YEXRZMZX.js → needed-YU5BPYD6.js} +1 -1
  65. package/dist/chunks/notify-LTV7F634.js +3 -0
  66. package/dist/chunks/{own-WOK6H277.js → own-OJAQ5FRQ.js} +1 -1
  67. package/dist/chunks/pdfium-7HNCQ3K3.js +3 -0
  68. package/dist/chunks/preset-command-VP5RAXBG.js +3 -0
  69. package/dist/chunks/registry-E5PNQWOZ.js +3 -0
  70. package/dist/chunks/run-WSETTQXP.js +3 -0
  71. package/dist/chunks/{server-QNWPC2CC.js → server-EFNTD7ZW.js} +3 -3
  72. package/dist/chunks/{theme-EHFY7DT6.js → theme-NF3LQHPV.js} +1 -1
  73. package/dist/chunks/transcribe-CQFHXBTV.js +3 -0
  74. package/dist/chunks/transcribe-command-ZXB3JJFZ.js +3 -0
  75. package/dist/chunks/update-command-DJLYU6AB.js +3 -0
  76. package/dist/chunks/{update-note-GYJWUDFS.js → update-note-CJ5XYKYH.js} +1 -1
  77. package/dist/chunks/watch-command-ZNMO4SF7.js +3 -0
  78. package/dist/index.js +13 -13
  79. package/package.json +9 -9
  80. package/dist/chunks/args-FSQFXDIX.js +0 -3
  81. package/dist/chunks/chunk-2J2PTA5O.js +0 -3
  82. package/dist/chunks/chunk-2MLASXG5.js +0 -3
  83. package/dist/chunks/chunk-5TEAR5XH.js +0 -3
  84. package/dist/chunks/chunk-63BBFKT2.js +0 -4
  85. package/dist/chunks/chunk-72TNSFL5.js +0 -36
  86. package/dist/chunks/chunk-AYB5AJ4E.js +0 -3
  87. package/dist/chunks/chunk-C32KGH4S.js +0 -3
  88. package/dist/chunks/chunk-LBDSFSYP.js +0 -3
  89. package/dist/chunks/chunk-OY4EGSPE.js +0 -3
  90. package/dist/chunks/chunk-UXRQ4UBQ.js +0 -66
  91. package/dist/chunks/chunk-WIPP5TWQ.js +0 -3
  92. package/dist/chunks/chunk-WZWK3PEZ.js +0 -3
  93. package/dist/chunks/chunk-ZRHYGR2L.js +0 -134
  94. package/dist/chunks/clip-command-NZNC46H2.js +0 -3
  95. package/dist/chunks/clipboard-GICOXMMN.js +0 -3
  96. package/dist/chunks/colour-GSDOHCFK.js +0 -3
  97. package/dist/chunks/command-GYCYLUHN.js +0 -3
  98. package/dist/chunks/config-command-6YUMMZF3.js +0 -3
  99. package/dist/chunks/continue-editing-QE5RRIMG.js +0 -3
  100. package/dist/chunks/decoded-NBZ335RZ.js +0 -3
  101. package/dist/chunks/execute-FYEXZ7EY.js +0 -3
  102. package/dist/chunks/extensions-V5O4NIHI.js +0 -3
  103. package/dist/chunks/image-3CMUB2P4.js +0 -3
  104. package/dist/chunks/install-IDUHZTTS.js +0 -3
  105. package/dist/chunks/install-L5C2UT6M.js +0 -3
  106. package/dist/chunks/launch-GUHDBMSJ.js +0 -17
  107. package/dist/chunks/lock-UQJ66TZ3.js +0 -3
  108. package/dist/chunks/manager-UKTMRXKE.js +0 -4
  109. package/dist/chunks/pdfium-LYHOU6WV.js +0 -3
  110. package/dist/chunks/preset-command-6A2C6VPQ.js +0 -3
  111. package/dist/chunks/registry-2YU7NW4P.js +0 -3
  112. package/dist/chunks/run-U2CU6VGE.js +0 -5
  113. package/dist/chunks/transcribe-SCL3LFZU.js +0 -3
  114. package/dist/chunks/transcribe-command-BX2VVUI3.js +0 -3
  115. package/dist/chunks/update-command-JCTCRPCS.js +0 -3
  116. package/dist/chunks/watch-command-ZLZAWTNJ.js +0 -3
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
3
  import{execFile as I,spawn as R}from"node:child_process";import{access as T,constants as K}from"node:fs/promises";import{dirname as $,join as L}from"node:path";import{promisify as C}from"node:util";function S(e){let[t,r]=(e??"").split("/").map(Number);return!t||!r?0:Math.round(t/r*100)/100}function O(e){let t=e.side_data_list?.find(n=>typeof n.rotation=="number")?.rotation,r=t!==void 0?-t:Number(e.tags?.rotate??0);return(Math.round(r/90)*90%360+360)%360}function A(e){let t=e,r=t.streams??[],n=r.find(o=>o.codec_type==="video"&&o.disposition?.attached_pic!==1),i=r.find(o=>o.codec_type==="audio"),a={duration:Number(t.format?.duration)||Math.max(0,...r.map(o=>Number(o.duration)||0))};if(n){let o=O(n),f=o===90||o===270,s=n.width??0,c=n.height??0;a.video={codec:n.codec_name??"",width:f?c:s,height:f?s:c,fps:S(n.avg_frame_rate)||S(n.r_frame_rate),rotation:o,hdr:n.color_transfer==="arib-std-b67"||n.color_transfer==="smpte2084"}}return i&&(a.audio={codec:i.codec_name??"",channels:i.channels??0,sampleRate:Number(i.sample_rate)||0}),a}var v=C(I);function D(e,t){let r=t.PATH??t.Path??"",n=e==="win32"?";":":",i=r.split(n).filter(Boolean);return e==="darwin"&&i.push("/opt/homebrew/bin","/usr/local/bin"),[...new Set(i)]}var k=e=>process.platform==="win32"?`${e}.exe`:e;async function N(e){try{return await T(e,K.X_OK),!0}catch{return!1}}function G(e){let t=new Set;for(let r of e.split(`
4
- `)){let n=r.match(/^\s*[A-Z.|]{3,6}\s+(\S+)\s/);n?.[1]&&n[1]!=="="&&t.add(n[1])}return t}async function J(){try{let{installed:e}=await import("./paths-6OENILJ4.js");return(await e("video"))?.dir}catch{return}}async function j(){try{let{chosenPath:e}=await import("./own-WOK6H277.js"),t=await e("video");return t===void 0?void 0:$(t)}catch{return}}async function q(){try{let{removeForgeCopy:e}=await import("./own-WOK6H277.js");await e("video")}catch{}}async function H(){let e=await J(),t=await j(),r=[...t?[t]:[],...D(process.platform,process.env),...e?[e]:[]];for(let n of r){let i=L(n,k("ffmpeg")),m=L(n,k("ffprobe"));if(!await N(i)||!await N(m))continue;try{await v(i,["-hide_banner","-version"],{timeout:5e3})}catch{continue}let[a,o]=await Promise.all(["-encoders","-filters"].map(s=>v(i,["-hide_banner",s],{timeout:5e3,maxBuffer:4<<20}).then(({stdout:c})=>G(c)).catch(()=>{}))),f=a&&o?new Set([...a,...o]):void 0;return e!==void 0&&n!==e&&await q(),{ffmpeg:i,ffprobe:m,...f?{has:f}:{}}}}var b,w=null,F;function y(){return w?Promise.resolve(w.value):(b=(b??H()).then(t=>(t||(b=void 0),F=t,t)),b)}function te(){return w?w.value:F}function ne(e){w=e===null?null:{value:e},b=void 0,F=void 0}async function re(e,t){let r=t??await y();if(!r)throw new Error("ffmpeg is not installed");let{stdout:n}=await v(r.ffprobe,["-v","error","-print_format","json","-show_format","-show_streams",e],{timeout:3e4,maxBuffer:16*1024*1024});return A(JSON.parse(n))}async function oe(e,t,r){let n=r??await y();if(!n)return;let i=Math.max(0,t-15),{stdout:m}=await v(n.ffprobe,["-v","error","-select_streams","v:0","-skip_frame","nokey","-show_entries","frame=pts_time","-of","csv=p=0","-read_intervals",`${i}%${t+.01}`,e],{timeout:3e4,maxBuffer:4*1024*1024}),a=m.split(`
4
+ `)){let n=r.match(/^\s*[A-Z.|]{3,6}\s+(\S+)\s/);n?.[1]&&n[1]!=="="&&t.add(n[1])}return t}async function J(){try{let{installed:e}=await import("./paths-6OENILJ4.js");return(await e("video"))?.dir}catch{return}}async function j(){try{let{chosenPath:e}=await import("./own-OJAQ5FRQ.js"),t=await e("video");return t===void 0?void 0:$(t)}catch{return}}async function q(){try{let{removeForgeCopy:e}=await import("./own-OJAQ5FRQ.js");await e("video")}catch{}}async function H(){let e=await J(),t=await j(),r=[...t?[t]:[],...D(process.platform,process.env),...e?[e]:[]];for(let n of r){let i=L(n,k("ffmpeg")),m=L(n,k("ffprobe"));if(!await N(i)||!await N(m))continue;try{await v(i,["-hide_banner","-version"],{timeout:5e3})}catch{continue}let[a,o]=await Promise.all(["-encoders","-filters"].map(s=>v(i,["-hide_banner",s],{timeout:5e3,maxBuffer:4<<20}).then(({stdout:c})=>G(c)).catch(()=>{}))),f=a&&o?new Set([...a,...o]):void 0;return e!==void 0&&n!==e&&await q(),{ffmpeg:i,ffprobe:m,...f?{has:f}:{}}}}var b,w=null,F;function y(){return w?Promise.resolve(w.value):(b=(b??H()).then(t=>(t||(b=void 0),F=t,t)),b)}function te(){return w?w.value:F}function ne(e){w=e===null?null:{value:e},b=void 0,F=void 0}async function re(e,t){let r=t??await y();if(!r)throw new Error("ffmpeg is not installed");let{stdout:n}=await v(r.ffprobe,["-v","error","-print_format","json","-show_format","-show_streams",e],{timeout:3e4,maxBuffer:16*1024*1024});return A(JSON.parse(n))}async function oe(e,t,r){let n=r??await y();if(!n)return;let i=Math.max(0,t-15),{stdout:m}=await v(n.ffprobe,["-v","error","-select_streams","v:0","-skip_frame","nokey","-show_entries","frame=pts_time","-of","csv=p=0","-read_intervals",`${i}%${t+.01}`,e],{timeout:3e4,maxBuffer:4*1024*1024}),a=m.split(`
5
5
  `).map(o=>Number.parseFloat(o)).filter(o=>Number.isFinite(o)&&o<=t+.001);return a.length?Math.max(...a):void 0}var B=4e3;async function ie(e,t,r,n={}){let i=n.tools??await y();if(!i)return null;let m=Math.max(1,Math.round(t*B)),a=Math.max(1,Math.ceil(m/r)),o=new Array(r).fill(0),f=0,s=Buffer.alloc(0);if(!await new Promise((p,d)=>{let u=R(i.ffmpeg,["-hide_banner","-nostdin","-loglevel","error","-i",e,"-map","0:a:0","-ac","1","-ar",String(B),"-f","s16le","-"],{stdio:["ignore","pipe","pipe"]}),h=()=>u.kill("SIGKILL");n.signal?.addEventListener("abort",h,{once:!0}),u.stdout.on("data",l=>{let _=s.length?Buffer.concat([s,l]):l,P=_.length-_.length%2;for(let x=0;x<P;x+=2){let M=Math.abs(_.readInt16LE(x)),E=Math.min(r-1,Math.floor(f/a));M>(o[E]??0)&&(o[E]=M),f++}s=_.subarray(P)}),u.stderr.resume(),u.on("error",d),u.on("close",l=>{n.signal?.removeEventListener("abort",h),n.signal?.aborted?d(n.signal.reason??new Error("aborted")):p(l===0&&f>0)})}))return null;let g=Math.max(1,...o);return o.map(p=>Math.sqrt(p/g))}async function se(e,t,r,n){await Z(["-ss",String(Math.max(0,t)),"-i",e,"-frames:v","1","-y",r],{tools:n})}function V(e){let t;for(let r of e.matchAll(/out_time_us=(\d+)/g))t=Number(r[1])/1e6;return t}var X=4e3;async function Z(e,t={}){let{signal:r,onTime:n}=t;if(r?.aborted)throw r.reason??new Error("aborted");let i=t.tools??await y();if(!i)throw new Error("ffmpeg is not installed");let a=["-hide_banner","-nostdin","-loglevel",t.report?"info":"error","-progress","pipe:1","-nostats",...e];return new Promise((o,f)=>{let s=R(i.ffmpeg,a,{stdio:["ignore","pipe","pipe"]}),c="",g=()=>s.kill("SIGKILL");r?.addEventListener("abort",g,{once:!0}),s.stdout.setEncoding("utf8");let p="";s.stdout.on("data",d=>{let u=p+d,h=u.lastIndexOf(`
6
6
  `);p=u.slice(h+1);let l=V(u.slice(0,h+1));l!==void 0&&n?.(l)}),s.stderr.setEncoding("utf8"),s.stderr.on("data",d=>{c=(c+d).slice(-X)}),s.on("error",d=>{r?.removeEventListener("abort",g),f(d)}),s.on("close",d=>{r?.removeEventListener("abort",g),r?.aborted?f(r.reason??new Error("aborted")):d===0?o(c):f(new Error(c.trim()||`ffmpeg exited with ${d}`))})})}export{D as a,G as b,y as c,te as d,ne as e,re as f,oe as g,ie as h,se as i,V as j,Z as k};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as L,b as O,f as T}from"./chunk-JGJU3AW5.js";import{b as K,c as P,m as j,n as z,p as J,q as W,s as $}from"./chunk-ZHNPBRCX.js";import{b as w}from"./chunk-GRWOJKQB.js";import{b as q}from"./chunk-IED6VBE6.js";import{d as R}from"./chunk-R24JCIZ5.js";import{a as M}from"./chunk-XPATZLEH.js";import{f as B}from"./chunk-T37DEXUI.js";import{b as I}from"./chunk-BIBDLXCG.js";import{a as k}from"./chunk-J7FLFHQJ.js";import{a as v}from"./chunk-H3DIRJFE.js";import{existsSync as E}from"node:fs";import{basename as G,dirname as H,extname as Q,join as U}from"node:path";var V={images:"an image",pdfs:"a PDF",documents:"a document",videos:"a video",audio:"audio",other:"a file Forge reads"};function X(e){let t=Object.keys(e).filter(s=>e[s]);if(t.length===0)return"not supported";let n=t.map(s=>V[s]);return`not ${n.length===1?n[0]:`${n.slice(0,-1).join(", ")} or ${n.at(-1)}`}`}function Y(e){return e.kind==="document"?e.format==="pdf"?"no images to shrink":"nothing to compress":`${v[e.format].label} is lossless`}function Z(e,t,n){if(e.kind!=="image")return{left:"images only"};let s=e,r=n===void 0?{}:{output:n};if(t.tool==="sharpen"||t.tool==="boost"){let c=t.tool==="sharpen"?1:t.scale??2;if(B(s.width,s.height,c))return{left:c===1?"too large":`too large for ${c}\xD7`};let[f]=K.plan([s],{scale:String(c),target:R(s),...r});return f?{job:f}:{left:"not supported"}}if(t.tool==="cutout"){let[c]=P.plan([s],{target:"png",...r});return c?{job:c}:{left:"not supported"}}if(t.tool==="rotate"){if(s.frames>1)return{left:"animated"};let[c]=$.plan([s],{turn:t.turn??90,...r});return c?{job:c}:{left:"not supported"}}if(t.tool==="trim"&&s.frames>1)return{left:"animated"};let o=t.tool==="trim"?J:W,[i]=o.plan([s],{target:R(s),...t.resize?{resize:t.resize}:{},...r});return i?{job:i}:{left:"not supported"}}function ee(e,t,n){if(t.op==="edit")return Z(e,t,n);if(e.kind==="media")return{left:"one at a time"};let s=n===void 0?{}:{destination:n};if(t.op==="compress"){if(!j.appliesTo([e]))return{left:Y(e)};if(t.targetBytes!==void 0&&e.bytes<=t.targetBytes)return{left:"already under that size"};let[i]=j.plan([e],{mode:t.targetBytes===void 0?"quality":"size",...t.quality===void 0?{}:{quality:t.quality},...s});return i?{job:i}:{left:"not supported"}}let r=t.answers[O(e)];if(!r)return{left:X(t.answers)};if(e.format===r.target)return{left:`already ${v[r.target].label}`};if(!M(e).includes(r.target))return{left:`can\u2019t become ${v[r.target].label}`};let[o]=z.plan([e],{target:r.target,...r.quality===void 0?{}:{quality:r.quality},...r.dpi===void 0?{}:{dpi:String(r.dpi)},pages:"all",...s});return o?.op==="convert"?{job:o}:{left:"not supported"}}function te(e,t){if(!t(e))return e;let n=Q(e),s=G(e,n);for(let r=1;;r++){let o=U(H(e),I(s,` (${r})${n}`));if(!t(o)&&!E(o))return o}}function ne(e,t,n,s={}){let r=s.existing??"leave",o=ee(e,t,s.destination);if(!("job"in o))return o;let{job:i}=o,c=i.outputs.some(a=>E(a)&&!n.has(a));if(c&&r==="leave")return{left:t.op==="compress"?"already compressed":t.op==="edit"?"already edited":"already converted"};let f=r==="number"?a=>n.has(a)||E(a):a=>n.has(a);i.outputs=i.outputs.map(a=>te(a,f));for(let a of i.outputs)n.add(a);return c&&r==="ask"?{job:i,taken:!0}:{job:i}}function S(e,t,n,s={}){let r=[],o=[],i=[];for(let c of e){let f=ne(c,t,n,s);"job"in f?(r.push(f.job),f.taken&&i.push(f.job)):o.push({path:c.path,reason:f.left})}return{jobs:r,left:o,taken:i}}async function D(e,t,n={}){let s=new Set,r=n.existing??"leave",{jobs:o,left:i}=S(e,t,s,{destination:n.destination,existing:r});return{outcome:await w(o,{force:r==="replace",...t.op==="compress"&&t.targetBytes!==void 0?{targetBytes:t.targetBytes}:{},...n.concurrency===void 0?{}:{concurrency:n.concurrency},...n.onEvent?{onEvent:n.onEvent}:{},...n.signal?{signal:n.signal}:{}}),left:i,claimed:s,jobs:o}}function C(e,t){let{outcome:n,left:s}=t,r=new Map;for(let o of n.results){let i=o.job.sources[0].path;r.set(i,{path:i,state:"done",result:o})}for(let o of[...n.refusals,...n.failures])if(o.error.code==="cannot-compress-more"){let i=o.error.short==="nothing written"?"can\u2019t get smaller":"already under that size";r.set(o.path,{path:o.path,state:"left",reason:i})}else o.error.code==="nothing-to-trim"?r.set(o.path,{path:o.path,state:"left",reason:"no empty edges"}):r.set(o.path,{path:o.path,state:"failed",reason:o.error.title.toLowerCase()});for(let o of n.unreachable){let i=o.job.sources[0].path;r.set(i,{path:i,state:"left",reason:`can\u2019t get below ${k(o.smallest)}`})}for(let o of s)r.set(o.path,{path:o.path,state:"left",reason:o.reason});return e.map(o=>r.get(o.path)??{path:o.path,state:"left",reason:n.cancelled?"stopped":"not run"})}import{watch as oe}from"node:fs";import{readdir as re,stat as se}from"node:fs/promises";import{join as ie,resolve as N}from"node:path";function _(e,t,n){let s=N(e),r=n.settleMs??1e3,o=n.pollMs??500,i=new Set([...t].map(m=>N(m))),c=new Map,f=!1,a=!1,d=!1,p=async()=>{if(!f){if(a){d=!0;return}a=!0;try{let m=await re(s,{withFileTypes:!0}).catch(()=>[]),g=new Set;for(let l of m){if(!l.isFile()||L(l.name))continue;let u=ie(s,l.name);if(g.add(u),i.has(u)||n.ignore?.(u))continue;let y=await se(u).catch(()=>{});if(!y||f)continue;let F=Date.now(),b=c.get(u);if(!b||b.size!==y.size||b.mtimeMs!==y.mtimeMs){c.set(u,{size:y.size,mtimeMs:y.mtimeMs,since:F});continue}F-b.since<r||(c.delete(u),i.add(u),n.onFile(u))}for(let l of[...i,...c.keys()])g.has(l)||(i.delete(l),c.delete(l))}finally{a=!1,d&&!f&&(d=!1,p())}}},x=setInterval(()=>{p()},o),h;try{h=oe(s,{persistent:!1},()=>{p()}),h.on("error",()=>{})}catch{}return p(),{close(){f=!0,clearInterval(x),h?.close()}}}var A=e=>"op"in e&&(e.op==="convert"||e.op==="compress"||e.op==="edit")?e:{op:"convert",answers:e};function ae(e,t,n,s){let{jobs:r,left:o}=S(e,A(t),n,{destination:s});return{jobs:r,left:o}}async function ze(e,t,n={}){return D(e.sources,A(t),n)}var ce=(e,t)=>e==="other"?t==="text"?"a text file":"not supported":"not yet supported";function Je(e){let t=q(e.concurrency),n=A(e.answers),s=[],r=new Set,o=!1,i=async a=>{e.onEvent({type:"arrived",path:a}),e.onEvent({type:"phase",path:a,phase:"reading"});let d=await T(a);if(d.kind==="failed"){e.onEvent({type:"failed",path:a,error:d.failure.error});return}if(d.kind!=="source"){e.onEvent({type:"left",path:a,reason:ce(d.kind,d.sniffed)});return}let{jobs:p,left:x}=ae([d.source],n,e.claimed,e.destination),[h]=x;if(h){e.onEvent({type:"left",path:a,reason:h.reason});return}let m=await w(p,{force:!1,concurrency:1,...n.op==="compress"&&n.targetBytes!==void 0?{targetBytes:n.targetBytes}:{},onEvent:l=>{l.type==="job:phase"&&"phase"in l.progress&&l.progress.phase!=="page"&&l.progress.phase!=="time"&&l.progress.phase!=="tiles"&&e.onEvent({type:"phase",path:a,phase:l.progress.phase,job:l.job})}}),[g]=C([d.source],{outcome:m,left:[],claimed:e.claimed,jobs:p});if(g?.result)e.onEvent({type:"converted",path:a,result:g.result});else if(g?.state==="left")e.onEvent({type:"left",path:a,reason:g.reason??""});else{let l=[...m.refusals,...m.failures][0];l&&e.onEvent({type:"failed",path:a,error:l.error})}},c=()=>{for(;!o&&r.size<t&&s.length>0;){let a=s.shift(),d=i(a).catch(()=>{}).finally(()=>{r.delete(d),c()});r.add(d)}},f=_(e.dir,e.known,{...e.settleMs===void 0?{}:{settleMs:e.settleMs},...e.pollMs===void 0?{}:{pollMs:e.pollMs},ignore:a=>e.claimed.has(a),onFile:a=>{s.push(a),c()}});return{async stop(){o=!0,f.close(),s.length=0,await Promise.all([...r])}}}export{S as a,C as b,ze as c,Je as d};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{availableParallelism as o}from"node:os";function r(){return Math.max(1,Math.min(o(),8))}function i(e=process.env){e.UV_THREADPOOL_SIZE===void 0&&(e.UV_THREADPOOL_SIZE=String(r()))}export{r as a,i as b};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{c as L}from"./chunk-YK26E3OX.js";import{U as S,V as k,W as P,ka as b}from"./chunk-CVNYUROW.js";import{spawn as A}from"node:child_process";var O=new Map;function H(e,n,t={}){let r=()=>(t.onStart?.(),e.serve?j(e,n,t):F(e,n,t)),o=(t.platform??process.platform)==="darwin"?void 0:e.id,s=(O.get(o)??Promise.resolve()).then(()=>e.id===void 0?r():L(e.id,r,{...t.what!==void 0?{what:t.what}:{},...t.signal!==void 0?{signal:t.signal}:{},...t.onWait!==void 0?{onWait:t.onWait}:{}}));return O.set(o,s.catch(()=>{})),s}function N(e){let n=e.indexOf("--in");return(n>=0?e[n+1]:e[0])??""}function J(e){if(e.startsWith('{"progress"'))try{let n=JSON.parse(e);return typeof n.progress!="number"||typeof n.of!="number"||n.of<=0?void 0:{done:n.progress,of:n.of}}catch{return}}function I(e,n,t,r,o,i){return e==="no-subject"?S(t):e==="boost-too-large"?k(t,r.maxScale??0):e==="boost-too-slow"?P(t,i??0,Number(o[o.indexOf("--scale")+1])):b(t,new Error(n))}function W(e){return{width:Number(e.width),height:Number(e.height),ms:Number(e.ms),...typeof e.hasAlpha=="boolean"?{hasAlpha:e.hasAlpha}:{},...Array.isArray(e.pages)?{pages:e.pages}:{}}}function T(e,n,t,r){return I(String(e.code??""),String(e.message??""),n,t,r,typeof e.seconds=="number"?e.seconds:void 0)}function F(e,n,t){let{signal:r}=t,o=t.subject??N(n);return r?.aborted?Promise.reject(r.reason??new Error("aborted")):new Promise((i,s)=>{let[f,w]=e.kind==="node"?[process.execPath,[e.entry,...n]]:[e.entry,n],l=A(f,w,{stdio:["ignore","pipe","pipe"]}),g="",d="",m=!1,a=u=>{m||(m=!0,r?.removeEventListener("abort",x),u())},x=()=>l.kill("SIGKILL");l.on("exit",()=>{r?.aborted&&a(()=>s(r.reason??new Error("aborted")))}),r?.addEventListener("abort",x,{once:!0});let R="";l.stdout.setEncoding("utf8").on("data",u=>{if(g+=u,!t.onProgress&&!t.onLine)return;let v=(R+u).split(`
4
+ `);R=v.pop()??"";for(let h of v){let c=J(h);if(c){t.onProgress?.(c.done,c.of);continue}if(!(!t.onLine||!h.trim().startsWith("{")))try{let y=JSON.parse(h);"ok"in y||t.onLine(y)}catch{}}}),l.stderr.setEncoding("utf8").on("data",u=>{d+=u}),l.on("error",u=>a(()=>s(b(o,u)))),l.on("close",u=>a(()=>{let v=g.split(`
5
+ `).filter(y=>y.trim().startsWith("{")).at(-1),h;try{h=v?JSON.parse(v):void 0}catch{h=void 0}let c=h;if(c&&c.ok===!0&&u===0)return i(W(c));if(c&&c.ok===!1)return s(T(c,o,t,n));s(b(o,new Error(`extension exited ${u} without a result: ${(d||g).trim().slice(-500)}`)))}))})}var $=5e3,E=class{constructor(n){this.ext=n;let[t,r]=n.kind==="node"?[process.execPath,[n.entry,"--serve"]]:[n.entry,["--serve"]];this.child=A(t,r,{stdio:["pipe","pipe","pipe"]});let o="";this.child.stdout.setEncoding("utf8").on("data",i=>{let s=(o+i).split(`
6
+ `);o=s.pop()??"";for(let f of s)this.listener?.line(f)}),this.child.stderr.setEncoding("utf8").on("data",i=>{this.said=(this.said+i).slice(-2e3)}),this.child.stdin.on("error",()=>{}),this.child.on("error",i=>{this.gone(),this.listener?.error(i)}),this.child.on("exit",()=>{this.gone(),this.listener?.exit()}),this.child.on("close",(i,s)=>this.listener?.close(s??`exit ${i}`))}ext;child;listener;exited=!1;said="";idle;gone(){this.exited=!0,clearTimeout(this.idle),p.get(this.ext.entry)===this&&p.delete(this.ext.entry)}holdAll(n){for(let t of[this.child,this.child.stdin,this.child.stdout,this.child.stderr])t[n]?.()}hold(n){clearTimeout(this.idle),this.said="",this.listener=n,this.holdAll("ref")}rest(n){this.listener=void 0,this.holdAll("unref"),this.idle=setTimeout(()=>{this.close()},n),this.idle.unref()}close(){return new Promise(n=>{if(this.exited)return n();this.gone();let t=setTimeout(()=>this.child.kill("SIGKILL"),3e3);t.unref(),this.child.once("exit",()=>{clearTimeout(t),n()}),this.child.stdin.end()})}},p=new Map;function M(e){for(let r of[...p.values()])e.id!==void 0&&r.ext.id===e.id&&r.ext.entry!==e.entry&&!r.listener&&r.close();let n=p.get(e.entry);if(n&&!n.exited&&!n.listener)return n;let t=new E(e);return p.set(e.entry,t),t}async function _(e){await Promise.all([...p.values()].filter(n=>(e===void 0||n.ext.id===e)&&!n.listener).map(n=>n.close()))}function j(e,n,t){let{signal:r}=t,o=t.subject??N(n);if(r?.aborted)return Promise.reject(r.reason??new Error("aborted"));let i=M(e);return new Promise((s,f)=>{let w=!1,l=d=>{w||(w=!0,r?.removeEventListener("abort",g),d())},g=()=>i.child.kill("SIGKILL");r?.addEventListener("abort",g,{once:!0}),i.hold({line(d){let m=J(d);if(m)return t.onProgress?.(m.done,m.of);if(!d.trim().startsWith("{"))return;let a;try{a=JSON.parse(d)}catch{return}if(!("ok"in a))return t.onLine?.(a);l(()=>{i.rest(t.idleMs??$),a.ok===!0?s(W(a)):f(T(a,o,t,n))})},exit(){r?.aborted&&l(()=>f(r.reason??new Error("aborted")))},close(d){l(()=>f(b(o,new Error(`extension exited ${d} without a result: ${i.said.trim().slice(-500)}`))))},error(d){l(()=>f(b(o,d)))}}),i.child.stdin.write(`${JSON.stringify({args:n})}
7
+ `)})}export{H as a,_ as b};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{a as o}from"./chunk-BD3OLIVT.js";import{f as n}from"./chunk-WZWK3PEZ.js";import{H as i}from"./chunk-WIPP5TWQ.js";import{a as r}from"./chunk-H3DIRJFE.js";var I=5,h=200,x=5;function z(t){return t.format==="heic"||t.format==="raw"?"jpeg":o(t).includes(t.format)?t.format:"png"}function E(t,m){let e=n.find(f=>f.id==="image")?.writes;if(!e?.has(t))return i(`Cannot ${m} into ${r[t].label}; only an image format can take the edit.`,`Choose one of: ${[...e??[]].join(", ")}.`)}var c=t=>`${t.width}x${t.height}`,u=t=>"percent"in t?`${t.percent}pct`:"width"in t?`${t.width}w`:`${t.height}h`;export{I as a,h as b,x as c,z as d,E as e,c as f,u as g};
3
+ import{a as o}from"./chunk-XPATZLEH.js";import{f as n}from"./chunk-DYIATUFE.js";import{E as i}from"./chunk-CVNYUROW.js";import{a as r}from"./chunk-H3DIRJFE.js";var I=5,h=200,x=5;function z(t){return t.format==="heic"||t.format==="raw"?"jpeg":o(t).includes(t.format)?t.format:"png"}function E(t,m){let e=n.find(f=>f.id==="image")?.writes;if(!e?.has(t))return i(`Cannot ${m} into ${r[t].label}; only an image format can take the edit.`,`Choose one of: ${[...e??[]].join(", ")}.`)}var c=t=>`${t.width}x${t.height}`,u=t=>"percent"in t?`${t.percent}pct`:"width"in t?`${t.width}w`:`${t.height}h`;export{I as a,h as b,x as c,z as d,E as e,c as f,u as g};
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- var v="0.5.1",x={ok:"\u2713",fail:"\u2715",warn:"\u26A0",cursor:"\u276F",strip:"\u258C",star:"\u2605",arrow:"\u2192",tip:"\u2727",longArrow:"\u2500\u2500\u2192",longArrowDown:`\u2502
3
+ var v="0.5.2",x={ok:"\u2713",fail:"\u2715",warn:"\u26A0",cursor:"\u276F",strip:"\u258C",star:"\u2605",arrow:"\u2192",tip:"\u2727",longArrow:"\u2500\u2500\u2192",longArrowDown:`\u2502
4
4
  \u25BC`,dotFilled:"\u25CF",dotEmpty:"\u25CB"},f={name:"dark",fg:"#e7e7e7",dim:"#b0b0b0",accent:"#e5a23c",ok:"#6fcf7f",warn:"#e5c07b",fail:"#e8796d",failTint:"#2e2020",failTintDim:"#b0b0b0",larger:"#f2994a",shedHatch:"#47774f",grownFill:"#403225",tag:"#63c1d8",label:"#a68ce0",modeConvert:"#55c7d9",modeConvertBg:"#122c33",modeCompress:"#79c98b",modeCompressBg:"#182c1e",modePdf:"#ff6b4a",modePdfBg:"#361c16",modeColour:"#f27ba8",modeColourBg:"#3a1e2b",modeEdit:"#b39ae8",modeEditBg:"#2a2238",modeTranscribe:"#e63946",modeTranscribeBg:"#3a1a1d",border:"#808080",selectionBg:"#2c2c2c",band:"#2c2c2c",canvas:"#1e1e1e",textSelectionBg:"#3f5c86",brand:"#e5a23c",keycapBg:"#333333",violet:"#a68ce0",faint:"#4d4d4d",listBand:"#323232",shelf:"#242424",tabChip:"#262626",panelBand:"#404040",ink:"#0c1d22",track:"#2e2e2e",trackFill:"#515151",thumb:"#e7e7e7",folderChip:"#414141",pill:"#e7e7e7",fieldBand:"#3d3d3d",defaultTagBg:"#33261a",defaultTag:"#c98a4b",newTagBg:"#2a3448",newTag:"#4f77c5"},o={name:"light",fg:"#262626",dim:"#4f4f4f",accent:"#915a01",ok:"#0e702c",warn:"#8a6100",fail:"#a43c32",failTint:"#f9e3df",failTintDim:"#4a4a4a",larger:"#8b4d01",shedHatch:"#87b896",grownFill:"#ece3d6",tag:"#0a6b86",label:"#5e4b99",modeConvert:"#036b7b",modeConvertBg:"#e6f7fa",modeCompress:"#24733a",modeCompressBg:"#eaf5ec",modePdf:"#b82a06",modePdfBg:"#fceee9",modeColour:"#b0306a",modeColourBg:"#f7e3ec",modeEdit:"#64569f",modeEditBg:"#f0ebfa",modeTranscribe:"#c0102c",modeTranscribeBg:"#fef0ef",border:"#767676",selectionBg:"#e4e4e4",band:"#e4e4e4",canvas:"#ffffff",textSelectionBg:"#b9cfe8",brand:"#915a01",keycapBg:"#e1e1e1",violet:"#5e4b99",faint:"#b2b2b2",listBand:"#dcdcdc",shelf:"#f3f3f3",tabChip:"#f0f0f0",panelBand:"#d5d5d5",ink:"#ffffff",track:"#e4e4e4",trackFill:"#afafaf",thumb:"#262626",folderChip:"#d0d0d0",pill:"#262626",fieldBand:"#d7d7d7",defaultTagBg:"#f5e2cc",defaultTag:"#8f5000",newTagBg:"#e1e7f4",newTag:"#3358a3"},i={name:"neutral",fg:"",dim:"gray",accent:"yellow",ok:"green",warn:"yellow",fail:"red",failTint:"",failTintDim:"gray",larger:"yellow",shedHatch:"green",grownFill:"",tag:"cyan",label:"magenta",modeConvert:"cyan",modeConvertBg:"",modeCompress:"green",modeCompressBg:"",modePdf:"red",modePdfBg:"",modeColour:"magenta",modeColourBg:"",modeEdit:"magenta",modeEditBg:"",modeTranscribe:"redBright",modeTranscribeBg:"",border:"gray",selectionBg:"",band:"",canvas:"",textSelectionBg:"",brand:"yellow",keycapBg:"",violet:"magenta",faint:"gray",listBand:"",shelf:"",tabChip:"",panelBand:"",ink:"",track:"",trackFill:"",thumb:"",folderChip:"",pill:"",fieldBand:"",defaultTagBg:"",defaultTag:"",newTagBg:"",newTag:""},d=["convert","compress","pdf","edit","transcribe","colour"],k=`1\u2013${d.length}`;function E(e,t){let r=d,n=e==="menu"?r.length:r.indexOf(e),a=Math.max(0,Math.min(r.length-1,n+t));return r[a]}function P(e){return/^[1-9]$/.test(e)?d[Number(e)-1]:void 0}var S={convert:"\u2194",compress:"\u2193",pdf:"\u25A3",colour:"\u25D0",edit:"\u2726",transcribe:"\xB6"},c="#7d6ad0",l="#cc8ae2";function s(e,t){return t==="compress"?{fg:e.modeCompress,bg:e.modeCompressBg}:t==="pdf"?{fg:e.modePdf,bg:e.modePdfBg}:t==="colour"?{fg:e.modeColour,bg:e.modeColourBg}:t==="edit"?{fg:e.modeEdit,bg:e.modeEditBg}:t==="transcribe"?{fg:e.modeTranscribe,bg:e.modeTranscribeBg}:{fg:e.modeConvert,bg:e.modeConvertBg}}var g=["#f26e69","#e5a23c","#ace02c","#55c7d9","#6579fd","#ad95e9"],b=["#e5a23c","#f2cf6b"],m={convert:["#1e96a7","#1e94b3","#1e92c0","#1d8ed2","#1b86ef","#4a7df8","#6974f8","#816af8","#995cf8"],compress:["#24b459","#22ab6d","#21a479","#209f81","#1f9c89","#1f9a91","#1e9998","#1e97a0","#1e96a7"],pdf:["#eb4319","#e3541a","#de601b","#db6a1c","#d9731d","#d87c1e","#d8841f","#d98c20","#d99522"],edit:["#9b5af8","#985cf8","#965ef8","#945ff8","#9161f8","#8f62f8","#8d64f8","#8a65f8","#8867f8"],transcribe:["#f3233e","#f12259","#ee2270","#ea2186","#e6219b","#e121b0","#da22c6","#d122dc","#c723f2"],colour:["#f42335","#e05b1a","#d87d1e","#da9b23","#d2b427","#b4c027","#5bbf23","#20a27c","#1e989b","#1e94b6","#1c8cd9","#577af8","#7371f8","#8568f8","#965df8"]},u=["#d99522","#da9822","#da9b23","#da9f24","#d9a224","#d9a525","#d8a825","#d7ab26","#d6ad26"],B={convert:["#d6f7fd","#ddf5fe","#e1f4fe","#e4f2fe","#e7f1fe","#eaf0fe","#eceffe","#efeefe","#f1edfe"],compress:["#e0f7e4","#def8e7","#dcf8ea","#daf8ed","#d8f8f1","#d7f8f4","#d6f8f7","#d6f8fa","#d6f7fd"],pdf:["#feece7","#feece6","#feece5","#feece3","#feece2","#feede0","#feedde","#feeddc","#feeed9"],edit:["#f2edfe","#f1edfe","#f1edfe","#f1eefe","#f0eefe","#f0eefe","#f0eefe","#f0eefe","#efeefe"],transcribe:["#feebea","#feebec","#feebee","#feeaf0","#feeaf2","#feeaf5","#fee9f9","#fde9fd","#f9eafe"],colour:["#feebe9","#feece5","#feede0","#feeed7","#f7f1d6","#eff3d9","#e5f6df","#dbf8eb","#d6f8f8","#def5fe","#e5f2fe","#ebf0fe","#edeffe","#efeefe","#f1edfe"]},p=["#feeed9","#feeed8","#feeed7","#fdeed6","#fcefd6","#fbefd6","#fbefd6","#faefd6","#f9f0d6"],T={convert:["#138291","#8467bd"],compress:["#2b8748","#138291"],pdf:["#d54322","#a06c10"],edit:["#8567bc","#7b67cd"],transcribe:["#df3140","#9c5cb1"],colour:["#cb4b49","#a06c10","#618110","#138291","#5869ec","#8268bd"]};function C(e,t){return e.name==="light"?t==="menu"?u:m[t]:t==="menu"?e.name==="dark"?b:[e.brand]:t==="compress"?[e.modeCompress,e.modeConvert]:t==="pdf"?[e.modePdf,e.brand]:t==="colour"?e.name==="dark"?g:[e.modeColour,e.violet]:t==="edit"?[e.modeEdit,e.name==="dark"?c:e.violet]:t==="transcribe"?[e.modeTranscribe,e.name==="dark"?l:e.violet]:[e.modeConvert,e.violet]}function y(e,t){if(e.name==="light")return t==="menu"?p:B[t]}function w(e,t){return e.name==="light"?T[t]:C(e,t)}function M(e){return{...e,accent:e.brand,tag:e.brand,label:e.brand}}function R(e,t){let{fg:r,bg:n}=s(e,t);return{...e,accent:r,tag:r,label:r,band:n===""?e.band:n}}function H(e){return e.canvas!==""}function O(e){return e==="dark"?f:e==="light"?o:i}function D(e){return e===""?void 0:e}var _={filled:"\u2501",empty:"\u2501",knob:"\u25CF"};function h(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""?!1:process.stdout.isTTY===!0}function F(){h()||(process.env.FORCE_COLOR="0")}export{v as a,x as b,f as c,o as d,i as e,d as f,k as g,E as h,P as i,S as j,s as k,C as l,y as m,w as n,M as o,R as p,H as q,O as r,D as s,_ as t,h as u,F as v};
@@ -0,0 +1,82 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{A as ge,B as le,C as pe,D as he,a,b as te,c as re,d as k,e as $,f as O,g as D,h as ie,j as oe,k as l,l as A,m as se,n as x,o as H,p as ae,q as E,r as L,s as R,t as ce,u as I,v as ue,w as fe,x as me,y as de,z as B}from"./chunk-TARDT6LZ.js";import{r as M}from"./chunk-BIBDLXCG.js";import{execFile as Ye}from"node:child_process";import{chmodSync as Q,existsSync as Ie,mkdirSync as Z,readdirSync as be,readFileSync as N,rmdirSync as qe,rmSync as p,writeFileSync as We}from"node:fs";import{dirname as P,join as c}from"node:path";var je={convert:"#55c7d9",compress:"#79c98b",edit:"#b39ae8",pdf:"#ff6b4a"},_e="#55c7d9",Ge="#a68ce0",Te=4/5,Je=(e,n,t,i)=>`<path fill="${i}" d="M${e} ${n}h${4*t}v${t}h${-3*t}v${t}h${2*t}v${t}h${-2*t}v${2*t}h${-t}z"/>`;function Ke(e,n){let t=n<=20,i=t?3:4,r=t?6:4.6,o=t?51:51.5,m=Array.from({length:i},(g,w)=>o-(i-1-w)*r).map(g=>`<line x1="${g}" y1="66" x2="${g+66*Te}" y2="0"/>`).join(""),u=e==="forge"?"url(#w)":je[e];return`<svg width="${n}" height="${n}" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="w" gradientUnits="userSpaceOnUse" x1="34" y1="0" x2="62" y2="0"><stop offset="0" stop-color="${_e}"/><stop offset="1" stop-color="${Ge}"/></linearGradient><clipPath id="c"><rect width="64" height="64" rx="14"/></clipPath><clipPath id="i"><rect x="1.5" y="1.5" width="61" height="61" rx="12.5"/></clipPath></defs><g clip-path="url(#c)"><rect width="64" height="64" fill="#1e1e1e"/><g clip-path="url(#i)" stroke="${u}" stroke-width="${t?3.6:2.4}">${m}</g>${Je(16,12,8,"#e7e7e7")}</g><rect x=".75" y=".75" width="62.5" height="62.5" rx="13.5" fill="none" stroke="#3a3a3a" stroke-width="1.5"/></svg>`}async function v(e,n){let{default:t}=await import("sharp");return t(Buffer.from(Ke(e,n))).png().toBuffer()}function ye(e){let n=Buffer.alloc(6);n.writeUInt16LE(0,0),n.writeUInt16LE(1,2),n.writeUInt16LE(e.length,4);let t=6+16*e.length,i=e.map(({size:r,png:o})=>{let s=Buffer.alloc(16);return s[0]=r>=256?0:r,s[1]=r>=256?0:r,s.writeUInt16LE(1,4),s.writeUInt16LE(32,6),s.writeUInt32LE(o.length,8),s.writeUInt32LE(t,12),t+=o.length,s});return Buffer.concat([n,...i,...e.map(r=>r.png)])}function h(e){let n=[{action:"open",label:"Open Forge",kinds:["image","folder"],window:!0,paint:"forge"},{action:"convert",label:"Convert in Forge",kinds:["image","folder"],window:!0,paint:"convert"},{action:"compress",label:"Compress in Forge",kinds:["image","folder"],window:!0,paint:"compress"},{action:"sharpen",label:"Sharpen in Forge",kinds:["image"],window:!1,paint:"edit"},{action:"open-pdf",label:"Open in Forge",kinds:["pdf"],window:!0,paint:"pdf"}],t=(e.presets??[]).map(i=>({action:"preset",preset:i,label:`${i} in Forge`,kinds:["image"],window:!1,paint:"forge"}));return[...e.sharpen?n:n.filter(i=>i.action!=="sharpen"),...t]}var U="Forge was uninstalled",j="Its menu items are removed.",we="Forge could not start",$e="Run forge in a terminal once to set its menu up again.";function xe(e){let{osascript:n,pbs:t}=e.tools??{osascript:"/usr/bin/osascript",pbs:"/System/Library/CoreServices/pbs"},i=[e.node,...e.execArgv,e.forge].map(a).join(" "),[r,o]=$({on:[],off:e.services,osascript:n}),s=[r,...o].map(a).join(" "),m=(u,g)=>`${a(n)} -e 'display notification "${g}" with title "${u}"'`;return`#!/bin/sh
4
+ # Forge's right-click menu. Rewritten by Forge whenever it sets the menu up.
5
+ if [ ! -f ${a(e.forge)} ]; then
6
+ # Forge is gone: take its menu with it, and say so once.
7
+ ${e.bundles.map(u=>` rm -rf ${a(u)}`).join(`
8
+ `)}
9
+ rm -rf ${a(e.menuDir)}
10
+ ${s}
11
+ ${a(t)} -update
12
+ ${m(U,j)}
13
+ exit 0
14
+ fi
15
+ if [ ! -x ${a(e.node)} ]; then
16
+ ${m(we,$e)}
17
+ exit 1
18
+ fi
19
+ ${e.xdgConfigHome===void 0?"":`export XDG_CONFIG_HOME=${a(e.xdgConfigHome)}
20
+ `}exec ${i} menu run "$@"
21
+ `}function ve(e){let n=e.xdgConfigHome===void 0?{}:{XDG_CONFIG_HOME:e.xdgConfigHome};return`// Forge's right-click menu. Rewritten by Forge whenever it sets the menu up.
22
+ import { execFileSync, spawn } from 'node:child_process'
23
+ import { existsSync, rmSync } from 'node:fs'
24
+
25
+ const FORGE = ${JSON.stringify(e.forge)}
26
+ const ARGS = ${JSON.stringify(e.execArgv)}
27
+ const MENU = ${JSON.stringify(e.menuDir)}
28
+ const KEYS = ${JSON.stringify(e.keys)}
29
+ const ENV = ${JSON.stringify(n)}
30
+
31
+ if (existsSync(FORGE)) {
32
+ const child = spawn(process.execPath, [...ARGS, FORGE, 'menu', 'run', ...process.argv.slice(2)], {
33
+ stdio: 'inherit',
34
+ windowsHide: true,
35
+ env: { ...process.env, ...ENV },
36
+ })
37
+ child.on('exit', (code) => process.exit(code ?? 0))
38
+ } else {
39
+ // Forge is gone: say so while its app ID still exists, then take the menu with it.
40
+ try {
41
+ execFileSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-Command', ${JSON.stringify(he(U,j))}], { windowsHide: true })
42
+ } catch {}
43
+ for (const key of KEYS) {
44
+ try {
45
+ execFileSync('reg.exe', ['delete', key, '/f'], { windowsHide: true, stdio: 'ignore' })
46
+ } catch {}
47
+ }
48
+ rmSync(MENU, { recursive: true, force: true })
49
+ }
50
+ `}function Ve(){return`say() {
51
+ if command -v notify-send >/dev/null 2>&1; then
52
+ notify-send --app-name=Forge -- "$1" "$2" >/dev/null 2>&1
53
+ elif command -v gdbus >/dev/null 2>&1; then
54
+ ${["gdbus call --session --dest org.freedesktop.Notifications","--object-path /org/freedesktop/Notifications","--method org.freedesktop.Notifications.Notify",`Forge 0 "''" "\\"$1\\"" "\\"$2\\"" '[]' '{}' -1`].join(" ")} >/dev/null 2>&1
55
+ fi
56
+ }`}function Se(e){let n=[e.node,...e.execArgv,e.forge].map(a).join(" "),t=e.files.map(a).join(` \\
57
+ `),i="";if(e.thunar!==void 0){let r=a(e.thunar.file),o=a(`${e.thunar.file}.forge-tmp`),s=a(e.thunar.seed),m=['/<action>/ { held = ""; holding = 1 }',`holding { held = held $0 "\\n"; if (/<\\/action>/) { holding = 0; if (held !~ /<unique-id>${e.marker}-/) printf "%s", held }; next }`,"{ print }"].join(`
58
+ `);i=` if [ -f ${r} ] && grep -qF '<unique-id>${e.marker}-' ${r}; then
59
+ awk ${a(m)} ${r} > ${o} && mv -f ${o} ${r}
60
+ if [ -f ${s} ] && cmp -s ${s} ${r}; then rm -f ${r}; fi
61
+ fi
62
+ `}return`#!/bin/sh
63
+ # Forge's right-click menu. Rewritten by Forge whenever it sets the menu up.
64
+ ${Ve()}
65
+ if [ ! -f ${a(e.forge)} ]; then
66
+ # Forge is gone: take its menu with it, and say so once.
67
+ for f in ${t}; do
68
+ if [ -f "$f" ] && grep -qF ${a(e.marker)} "$f"; then rm -f "$f"; fi
69
+ done
70
+ ${i}${e.folders.map(r=>` rmdir ${a(r)} 2>/dev/null
71
+ `).join("")} rm -rf ${a(e.menuDir)}
72
+ say ${a(U)} ${a(j)}
73
+ exit 0
74
+ fi
75
+ if [ ! -x ${a(e.node)} ]; then
76
+ say ${a(we)} ${a($e)}
77
+ exit 1
78
+ fi
79
+ ${e.xdgConfigHome===void 0?"":`export XDG_CONFIG_HOME=${a(e.xdgConfigHome)}
80
+ `}exec ${n} menu run "$@"
81
+ `}var b="HKCU\\Software\\Classes",Me=`${b}\\SystemFileAssociations\\image\\shell\\Forge`,ke=`${b}\\Directory\\shell\\Forge`,G=`${b}\\SystemFileAssociations\\.pdf\\shell\\ForgeOpen`,De=`${b}\\AppUserModelId\\${le}`,J=()=>[Me,ke,G,De],K=e=>`${e.paint}.ico`;function Ee(e){let n=o=>`conhost.exe --headless "${e.node}" "${e.menuDir}\\run.mjs" ${o.action}${o.preset===void 0?"":` ${o.preset}`} "%1"`,t=o=>`${e.menuDir}\\${K(o)}`,i=(o,s)=>{let m=e.items.filter(u=>u.kinds.includes(s));return m.length===0?[]:[{key:o,values:{MUIVerb:"Forge",Icon:t({paint:"forge"}),SubCommands:""}},...m.flatMap((u,g)=>{let w=u.preset===void 0?u.action:`preset-${u.preset}`,f=`${o}\\shell\\${g+1}${w}`;return[{key:f,values:{MUIVerb:u.label,Icon:t(u)}},{key:`${f}\\command`,values:{"":n(u)}}]})]},r=e.items.find(o=>o.kinds.includes("pdf"));return[...i(Me,"image"),...i(ke,"folder"),...r?[{key:G,values:{MUIVerb:r.label,Icon:t(r)}},{key:`${G}\\command`,values:{"":n(r)}}]:[],{key:De,values:{DisplayName:"Forge",IconUri:`${e.menuDir}\\forge.png`}}]}var T=e=>`'${pe(e)}'`,_=e=>T(`Registry::${e.replace(/^HKCU\\/,"HKEY_CURRENT_USER\\")}`);function V(e){return["$ErrorActionPreference = 'Stop'",...J().map(t=>`Remove-Item -Path ${_(t)} -Recurse -Force -ErrorAction SilentlyContinue`),...e.flatMap(({key:t,values:i})=>[`New-Item -Path ${_(t)} -Force | Out-Null`,...Object.entries(i).map(([r,o])=>`Set-ItemProperty -LiteralPath ${_(t)} -Name ${T(r===""?"(default)":r)} -Value ${T(o)}`)])].join(`
82
+ `)}var vn=(e,n)=>e.version===n.version&&e.forge===n.forge&&e.node===n.node&&e.execArgv.join("\0")===n.execArgv.join("\0")&&e.xdgConfigHome===n.xdgConfigHome&&(e.presets??[]).join("\0")===(n.presets??[]).join("\0"),Fe="/System/Library/CoreServices/pbs",Pe=e=>c(e.menuDir,"state.json"),S=e=>c(e.home,"Library","Services"),q=e=>h({sharpen:!0}).map(n=>c(S(e),`${n.label}.workflow`)),W=()=>h({sharpen:!0}).map(k);function Ne(e){let n;try{n=be(S(e)).filter(t=>t.endsWith(".workflow"))}catch{return[]}return n.flatMap(t=>{let i=c(S(e),t);try{let r=N(c(i,"Contents","Info.plist"),"utf8"),o=/<key>CFBundleIdentifier<\/key>\s*<string>([^<]*)<\/string>/.exec(r)?.[1],s=/<key>CFBundleName<\/key>\s*<string>([^<]*)<\/string>/.exec(r)?.[1];return!o?.startsWith(re)||s===void 0?[]:[{path:i,key:`${o} - ${(u=>u.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"))(s)} - runWorkflowAsService`}]}catch{return[]}})}function Xe(e){try{return JSON.parse(N(Pe(e),"utf8"))}catch{return}}var Sn=e=>Xe(e)!==void 0,d=(e,n)=>{Z(P(e),{recursive:!0}),We(e,n)};async function Mn(e){if(!Qe(e.platform))return;let n=h({sharpen:e.sharpen,presets:e.presets??[]});if(Z(e.menuDir,{recursive:!0}),e.platform==="linux")await nn(e,n);else if(e.platform==="darwin"){let i=c(e.menuDir,"run"),r=n.filter(f=>f.preset!==void 0),o=r.map(f=>c(S(e),O(f,i).name));d(i,xe({...e,bundles:[...q(e),...o],services:[...W(),...r.map(k)]})),Q(i,493);let s=Ne(e);for(let f of[...q(e),...s.map(C=>C.path)])p(f,{recursive:!0,force:!0});let m=new Map,{default:u}=await import("sharp");for(let f of n){m.has(f.paint)||m.set(f.paint,await u(await v(f.paint,64)).tiff().toBuffer());let{name:C,files:Re}=O(f,i),ne=c(S(e),C);for(let[Be,Ue]of Object.entries(Re))d(c(ne,Be),Ue);d(c(ne,"Contents","Resources",`${te}.tiff`),m.get(f.paint))}let g=n.map(k),w=new Set([...W(),...s.map(f=>f.key)]);await e.run(...$({on:g,off:[...w].filter(f=>!g.includes(f))})),await e.run(Fe,["-update"])}else{d(c(e.menuDir,"run.mjs"),ve({...e,keys:J()}));for(let i of Ce){let r=await Promise.all([16,24,32,48,256].map(async o=>({size:o,png:await v(i,o)})));d(c(e.menuDir,K({paint:i})),ye(r))}d(c(e.menuDir,"forge.png"),await v("forge",256)),await e.run("powershell.exe",Le(V(Ee({...e,items:n}))))}let t={version:e.version,forge:e.forge,node:e.node,execArgv:e.execArgv,...e.xdgConfigHome===void 0?{}:{xdgConfigHome:e.xdgConfigHome},...e.presets&&e.presets.length>0?{presets:[...e.presets]}:{}};d(Pe(e),JSON.stringify(t))}var Qe=e=>e==="darwin"||e==="win32"||e==="linux",Ce=["forge","convert","compress","edit","pdf"],Oe=e=>ie({home:e.home,...e.xdgDataHome===void 0?{}:{xdgDataHome:e.xdgDataHome},...e.xdgConfigHome===void 0?{}:{xdgConfigHome:e.xdgConfigHome},...e.xdgConfigDirs===void 0?{}:{xdgConfigDirs:e.xdgConfigDirs}});function X(e){let n=h({sharpen:!0}),t=n.map(r=>r.action),i=(r,o)=>{try{return be(r).filter(o).map(s=>c(r,s))}catch{return[]}};return[...new Set([...n.map(r=>c(l(e),A(r))),...i(l(e),()=>!0),...n.map(r=>c(x(e),H(r,t))),...i(x(e),r=>r.startsWith("forge-")&&r.endsWith(".nemo_action")),...R.map(r=>c(E(e),L(r)))])]}var y=e=>{try{return N(e,"utf8")}catch{return}};function Ae(e){for(let n of e)y(n)?.includes(D)&&p(n,{force:!0})}var He=e=>c(e.menuDir,"made.json"),z=e=>{try{return JSON.parse(N(He(e),"utf8"))}catch{return[]}};function F(e,n){let t=[];for(let i=n;!Ie(i)&&P(i)!==i;i=P(i))t.push(i);t.length!==0&&(Z(n,{recursive:!0}),d(He(e),JSON.stringify([...new Set([...z(e),...t])])))}function Ze(e){for(let n of[...e].sort((t,i)=>i.length-t.length))try{qe(n)}catch{}}var ee=e=>c(e.menuDir,"thunar-seed.xml");async function ze(e,n,t,i){let r=I(n),o=y(r);if(o===void 0){if(!ge(n,e.path,Ie))return;o=ue(n).map(y).find(m=>m!==void 0&&B(m,"")!==void 0)??fe,d(ee(e),o),F(e,P(r))}let s=B(o,me(t,{launcher:i,menuDir:e.menuDir}));s!==void 0&&s!==y(r)&&await M(r,Buffer.from(s))}async function en(e,n){let t=I(n),i=y(t);if(i===void 0||!i.includes(`<unique-id>${D}-`))return;let r=de(i);r===y(ee(e))?p(t,{force:!0}):await M(t,Buffer.from(r))}async function Y(e,n,t=!1){await M(e,Buffer.from(n)),t&&Q(e,493)}async function nn(e,n){let t=Oe(e),i=c(e.menuDir,"run");for(let o of Ce)d(c(e.menuDir,oe({paint:o})),await v(o,128));Ae(X(t));let r=h({sharpen:!0}).map(o=>o.action);F(e,l(t));for(let o of n)await Y(c(l(t),A(o)),se(o,i),!0);F(e,x(t));for(let o of n)await Y(c(x(t),H(o,r)),ae(o,i));F(e,E(t));for(let o of R){let s=ce(o,n,{launcher:i,menuDir:e.menuDir});s!==void 0&&await Y(c(E(t),L(o)),s,!0)}await ze(e,t,n,i),d(i,Se({...e,files:X(t),folders:[...new Set([l(t),...z(e)])].sort((o,s)=>s.length-o.length),marker:D,thunar:{file:I(t),seed:ee(e)}})),Q(i,493)}async function tn(e){let n=Oe(e);Ae(X(n)),await en(e,n),Ze([l(n),...z(e)]),p(e.menuDir,{recursive:!0,force:!0})}async function kn(e){if(e.platform==="linux")await tn(e);else if(e.platform==="darwin"){let n=Ne(e);for(let i of[...q(e),...n.map(r=>r.path)])p(i,{recursive:!0,force:!0});p(e.menuDir,{recursive:!0,force:!0});let t=new Set([...W(),...n.map(i=>i.key)]);await e.run(...$({on:[],off:[...t]})),await e.run(Fe,["-update"])}else e.platform==="win32"&&(p(e.menuDir,{recursive:!0,force:!0}),await e.run("powershell.exe",Le(V([]))))}var Le=e=>["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",e],Dn=(e,n)=>new Promise((t,i)=>{Ye(e,n,{timeout:6e4,windowsHide:!0},r=>r?i(r):t())});export{vn as a,Xe as b,Sn as c,Mn as d,Qe as e,kn as f,Dn as g};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{c as a}from"./chunk-VLVNA4T3.js";import{dirname as l,sep as f}from"node:path";var p=2e4,g=t=>t>=p;function u(t,o){return{made:t.map(i=>({from:i.job.sources.map(e=>e.path),to:i.job.outputs})),failed:o.map(i=>({path:i.path,message:i.error.message}))}}var d=t=>t.length===1?a(t[0]):`${t.length} files`;function m(t){let[o,...i]=t.map(s=>l(s).split(f)),e=o??[];for(let s of i){let n=0;for(;n<e.length&&e[n]===s[n];)n++;e=e.slice(0,n)}return e.join(f)||f}function y(t,o){let i=o.made.length+o.failed.length;if(i===0)return;let[e]=o.failed,s=e&&(e.path?`${a(e.path)}: `:"")+e.message;if(i===1){let[r]=o.made;return r?{title:`${t} finished`,body:`${d(r.from)} \u2192 ${d(r.to)}`}:{title:`${t} failed`,body:s??""}}let n=`${t} finished ${o.made.length} of ${i} files`;return s!==void 0?{title:n,body:s}:{title:n,body:`Saved to ${a(m(o.made.flatMap(r=>r.to)))}`}}export{g as a,u as b,y as c};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{d as E,k as F}from"./chunk-J6AZTW62.js";import{n as te,o as A,q as re}from"./chunk-BIBDLXCG.js";import{a as ie,b as oe,c as ne,d as ae,e as se,f as he,g as I}from"./chunk-7KYO62XK.js";import{B as j,E as O,J as X,X as G,a as b,aa as H,b as L,c as P,ca as K,d as z,da as Q,e as _,ea as Y,f as N,fa as Z,g as $,ga as ee,h as D,i as q,ka as x,l as U,m as W,n as V,t as J,u as S}from"./chunk-CVNYUROW.js";import{c as y}from"./chunk-VLVNA4T3.js";import{a as f}from"./chunk-H3DIRJFE.js";import{b as w}from"./chunk-KXKQDFHX.js";import{constants as be}from"node:fs";import{access as Se,readFile as xe,rm as Ee,stat as Ie,writeFile as ve}from"node:fs/promises";import{dirname as ze}from"node:path";function Ue(e){if(f[e].hasAlpha)return;let r=Object.keys(f).filter(t=>f[t].hasAlpha&&t!=="heic").join(", ");return O(`${f[e].label} cannot hold transparency, so a cutout cannot be saved as one.`,`Choose a format that can: ${r}.`)}var ce="1.1.0";function fe(e,r){let t=e.split(".").map(i=>Number.parseInt(i,10)||0),o=r.split(".").map(i=>Number.parseInt(i,10)||0);for(let i=0;i<Math.max(t.length,o.length);i++){let a=(t[i]??0)-(o[i]??0);if(a!==0)return a>0}return!0}var ge="1.4.0";function We(e){return e!==void 0&&fe(e,ge)}function M(e){return e!==void 0&&fe(e,ce)?[2,3,4]:[2,4]}function Ve(e,r,t){if(e===1||M(r).some(i=>i===e))return;if(t!==void 0&&M(t).some(i=>i===e))return X("boost",`boost ${e}\xD7`,r,ce);let o=M(r).map(i=>`--boost ${i}`);return O(`No released boost makes ${e}\xD7 yet.`,`Try ${o.slice(0,-1).join(", ")} or ${o.at(-1)}.`)}var le=16384,ye=1e8;function de(e,r,t){let o=Math.max(e,r)*t;if(o>le)return{side:o};let i=e*t*r*t;if(i>ye)return{megapixels:Math.round(i/1e6)}}var u=e=>Math.max(1,Math.round(e));function T(e,r){return"percent"in r?{width:u(e.width*r.percent/100),height:u(e.height*r.percent/100)}:"width"in r?{width:u(r.width),height:u(e.height*r.width/e.width)}:{width:u(e.width*r.height/e.height),height:u(r.height)}}function pe(e){return de(e.width,e.height,1)}var Oe=new Set(["jpeg","png","webp","avif","heic","raw","gif","tiff"]),Fe=new Set(["jpeg","png","webp","avif","gif","tiff"]),Ae={jpeg:"jpeg",png:"png",webp:"webp",gif:"gif",tiff:"tiff"};function Me(e,r){if(r.format==="heif")return r.compression==="av1"?"avif":"heic";let t=Ae[r.format??""];if(!t)throw q(e,r.format??"an unknown format");return t}async function Te(e){let r;try{r=await Ie(e)}catch(a){let s=a.code;throw s==="ENOENT"?L(e):s==="EACCES"||s==="EPERM"?z(e):s==="ENOTDIR"?_(e):s==="ELOOP"?N(e):s==="ENAMETOOLONG"?$(e):D(e,a)}if(!r.isFile())throw P(e);try{await Se(e,be.R_OK)}catch{throw z(e)}if(await oe(e)){if(!await ie())throw U(e);let a;try{a=await ne(e)}catch(s){throw S(e,"heic",s)}if(a.width===0||a.height===0)throw S(e,"heic",void 0);return{kind:"image",path:e,format:"heic",width:a.width,height:a.height,bytes:r.size,hasAlpha:a.hasAlpha,frames:1}}let t=await ae(e);if(t){if(!await se())throw W(e);let a;try{a=await he(e,t)}catch(s){throw S(e,"raw",s)}if(!a)throw V(e);return{kind:"image",path:e,format:"raw",width:a.width,height:a.height,bytes:r.size,hasAlpha:!1,frames:1}}let o=await w(),i;try{i=await o(e).metadata()}catch(a){throw J(e,a)}return{kind:"image",path:e,format:Me(e,i),width:i.autoOrient?.width??i.width??0,height:i.autoOrient?.height??i.height??0,bytes:r.size,hasAlpha:i.hasAlpha??!1,frames:i.pages??1}}function k(e,r,t,o){let i=t??f[r].defaultQuality;if(o&&f[r].quantisable)return ke(e,r,t,o);switch(r){case"jpeg":return e.jpeg({quality:i,mozjpeg:!0});case"webp":return e.webp({quality:i});case"avif":return e.avif({quality:i});case"png":return e.png({compressionLevel:9});case"gif":return e.gif();case"tiff":return e.tiff({compression:"deflate"});case"heic":throw new Error("heic is not writable; the capability graph should have prevented this");case"raw":throw new Error("raw is not writable; the capability graph should have prevented this");case"pdf":throw new Error("pdf is not an image target; the capability graph should have prevented this");case"docx":throw new Error("docx is not an image target; the capability graph should have prevented this");case"doc":throw new Error("doc is not an image target; the capability graph should have prevented this");default:throw new Error(`${r} is not an image target; the capability graph should have prevented this`)}}function ke(e,r,t,{dither:o}){let i=t??100,a=o?1:0;return r==="gif"?e.gif({interFrameMaxError:Math.round(32*(100-i)/100),dither:a}):e.png({palette:!0,quality:i,dither:a,compressionLevel:9,effort:10})}var R=(e,r)=>e.kind==="image"&&e.frames>1&&f[r].animatable;async function Re(e,r){let t=ze(r);await A(r);let o=te(r);try{return await ve(o,e),await re(o,r),e.length}catch(i){throw await Ee(o,{force:!0}).catch(()=>{}),j(r,i)}}async function g(e,r,t,o,i,a){if(e.kind!=="image")throw new Error("pipelineFor received a non-image source");let s=i??await I(e.path,e.format),n=(await w())(s,o?{animated:!0}:{});if(n=n.rotate(),t.trim&&(n=n.trim()),t.crop){if(!t.crop.box)throw new Error("pipelineFor needs the crop placed (run does it)");n=n.extract(t.crop.box)}if(t.resize){if(!a&&(t.trim||t.crop))throw new Error("pipelineFor needs the resolved size to resize a cut image");let c=a??T(e,t.resize);n=n.resize(c.width,c.height,{fit:"fill"})}return t.rotate&&(n=n.rotate(t.rotate)),e.hasAlpha&&!f[r].hasAlpha&&(n=n.flatten({background:t.background})),n=t.keepMetadata?n.keepMetadata():n.keepIccProfile(),{pipeline:n}}async function st(e,r){let t={background:"#ffffff",keepMetadata:!1},{pipeline:o}=await g(e,"png",t,!1);await o.png({compressionLevel:1}).toFile(r)}async function ht(e,r,t){let{pipeline:o}=await g(e,r,t,R(e,r));return await k(o,r,t.quality,t.compress).toBuffer()}async function Be(e){let r={width:e.width,height:e.height};if(e.frames>1)return{upright:r,trimmed:"animated"};let t=await I(e.path,e.format);try{let o=await w(),{info:i}=await o(t).rotate().trim().jpeg({quality:1}).toBuffer({resolveWithObject:!0});return i.width===r.width&&i.height===r.height?{upright:r,trimmed:"nothing"}:{upright:r,trimmed:{width:i.width,height:i.height}}}catch(o){throw b(o)?o:x(e.path,o)}}var me=1024;async function Ce(e){let r={background:"#ffffff",keepMetadata:!1},{pipeline:t}=await g(e,"png",r,!1);try{let{data:o,info:i}=await t.resize(me,me,{fit:"inside",withoutEnlargement:!0}).ensureAlpha().raw().toBuffer({resolveWithObject:!0}),a=i.width*i.height,s=i.channels,p=new Uint8Array(a*3),n=new Uint8Array(a),c=!1;for(let m=0;m<a;m++){for(let h=0;h<3;h++)p[m*3+h]=o[m*s+(s>=4?h:0)]??0;n[m]=o[m*s+s-1]??255,n[m]!==255&&(c=!0)}return{size:{width:e.width,height:e.height},thumb:{width:i.width,height:i.height,rgb:p,...c?{alpha:n}:{}}}}catch(o){throw b(o)?o:x(e.path,o)}}var ue=128;async function Le(e,r){let{thumb:t,size:o}=e,i=E(t,r),a=await w(),{info:s}=await a(Pe(t),{raw:{width:t.width,height:t.height,channels:3}}).resize(i.width,i.height,{fit:"cover",position:a.strategy.attention}).raw().toBuffer({resolveWithObject:!0}),p=E(o,r),n=Math.round(-(s.cropOffsetLeft??0)*o.width/t.width),c=Math.round(-(s.cropOffsetTop??0)*o.height/t.height);return{...p,left:Math.min(Math.max(n,0),o.width-p.width),top:Math.min(Math.max(c,0),o.height-p.height)}}function Pe(e){let{alpha:r}=e;if(!r)return e.rgb;let t=new Uint8Array(e.rgb.length);for(let o=0;o<t.length;o++){let i=(r[Math.floor(o/3)]??255)/255;t[o]=Math.round(ue+((e.rgb[o]??0)-ue)*i)}return t}async function _e(e,r){if(e.op!=="convert")throw new Error(`image engine cannot ${e.op}`);let t=e.sources[0],o=e.outputs[0];if(t.kind!=="image")throw new Error("the image engine cannot convert a document source");let i=f[e.target],a=[];r({phase:"reading"});let s=t.frames>1,p=R(t,e.target);s&&!i.animatable&&a.push({code:"animation-flattened",message:`${y(t.path)} has ${t.frames} frames, and ${i.label} cannot animate. Only the first frame was converted.`});let n=e.options,c;if(n.rotate&&s)throw ee(t.path);if(n.trim||n.crop||n.resize){let h={width:t.width,height:t.height};if(n.trim&&n.crop)throw new Error("a job cannot both trim and crop");if(n.crop){if(s)throw Z(t.path);let{aspect:d}=n.crop,B=v=>v.width===t.width&&v.height===t.height,C=E(h,d),l=n.crop.box??(B(C)?C:await Le(await Ce(t),d));if(B(l)){if(!n.resize)throw Y(t.path,F(d));a.push({code:"nothing-cropped",message:`${y(t.path)} is already ${F(d)}; resized only.`});let{crop:v,...we}=n;n=we}else n={...n,crop:{aspect:d,box:l}},h={width:l.width,height:l.height}}if(n.trim){if(s)throw Q(t.path);let{trimmed:d}=await Be(t);if(d==="nothing"){if(!n.resize)throw K(t.path);a.push({code:"nothing-trimmed",message:`${y(t.path)} has no empty edges; resized only.`})}else d!=="animated"&&(h=d)}if(n.resize&&(c=T(h,n.resize),pe(c)))throw G(t.path,c)}r({phase:"decoding"});let{pipeline:m}=await g(t,e.target,n,p,void 0,c);try{await A(o),r({phase:"encoding"});let h=await k(m,e.target,n.quality,n.compress).toBuffer();if(n.compress&&h.length>=t.bytes)throw H(t.path,t.bytes,h.length);r({phase:"writing"});let d=await Re(h,o);return{job:e,outputBytes:d,warnings:a}}catch(h){throw b(h)?h:x(t.path,h)}}async function Ne(e){let r=await I(e.path,e.format);return typeof r=="string"?await xe(r):r}async function $e(e){if(e.op!=="convert")return;let r=f[e.target];if(!r.lossy&&!(r.quantisable&&e.options.compress))return;let t=e.sources[0];if(t.kind!=="image")return;let o=await Ne(t);return{ladder:[{}],measure:async i=>{let{pipeline:a}=await g(t,e.target,i,R(t,e.target),o);return(await k(a,e.target,i.quality,i.compress).toBuffer()).length}}}var ct={id:"image",reads:Oe,writes:Fe,ops:new Set(["convert"]),probe:Te,run:_e,measurer:$e};export{Ue as a,We as b,M as c,Ve as d,le as e,de as f,T as g,pe as h,k as i,Re as j,st as k,ht as l,Be as m,Ce as n,Le as o,ct as p};
@@ -0,0 +1,55 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as y}from"./chunk-SNFUGJ3M.js";import{execFile as C}from"node:child_process";import{accessSync as v,constants as k}from"node:fs";import{isAbsolute as A,join as a}from"node:path";var S=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function $(e,t){if(typeof e=="string")return`${t}<string>${S(e)}</string>`;if(typeof e=="number")return`${t}<integer>${e}</integer>`;if(typeof e=="boolean")return`${t}<${e}/>`;if(Array.isArray(e))return`${t}<array>
4
+ ${e.map(o=>$(o,`${t} `)).join(`
5
+ `)}
6
+ ${t}</array>`;let n=Object.entries(e).map(([o,i])=>`${t} <key>${S(o)}</key>
7
+ ${$(i,`${t} `)}`);return n.length===0?`${t}<dict/>`:`${t}<dict>
8
+ ${n.join(`
9
+ `)}
10
+ ${t}</dict>`}var h=e=>`<?xml version="1.0" encoding="UTF-8"?>
11
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
12
+ <plist version="1.0">
13
+ ${$(e,"")}
14
+ </plist>
15
+ `,T={image:"public.image",folder:"public.folder",pdf:"com.adobe.pdf"};function P(e){return e.length===1&&e[0]==="image"?"com.apple.Automator.fileSystemObject.image":e.length===1&&e[0]==="pdf"?"com.apple.Automator.fileSystemObject.PDF":e.length===1&&e[0]==="folder"?"com.apple.Automator.fileSystemObject.folder":"com.apple.Automator.fileSystemObject"}var u=e=>`'${e.replace(/'/g,"'\\''")}'`,w="forge",D=e=>e.preset===void 0?`com.forge-terminal.menu.${e.action}`:`com.forge-terminal.menu.preset.${e.preset}`,Y="com.forge-terminal.menu.",N="runWorkflowAsService",G=e=>`${D(e)} - ${e.label} - ${N}`,E=`ObjC.import('Foundation')
16
+ function run(argv) {
17
+ const domain = argv[0]
18
+ const defaults = $.NSUserDefaults.standardUserDefaults
19
+ const or = (v) => (v.isNil() ? $.NSDictionary.dictionary : v)
20
+ const all = $.NSMutableDictionary.dictionaryWithDictionary(or(defaults.persistentDomainForName(domain)))
21
+ const status = $.NSMutableDictionary.dictionaryWithDictionary(or(all.objectForKey('NSServicesStatus')))
22
+ const on = { presentation_modes: { ContextMenu: true, FinderPreview: true, ServicesMenu: true, TouchBar: true } }
23
+ for (const arg of argv.slice(1)) {
24
+ const key = arg.slice(1)
25
+ if (arg[0] === '+') status.setObjectForKey($(on), key)
26
+ else status.removeObjectForKey(key)
27
+ }
28
+ all.setObjectForKey(status, 'NSServicesStatus')
29
+ defaults.setPersistentDomainForName(all, domain)
30
+ }`;function Q(e){return[e.osascript??"/usr/bin/osascript",["-l","JavaScript","-e",E,e.domain??"pbs",...e.on.map(t=>`+${t}`),...e.off.map(t=>`-${t}`)]]}function z(e,t){let n=h({CFBundleDevelopmentRegion:"English",CFBundleIdentifier:D(e),CFBundleInfoDictionaryVersion:"6.0",CFBundleName:e.label,CFBundlePackageType:"BNDL",CFBundleShortVersionString:"1.0",CFBundleVersion:"1",NSServices:[{NSIconName:w,NSMenuItem:{default:e.label},NSMessage:N,NSRequiredContext:{NSApplicationIdentifier:"com.apple.finder"},NSSendFileTypes:e.kinds.map(s=>T[s])}]}),o=e.preset===void 0?"":` ${u(e.preset)}`,i=`${u(t)} ${e.action}${o} "$@"`,r=h({AMApplicationBuild:"521",AMApplicationVersion:"2.10",AMDocumentVersion:"2",actions:[{action:{AMAccepts:{Container:"List",Optional:!0,Types:["com.apple.cocoa.path"]},AMActionVersion:"2.0.3",AMApplication:["Automator"],AMParameterProperties:{COMMAND_STRING:{},CheckedForUserDefaultShell:{},inputMethod:{},shell:{},source:{}},AMProvides:{Container:"List",Types:["com.apple.cocoa.string"]},ActionBundlePath:"/System/Library/Automator/Run Shell Script.action",ActionName:"Run Shell Script",ActionParameters:{COMMAND_STRING:i,CheckedForUserDefaultShell:!0,inputMethod:1,shell:"/bin/zsh",source:""},BundleIdentifier:"com.apple.RunShellScript",CFBundleVersion:"2.0.3",CanShowSelectedItemsWhenRun:!1,CanShowWhenRun:!0,Category:["AMCategoryUtilities"],"Class Name":"RunShellScriptAction",InputUUID:"7A1F3C2E-0F4B-4E8A-9C61-5B2D8E4F1A01",OutputUUID:"7A1F3C2E-0F4B-4E8A-9C61-5B2D8E4F1A02",UUID:"7A1F3C2E-0F4B-4E8A-9C61-5B2D8E4F1A03",UnlocalizedApplications:["Automator"]},isViewVisible:!0}],connectors:{},workflowMetaData:{serviceApplicationBundleID:"com.apple.finder",serviceApplicationPath:"/System/Library/CoreServices/Finder.app",serviceInputTypeIdentifier:P(e.kinds),serviceOutputTypeIdentifier:"com.apple.Automator.nothing",serviceProcessesInput:!1,workflowTypeIdentifier:"com.apple.Automator.servicesMenu"}});return{name:`${e.label}.workflow`,files:{"Contents/Info.plist":n,"Contents/document.wflow":r,"Contents/Resources/document.wflow":r}}}var m="forge-terminal-menu";function oe(e){let t=o=>o&&A(o)?o:void 0,n=(e.xdgConfigDirs??"").split(":").filter(o=>A(o));return{dataHome:t(e.xdgDataHome)??a(e.home,".local","share"),configHome:t(e.xdgConfigHome)??a(e.home,".config"),configDirs:n.length>0?n:["/etc/xdg"]}}function x(e,t=process.env.PATH){for(let n of(t??"").split(":"))if(n!=="")try{return v(a(n,e),k.X_OK),!0}catch{}return!1}var I={image:"image/*",folder:"inode/directory",pdf:"application/pdf"},U=e=>e.map(t=>`${I[t]};`).join(""),M=e=>`${e.paint}.png`,ie=e=>a(e.dataHome,"nautilus","scripts","Forge"),f=e=>e.preset===void 0?e.action:`preset-${e.preset}`,g=e=>e.preset===void 0?e.action:`preset ${e.preset}`,re=e=>e.label;function se(e,t){return`#!/bin/sh
31
+ # ${m}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.
32
+ if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then
33
+ IFS='
34
+ '
35
+ set -f
36
+ set -- $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
37
+ fi
38
+ exec ${u(t)} ${g(e)} "$@"
39
+ `}var ae=e=>a(e.dataHome,"nemo","actions"),ce=(e,t)=>`forge-${e.preset===void 0?t.indexOf(e.action)+1:t.length+1}-${f(e)}.nemo_action`,l=e=>e.replace(/%/g,"%%");function ue(e,t){return`[Nemo Action]
40
+ # ${m}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.
41
+ Name=${l(e.label)}
42
+ Comment=${l(e.label)}
43
+ Exec=${l(u(t))} ${g(e)} %F
44
+ Selection=notnone
45
+ Mimetypes=${U(e.kinds)}
46
+ `}var pe=e=>a(e.dataHome,"kio","servicemenus"),le=e=>`forge-${e}.desktop`,me=["image","folder","pdf"],_=e=>l(`"${e.replace(/[\\"`$]/g,"\\$&")}"`).replace(/\\/g,"\\\\");function fe(e,t,n){let o=t.filter(c=>c.kinds.includes(e));if(o.length===0)return;let i=o.length>1,r=["[Desktop Entry]",`# ${m}: Forge's right-click menu, written by Forge. \`forge menu remove\` takes it out.`,"Type=Service","ServiceTypes=KonqPopupMenu/Plugin","X-KDE-ServiceTypes=KonqPopupMenu/Plugin",`MimeType=${I[e]};`,`Actions=${o.map(c=>`${f(c)};`).join("")}`,"X-KDE-Priority=TopLevel",...i?["X-KDE-Submenu=Forge",`Icon=${a(n.menuDir,"forge.png")}`]:[]],s=o.map(c=>["",`[Desktop Action ${f(c)}]`,`Name=${c.label}`,`Icon=${a(n.menuDir,M(c))}`,`Exec=${_(n.launcher)} ${g(c)} %F`].join(`
47
+ `));return`${[...r,...s].join(`
48
+ `)}
49
+ `}var ge=e=>a(e.configHome,"Thunar","uca.xml"),de=e=>e.configDirs.map(t=>a(t,"Thunar","uca.xml")),$e=`<?xml version="1.0" encoding="UTF-8"?>
50
+ <actions>
51
+ </actions>
52
+ `,L=e=>`${m}-${f(e)}`,p=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),O={image:{patterns:["*"],type:"image-files"},folder:{patterns:["*"],type:"directories"},pdf:{patterns:["*.pdf","*.PDF"],type:"other-files"}};function xe(e,t){return e.map(n=>{let o=n.kinds.map(s=>O[s]),i=[...new Set(o.flatMap(s=>s.patterns))],r=i.includes("*")?["*"]:i;return["<action>",` <icon>${p(a(t.menuDir,M(n)))}</icon>`,` <name>${p(n.label)}</name>`,` <submenu>${n.kinds.includes("pdf")?"":"Forge"}</submenu>`,` <unique-id>${L(n)}</unique-id>`,` <command>${p(l(u(t.launcher)))} ${g(n)} %F</command>`,` <description>${p(n.label)}</description>`," <range></range>",` <patterns>${p(r.join(";"))}</patterns>`,...o.map(s=>` <${s.type}/>`),"</action>"].join(`
53
+ `)}).map(n=>`${n}
54
+ `).join("")}var j=/[ \t]*<action>[\s\S]*?<\/action>[ \t]*\r?\n?/g;function R(e){return e.replace(j,t=>t.includes(`<unique-id>${m}-`)?"":t)}function ye(e,t){let n=R(e),o=n.lastIndexOf("</actions>");if(o===-1||!/<actions>/.test(n))return;let i=n.lastIndexOf(`
55
+ `,o)+1;return/^[ \t]*$/.test(n.slice(i,o))&&(o=i),`${n.slice(0,o)}${t}${n.slice(o)}`}var Se=(e,t,n)=>x("thunar",t)||n(a(e.configHome,"Thunar"));var B="ForgeTerminal.Forge",F=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),K=e=>e.replace(/['‘’‚‛]/g,"$&$&"),b=K;function H(e,t){return["[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null","[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] > $null","$x = New-Object Windows.Data.Xml.Dom.XmlDocument",`$x.LoadXml('<toast><visual><binding template="ToastText02"><text id="1">${b(F(e))}</text><text id="2">${b(F(t))}</text></binding></visual></toast>')`,`[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('${B}').Show([Windows.UI.Notifications.ToastNotification]::new($x))`].join("; ")}function W(e,t,n=process.platform){return n==="win32"?["powershell.exe",["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-Command",H(e,t)]]:["/usr/bin/osascript",["-e","on run argv","-e","display notification (item 2 of argv) with title (item 1 of argv)","-e","end run",e,t]]}var d=e=>`"${e.replace(/[\\"]/g,"\\$&").replace(/\n/g,"\\n")}"`;function X(e,t,n={}){let o=n.has??(i=>x(i));if(o("notify-send"))return["notify-send",["--app-name=Forge",...n.icon?[`--icon=${n.icon}`]:[],"--",e,t]];if(o("gdbus"))return["gdbus",["call","--session","--dest","org.freedesktop.Notifications","--object-path","/org/freedesktop/Notifications","--method","org.freedesktop.Notifications.Notify",d("Forge"),"0",d(n.icon??""),d(e),d(t),"[]","{}","-1"]]}function V(e,t,n=process.platform,o={}){let i=n==="linux"?X(e,t,o):W(e,t,n);return new Promise(r=>{if(i===void 0)return r();try{C(i[0],i[1],{timeout:1e4,windowsHide:!0},()=>r())}catch{r()}})}var q=(e,t)=>new Promise((n,o)=>C(e,t,{timeout:2e3},(i,r)=>i?o(i):n(r)));async function J(e,t=q){let n=(await t("lsappinfo",["front"])).trim();return(await t("lsappinfo",["info","-only","bundleid",n])).match(/bundleID="([^"]*)"/)?.[1]===e}async function Ie(e,t,n={}){if(e===void 0||!y(t))return;let o=n.platform??process.platform,i=n.env??process.env;if(i.FORGE_NO_NOTIFY||i.SSH_CONNECTION||i.SSH_TTY)return;let r=i.__CFBundleIdentifier;o==="darwin"&&r&&await J(r,n.ask).catch(()=>!1)||await(n.post??((s,c)=>V(s,c,o)))(e.title,e.body)}export{u as a,w as b,Y as c,G as d,Q as e,z as f,m as g,oe as h,x as i,M as j,ie as k,re as l,se as m,ae as n,ce as o,ue as p,pe as q,le as r,me as s,fe as t,ge as u,de as v,$e as w,xe as x,R as y,ye as z,Se as A,B,K as C,H as D,W as E,d as F,X as G,V as H,J as I,Ie as J};
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{r as E}from"./chunk-DZOBIUV6.js";import{ba as O}from"./chunk-WIPP5TWQ.js";import{execFile as F,spawn as W}from"node:child_process";import{createHash as v}from"node:crypto";import{mkdir as k,mkdtemp as P,open as D,readFile as J,rename as A,rm as w,writeFile as $}from"node:fs/promises";import{tmpdir as h}from"node:os";import{join as m}from"node:path";import{promisify as B}from"node:util";var H=B(F),U=async(t,e)=>{let{stdout:c}=await H("osascript",["-l","JavaScript","-e",t,...e],{timeout:5e3});return c.trim()},S={darwin:{images:[{type:"public.png",ext:"png",format:"png"},{type:"public.jpeg",ext:"jpg",format:"jpeg"},{type:"org.webmproject.webp",ext:"webp",format:"webp"},{type:"public.heic",ext:"heic",format:"heic"},{type:"public.avif",ext:"avif",format:"avif"},{type:"com.compuserve.gif",ext:"gif",format:"gif"},{type:"public.tiff",ext:"tiff",format:"tiff"}],file:"public.file-url",standIn:"public.tiff",text:["public.utf8-plain-text"]},win32:{images:[{type:"PNG",ext:"png",format:"png"},{type:"image/png",ext:"png",format:"png"},{type:"JFIF",ext:"jpg",format:"jpeg"},{type:"image/jpeg",ext:"jpg",format:"jpeg"},{type:"image/webp",ext:"webp",format:"webp"},{type:"image/heic",ext:"heic",format:"heic"},{type:"image/avif",ext:"avif",format:"avif"},{type:"GIF",ext:"gif",format:"gif"},{type:"image/gif",ext:"gif",format:"gif"},{type:"Bitmap",ext:"png",format:"png"}],file:"FileDrop",standIn:"Bitmap",text:["UnicodeText","Text"]},linux:{images:[{type:"image/png",ext:"png",format:"png"},{type:"image/jpeg",ext:"jpg",format:"jpeg"},{type:"image/webp",ext:"webp",format:"webp"},{type:"image/heic",ext:"heic",format:"heic"},{type:"image/avif",ext:"avif",format:"avif"},{type:"image/gif",ext:"gif",format:"gif"},{type:"image/tiff",ext:"tiff",format:"tiff"}],file:"text/uri-list",standIn:null,text:["text/plain;charset=utf-8","UTF8_STRING","text/plain","STRING","TEXT"]}};function _(t,e){let c=t.includes(e.file);return e.images.find(i=>t.includes(i.type)&&!(c&&i.type===e.standIn))}function T(t,e){return e.text.some(c=>t.includes(c))}function bt(t=process.platform,e=process.env){return e.SSH_CONNECTION||e.SSH_TTY?!1:t==="linux"?j(e).length>0:t==="darwin"||t==="win32"}var M=Object.fromEntries(S.darwin.images.map(t=>[t.format,t.type]));function Y(t){return M[t]??"public.data"}var I={changeCount:-1,image:null,text:!1};function y(t,e){return v("sha256").update(t.join(`
3
+ import{r as E}from"./chunk-BIBDLXCG.js";import{_ as O}from"./chunk-CVNYUROW.js";import{execFile as F,spawn as W}from"node:child_process";import{createHash as v}from"node:crypto";import{mkdir as k,mkdtemp as P,open as D,readFile as J,rename as A,rm as w,writeFile as $}from"node:fs/promises";import{tmpdir as h}from"node:os";import{join as m}from"node:path";import{promisify as B}from"node:util";var H=B(F),U=async(t,e)=>{let{stdout:c}=await H("osascript",["-l","JavaScript","-e",t,...e],{timeout:5e3});return c.trim()},S={darwin:{images:[{type:"public.png",ext:"png",format:"png"},{type:"public.jpeg",ext:"jpg",format:"jpeg"},{type:"org.webmproject.webp",ext:"webp",format:"webp"},{type:"public.heic",ext:"heic",format:"heic"},{type:"public.avif",ext:"avif",format:"avif"},{type:"com.compuserve.gif",ext:"gif",format:"gif"},{type:"public.tiff",ext:"tiff",format:"tiff"}],file:"public.file-url",standIn:"public.tiff",text:["public.utf8-plain-text"]},win32:{images:[{type:"PNG",ext:"png",format:"png"},{type:"image/png",ext:"png",format:"png"},{type:"JFIF",ext:"jpg",format:"jpeg"},{type:"image/jpeg",ext:"jpg",format:"jpeg"},{type:"image/webp",ext:"webp",format:"webp"},{type:"image/heic",ext:"heic",format:"heic"},{type:"image/avif",ext:"avif",format:"avif"},{type:"GIF",ext:"gif",format:"gif"},{type:"image/gif",ext:"gif",format:"gif"},{type:"Bitmap",ext:"png",format:"png"}],file:"FileDrop",standIn:"Bitmap",text:["UnicodeText","Text"]},linux:{images:[{type:"image/png",ext:"png",format:"png"},{type:"image/jpeg",ext:"jpg",format:"jpeg"},{type:"image/webp",ext:"webp",format:"webp"},{type:"image/heic",ext:"heic",format:"heic"},{type:"image/avif",ext:"avif",format:"avif"},{type:"image/gif",ext:"gif",format:"gif"},{type:"image/tiff",ext:"tiff",format:"tiff"}],file:"text/uri-list",standIn:null,text:["text/plain;charset=utf-8","UTF8_STRING","text/plain","STRING","TEXT"]}};function _(t,e){let c=t.includes(e.file);return e.images.find(i=>t.includes(i.type)&&!(c&&i.type===e.standIn))}function T(t,e){return e.text.some(c=>t.includes(c))}function bt(t=process.platform,e=process.env){return e.SSH_CONNECTION||e.SSH_TTY?!1:t==="linux"?j(e).length>0:t==="darwin"||t==="win32"}var M=Object.fromEntries(S.darwin.images.map(t=>[t.format,t.type]));function Y(t){return M[t]??"public.data"}var I={changeCount:-1,image:null,text:!1};function y(t,e){return v("sha256").update(t.join(`
4
4
  `)).update("\0").update(e).digest().readUIntBE(0,6)}function x(t){return v("sha256").update(t).digest("hex")}async function L(t,e){let{default:c}=await import("sharp"),i=m(e,"Copied image.png");return await c(t).keepIccProfile().png().toFile(`${i}.part`),await A(`${i}.part`,i),await w(t,{force:!0}),i}var X=`ObjC.import('AppKit')
5
5
  const pb = $.NSPasteboard.generalPasteboard
6
6
  JSON.stringify({ types: ObjC.deepUnwrap(pb.types) || [], count: Number(pb.changeCount) })`,K=`function run(argv) {
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{homedir as m}from"node:os";import{posix as f,win32 as u}from"node:path";var d=/[\u0000-\u001f\u007f-\u009f‪-‮⁦-⁩]/g;function o(r){return r.replace(d,"?")}function s(r,n,e){let t=e.relative(n,r);if(t==="")return"";if(!(t===".."||t.startsWith(`..${e.sep}`)||e.isAbsolute(t)))return t}function w(r,n={}){return o(a(r,n))}function a(r,n){let e=(n.platform??process.platform)==="win32"?u:f;if(n.cwd!==void 0){let i=s(r,n.cwd,e);if(i!==void 0)return i===""?".":i}let t=s(r,n.home??m(),e);return t!==void 0?t===""?"~":`~${e.sep}${t}`:r}function h(r,n=process.platform){return o((n==="win32"?u:f).basename(r))}export{o as a,w as b,h as c};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{b as g,c as R,d as T,e as E,f as w,g as d}from"./chunk-QVACE4IE.js";import{H as y}from"./chunk-WIPP5TWQ.js";var L={set:"tailwind",start:50,end:950,count:11},D=["tailwind","even","radix"],I=[0,50,100,150,200,250,300,350,400,450],$=[550,600,650,700,750,800,850,900,950,1e3],N=Array.from({length:19},(e,t)=>t+3),P=[20,50,100,150,200,260,330,420,500,560,750,920],_=8;function W({set:e,start:t,end:n,count:r}){if(!D.includes(e))return`The set must be tailwind, even or radix; got ${e}.`;if(e!=="radix"){if(!I.includes(t))return t%50===0?`The start must be from 0 to 450, so the colour (500) stays in the scale; got ${t}.`:`The start must be a multiple of 50; got ${t}.`;if(!$.includes(n))return n%50===0?`The end must be from 550 to 1000, so the colour (500) stays in the scale; got ${n}.`:`The end must be a multiple of 50; got ${n}.`;if(e==="even"&&!N.includes(r))return`An even set has 3 to 21 steps; got ${r}.`}}function x(e){let{set:t,start:n,end:r,count:a}=e;if(t==="radix")return P.map((o,u)=>({step:u+1,at:o}));if(t==="tailwind"){let o=new Set([n,r,500]);for(let u=Math.ceil((n+1)/100)*100;u<r;u+=100)o.add(u);return[...o].sort((u,s)=>u-s).map(u=>({step:u,at:u}))}let i=a-1,l=Math.round(i*(500-n)/(r-n)),f=Math.max(1,Math.min(i-1,l)),h=i-f,c=[];for(let o=0;o<=f;o++)c.push(n+(500-n)*o/f);for(let o=1;o<=h;o++)c.push(500+(r-500)*o/h);for(let o of[10,5,1]){let u=c.map(s=>Math.round(s/o)*o);if(new Set(u).size===u.length)return c.map((s,p)=>({step:u[p],at:s}))}return c.map(o=>({step:o,at:o}))}function F(e){return x(e).map(t=>t.step)}var Y=F(L);function q(e){return e.set==="radix"?_:x(e).findIndex(t=>t.at===500)}var H=[[50,1],[100,.86],[200,.68],[300,.46],[400,.22],[500,0]],U=[[500,0],[600,.2],[700,.4],[800,.6],[900,.8],[950,1]];function M(e,t){for(let n=1;n<e.length;n++){let[r,a]=e[n-1],[i,l]=e[n];if(t<=i)return a+(l-a)*(t-r)/(i-r)}return e[e.length-1][1]}var j=.995,k=.35,B=5e-4;function J(e,t=L){let n=W(t);if(n)throw y(n,"Try: Tailwind, from 50 to 950.");let{L:r,C:a,h:i}=w(R(e)),l=a<B,f=Math.max(.975,r),h=r<.16?.42*r:Math.max(.16,.42*r),c=x(t),o=c[c.length-1]?.at===1e3;return c.map(({step:u,at:s})=>{if(s===500)return{step:u,at:s,rgb:{...e},hex:g(e),reference:!0};let p,b;if(s>=50&&s<500){let m=M(H,s);p=r+(f-r)*m,b=a*(1-.88*m)}else if(s<50){let m=(50-s)/50;p=f+(Math.max(j,f)-f)*m,b=a*.12*(1-m)}else if(s<=950||o){let m=o?(s-500)/500:M(U,s);p=r-(r-h)*m,b=a*(1-.45*m)}else{let m=(s-950)/50;p=h*(1-k*m),b=a*.55*(1-.4*m)}for(l&&(b=0);b>0&&!E(d({L:p,C:b,h:i}));)b-=.002;let A=T(d({L:p,C:Math.max(0,b),h:i}));return{step:u,at:s,rgb:A,hex:g(A),reference:!1}})}var S=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},C=({r:e,g:t,b:n})=>.2126*S(e)+.7152*S(t)+.0722*S(n);function O(e,t){let[n,r]=[C(e),C(t)].sort((a,i)=>i-a);return(n+.05)/(r+.05)}function V(e){return e>=7?"AAA":e>=4.5?"AA":e>=3?"large":"fails"}var G={r:255,g:255,b:255},X={r:0,g:0,b:0},v=e=>Math.floor(e*10)/10;function Z(e){return{white:v(O(e,G)),black:v(O(e,X))}}export{L as a,D as b,I as c,$ as d,N as e,x as f,F as g,q as h,J as i,O as j,V as k,Z as l};
3
+ import{b as g,c as R,d as T,e as E,f as w,g as d}from"./chunk-QVACE4IE.js";import{E as y}from"./chunk-CVNYUROW.js";var L={set:"tailwind",start:50,end:950,count:11},D=["tailwind","even","radix"],I=[0,50,100,150,200,250,300,350,400,450],$=[550,600,650,700,750,800,850,900,950,1e3],N=Array.from({length:19},(e,t)=>t+3),P=[20,50,100,150,200,260,330,420,500,560,750,920],_=8;function W({set:e,start:t,end:n,count:r}){if(!D.includes(e))return`The set must be tailwind, even or radix; got ${e}.`;if(e!=="radix"){if(!I.includes(t))return t%50===0?`The start must be from 0 to 450, so the colour (500) stays in the scale; got ${t}.`:`The start must be a multiple of 50; got ${t}.`;if(!$.includes(n))return n%50===0?`The end must be from 550 to 1000, so the colour (500) stays in the scale; got ${n}.`:`The end must be a multiple of 50; got ${n}.`;if(e==="even"&&!N.includes(r))return`An even set has 3 to 21 steps; got ${r}.`}}function x(e){let{set:t,start:n,end:r,count:a}=e;if(t==="radix")return P.map((o,u)=>({step:u+1,at:o}));if(t==="tailwind"){let o=new Set([n,r,500]);for(let u=Math.ceil((n+1)/100)*100;u<r;u+=100)o.add(u);return[...o].sort((u,s)=>u-s).map(u=>({step:u,at:u}))}let i=a-1,l=Math.round(i*(500-n)/(r-n)),f=Math.max(1,Math.min(i-1,l)),h=i-f,c=[];for(let o=0;o<=f;o++)c.push(n+(500-n)*o/f);for(let o=1;o<=h;o++)c.push(500+(r-500)*o/h);for(let o of[10,5,1]){let u=c.map(s=>Math.round(s/o)*o);if(new Set(u).size===u.length)return c.map((s,p)=>({step:u[p],at:s}))}return c.map(o=>({step:o,at:o}))}function F(e){return x(e).map(t=>t.step)}var Y=F(L);function q(e){return e.set==="radix"?_:x(e).findIndex(t=>t.at===500)}var H=[[50,1],[100,.86],[200,.68],[300,.46],[400,.22],[500,0]],U=[[500,0],[600,.2],[700,.4],[800,.6],[900,.8],[950,1]];function M(e,t){for(let n=1;n<e.length;n++){let[r,a]=e[n-1],[i,l]=e[n];if(t<=i)return a+(l-a)*(t-r)/(i-r)}return e[e.length-1][1]}var j=.995,k=.35,B=5e-4;function J(e,t=L){let n=W(t);if(n)throw y(n,"Try: Tailwind, from 50 to 950.");let{L:r,C:a,h:i}=w(R(e)),l=a<B,f=Math.max(.975,r),h=r<.16?.42*r:Math.max(.16,.42*r),c=x(t),o=c[c.length-1]?.at===1e3;return c.map(({step:u,at:s})=>{if(s===500)return{step:u,at:s,rgb:{...e},hex:g(e),reference:!0};let p,b;if(s>=50&&s<500){let m=M(H,s);p=r+(f-r)*m,b=a*(1-.88*m)}else if(s<50){let m=(50-s)/50;p=f+(Math.max(j,f)-f)*m,b=a*.12*(1-m)}else if(s<=950||o){let m=o?(s-500)/500:M(U,s);p=r-(r-h)*m,b=a*(1-.45*m)}else{let m=(s-950)/50;p=h*(1-k*m),b=a*.55*(1-.4*m)}for(l&&(b=0);b>0&&!E(d({L:p,C:b,h:i}));)b-=.002;let A=T(d({L:p,C:Math.max(0,b),h:i}));return{step:u,at:s,rgb:A,hex:g(A),reference:!1}})}var S=e=>{let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4},C=({r:e,g:t,b:n})=>.2126*S(e)+.7152*S(t)+.0722*S(n);function O(e,t){let[n,r]=[C(e),C(t)].sort((a,i)=>i-a);return(n+.05)/(r+.05)}function V(e){return e>=7?"AAA":e>=4.5?"AA":e>=3?"large":"fails"}var G={r:255,g:255,b:255},X={r:0,g:0,b:0},v=e=>Math.floor(e*10)/10;function Z(e){return{white:v(O(e,G)),black:v(O(e,X))}}export{L as a,D as b,I as c,$ as d,N as e,x as f,F as g,q as h,J as i,O as j,V as k,Z as l};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{b as h,c as A,g as o,m as y,n as I,p as v,q as O,r as P}from"./chunk-655UG277.js";import{a as x,b as u,d as S}from"./chunk-WZWK3PEZ.js";import{g as s,h as f,j as g,k as b,l as c,m as a}from"./chunk-DZOBIUV6.js";import{H as d}from"./chunk-WIPP5TWQ.js";var l=e=>e.length===1&&e[0]?.kind==="document"&&e[0].format==="pdf"?e[0]:void 0,k={id:"split",label:"Split",verb:"Splitting",hint:"into several files",appliesTo:e=>(l(e)?.pages??0)>1,unavailable:e=>l(e)===void 0?"one PDF at a time":"only one page",options(e){let t=l(e);return t?[{kind:"select",id:"mode",label:"How",default:"every-page",choices:[{value:"every-page",label:"Every page",hint:`${t.pages} files`},{value:"every-n",label:"Every N pages",hint:"ask how many"},{value:"points",label:"At points I choose",hint:"grid"}]}]:[]},plan(e,t){let n=l(e);if(!n)return[];let r=Array.isArray(t.cuts)?t.cuts:[],i=S(r,n.pages).length,C=c(f(n.path,i),o(t.destination),o(t.name));return[{op:"split",sources:[n],outputs:C,cuts:r}]}};function $(e){return Array.from({length:Math.max(0,e-1)},(t,n)=>n)}function B(e,t){if(!Number.isInteger(t)||t<1)throw d("Splitting every N pages needs N to be a whole number, at least 1.");let n=[];for(let r=t;r<e;r+=t)n.push(r-1);return n}var p=e=>e.length===1&&e[0]?.kind==="document"&&e[0].format==="pdf"?e[0]:void 0;function D(e,t){return Array.isArray(t.pages)?u(t.pages):typeof t.pages=="string"?u(x(t.pages,e.pages)):[]}var w=e=>({kind:"text",id:"pages",label:"Pages",placeholder:`1-${e.pages}`}),T={id:"extract",label:"Extract",verb:"Extracting",hint:"keep only some pages",appliesTo:e=>p(e)!==void 0,unavailable:()=>"one PDF at a time",options:e=>{let t=p(e);return t?[w(t),{kind:"select",id:"separate",label:"Output",default:"one",choices:[{value:"one",label:"One file",hint:"all selected pages together"},{value:"many",label:"Separate files",hint:"one per page"}]}]:[]},plan(e,t){let n=p(e);if(!n)return[];let r=D(n,t),i=t.separate==="many";return[{op:"extract",sources:[n],outputs:c(g(n.path,r,i),o(t.destination),o(t.name)),pages:r,separate:i}]}},j={id:"delete",label:"Delete",verb:"Deleting",hint:"drop some pages",appliesTo:e=>p(e)!==void 0,unavailable:()=>"one PDF at a time",options:e=>{let t=p(e);return t?[w(t)]:[]},plan(e,t){let n=p(e);return n?[{op:"delete",sources:[n],outputs:[a(s(n.path,"trimmed"),o(t.destination),o(t.name))],pages:D(n,t)}]:[]}};var m=e=>e.filter(t=>t.kind==="document"&&t.format==="pdf"),J={id:"merge",label:"Merge",verb:"Merging",hint:"several files into one",appliesTo:e=>m(e).length>=2&&m(e).length===e.length,unavailable:e=>m(e).length!==e.length?"PDFs only":"needs 2+ files",options:()=>[],plan(e,t){let n=a(b(e.map(r=>r.path)),o(t.destination),o(t.name));return[{op:"merge",sources:e,outputs:[n]}]}};var N=e=>e.length===1&&e[0]?.kind==="document"&&e[0].format==="pdf"?e[0]:void 0,E={id:"rotate",label:"Rotate",verb:"Rotating",hint:"turn pages",appliesTo:e=>N(e)!==void 0,unavailable:()=>"one PDF at a time",options:()=>[{kind:"select",id:"degrees",label:"Turn",default:"90",choices:[{value:"90",label:"90\xB0 right",hint:"a quarter turn"},{value:"180",label:"180\xB0",hint:"upside down"},{value:"270",label:"90\xB0 left",hint:"a quarter turn back"}]}],plan(e,t){let n=N(e);if(!n)return[];let i=Number(t.degrees??90)/90%4||1;return[{op:"rotate",sources:[n],outputs:[a(s(n.path,"rotated"),o(t.destination),o(t.name))],turns:i}]}};var R=[I,y,J,k,T,j,E,v,O,P],se=R.filter(e=>!["convert","compress","trim","resize","crop"].includes(e.id)),F=[h,A];function ce(e,t=new Set){return[...R,...F.filter(n=>n.requires&&t.has(n.requires))].filter(n=>n.appliesTo(e))}function le(e,t){return e.appliesTo(t)?void 0:e.unavailable?.(t)}export{E as a,k as b,$ as c,B as d,R as e,se as f,ce as g,le as h};
3
+ import{b as h,c as A,g as o,m as y,n as I,p as v,q as O,r as P}from"./chunk-ZHNPBRCX.js";import{a as x,b as u,d as S}from"./chunk-DYIATUFE.js";import{g as s,h as f,j as g,k as b,l as c,m as a}from"./chunk-BIBDLXCG.js";import{E as d}from"./chunk-CVNYUROW.js";var l=e=>e.length===1&&e[0]?.kind==="document"&&e[0].format==="pdf"?e[0]:void 0,k={id:"split",label:"Split",verb:"Splitting",hint:"into several files",appliesTo:e=>(l(e)?.pages??0)>1,unavailable:e=>l(e)===void 0?"one PDF at a time":"only one page",options(e){let t=l(e);return t?[{kind:"select",id:"mode",label:"How",default:"every-page",choices:[{value:"every-page",label:"Every page",hint:`${t.pages} files`},{value:"every-n",label:"Every N pages",hint:"ask how many"},{value:"points",label:"At points I choose",hint:"grid"}]}]:[]},plan(e,t){let n=l(e);if(!n)return[];let r=Array.isArray(t.cuts)?t.cuts:[],i=S(r,n.pages).length,C=c(f(n.path,i),o(t.destination),o(t.name));return[{op:"split",sources:[n],outputs:C,cuts:r}]}};function $(e){return Array.from({length:Math.max(0,e-1)},(t,n)=>n)}function B(e,t){if(!Number.isInteger(t)||t<1)throw d("Splitting every N pages needs N to be a whole number, at least 1.");let n=[];for(let r=t;r<e;r+=t)n.push(r-1);return n}var p=e=>e.length===1&&e[0]?.kind==="document"&&e[0].format==="pdf"?e[0]:void 0;function D(e,t){return Array.isArray(t.pages)?u(t.pages):typeof t.pages=="string"?u(x(t.pages,e.pages)):[]}var w=e=>({kind:"text",id:"pages",label:"Pages",placeholder:`1-${e.pages}`}),T={id:"extract",label:"Extract",verb:"Extracting",hint:"keep only some pages",appliesTo:e=>p(e)!==void 0,unavailable:()=>"one PDF at a time",options:e=>{let t=p(e);return t?[w(t),{kind:"select",id:"separate",label:"Output",default:"one",choices:[{value:"one",label:"One file",hint:"all selected pages together"},{value:"many",label:"Separate files",hint:"one per page"}]}]:[]},plan(e,t){let n=p(e);if(!n)return[];let r=D(n,t),i=t.separate==="many";return[{op:"extract",sources:[n],outputs:c(g(n.path,r,i),o(t.destination),o(t.name)),pages:r,separate:i}]}},j={id:"delete",label:"Delete",verb:"Deleting",hint:"drop some pages",appliesTo:e=>p(e)!==void 0,unavailable:()=>"one PDF at a time",options:e=>{let t=p(e);return t?[w(t)]:[]},plan(e,t){let n=p(e);return n?[{op:"delete",sources:[n],outputs:[a(s(n.path,"trimmed"),o(t.destination),o(t.name))],pages:D(n,t)}]:[]}};var m=e=>e.filter(t=>t.kind==="document"&&t.format==="pdf"),J={id:"merge",label:"Merge",verb:"Merging",hint:"several files into one",appliesTo:e=>m(e).length>=2&&m(e).length===e.length,unavailable:e=>m(e).length!==e.length?"PDFs only":"needs 2+ files",options:()=>[],plan(e,t){let n=a(b(e.map(r=>r.path)),o(t.destination),o(t.name));return[{op:"merge",sources:e,outputs:[n]}]}};var N=e=>e.length===1&&e[0]?.kind==="document"&&e[0].format==="pdf"?e[0]:void 0,E={id:"rotate",label:"Rotate",verb:"Rotating",hint:"turn pages",appliesTo:e=>N(e)!==void 0,unavailable:()=>"one PDF at a time",options:()=>[{kind:"select",id:"degrees",label:"Turn",default:"90",choices:[{value:"90",label:"90\xB0 right",hint:"a quarter turn"},{value:"180",label:"180\xB0",hint:"upside down"},{value:"270",label:"90\xB0 left",hint:"a quarter turn back"}]}],plan(e,t){let n=N(e);if(!n)return[];let i=Number(t.degrees??90)/90%4||1;return[{op:"rotate",sources:[n],outputs:[a(s(n.path,"rotated"),o(t.destination),o(t.name))],turns:i}]}};var R=[I,y,J,k,T,j,E,v,O,P],se=R.filter(e=>!["convert","compress","trim","resize","crop"].includes(e.id)),F=[h,A];function ce(e,t=new Set){return[...R,...F.filter(n=>n.requires&&t.has(n.requires))].filter(n=>n.appliesTo(e))}function le(e,t){return e.appliesTo(t)?void 0:e.unavailable?.(t)}export{E as a,k as b,$ as c,B as d,R as e,se as f,ce as g,le as h};
@@ -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 a}from"./chunk-WZWK3PEZ.js";import{c as i}from"./chunk-XURW53YK.js";import{a as e}from"./chunk-H3DIRJFE.js";function s(t){let o=Object.keys(e);return[...t].sort((r,n)=>o.indexOf(r)-o.indexOf(n))}function f(t){let o=new Set;for(let r of a)if(r.reads.has(t.format))for(let n of r.writesFor?.(t)??r.writes)e[n].keepsOnly&&n!==t.format||o.add(n);return s([...o])}function F(t){return f(t).map(o=>({id:o,label:e[o].label,hint:e[o].hint,lossy:e[o].lossy}))}function d(){let t=new Set;for(let o of a)for(let r of o.reads)t.add(r);return s([...t])}function l(){let t=new Set;for(let o of a)for(let r of o.writes)t.add(r);return s([...t])}function p(t){return i.writes.has(t)}function I(){let t=new Set(d()),o=new Set(l());return s([...new Set([...t,...o])]).map(r=>({id:r,label:e[r].label,extensions:[...e[r].extensions],read:t.has(r),write:o.has(r),lossy:e[r].lossy}))}export{f as a,F as b,d as c,l as d,p as e,I as f};
3
+ import{f as a}from"./chunk-DYIATUFE.js";import{c as i}from"./chunk-K6ERQTUQ.js";import{a as e}from"./chunk-H3DIRJFE.js";function s(t){let o=Object.keys(e);return[...t].sort((r,n)=>o.indexOf(r)-o.indexOf(n))}function f(t){let o=new Set;for(let r of a)if(r.reads.has(t.format))for(let n of r.writesFor?.(t)??r.writes)e[n].keepsOnly&&n!==t.format||o.add(n);return s([...o])}function F(t){return f(t).map(o=>({id:o,label:e[o].label,hint:e[o].hint,lossy:e[o].lossy}))}function d(){let t=new Set;for(let o of a)for(let r of o.reads)t.add(r);return s([...t])}function l(){let t=new Set;for(let o of a)for(let r of o.writes)t.add(r);return s([...t])}function p(t){return i.writes.has(t)}function I(){let t=new Set(d()),o=new Set(l());return s([...new Set([...t,...o])]).map(r=>({id:r,label:e[r].label,extensions:[...e[r].extensions],read:t.has(r),write:o.has(r),lossy:e[r].lossy}))}export{f as a,F as b,d as c,l as d,p as e,I as f};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as Ht,c as kt}from"./chunk-IED6VBE6.js";import{j as It}from"./chunk-DYIATUFE.js";import{D as Ot,a as Tt,b as gt}from"./chunk-CVNYUROW.js";import{a as wt}from"./chunk-H3DIRJFE.js";import{c as et,e as $e}from"./chunk-TMUK2DD3.js";var it=et((Vs,Yt)=>{"use strict";var Xt="[^\\\\/]",$r="(?=.)",jt="[^/]",yt="(?:\\/|$)",Qt="(?:^|\\/)",Rt=`\\.{1,2}${yt}`,vr="(?!\\.)",Lr=`(?!${Qt}${Rt})`,wr=`(?!\\.{0,1}${yt})`,Tr=`(?!${Rt})`,Or="[^.\\/]",Hr=`${jt}*?`,kr="/",zt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:$r,QMARK:jt,END_ANCHOR:yt,DOTS_SLASH:Rt,NO_DOT:vr,NO_DOTS:Lr,NO_DOT_SLASH:wr,NO_DOTS_SLASH:Tr,QMARK_NO_DOT:Or,STAR:Hr,START_ANCHOR:Qt,SEP:kr},Ir={...zt,SLASH_LITERAL:"[\\\\/]",QMARK:Xt,STAR:`${Xt}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Pr={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Yt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Pr,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Ir:zt}}});var ut=et(q=>{"use strict";var{REGEX_BACKSLASH:Dr,REGEX_REMOVE_BACKSLASH:Nr,REGEX_SPECIAL_CHARS:Fr,REGEX_SPECIAL_CHARS_GLOBAL:Br}=it();q.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);q.hasRegexChars=t=>Fr.test(t);q.isRegexChar=t=>t.length===1&&q.hasRegexChars(t);q.escapeRegex=t=>t.replace(Br,"\\$1");q.toPosixSlashes=t=>t.replace(Dr,"/");q.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};q.removeBackslashes=t=>t.replace(Nr,r=>r==="\\"?"":r);q.escapeLast=(t,r,e)=>{let s=t.lastIndexOf(r,e);return s===-1?t:t[s-1]==="\\"?q.escapeLast(t,r,s-1):`${t.slice(0,s)}\\${t.slice(s)}`};q.removePrefix=(t,r={})=>{let e=t;return e.startsWith("./")&&(e=e.slice(2),r.prefix="./"),e};q.wrapOutput=(t,r={},e={})=>{let s=e.contains?"":"^",n=e.contains?"":"$",o=`${s}(?:${t})${n}`;return r.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};q.basename=(t,{windows:r}={})=>{let e=t.split(r?/[\\/]/:"/"),s=e[e.length-1];return s===""?e[e.length-2]:s}});var ne=et((tn,se)=>{"use strict";var Zt=ut(),{CHAR_ASTERISK:St,CHAR_AT:Mr,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:Gr,CHAR_DOT:_t,CHAR_EXCLAMATION_MARK:Et,CHAR_FORWARD_SLASH:re,CHAR_LEFT_CURLY_BRACE:bt,CHAR_LEFT_PARENTHESES:ft,CHAR_LEFT_SQUARE_BRACKET:Wr,CHAR_PLUS:qr,CHAR_QUESTION_MARK:Vt,CHAR_RIGHT_CURLY_BRACE:Ur,CHAR_RIGHT_PARENTHESES:Jt,CHAR_RIGHT_SQUARE_BRACKET:Kr}=it(),te=t=>t===re||t===rt,ee=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Xr=(t,r)=>{let e=r||{},s=t.length-1,n=e.parts===!0||e.tokens===!0||e.scanToEnd===!0,o=[],i=[],l=[],g=t,y=-1,S=0,R=0,h=!1,d=!1,A=!1,x=!1,L=!1,B=!1,E=!1,M=!1,j=!1,k=!1,T=0,v,_,C={value:"",depth:0,isGlob:!1},u=()=>y>=s,G=()=>g.charCodeAt(y+1),D=()=>(v=_,g.charCodeAt(++y));for(;y<s;){_=D();let $;if(_===rt){E=C.backslashes=!0,_=D(),_===bt&&(B=!0);continue}if(B===!0||_===bt){for(T++;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===bt){T++;continue}if(B!==!0&&_===_t&&(_=D())===_t){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(B!==!0&&_===Gr){if(h=C.isBrace=!0,A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Ur&&(T--,T===0)){B=!1,h=C.isBrace=!0,k=!0;break}}if(n===!0)continue;break}if(_===re){if(o.push(y),i.push(C),C={value:"",depth:0,isGlob:!1},k===!0)continue;if(v===_t&&y===S+1){S+=2;continue}R=y+1;continue}if(e.noext!==!0&&(_===qr||_===Mr||_===St||_===Vt||_===Et)===!0&&G()===ft){if(A=C.isGlob=!0,x=C.isExtglob=!0,k=!0,_===Et&&y===S&&(j=!0),n===!0){let U=0;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){U++;continue}if(_===Jt&&--U===0){k=!0;break}}continue}break}if(_===St){if(v===St&&(L=C.isGlobstar=!0),A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Vt){if(A=C.isGlob=!0,k=!0,n===!0)continue;break}if(_===Wr){for(;u()!==!0&&($=D());){if($===rt){E=C.backslashes=!0,D();continue}if($===Kr){d=C.isBracket=!0,A=C.isGlob=!0,k=!0;break}}if(n===!0)continue;break}if(e.nonegate!==!0&&_===Et&&y===S){M=C.negated=!0,S++;continue}if(e.noparen!==!0&&_===ft){if(A=C.isGlob=!0,n===!0){let W=1;for(;u()!==!0&&(_=D());){if(_===rt){E=C.backslashes=!0,D();continue}if(_===ft){W++;continue}if(_===Jt&&--W===0){k=!0;break}}continue}break}if(A===!0){if(k=!0,n===!0)continue;break}}e.noext===!0&&(x=!1,A=!1);let I=g,c="",a="";S>0&&(c=g.slice(0,S),g=g.slice(S),R-=S),I&&A===!0&&R>0?(I=g.slice(0,R),a=g.slice(R)):A===!0?(I="",a=g):I=g,I&&I!==""&&I!=="/"&&I!==g&&te(I.charCodeAt(I.length-1))&&(I=I.slice(0,-1)),e.unescape===!0&&(a&&(a=Zt.removeBackslashes(a)),I&&E===!0&&(I=Zt.removeBackslashes(I)));let X={prefix:c,input:t,start:S,base:I,glob:a,isBrace:h,isBracket:d,isGlob:A,isExtglob:x,isGlobstar:L,negated:M,negatedExtglob:j};if(e.tokens===!0&&(X.maxDepth=0,te(_)||i.push(C),X.tokens=i),e.parts===!0||e.tokens===!0){let $;for(let N=0;N<o.length;N++){let J=$!==void 0?$+1:S,ot=o[N],Y=t.slice(J,ot);e.tokens&&(N===0&&S!==0?(i[N].isPrefix=!0,i[N].value=c):i[N].value=Y,ee(i[N]),X.maxDepth+=i[N].depth),ot>=S&&(l.push(Y),$=ot)}let W=$!==void 0?$+1:S,U=t.slice(W);l.push(U),e.tokens&&$&&$+1<t.length&&(i[i.length-1].value=U,ee(i[i.length-1]),X.maxDepth+=i[i.length-1].depth),X.slashes=o,X.parts=l}return X};se.exports=Xr});var ae=et((en,ue)=>{"use strict";var at=it(),K=ut(),{MAX_LENGTH:ht,POSIX_REGEX_SOURCE:jr,REGEX_NON_SPECIAL_CHARS:Qr,REGEX_SPECIAL_CHARS_BACKREF:zr,REPLACEMENTS:oe}=at,Yr=(t,r)=>{if(typeof r.expandRange=="function")return r.expandRange(...t,r);t.sort();let e=`[${t.join("-")}]`;try{new RegExp(e)}catch{return t.map(n=>K.escapeRegex(n)).join("..")}return e},st=(t,r)=>`Missing ${t}: "${r}" - use "\\\\${r}" to match literal characters`,ie=t=>{let r=[],e=0,s=0,n=0,o="",i=!1;for(let l of t){if(i===!0){o+=l,i=!1;continue}if(l==="\\"){o+=l,i=!0;continue}if(l==='"'){n=n===1?0:1,o+=l;continue}if(n===0){if(l==="[")e++;else if(l==="]"&&e>0)e--;else if(e===0){if(l==="(")s++;else if(l===")"&&s>0)s--;else if(l==="|"&&s===0){r.push(o),o="";continue}}}o+=l}return r.push(o),r},Zr=t=>{let r=!1;for(let e of t){if(r===!0){r=!1;continue}if(e==="\\"){r=!0;continue}if(/[?*+@!()[\]{}]/.test(e))return!1}return!0},xt=t=>{let r=t.trim(),e=!0;for(;e===!0;)e=!1,/^@\([^\\()[\]{}|]+\)$/.test(r)&&(r=r.slice(2,-1),e=!0);if(Zr(r))return r.replace(/\\(.)/g,"$1")},Vr=t=>{let r=t.map(xt).filter(Boolean);for(let e=0;e<r.length;e++)for(let s=e+1;s<r.length;s++){let n=r[e],o=r[s],i=n[0];if(!(!i||n!==i.repeat(n.length)||o!==i.repeat(o.length))&&(n===o||n.startsWith(o)||o.startsWith(n)))return!0}return!1},mt=(t,r=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let e=0,s=0,n=0,o=!1;for(let i=1;i<t.length;i++){let l=t[i];if(o===!0){o=!1;continue}if(l==="\\"){o=!0;continue}if(l==='"'){n=n===1?0:1;continue}if(n!==1){if(l==="["){e++;continue}if(l==="]"&&e>0){e--;continue}if(!(e>0)){if(l==="("){s++;continue}if(l===")"&&(s--,s===0))return r===!0&&i!==t.length-1?void 0:{type:t[0],body:t.slice(2,i),end:i}}}}},Jr=t=>`${t.length===1?K.escapeRegex(t[0]):`[${t.map(e=>K.escapeRegex(e)).join("")}]`}*`,ts=t=>{let r=0,e=[];for(;r<t.length;){let s=mt(t.slice(r),!1);if(!s||s.type!=="*")return;let n=ie(s.body).map(i=>i.trim());if(n.length!==1)return;let o=xt(n[0]);if(!o||o.length!==1)return;e.push(o),r+=s.end+1}if(!(e.length<1))return e},es=t=>{let r=0,e=t.trim(),s=mt(e);for(;s;)r++,e=s.body.trim(),s=mt(e);return r},rs=(t,r)=>{if(r.maxExtglobRecursion===!1)return{risky:!1};let e=typeof r.maxExtglobRecursion=="number"?r.maxExtglobRecursion:at.DEFAULT_MAX_EXTGLOB_RECURSION,s=ie(t).map(l=>l.trim());if(s.length>1&&(s.some(l=>l==="")||s.some(l=>/^[*?]+$/.test(l))||Vr(s)))return{risky:!0};let n=[],o=!1,i=!0;for(let l of s){let g=ts(l);if(g){o=!0,n.push(...g);continue}let y=xt(l);if(y&&y.length===1){n.push(y);continue}if(i=!1,es(l)>e)return{risky:!0}}return o?i?{risky:!0,safeOutput:Jr([...new Set(n)])}:{risky:!0}:{risky:!1}},Ct=(t,r)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=oe[t]||t;let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);let o={type:"bos",value:"",output:e.prepend||""},i=[o],l=e.capture?"":"?:",g=at.globChars(e.windows),y=at.extglobChars(g),{DOT_LITERAL:S,PLUS_LITERAL:R,SLASH_LITERAL:h,ONE_CHAR:d,DOTS_SLASH:A,NO_DOT:x,NO_DOT_SLASH:L,NO_DOTS_SLASH:B,QMARK:E,QMARK_NO_DOT:M,STAR:j,START_ANCHOR:k}=g,T=f=>`(${l}(?:(?!${k}${f.dot?A:S}).)*?)`,v=e.dot?"":x,_=e.dot?E:M,C=e.bash===!0?T(e):j;e.capture&&(C=`(${C})`),typeof e.noext=="boolean"&&(e.noextglob=e.noext);let u={input:t,index:-1,start:0,dot:e.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=K.removePrefix(t,u),n=t.length;let G=[],D=[],I=[],c=o,a,X=()=>u.index===n-1,$=u.peek=(f=1)=>t[u.index+f],W=u.advance=()=>t[++u.index]||"",U=()=>t.slice(u.index+1),N=(f="",H=0)=>{u.consumed+=f,u.index+=H},J=f=>{u.output+=f.output!=null?f.output:f.value,N(f.value)},ot=()=>{let f=1;for(;$()==="!"&&($(2)!=="("||$(3)==="?");)W(),u.start++,f++;return f%2===0?!1:(u.negated=!0,u.start++,!0)},Y=f=>{u[f]++,I.push(f)},z=f=>{u[f]--,I.pop()},b=f=>{if(c.type==="globstar"){let H=u.braces>0&&(f.type==="comma"||f.type==="brace"),p=f.extglob===!0||G.length&&(f.type==="pipe"||f.type==="paren");f.type!=="slash"&&f.type!=="paren"&&!H&&!p&&(u.output=u.output.slice(0,-c.output.length),c.type="star",c.value="*",c.output=C,u.output+=c.output)}if(G.length&&f.type!=="paren"&&(G[G.length-1].inner+=f.value),(f.value||f.output)&&J(f),c&&c.type==="text"&&f.type==="text"){c.output=(c.output||c.value)+f.value,c.value+=f.value;return}f.prev=c,i.push(f),c=f},lt=(f,H)=>{let p={...y[H],conditions:1,inner:""};p.prev=c,p.parens=u.parens,p.output=u.output,p.startIndex=u.index,p.tokensIndex=i.length;let m=(e.capture?"(":"")+p.open;Y("parens"),b({type:f,value:H,output:u.output?"":d}),b({type:"paren",extglob:!0,value:W(),output:m}),G.push(p)},Ce=f=>{let H=t.slice(f.startIndex,u.index+1),p=t.slice(f.startIndex+2,u.index),m=rs(p,e);if((f.type==="plus"||f.type==="star")&&m.risky){let w=m.safeOutput?(f.output?"":d)+(e.capture?`(${m.safeOutput})`:m.safeOutput):void 0,Q=i[f.tokensIndex];Q.type="text",Q.value=H,Q.output=w||K.escapeRegex(H);for(let Z=f.tokensIndex+1;Z<i.length;Z++)i[Z].value="",i[Z].output="",delete i[Z].suffix;u.output=f.output+Q.output,u.backtrack=!0,b({type:"paren",extglob:!0,value:a,output:""}),z("parens");return}let O=f.close+(e.capture?")":""),F;if(f.type==="negate"){let w=C;if(f.inner&&f.inner.length>1&&f.inner.includes("/")&&(w=T(e)),(w!==C||X()||/^\)+$/.test(U()))&&(O=f.close=`)$))${w}`),f.inner.includes("*")&&(F=U())&&/^\.[^\\/.]+$/.test(F)){let Q=Ct(F,{...r,fastpaths:!1}).output;O=f.close=`)${Q})${w})`}f.prev.type==="bos"&&(u.negatedExtglob=!0)}b({type:"paren",extglob:!0,value:a,output:O}),z("parens")};if(e.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let f=!1,H=t.replace(zr,(p,m,O,F,w,Q)=>F==="\\"?(f=!0,p):F==="?"?m?m+F+(w?E.repeat(w.length):""):Q===0?_+(w?E.repeat(w.length):""):E.repeat(O.length):F==="."?S.repeat(O.length):F==="*"?m?m+F+(w?C:""):C:m?p:`\\${p}`);return f===!0&&(e.unescape===!0?H=H.replace(/\\/g,""):H=H.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),H===t&&e.contains===!0?(u.output=t,u):(u.output=K.wrapOutput(H,u,r),u)}for(;!X();){if(a=W(),a==="\0")continue;if(a==="\\"){let p=$();if(p==="/"&&e.bash!==!0||p==="."||p===";")continue;if(!p){a+="\\",b({type:"text",value:a});continue}let m=/^\\+/.exec(U()),O=0;if(m&&m[0].length>2&&(O=m[0].length,u.index+=O,O%2!==0&&(a+="\\")),e.unescape===!0?a=W():a+=W(),u.brackets===0){b({type:"text",value:a});continue}}if(u.brackets>0&&(a!=="]"||c.value==="["||c.value==="[^")){if(e.posix!==!1&&a===":"){let p=c.value.slice(1);if(p.includes("[")&&(c.posix=!0,p.includes(":"))){let m=c.value.lastIndexOf("["),O=c.value.slice(0,m),F=c.value.slice(m+2),w=jr[F];if(w){c.value=O+w,u.backtrack=!0,W(),!o.output&&i.indexOf(c)===1&&(o.output=d);continue}}}(a==="["&&$()!==":"||a==="-"&&$()==="]")&&(a=`\\${a}`),a==="]"&&(c.value==="["||c.value==="[^")&&(a=`\\${a}`),e.posix===!0&&a==="!"&&c.value==="["&&(a="^"),c.value+=a,J({value:a});continue}if(u.quotes===1&&a!=='"'){a=K.escapeRegex(a),c.value+=a,J({value:a});continue}if(a==='"'){u.quotes=u.quotes===1?0:1,e.keepQuotes===!0&&b({type:"text",value:a});continue}if(a==="("){Y("parens"),b({type:"paren",value:a});continue}if(a===")"){if(u.parens===0&&e.strictBrackets===!0)throw new SyntaxError(st("opening","("));let p=G[G.length-1];if(p&&u.parens===p.parens+1){Ce(G.pop());continue}b({type:"paren",value:a,output:u.parens?")":"\\)"}),z("parens");continue}if(a==="["){if(e.nobracket===!0||!U().includes("]")){if(e.nobracket!==!0&&e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));a=`\\${a}`}else Y("brackets");b({type:"bracket",value:a});continue}if(a==="]"){if(e.nobracket===!0||c&&c.type==="bracket"&&c.value.length===1){b({type:"text",value:a,output:`\\${a}`});continue}if(u.brackets===0){if(e.strictBrackets===!0)throw new SyntaxError(st("opening","["));b({type:"text",value:a,output:`\\${a}`});continue}z("brackets");let p=c.value.slice(1);if(c.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(a=`/${a}`),c.value+=a,J({value:a}),e.literalBrackets===!1||K.hasRegexChars(p))continue;let m=K.escapeRegex(c.value);if(u.output=u.output.slice(0,-c.value.length),e.literalBrackets===!0){u.output+=m,c.value=m;continue}c.value=`(${l}${m}|${c.value})`,u.output+=c.value;continue}if(a==="{"&&e.nobrace!==!0){Y("braces");let p={type:"brace",value:a,output:"(",outputIndex:u.output.length,tokensIndex:u.tokens.length};D.push(p),b(p);continue}if(a==="}"){let p=D[D.length-1];if(e.nobrace===!0||!p){b({type:"text",value:a,output:a});continue}let m=")";if(p.dots===!0){let O=i.slice(),F=[];for(let w=O.length-1;w>=0&&(i.pop(),O[w].type!=="brace");w--)O[w].type!=="dots"&&F.unshift(O[w].value);m=Yr(F,e),u.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){let O=u.output.slice(0,p.outputIndex),F=u.tokens.slice(p.tokensIndex);p.value=p.output="\\{",a=m="\\}",u.output=O;for(let w of F)u.output+=w.output||w.value}b({type:"brace",value:a,output:m}),z("braces"),D.pop();continue}if(a==="|"){G.length>0&&G[G.length-1].conditions++,b({type:"text",value:a});continue}if(a===","){let p=a,m=D[D.length-1];m&&I[I.length-1]==="braces"&&(m.comma=!0,p="|"),b({type:"comma",value:a,output:p});continue}if(a==="/"){if(c.type==="dot"&&u.index===u.start+1){u.start=u.index+1,u.consumed="",u.output="",i.pop(),c=o;continue}b({type:"slash",value:a,output:h});continue}if(a==="."){if(u.braces>0&&c.type==="dot"){c.value==="."&&(c.output=S);let p=D[D.length-1];c.type="dots",c.output+=a,c.value+=a,p.dots=!0;continue}if(u.braces+u.parens===0&&c.type!=="bos"&&c.type!=="slash"){b({type:"text",value:a,output:S});continue}b({type:"dot",value:a,output:S});continue}if(a==="?"){if(!(c&&c.value==="(")&&e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("qmark",a);continue}if(c&&c.type==="paren"){let m=$(),O=a;(c.value==="("&&!/[!=<:]/.test(m)||m==="<"&&!/<([!=]|\w+>)/.test(U()))&&(O=`\\${a}`),b({type:"text",value:a,output:O});continue}if(e.dot!==!0&&(c.type==="slash"||c.type==="bos")){b({type:"qmark",value:a,output:M});continue}b({type:"qmark",value:a,output:E});continue}if(a==="!"){if(e.noextglob!==!0&&$()==="("&&($(2)!=="?"||!/[!=<:]/.test($(3)))){lt("negate",a);continue}if(e.nonegate!==!0&&u.index===0){ot();continue}}if(a==="+"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){lt("plus",a);continue}if(c&&c.value==="("||e.regex===!1){b({type:"plus",value:a,output:R});continue}if(c&&(c.type==="bracket"||c.type==="paren"||c.type==="brace")||u.parens>0){b({type:"plus",value:a});continue}b({type:"plus",value:R});continue}if(a==="@"){if(e.noextglob!==!0&&$()==="("&&$(2)!=="?"){b({type:"at",extglob:!0,value:a,output:""});continue}b({type:"text",value:a});continue}if(a!=="*"){(a==="$"||a==="^")&&(a=`\\${a}`);let p=Qr.exec(U());p&&(a+=p[0],u.index+=p[0].length),b({type:"text",value:a});continue}if(c&&(c.type==="globstar"||c.star===!0)){c.type="star",c.star=!0,c.value+=a,c.output=C,u.backtrack=!0,u.globstar=!0,N(a);continue}let f=U();if(e.noextglob!==!0&&/^\([^?]/.test(f)){lt("star",a);continue}if(c.type==="star"){if(e.noglobstar===!0){N(a);continue}let p=c.prev,m=p.prev,O=p.type==="slash"||p.type==="bos",F=m&&(m.type==="star"||m.type==="globstar");if(e.bash===!0&&(!O||f[0]&&f[0]!=="/")){b({type:"star",value:a,output:""});continue}let w=u.braces>0&&(p.type==="comma"||p.type==="brace"),Q=G.length&&(p.type==="pipe"||p.type==="paren");if(!O&&p.type!=="paren"&&!w&&!Q){b({type:"star",value:a,output:""});continue}for(;f.slice(0,3)==="/**";){let tt=t[u.index+4];if(tt&&tt!=="/")break;f=f.slice(3),N("/**",3)}let Z=X()||u.parens>0&&f===")".repeat(u.parens)&&!G.some(tt=>tt.type==="negate");if(p.type==="bos"&&X()){c.type="globstar",c.value+=a,c.output=T(e),u.output=c.output,u.globstar=!0,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!F&&Z){u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=T(e)+(e.strictSlashes?")":"|$)"),c.value+=a,u.globstar=!0,u.output+=p.output+c.output,N(a);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&f[0]==="/"){let tt=f[1]!==void 0?"|$":"";u.output=u.output.slice(0,-(p.output+c.output).length),p.output=`(?:${p.output}`,c.type="globstar",c.output=`${T(e)}${h}|${h}${tt})`,c.value+=a,u.output+=p.output+c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&f[0]==="/"){c.type="globstar",c.value+=a,c.output=`(?:^|${h}|${T(e)}${h})`,u.output=c.output,u.globstar=!0,N(a+W()),b({type:"slash",value:"/",output:""});continue}u.output=u.output.slice(0,-c.output.length),c.type="globstar",c.output=T(e),c.value+=a,u.output+=c.output,u.globstar=!0,N(a);continue}let H={type:"star",value:a,output:C};if(e.bash===!0){H.output=".*?",(c.type==="bos"||c.type==="slash")&&(H.output=v+H.output),b(H);continue}if(c&&(c.type==="bracket"||c.type==="paren")&&e.regex===!0){H.output=a,b(H);continue}(u.index===u.start||c.type==="slash"||c.type==="dot")&&(c.type==="dot"?(u.output+=L,c.output+=L):e.dot===!0?(u.output+=B,c.output+=B):(u.output+=v,c.output+=v),$()!=="*"&&(u.output+=d,c.output+=d)),b(H)}for(;u.brackets>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","]"));u.output=K.escapeLast(u.output,"["),z("brackets")}for(;u.parens>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing",")"));u.output=K.escapeLast(u.output,"("),z("parens")}for(;u.braces>0;){if(e.strictBrackets===!0)throw new SyntaxError(st("closing","}"));u.output=K.escapeLast(u.output,"{"),z("braces")}if(e.strictSlashes!==!0&&(c.type==="star"||c.type==="bracket")&&b({type:"maybe_slash",value:"",output:`${h}?`}),u.backtrack===!0){u.output="";for(let f of u.tokens)u.output+=f.output!=null?f.output:f.value,f.suffix&&(u.output+=f.suffix)}return u};Ct.fastpaths=(t,r)=>{let e={...r},s=typeof e.maxLength=="number"?Math.min(ht,e.maxLength):ht,n=t.length;if(n>s)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${s}`);t=oe[t]||t;let{DOT_LITERAL:o,SLASH_LITERAL:i,ONE_CHAR:l,DOTS_SLASH:g,NO_DOT:y,NO_DOTS:S,NO_DOTS_SLASH:R,STAR:h,START_ANCHOR:d}=at.globChars(e.windows),A=e.dot?S:y,x=e.dot?R:y,L=e.capture?"":"?:",B={negated:!1,prefix:""},E=e.bash===!0?".*?":h;e.capture&&(E=`(${E})`);let M=v=>v.noglobstar===!0?E:`(${L}(?:(?!${d}${v.dot?g:o}).)*?)`,j=v=>{switch(v){case"*":return`${A}${l}${E}`;case".*":return`${o}${l}${E}`;case"*.*":return`${A}${E}${o}${l}${E}`;case"*/*":return`${A}${E}${i}${l}${x}${E}`;case"**":return A+M(e);case"**/*":return`(?:${A}${M(e)}${i})?${x}${l}${E}`;case"**/*.*":return`(?:${A}${M(e)}${i})?${x}${E}${o}${l}${E}`;case"**/.*":return`(?:${A}${M(e)}${i})?${o}${l}${E}`;default:{let _=/^(.*?)\.(\w+)$/.exec(v);if(!_)return;let C=j(_[1]);return C?C+o+_[2]:void 0}}},k=K.removePrefix(t,B),T=j(k);return T&&e.strictSlashes!==!0&&(T+=`${i}?`),T};ue.exports=Ct});var pe=et((rn,le)=>{"use strict";var ss=ne(),$t=ae(),ce=ut(),ns=it(),os=t=>t&&typeof t=="object"&&!Array.isArray(t),P=(t,r,e=!1)=>{if(Array.isArray(t)){let S=t.map(h=>P(h,r,e));return h=>{for(let d of S){let A=d(h);if(A)return A}return!1}}let s=os(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!s)throw new TypeError("Expected pattern to be a non-empty string");let n=r||{},o=n.windows,i=s?P.compileRe(t,r):P.makeRe(t,r,!1,!0),l=i.state;delete i.state;let g=()=>!1;if(n.ignore){let S={...r,ignore:null,onMatch:null,onResult:null};g=P(n.ignore,S,e)}let y=(S,R=!1)=>{let{isMatch:h,match:d,output:A}=P.test(S,i,r,{glob:t,posix:o}),x={glob:t,state:l,regex:i,posix:o,input:S,output:A,match:d,isMatch:h};return typeof n.onResult=="function"&&n.onResult(x),h===!1?(x.isMatch=!1,R?x:!1):g(S)?(typeof n.onIgnore=="function"&&n.onIgnore(x),x.isMatch=!1,R?x:!1):(typeof n.onMatch=="function"&&n.onMatch(x),R?x:!0)};return e&&(y.state=l),y};P.test=(t,r,e,{glob:s,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=e||{},i=o.format||(n?ce.toPosixSlashes:null),l=t===s,g=l&&i?i(t):t;return l===!1&&(g=i?i(t):t,l=g===s),(l===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?l=P.matchBase(t,r,e,n):l=r.exec(g)),{isMatch:!!l,match:l,output:g}};P.matchBase=(t,r,e,s=e&&e.windows)=>(r instanceof RegExp?r:P.makeRe(r,e)).test(ce.basename(t,{windows:s}));P.isMatch=(t,r,e)=>P(r,e)(t);P.parse=(t,r)=>Array.isArray(t)?t.map(e=>P.parse(e,r)):$t(t,{...r,fastpaths:!1});P.scan=(t,r)=>ss(t,r);P.compileRe=(t,r,e=!1,s=!1)=>{if(e===!0)return t.output;let n=r||{},o=n.contains?"":"^",i=n.contains?"":"$",l=`${o}(?:${t.output})${i}`;t&&t.negated===!0&&(l=`^(?!${l}).*$`);let g=P.toRegex(l,r);return s===!0&&(g.state=t),g};P.makeRe=(t,r={},e=!1,s=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return r.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(n.output=$t.fastpaths(t,r)),n.output||(n=$t(t,r)),P.compileRe(n,r,e,s)};P.toRegex=(t,r)=>{try{let e=r||{};return new RegExp(t,e.flags||(e.nocase?"i":""))}catch(e){if(r&&r.debug===!0)throw e;return/$^/}};P.constants=ns;le.exports=P});var de=et((sn,ge)=>{"use strict";var fe=pe(),is=ut();function he(t,r,e=!1){return r&&(r.windows===null||r.windows===void 0)&&(r={...r,windows:is.isWindows()}),fe(t,r,e)}Object.assign(he,fe);ge.exports=he});import{existsSync as Ns}from"node:fs";import{stat as Fs}from"node:fs/promises";import{resolve as me}from"node:path";import{readdir as us,readdirSync as as,realpath as cs,realpathSync as ls,stat as ps,statSync as fs}from"fs";import{isAbsolute as hs,posix as V,resolve as gs}from"path";import{fileURLToPath as ds}from"url";import{createRequire as ve}from"module";import{basename as Le,dirname as At,normalize as we,relative as Te,resolve as Oe,sep as Nt}from"path";import*as He from"fs";var Pt=ve(import.meta.url);function ke(t){let r=we(t);return r.length>1&&r[r.length-1]===Nt&&(r=r.substring(0,r.length-1)),r}var Ie=/[\\/]/g;function Ft(t,r){return t.replace(Ie,r)}var Pe=/^[a-z]:[\\/]$/i;function De(t){return t==="/"||Pe.test(t)}function dt(t,r){let{resolvePaths:e,normalizePath:s,pathSeparator:n}=r,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(e&&(t=Oe(t)),(s||o)&&(t=ke(t)),t===".")return"";let i=t[t.length-1]!==n;return Ft(i?t+n:t,n)}function Bt(t,r){return r+t}function Ne(t,r){return function(e,s){return s.startsWith(t)?s.slice(t.length)+e:Ft(Te(t,s),r.pathSeparator)+r.pathSeparator+e}}function Fe(t){return t}function Be(t,r,e){return r+t+e}function Me(t,r){let{relativePaths:e,includeBasePath:s}=r;return e&&t?Ne(t,r):s?Bt:Fe}function Ge(t){return function(r,e){e.push(r.substring(t.length)||".")}}function We(t){return function(r,e,s){let n=r.substring(t.length)||".";s.every(o=>o(n,!0))&&e.push(n)}}var qe=(t,r)=>{r.push(t||".")},Ue=(t,r,e)=>{let s=t||".";e.every(n=>n(s,!0))&&r.push(s)},Ke=()=>{};function Xe(t,r){let{includeDirs:e,filters:s,relativePaths:n}=r;return e?n?s&&s.length?We(t):Ge(t):s&&s.length?Ue:qe:Ke}var je=(t,r,e,s)=>{s.every(n=>n(t,!1))&&e.files++},Qe=(t,r,e,s)=>{s.every(n=>n(t,!1))&&r.push(t)},ze=(t,r,e,s)=>{e.files++},Ye=(t,r)=>{r.push(t)},Ze=()=>{};function Ve(t){let{excludeFiles:r,filters:e,onlyCounts:s}=t;return r?Ze:e&&e.length?s?je:Qe:s?ze:Ye}var Je=t=>t,tr=()=>[""].slice(0,0);function er(t){return t.group?tr:Je}var rr=(t,r,e)=>{t.push({directory:r,files:e,dir:r})},sr=()=>{};function nr(t){return t.group?rr:sr}var or=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue(),n.realpath(t,(i,l)=>{if(i)return s.dequeue(o?null:i,r);n.stat(l,(g,y)=>{if(g)return s.dequeue(o?null:g,r);if(y.isDirectory()&&Mt(t,l,r))return s.dequeue(null,r);e(y,l),s.dequeue(null,r)})})},ir=function(t,r,e){let{queue:s,fs:n,options:{suppressErrors:o}}=r;s.enqueue();try{let i=n.realpathSync(t),l=n.statSync(i);if(l.isDirectory()&&Mt(t,i,r))return;e(l,i)}catch(i){if(!o)throw i}};function ur(t,r){return!t.resolveSymlinks||t.excludeSymlinks?null:r?ir:or}function Mt(t,r,e){if(e.options.useRealPaths)return ar(r,e);let s=At(t),n=1;for(;s!==e.root&&n<2;){let o=e.symlinks.get(s);!!o&&(o===r||o.startsWith(r)||r.startsWith(o))?n++:s=At(s)}return e.symlinks.set(t,r),n>1}function ar(t,r){return r.visited.includes(t+r.options.pathSeparator)}var cr=t=>t.counts,lr=t=>t.groups,pr=t=>t.paths,fr=t=>t.paths.slice(0,t.options.maxFiles),hr=(t,r,e)=>(pt(r,e,t.counts,t.options.suppressErrors),null),gr=(t,r,e)=>(pt(r,e,t.paths,t.options.suppressErrors),null),dr=(t,r,e)=>(pt(r,e,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Ar=(t,r,e)=>(pt(r,e,t.groups,t.options.suppressErrors),null);function pt(t,r,e,s){r(t&&!s?t:null,e)}function yr(t,r){let{onlyCounts:e,group:s,maxFiles:n}=t;return e?r?cr:hr:s?r?lr:Ar:n?r?fr:dr:r?pr:gr}var Gt={withFileTypes:!0},Rr=(t,r,e,s,n)=>{if(t.queue.enqueue(),s<0)return t.queue.dequeue(null,t);let{fs:o}=t;t.visited.push(r),t.counts.directories++,o.readdir(r||".",Gt,(i,l=[])=>{n(l,e,s),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},Sr=(t,r,e,s,n)=>{let{fs:o}=t;if(s<0)return;t.visited.push(r),t.counts.directories++;let i=[];try{i=o.readdirSync(r||".",Gt)}catch(l){if(!t.options.suppressErrors)throw l}n(i,e,s)};function _r(t){return t?Sr:Rr}var Er=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,r){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,r),t&&(r.controller.abort(),this.onQueueEmpty=void 0))}},br=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},mr=class{aborted=!1;abort(){this.aborted=!0}},Wt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,r,e){this.isSynchronous=!e,this.callbackInvoker=yr(r,this.isSynchronous),this.root=dt(t,r),this.state={root:De(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new br,options:r,queue:new Er((s,n)=>this.callbackInvoker(n,s,e)),symlinks:new Map,visited:[""].slice(0,0),controller:new mr,fs:r.fs||He},this.joinPath=Me(this.root,r),this.pushDirectory=Xe(this.root,r),this.pushFile=Ve(r),this.getArray=er(r),this.groupFiles=nr(r),this.resolveSymlink=ur(r,this.isSynchronous),this.walkDirectory=_r(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,r,e)=>{let{paths:s,options:{filters:n,resolveSymlinks:o,excludeSymlinks:i,exclude:l,maxFiles:g,signal:y,useRealPaths:S,pathSeparator:R},controller:h}=this.state;if(h.aborted||y&&y.aborted||g&&s.length>g)return;let d=this.getArray(this.state.paths);for(let A=0;A<t.length;++A){let x=t[A];if(x.isFile()||x.isSymbolicLink()&&!o&&!i){let L=this.joinPath(x.name,r);this.pushFile(L,d,this.state.counts,n)}else if(x.isDirectory()){let L=Be(x.name,r,this.state.options.pathSeparator);if(l&&l(x.name,L))continue;this.pushDirectory(L,s,n),this.walkDirectory(this.state,L,L,e-1,this.walk)}else if(this.resolveSymlink&&x.isSymbolicLink()){let L=Bt(x.name,r);this.resolveSymlink(L,this.state,(B,E)=>{if(B.isDirectory()){if(E=dt(E,this.state.options),l&&l(x.name,S?E:L+R))return;this.walkDirectory(this.state,E,S?E:L+R,e-1,this.walk)}else{E=S?E:L;let M=Le(E),j=dt(At(E),this.state.options);E=this.joinPath(M,j),this.pushFile(E,d,this.state.counts,n)}})}}this.groupFiles(this.state.groups,r,d)}};function xr(t,r){return new Promise((e,s)=>{qt(t,r,(n,o)=>{if(n)return s(n);e(o)})})}function qt(t,r,e){new Wt(t,r,e).start()}function Cr(t,r){return new Wt(t,r).start()}var Dt=class{constructor(t,r){this.root=t,this.options=r}withPromise(){return xr(this.root,this.options)}withCallback(t){qt(this.root,this.options,t)}sync(){return Cr(this.root,this.options)}},Ut=null;try{Pt.resolve("picomatch"),Ut=Pt("picomatch")}catch{}var Kt=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Nt,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new Dt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,r){return this.options={...this.options,...r},new Dt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...r){let e=this.globFunction||Ut;if(!e)throw new Error("Please specify a glob function to use glob matching.");var s=this.globCache[t.join("\0")];return s||(s=e(t,...r),this.globCache[t.join("\0")]=s),this.options.filters.push(n=>s(n)),this}};var nt=$e(de(),1),As=Array.isArray,Se=/\\/g,ys=/^[A-Za-z]:$/,_e=process.platform==="win32",Rs=/^(\/?\.\.)+$/;function Ss(t,r={}){let e=t.length,s=Array(e),n=Array(e),o,i;for(o=0;o<e;o++){let l=Ee(t[o]);s[o]=l;let g=l.length,y=Array(g);for(i=0;i<g;i++)y[i]=(0,nt.default)(l[i],r);n[o]=y}return l=>{let g=l.split("/");if(g[0]===".."&&Rs.test(l))return!0;for(o=0;o<e;o++){let y=s[o],S=n[o],R=g.length,h=Math.min(R,y.length);for(i=0;i<h;){let d=y[i];if(d.includes("/"))return!0;if(!S[i](g[i]))break;if(!r.noglobstar&&d==="**")return!0;i++}if(i===R)return!0}return!1}}var _s=/^[A-Z]:\/$/i,Es=_e?t=>_s.test(t):t=>t==="/";function Ae(t,r,e){if(t===r||r.startsWith(`${t}/`)){if(e){let n=t.length+ +!Es(t);return(o,i)=>o.slice(n,i?-1:void 0)||"."}let s=r.slice(t.length+1);return s?(n,o)=>{if(n===".")return s;let i=`${s}/${n}`;return o?i.slice(0,-1):i}:(n,o)=>o&&n!=="."?n.slice(0,-1):n}return e?s=>V.relative(t,s)||".":s=>V.relative(t,`${r}/${s}`)||"."}function bs(t,r){if(r.startsWith(`${t}/`)){let e=r.slice(t.length+1);return s=>`${e}/${s}`}return e=>{let s=V.relative(t,`${r}/${e}`);return e[e.length-1]==="/"&&s!==""?`${s}/`:s||"."}}function ye(t){return t.replace(ys,r=>`${r}/`)}var ms={parts:!0};function Ee(t){var r;let e=nt.default.scan(t,ms);return!((r=e.parts)===null||r===void 0)&&r.length?e.parts:[t]}var xs=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Cs=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,$s=t=>t.replace(xs,"\\$&"),vs=t=>t.replace(Cs,"\\$&"),Ls=_e?vs:$s;function ws(t,r){if(r?.caseSensitiveMatch===!1)return!0;let e=nt.default.scan(t);return e.isGlob||e.negated}function ct(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function be(t){return typeof t=="string"?[t]:t??[]}var Ts=/^(\/?\.\.)+/,Os=/\\(?=[()[\]{}!*+?@|])/g;function vt(t,r,e,s){var n;let o=r.cwd,i=t;t[t.length-1]==="/"&&(i=t.slice(0,-1)),i[i.length-1]!=="*"&&r.expandDirectories&&(i+="/**");let l=Ls(o);i=hs(i.replace(Os,""))?V.relative(l,i):V.normalize(i);let g=(n=Ts.exec(i))===null||n===void 0?void 0:n[0],y=Ee(i);if(g){let R=(g.length+1)/3,h=0,d=l.split("/");for(;h<R&&y[h+R]===d[d.length+h-R];)i=i.slice(0,(R-h-1)*3)+i.slice((R-h)*3+y[h+R].length+1)||".",h++;let A=V.join(o,g.slice(h*3));A[0]!=="."&&e.root.length>A.length&&(e.root=ye(A),e.depthOffset=-R+h)}if(!s&&e.depthOffset>=0){var S;(S=e.commonPath)!==null&&S!==void 0||(e.commonPath=y);let R=[],h=Math.min(e.commonPath.length,y.length);for(let d=0;d<h;d++){let A=y[d];if(A==="**"&&!y[d+1]){R.pop();break}if(d===y.length-1||A!==e.commonPath[d]||ws(A))break;R.push(A)}e.depthOffset=R.length,e.commonPath=R,e.root=ye(R.length>0?V.join(o,...R):o)}return i}function Hs(t,r,e){let s=[],n=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&n.push(vt(o,t,e,!0));for(let o of r)o&&(o[0]!=="!"||o[1]==="("?s.push(vt(o,t,e,!1)):(o[1]!=="!"||o[2]==="(")&&n.push(vt(o.slice(1),t,e,!0)));return{match:s,ignore:n}}function ks(t,r){let e=t.cwd,s={root:e,depthOffset:0},n=Hs(t,r,s);t.debug&&ct("internal processing patterns:",n);let{absolute:o,caseSensitiveMatch:i,debug:l,dot:g,followSymbolicLinks:y,onlyDirectories:S}=t,R=s.root.replace(Se,""),h={dot:g,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},d=(0,nt.default)(n.match,h),A=(0,nt.default)(n.ignore,h),x=Ss(n.match,h),L=Ae(e,R,o),B=o?L:Ae(e,R,!0),E=(k,T)=>{let v=B(T,!0);return v!=="."&&!x(v)||A(v)},M;t.deep!==void 0&&(M=Math.round(t.deep-s.depthOffset));let j=new Kt({filters:[l?(k,T)=>{let v=L(k,T),_=d(v)&&!A(v);return _&&ct(`matched ${v}`),_}:(k,T)=>{let v=L(k,T);return d(v)&&!A(v)}],exclude:l?(k,T)=>{let v=E(k,T);return ct(`${v?"skipped":"crawling"} ${T}`),v}:E,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:y,excludeSymlinks:!y,excludeFiles:S,includeDirs:S||!t.onlyFiles,maxDepth:M,signal:t.signal}).crawl(R);return t.debug&&ct("internal properties:",{...s,root:R}),[j,e!==R&&!o&&bs(e,R)]}function Is(t,r){if(r)for(let e=t.length-1;e>=0;e--)t[e]=r(t[e]);return t}var Re={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Ps(t){let r=Object.assign({},t);for(let e in Re)r[e]===void 0&&Object.assign(r,{[e]:Re[e]});return r.cwd=(r.cwd instanceof URL?ds(r.cwd):gs(r.cwd||process.cwd())).replace(Se,"/"),r.ignore=be(r.ignore),r.fs&&(r.fs={readdir:r.fs.readdir||us,readdirSync:r.fs.readdirSync||as,realpath:r.fs.realpath||cs,realpathSync:r.fs.realpathSync||ls,stat:r.fs.stat||ps,statSync:r.fs.statSync||fs}),r.debug&&ct("globbing with options:",r),r}function Ds(t,r={}){var e;if(t&&r?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let s=As(t)||typeof t=="string",n=be((e=s?t:t.patterns)!==null&&e!==void 0?e:"**/*"),o=Ps(s?r:t);return n.length>0?ks(o,n):[]}async function Lt(t,r){let[e,s]=Ds(t,r);return e?Is(await e.withPromise(),s):[]}var xe=Object.values(wt).flatMap(t=>t.extensions).map(t=>t.slice(1));function Bs(t){return/[*?[\]{}]/.test(t)}async function Ms(t,r){let e=r?`**/*.{${xe.join(",")}}`:`*.{${xe.join(",")}}`;return(await Lt([e],{cwd:t,absolute:!0,onlyFiles:!0,caseSensitiveMatch:!1})).sort()}async function Gs(t){let r=[];return await kt(t,Ht(),async(e,s)=>{try{r[s]={ok:!0,source:await It(e)}}catch(n){r[s]={ok:!1,error:n}}}),r}async function Ws(t,r,e,s){let n=await Ms(t,r);if(n.length===0){e({path:t,error:Ot(t)});return}for(let o of n)s(o,t,!1)}async function Rn(t,r){let e=[],s=[],n=new Map,o=new Set,i=[],l=(h,d,A)=>{let x=me(h);o.has(x)||(o.add(x),i.push({path:x,root:d,explicit:A}))},g=h=>{i.push({failure:h})};for(let h of t){let d=me(h);if(Bs(h)&&!Ns(d)){let x=(r.platform??process.platform)==="win32"?h.replaceAll("\\","/"):h,L=await Lt([x],{absolute:!0,onlyFiles:!0});L.length===0&&g({path:d,error:gt(d)});for(let B of L.sort())l(B,void 0,!1);continue}let A;try{A=await Fs(d)}catch{g({path:d,error:gt(d)});continue}if(A.isDirectory()){await Ws(d,r.recursive,g,l);continue}l(d,void 0,!0)}let y=i.filter(h=>"path"in h),S=await Gs(y.map(h=>h.path)),R=0;for(let h of i){if("failure"in h){s.push(h.failure);continue}let d=S[R++];if(d.ok)e.push(d.source),h.root&&n.set(h.path,h.root);else if(Tt(d.error))s.push({path:h.path,error:d.error});else if(h.explicit)throw d.error}return{sources:e,failures:s,roots:n}}export{Rn as a};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{a as m}from"./chunk-MF3KKEFB.js";import{W as l}from"./chunk-WIPP5TWQ.js";import{randomBytes as h}from"node:crypto";import{link as y,mkdir as p,readdir as x,readFile as P,rename as E,rm as c,stat as L,writeFile as S}from"node:fs/promises";import{join as u}from"node:path";var b=720*60*1e3,k=600*1e3,M=200,F=600*1e3;function a(){return u(m(),".locks")}function f(t){return u(a(),`${t}.lock`)}function v(t){if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(n){return n.code==="EPERM"}}async function s(t){try{let n=JSON.parse(await P(t,"utf8"));return typeof n.pid!="number"||typeof n.token!="string"?void 0:n}catch{return}}async function d(t,n){if(n===void 0||!v(n.pid))return!0;let e=await L(t).catch(()=>{});return e!==void 0&&Date.now()-e.mtimeMs>b}async function D(t){let n=`${t}.stale-${h(4).toString("hex")}`;try{await E(t,n)}catch{return}let e=await s(n);e!==void 0&&!await d(n,e)&&await y(n,t).catch(()=>{}),await c(n,{force:!0})}async function A(){let t=await x(a()).catch(()=>[]);for(let n of t){if(!/\.lock\.(stale-)?[0-9a-f]+$/.test(n))continue;let e=u(a(),n),i=await L(e).catch(()=>{});i&&Date.now()-i.mtimeMs>F&&await c(e,{force:!0})}}async function g(t,n){await p(a(),{recursive:!0});let e=f(t),i={pid:process.pid,token:h(8).toString("hex"),at:Date.now(),...n!==void 0?{what:n}:{}},r=`${e}.${i.token}`;await S(r,JSON.stringify(i),{flag:"wx"});try{for(let o=0;o<2;o++){try{return await y(r,e),i}catch(w){if(w.code!=="EEXIST")throw w}if(!await d(e,await s(e)))return;await D(e)}return}finally{await c(r,{force:!0})}}async function T(t,n){let e=f(t);(await s(e))?.token===n.token&&await c(e,{force:!0})}async function _(t){let n=f(t),e=await s(n);if(!(e===void 0||await d(n,e)))return{pid:e.pid,...e.what!==void 0?{what:e.what}:{}}}async function H(t,n,e={}){let i=Date.now()+(e.waitMs??k);await p(a(),{recursive:!0}),await A();let r=await g(t,e.what);for(r===void 0&&(e.waitMs??k)>0&&e.onWait?.();r===void 0;){if(e.signal?.aborted)throw e.signal.reason??new Error("aborted");if(Date.now()>=i)throw l(t,await _(t),e.action??"run");await new Promise(o=>setTimeout(o,M)),r=await g(t,e.what)}try{return await n()}finally{await T(t,r)}}export{k as a,_ as b,H as c};
3
+ import{a as m}from"./chunk-MF3KKEFB.js";import{T as l}from"./chunk-CVNYUROW.js";import{randomBytes as h}from"node:crypto";import{link as y,mkdir as p,readdir as x,readFile as P,rename as E,rm as c,stat as L,writeFile as S}from"node:fs/promises";import{join as u}from"node:path";var b=720*60*1e3,k=600*1e3,M=200,F=600*1e3;function a(){return u(m(),".locks")}function f(t){return u(a(),`${t}.lock`)}function v(t){if(!Number.isInteger(t)||t<=0)return!1;try{return process.kill(t,0),!0}catch(n){return n.code==="EPERM"}}async function s(t){try{let n=JSON.parse(await P(t,"utf8"));return typeof n.pid!="number"||typeof n.token!="string"?void 0:n}catch{return}}async function d(t,n){if(n===void 0||!v(n.pid))return!0;let e=await L(t).catch(()=>{});return e!==void 0&&Date.now()-e.mtimeMs>b}async function D(t){let n=`${t}.stale-${h(4).toString("hex")}`;try{await E(t,n)}catch{return}let e=await s(n);e!==void 0&&!await d(n,e)&&await y(n,t).catch(()=>{}),await c(n,{force:!0})}async function A(){let t=await x(a()).catch(()=>[]);for(let n of t){if(!/\.lock\.(stale-)?[0-9a-f]+$/.test(n))continue;let e=u(a(),n),i=await L(e).catch(()=>{});i&&Date.now()-i.mtimeMs>F&&await c(e,{force:!0})}}async function g(t,n){await p(a(),{recursive:!0});let e=f(t),i={pid:process.pid,token:h(8).toString("hex"),at:Date.now(),...n!==void 0?{what:n}:{}},r=`${e}.${i.token}`;await S(r,JSON.stringify(i),{flag:"wx"});try{for(let o=0;o<2;o++){try{return await y(r,e),i}catch(w){if(w.code!=="EEXIST")throw w}if(!await d(e,await s(e)))return;await D(e)}return}finally{await c(r,{force:!0})}}async function T(t,n){let e=f(t);(await s(e))?.token===n.token&&await c(e,{force:!0})}async function _(t){let n=f(t),e=await s(n);if(!(e===void 0||await d(n,e)))return{pid:e.pid,...e.what!==void 0?{what:e.what}:{}}}async function H(t,n,e={}){let i=Date.now()+(e.waitMs??k);await p(a(),{recursive:!0}),await A();let r=await g(t,e.what);for(r===void 0&&(e.waitMs??k)>0&&e.onWait?.();r===void 0;){if(e.signal?.aborted)throw e.signal.reason??new Error("aborted");if(Date.now()>=i)throw l(t,await _(t),e.action??"run");await new Promise(o=>setTimeout(o,M)),r=await g(t,e.what)}try{return await n()}finally{await T(t,r)}}export{k as a,_ as b,H as c};