forge-terminal 0.5.9 → 0.6.0

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 (158) hide show
  1. package/README.md +18 -12
  2. package/dist/chunks/{about-credits-32BUKO4K.js → about-credits-XL2AIGQ7.js} +1 -1
  3. package/dist/chunks/args-PS5SVBZY.js +3 -0
  4. package/dist/chunks/boot-QRKC4QBA.js +3 -0
  5. package/dist/chunks/check-HOITNMJX.js +3 -0
  6. package/dist/chunks/{chunk-6RCS3KBP.js → chunk-2JU3YZQU.js} +1 -1
  7. package/dist/chunks/{chunk-Q6KQWJ4J.js → chunk-2L66A2X6.js} +1 -1
  8. package/dist/chunks/chunk-2OSM4W4D.js +3 -0
  9. package/dist/chunks/{chunk-GVVQP3LF.js → chunk-3HG7RXC2.js} +1 -1
  10. package/dist/chunks/chunk-3IX3QA76.js +3 -0
  11. package/dist/chunks/chunk-3SVHRKQH.js +6 -0
  12. package/dist/chunks/chunk-4MZV4SRU.js +4 -0
  13. package/dist/chunks/chunk-4NDZTK22.js +3 -0
  14. package/dist/chunks/{chunk-7XFLG32B.js → chunk-5FJT4BNY.js} +1 -1
  15. package/dist/chunks/chunk-5XJCMMCM.js +3 -0
  16. package/dist/chunks/chunk-65Y7YCZZ.js +3 -0
  17. package/dist/chunks/{chunk-WBW6G4N6.js → chunk-6HUYBVQA.js} +1 -1
  18. package/dist/chunks/chunk-BSFBZBAI.js +16 -0
  19. package/dist/chunks/chunk-BWJNZT75.js +6 -0
  20. package/dist/chunks/{chunk-WE6KP4FR.js → chunk-BYUOU2Q2.js} +1 -1
  21. package/dist/chunks/chunk-CCNRNCRU.js +3 -0
  22. package/dist/chunks/chunk-ECA4PW5T.js +3 -0
  23. package/dist/chunks/chunk-EIPMQFIF.js +3 -0
  24. package/dist/chunks/chunk-EJWTYDBJ.js +3 -0
  25. package/dist/chunks/chunk-EYOO35US.js +3 -0
  26. package/dist/chunks/chunk-FGR6QCG5.js +3 -0
  27. package/dist/chunks/chunk-FWVE3GNA.js +3 -0
  28. package/dist/chunks/{chunk-ILQDMVJR.js → chunk-FXA45V4B.js} +1 -1
  29. package/dist/chunks/chunk-G6L5NIJ5.js +19 -0
  30. package/dist/chunks/chunk-GIG4I2IC.js +23 -0
  31. package/dist/chunks/chunk-HXKLYK3M.js +7 -0
  32. package/dist/chunks/chunk-I2LPGKUU.js +3 -0
  33. package/dist/chunks/chunk-JD3RB6IV.js +66 -0
  34. package/dist/chunks/{chunk-W53XNVNH.js → chunk-JUA63KQK.js} +1 -1
  35. package/dist/chunks/{chunk-4KGC5ZBZ.js → chunk-NLM2SP3F.js} +1 -1
  36. package/dist/chunks/chunk-NMGQGYVM.js +3 -0
  37. package/dist/chunks/chunk-NUCGWLOY.js +8 -0
  38. package/dist/chunks/{chunk-SM735FG7.js → chunk-NUTTDNTG.js} +1 -1
  39. package/dist/chunks/chunk-PA7AG2NK.js +55 -0
  40. package/dist/chunks/{chunk-3374PCO5.js → chunk-PISCJKIG.js} +1 -1
  41. package/dist/chunks/chunk-PON65UTS.js +3 -0
  42. package/dist/chunks/chunk-QIMSNTKL.js +3 -0
  43. package/dist/chunks/{chunk-4MJEEEFA.js → chunk-QO4JUY6B.js} +1 -1
  44. package/dist/chunks/chunk-QPUKPSPZ.js +3 -0
  45. package/dist/chunks/{chunk-YRXJDFP3.js → chunk-S7BZPV5T.js} +1 -1
  46. package/dist/chunks/chunk-SFN3LBB6.js +3 -0
  47. package/dist/chunks/{chunk-OXDRJO4V.js → chunk-TNIPRV6K.js} +1 -1
  48. package/dist/chunks/{chunk-SZRSAL64.js → chunk-UEAZTRTL.js} +1 -1
  49. package/dist/chunks/chunk-UI4EUC3S.js +3 -0
  50. package/dist/chunks/chunk-UN5DSJE2.js +3 -0
  51. package/dist/chunks/chunk-UUTBDIFR.js +3 -0
  52. package/dist/chunks/chunk-WID72ZII.js +4 -0
  53. package/dist/chunks/chunk-X2YUHPOU.js +4 -0
  54. package/dist/chunks/chunk-X4QI2EYV.js +3 -0
  55. package/dist/chunks/chunk-YBA6DJQ4.js +3 -0
  56. package/dist/chunks/chunk-YJZEHJ6U.js +3 -0
  57. package/dist/chunks/chunk-YYZYZWF5.js +80 -0
  58. package/dist/chunks/clip-command-4ON3Q57W.js +3 -0
  59. package/dist/chunks/clipboard-W67Q22JG.js +3 -0
  60. package/dist/chunks/colour-2BGK2BFR.js +3 -0
  61. package/dist/chunks/command-ZX3L5VFO.js +3 -0
  62. package/dist/chunks/config-command-VEGQPXVB.js +3 -0
  63. package/dist/chunks/continue-editing-LTMIEFRD.js +3 -0
  64. package/dist/chunks/decoded-SK6W44WW.js +3 -0
  65. package/dist/chunks/{entry-BZYPZONY.js → entry-3R2GK3IW.js} +2 -2
  66. package/dist/chunks/execute-TC3QZ6GL.js +3 -0
  67. package/dist/chunks/extensions-3SG2LW7R.js +3 -0
  68. package/dist/chunks/{extensions-command-JZSOQJEV.js → extensions-command-RNAPQYWV.js} +1 -1
  69. package/dist/chunks/ffmpeg-G4TRWUTV.js +3 -0
  70. package/dist/chunks/image-67XO45NW.js +3 -0
  71. package/dist/chunks/install-UN3YGSJW.js +3 -0
  72. package/dist/chunks/{install-KGFOAQCU.js → install-X7EEH5CQ.js} +1 -1
  73. package/dist/chunks/launch-EGFNGHLN.js +18 -0
  74. package/dist/chunks/lock-5ZO5PCZP.js +3 -0
  75. package/dist/chunks/manager-272REVNF.js +4 -0
  76. package/dist/chunks/{needed-DYERJ72M.js → needed-7IUPDEJB.js} +1 -1
  77. package/dist/chunks/notify-UD7FQAWX.js +3 -0
  78. package/dist/chunks/{own-2QGMHSKL.js → own-5BD5BVE7.js} +1 -1
  79. package/dist/chunks/pdfium-MHPBLZY5.js +3 -0
  80. package/dist/chunks/preferences-E2CH2YSG.js +3 -0
  81. package/dist/chunks/preset-command-5I3NZ2OP.js +3 -0
  82. package/dist/chunks/registry-DWFV4GBG.js +3 -0
  83. package/dist/chunks/{run-GUFPETHF.js → run-3DX3SROY.js} +1 -1
  84. package/dist/chunks/{server-PIXRL5PA.js → server-TF32DQEO.js} +32 -28
  85. package/dist/chunks/signals-QSXY3F2A.js +3 -0
  86. package/dist/chunks/text-layer-PFIDCTEL.js +5 -0
  87. package/dist/chunks/theme-4Y66DDAO.js +3 -0
  88. package/dist/chunks/transcribe-HH5P3PV4.js +3 -0
  89. package/dist/chunks/transcribe-command-VY5HYNXV.js +3 -0
  90. package/dist/chunks/update-command-6VVDG75Y.js +3 -0
  91. package/dist/chunks/update-note-XV2T2NNG.js +3 -0
  92. package/dist/chunks/watch-command-BMSMGIHK.js +3 -0
  93. package/dist/helpers/forge-transcribe +0 -0
  94. package/dist/index.js +16 -15
  95. package/package.json +19 -3
  96. package/dist/chunks/args-ZVZQR23M.js +0 -3
  97. package/dist/chunks/boot-2YFTQOMG.js +0 -3
  98. package/dist/chunks/check-B6NP7BEM.js +0 -3
  99. package/dist/chunks/chunk-4RNVZQRC.js +0 -3
  100. package/dist/chunks/chunk-6KUWZQGG.js +0 -3
  101. package/dist/chunks/chunk-6MWJO3GB.js +0 -4
  102. package/dist/chunks/chunk-6PEIZZNE.js +0 -3
  103. package/dist/chunks/chunk-7FW7JX74.js +0 -36
  104. package/dist/chunks/chunk-7XDMC7FL.js +0 -72
  105. package/dist/chunks/chunk-AR3M2PLK.js +0 -3
  106. package/dist/chunks/chunk-ASLKQXZ2.js +0 -3
  107. package/dist/chunks/chunk-BKLPRILS.js +0 -3
  108. package/dist/chunks/chunk-FAUL5L2W.js +0 -3
  109. package/dist/chunks/chunk-FBVRKMAF.js +0 -3
  110. package/dist/chunks/chunk-GHYODKA3.js +0 -3
  111. package/dist/chunks/chunk-H3DIRJFE.js +0 -3
  112. package/dist/chunks/chunk-HTA25PO2.js +0 -3
  113. package/dist/chunks/chunk-J7FLFHQJ.js +0 -3
  114. package/dist/chunks/chunk-K253E723.js +0 -3
  115. package/dist/chunks/chunk-KH5DHZ2U.js +0 -8
  116. package/dist/chunks/chunk-L44NRTP4.js +0 -3
  117. package/dist/chunks/chunk-N32JL4UI.js +0 -3
  118. package/dist/chunks/chunk-N6RCLJE6.js +0 -4
  119. package/dist/chunks/chunk-NDYMC3HY.js +0 -66
  120. package/dist/chunks/chunk-NMECUMJD.js +0 -7
  121. package/dist/chunks/chunk-OQBIYNGK.js +0 -6
  122. package/dist/chunks/chunk-QQV7CCAY.js +0 -3
  123. package/dist/chunks/chunk-RCWFUBTG.js +0 -3
  124. package/dist/chunks/chunk-TFGK7IRZ.js +0 -19
  125. package/dist/chunks/chunk-TGC24JEW.js +0 -4
  126. package/dist/chunks/chunk-TLHUFIXD.js +0 -3
  127. package/dist/chunks/chunk-V6GWPR2A.js +0 -3
  128. package/dist/chunks/chunk-VJMOZPHW.js +0 -3
  129. package/dist/chunks/chunk-YPAFAG4W.js +0 -6
  130. package/dist/chunks/chunk-ZBMJTIYR.js +0 -3
  131. package/dist/chunks/chunk-ZX5FDZZW.js +0 -55
  132. package/dist/chunks/clip-command-MDSM6KJP.js +0 -3
  133. package/dist/chunks/clipboard-IZJTBTSW.js +0 -3
  134. package/dist/chunks/colour-2MYODUDY.js +0 -3
  135. package/dist/chunks/command-GAGAD65W.js +0 -3
  136. package/dist/chunks/config-command-CKPJXJEE.js +0 -3
  137. package/dist/chunks/continue-editing-M6WESEVB.js +0 -3
  138. package/dist/chunks/decoded-XWKU23RG.js +0 -3
  139. package/dist/chunks/execute-7M6WA4W7.js +0 -3
  140. package/dist/chunks/extensions-E3OUBT36.js +0 -3
  141. package/dist/chunks/ffmpeg-KDZEPLNA.js +0 -3
  142. package/dist/chunks/image-R5C3AWHT.js +0 -3
  143. package/dist/chunks/install-MFYGS5TG.js +0 -3
  144. package/dist/chunks/launch-VNW4YQ4Z.js +0 -17
  145. package/dist/chunks/lock-BG3CLOHA.js +0 -3
  146. package/dist/chunks/manager-L753MI7U.js +0 -4
  147. package/dist/chunks/notify-NQNNOBFC.js +0 -3
  148. package/dist/chunks/pdfium-77L526HZ.js +0 -3
  149. package/dist/chunks/preferences-3P4V2EDX.js +0 -3
  150. package/dist/chunks/preset-command-UNMXHW5A.js +0 -3
  151. package/dist/chunks/registry-RS7LQ3UA.js +0 -3
  152. package/dist/chunks/text-layer-LHZNDMPZ.js +0 -3
  153. package/dist/chunks/theme-P3ZE2ZYB.js +0 -3
  154. package/dist/chunks/transcribe-KXQXEVBJ.js +0 -3
  155. package/dist/chunks/transcribe-command-JHWN4RWU.js +0 -3
  156. package/dist/chunks/update-command-DWEBUFT5.js +0 -3
  157. package/dist/chunks/update-note-CY3LCBCJ.js +0 -3
  158. package/dist/chunks/watch-command-QGVXM23I.js +0 -3
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as u}from"./chunk-FGR6QCG5.js";import{c as r}from"./chunk-VLVNA4T3.js";var s={jpeg:{id:"jpeg",label:"JPEG",extensions:[".jpg",".jpeg"],hasAlpha:!1,animatable:!1,lossy:!0,hint:"universal",defaultQuality:82},png:{id:"png",label:"PNG",extensions:[".png"],hasAlpha:!0,animatable:!1,lossy:!1,hint:"lossless",quantisable:!0},webp:{id:"webp",label:"WebP",extensions:[".webp"],hasAlpha:!0,animatable:!0,lossy:!0,hint:"smaller, modern",defaultQuality:80},avif:{id:"avif",label:"AVIF",extensions:[".avif"],hasAlpha:!0,animatable:!1,lossy:!0,hint:"smallest",defaultQuality:50},heic:{id:"heic",label:"HEIC",extensions:[".heic",".heif"],hasAlpha:!0,animatable:!1,lossy:!0,hint:"Apple photos"},raw:{id:"raw",label:"RAW",extensions:[".dng",".cr2",".cr3",".nef",".nrw",".arw",".srf",".sr2",".raf",".orf",".rw2",".rwl",".pef",".srw",".3fr",".fff",".erf",".dcr",".kdc",".mos"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"camera photos"},mp4:{id:"mp4",label:"MP4",extensions:[".mp4",".m4v"],hasAlpha:!1,animatable:!0,lossy:!0,hint:"H.264 \xB7 AAC",media:"video"},mov:{id:"mov",label:"MOV",extensions:[".mov",".qt"],hasAlpha:!1,animatable:!0,lossy:!0,hint:"QuickTime",media:"video",keepsOnly:!0},hevc:{id:"hevc",label:"HEVC",extensions:[".mp4"],hasAlpha:!1,animatable:!0,lossy:!0,hint:"H.265 \xB7 AAC",media:"video"},webm:{id:"webm",label:"WebM",extensions:[".webm"],hasAlpha:!1,animatable:!0,lossy:!0,hint:"VP9 \xB7 Opus",media:"video"},gif:{id:"gif",label:"GIF",extensions:[".gif"],hasAlpha:!0,animatable:!0,lossy:!1,hint:"animation",quantisable:!0,media:"video"},tiff:{id:"tiff",label:"TIFF",extensions:[".tif",".tiff"],hasAlpha:!0,animatable:!1,lossy:!1,hint:"archival"},pdf:{id:"pdf",label:"PDF",extensions:[".pdf"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"document"},docx:{id:"docx",label:"DOCX",extensions:[".docx"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"Word document"},doc:{id:"doc",label:"DOC",extensions:[".doc"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"legacy Word"},mkv:{id:"mkv",label:"MKV",extensions:[".mkv"],hasAlpha:!1,animatable:!0,lossy:!0,hint:"Matroska",media:"video",keepsOnly:!0},avi:{id:"avi",label:"AVI",extensions:[".avi"],hasAlpha:!1,animatable:!0,lossy:!0,hint:"legacy video",media:"video",keepsOnly:!0},mp3:{id:"mp3",label:"MP3",extensions:[".mp3"],hasAlpha:!1,animatable:!1,lossy:!0,hint:"plays anywhere",media:"sound"},m4a:{id:"m4a",label:"M4A",extensions:[".m4a",".m4b"],hasAlpha:!1,animatable:!1,lossy:!0,hint:"AAC",media:"sound"},opus:{id:"opus",label:"Opus",extensions:[".opus"],hasAlpha:!1,animatable:!1,lossy:!0,hint:"smallest",media:"sound"},flac:{id:"flac",label:"FLAC",extensions:[".flac"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"lossless",media:"sound"},aiff:{id:"aiff",label:"AIFF",extensions:[".aiff",".aif",".aifc"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"uncompressed",media:"sound"},wav:{id:"wav",label:"WAV",extensions:[".wav"],hasAlpha:!1,animatable:!1,lossy:!1,hint:"uncompressed",media:"sound"},ogg:{id:"ogg",label:"OGG",extensions:[".ogg",".oga"],hasAlpha:!1,animatable:!1,lossy:!0,hint:"Vorbis",media:"sound",keepsOnly:!0}},P=Object.keys(s);function H(e){return s[e.toLowerCase()]}function R(e){let t=e.toLowerCase();return Object.values(s).filter(n=>n.extensions.includes(t))}function W(e){let t=s[e].extensions[0];if(!t)throw new Error(`format ${e} declares no extensions`);return t}var $=80;function M(e,t){return t??(e?s[e].defaultQuality:void 0)??$}import{dirname as F}from"node:path";var o=class extends Error{code;title;detail;short;hint;shellHint;constructor(t){super(t.detail===""?t.title:`${t.title}: ${t.detail}`,t.cause===void 0?void 0:{cause:t.cause}),this.name="ForgeError",this.code=t.code,this.title=t.title,this.detail=t.detail,this.short=t.short,this.hint=t.hint,this.shellHint=t.shellHint}};function y(e){return e instanceof o}function z(e){return new o({code:"file-not-found",title:"File not found",detail:`${r(e)} could not be found.`,short:`${r(e)} could not be found.`,hint:"Check the filename and try again."})}function V(e){return new o({code:"not-a-file",title:"Not a file",detail:`${r(e)} is not a file.`,short:`${r(e)} is not a file.`,hint:"Point Forge at an image, or at a directory of images."})}function q(e){return new o({code:"permission-denied",title:"Permission denied",detail:`${r(e)} could not be read.`,short:`${r(e)} could not be read.`,hint:"Check the file permissions and try again."})}function G(e){return new o({code:"not-a-directory",title:"Invalid path",detail:`${r(e)} could not be found: part of its path is not a directory.`,short:`part of ${r(e)}'s path is not a folder.`,hint:"Check the path and try again."})}function Q(e){return new o({code:"symlink-loop",title:"Too many symbolic links",detail:`${r(e)} could not be resolved: its path contains a symbolic-link loop.`,short:`${r(e)}'s path loops back on itself.`,hint:"Check for a circular symlink somewhere in the path."})}function _(e){return new o({code:"path-too-long",title:"Path too long",detail:`${r(e)}'s path is too long for the filesystem to resolve.`,short:`${r(e)}'s path is too long.`,hint:"Use a shorter path and try again."})}function B(e,t){return new o({code:"unreadable-path",title:"Could not read path",detail:`${r(e)} could not be checked.`,short:`${r(e)} could not be checked.`,hint:"Check the path and try again.",cause:t})}var v=new Set(["HEIC","HEVC","FLAC","RAW"]);function g(e){return`${(/^[A-Z0-9]+$/.test(e)&&!v.has(e)?/^[AEFILMNORSX8]/.test(e):/^[aeiou]/i.test(e))?"an":"a"} ${e}`}function E(e){return e.kind==="image"?"image":e.kind==="document"?"document":(e.facts?!e.facts.video:s[e.format].media==="sound")?"sound file":"video"}function Y(e,t){return new o({code:"unsupported-source",title:"Unsupported file type",detail:`${r(e)} is ${t}, which Forge cannot read.`,short:`${r(e)} is ${t}, which Forge cannot read.`})}function K(e,t){return new o({code:"unsupported-source",title:"Not an image",detail:`${r(e)} is ${t}, not an image.`,hint:"A palette is taken from a photo, a screenshot or artwork."})}function X(e){return new o({code:"unsupported-source",title:"Nothing to take colours from",detail:`${r(e)} has no visible pixels.`})}function Z(e){return new o({code:"unsupported-source",title:"No colours",detail:`There are no colours in ${e} that Forge can read.`,hint:"Write one a line, a name and a colour (bg #F8F1E6), or use a CSV with name and hex columns, CSS variables or design tokens."})}function ee(e,t){let n=t.slice(0,8).join("; "),i=t.length>8?`; and ${t.length-8} more`:"";return new o({code:"unsupported-source",title:"Not colours",detail:`${t.length===1?"One line":`${t.length} lines`} of ${e} could not be read as a colour: ${n}${i}.`,hint:"Write each as a name and a colour, such as bg #F8F1E6, or take the line out."})}function te(e,t=process.platform){if(t!=="darwin"){let n=t==="win32"?"Windows":t==="linux"?"Linux":"this system";return new o({code:"heic-decoder-unavailable",title:"Cannot read HEIC here",detail:`${r(e,t)} is a HEIC photo, which needs Forge's free HEIC extension on ${n}.`,short:"HEIC needs the heic extension.",hint:"Install it with: forge extensions add heic",shellHint:"Open /extensions to install it."})}return new o({code:"heic-decoder-unavailable",title:"Cannot read HEIC here",detail:`${r(e)} is a HEIC photo, which Forge decodes with the macOS sips tool.`,short:"HEIC needs sips, which could not be run.",hint:"sips could not be run. It ships with macOS at /usr/bin/sips."})}function ne(e,t=process.platform){if(t!=="darwin"){let n=t==="win32"?"Windows":t==="linux"?"Linux":"this system";return new o({code:"raw-decoder-unavailable",title:"Cannot read RAW here",detail:`${r(e,t)} is a camera RAW photo, which needs Forge's free RAW extension on ${n}.`,short:"RAW needs the raw extension.",hint:"Install it with: forge extensions add raw",shellHint:"Open /extensions to install it."})}return new o({code:"raw-decoder-unavailable",title:"Cannot read RAW here",detail:`${r(e,t)} is a camera RAW photo, which Forge reads with macOS's own RAW support.`,short:"RAW needs sips, which could not be run.",hint:"sips could not be run. It ships with macOS at /usr/bin/sips."})}function oe(e){return new o({code:"raw-decoder-unavailable",title:"Cannot read this RAW",detail:`${r(e)} is a camera RAW photo that this Mac cannot read.`,short:"macOS cannot read RAW photos from this camera.",hint:"A newer camera usually needs a newer macOS."})}function re(e,t){let n=r(e.path);if(t!==void 0&&t!==e.format){let i=s[t].label;return s[t].lossy?new o({code:"unsupported-compress",title:"Cannot fit that to a size",detail:`Forge cannot search ${n} \u2192 ${i} toward a size yet.`,hint:"Convert it first, then compress the result with --max-size.",shellHint:"Convert it first, then /compress the result to a size."}):new o({code:"unsupported-compress",title:"Cannot fit that to a size",detail:`${i} is lossless \u2014 there is no quality to trade away, so ${n} cannot be made to fit as ${i}.`,hint:"Drop --max-size, or choose a lossy target. forge --formats lists them.",shellHint:"Choose a lossy target to aim for a size."})}if(e.kind==="document"&&e.format==="pdf"){let i=e.images?.skipped??0;return new o({code:"unsupported-compress",title:"Nothing to compress",detail:i>0?`${n}'s images are a kind Forge cannot re-encode, so there is nothing to make smaller.`:`${n} has no images \u2014 it is text and layout, which compression cannot shrink.`,hint:"Try a page operation such as --extract to keep fewer pages, or --to <format> to turn its pages into images.",shellHint:"Try /pdf to keep fewer pages, or /convert to turn its pages into images."})}return e.kind==="document"?new o({code:"unsupported-compress",title:"Nothing to compress",detail:`${n} is ${s[e.format].label}, which has no images Forge can re-encode.`,hint:`Use --to pdf to change it to PDF instead: forge ${n} --to pdf`,shellHint:"Use /convert to change it to PDF instead."}):new o({code:"unsupported-compress",title:"Nothing to compress",detail:`${n} is ${s[e.format].label}, which is lossless \u2014 there is no quality to trade away.`,hint:"Use --to to change it to a smaller format instead. forge --formats lists them.",shellHint:"Use /convert to change it to a smaller format instead."})}function ie(e){let t=r(e.path);return new o({code:"unsupported-pdf",title:"/pdf needs a PDF",detail:`${t} is ${s[e.format].label}, not a PDF.`,hint:"Converting it instead."})}function ae(e,t,n){return new o({code:"unsupported-operation",title:`Cannot ${e} these files`,detail:`Not available for these files: ${t}.`,hint:n??"Page operations work on PDFs: --merge takes two or more, the others take one.",shellHint:n??"Use /pdf with a PDF staged \u2014 two or more for merge."})}function se(e,t,n){let i=e.kind==="media"?`The smallest ${r(e.path)} can get is ${u(n)}, which is still over ${u(t)}.`:`${r(e.path)} is ${u(n)} even at the lowest quality, which is still over ${u(t)}.`;return new o({code:"target-unreachable",title:"Cannot get that small",detail:i,hint:"Try a larger --max-size, or --to a smaller format.",shellHint:"Try a larger target, or /convert to a smaller format."})}function le(e,t,n){return new o({code:"unsupported-target",title:`Cannot convert ${r(e.path)} to ${t}`,detail:`${r(e.path)} is ${g(s[e.format].label)} ${E(e)}.`,hint:`Available: ${n.join(", ")}`})}function k(e,t){return new o({code:"corrupt-source",title:"Damaged file",detail:`${r(e)} could not be read. It may be damaged, or not a format Forge recognises.`,short:`${r(e)} could not be read.`,hint:"The file may be incomplete or corrupted.",cause:t})}function C(e,t,n){return new o({code:"corrupt-source",title:`Damaged ${s[t].label}`,detail:`${r(e)} is ${g(s[t].label)} file, but its content could not be read.`,short:`${r(e)} could not be read.`,hint:"The file may be incomplete or corrupted.",cause:n})}function de(e,t={}){let n=r(e);return new o({code:"encrypted-source",title:"This PDF is password-protected",detail:`${n} is password-protected.`,short:`${n} is password-protected.`,hint:t.attempted?"That password didn't open it. Check it and try again.":`Convert it to images instead: forge ${n} --to jpeg --password-stdin`})}var c=e=>e==="convert"||e==="boost"||e==="remove-background";function ue(e,t="convert"){return new o({code:"output-exists",title:"File already exists",detail:`${r(e)} is already there.`,hint:c(t)?"Pass --force to replace it, or choose a different --output.":"Pass --force to replace it, or move the existing file out of the way.",shellHint:"Run it again and Forge will ask before replacing it."})}function ce(e,t){return new o({code:"output-collision",title:"Two files want the same output",detail:`${r(e[0])} and ${r(e[1])} would both become ${r(t)}.`,hint:"Convert them separately, or use --output to send them to different folders.",shellHint:"Convert them one at a time."})}function pe(e,t){return new o({code:"output-collision",title:"One output, written twice",detail:`${r(e)} would write ${r(t)} twice, and only the second would survive.`,hint:"Every output has to be its own file. Check the selection for a repeated page."})}function he(e,t="convert"){return new o({code:"output-is-input",title:"Output would replace the original",detail:`${r(e)} is both the input and the output.`,hint:c(t)?"Choose a different --output, or pass --force to overwrite in place.":"Move or rename that file first, or pass --force to overwrite it in place.",shellHint:c(t)?"Choose a different folder to save it in.":"Move or rename that file first."})}function f(e,t){return new o({code:"permission-denied",title:"Permission denied",detail:`${r(F(e))} is not a folder you can write to.`,hint:"Choose a different --output, or check the folder permissions.",shellHint:"Choose a different folder, or check its permissions.",cause:t})}var h=new Set(["EACCES","EPERM","EROFS"]);function ge(e,t){if(y(t))return t;let n=t?.code;return n!==void 0&&h.has(n)?f(e,t):n==="ENOSPC"||n==="EDQUOT"?m(e,t,e):n==="ENAMETOOLONG"?w(e,t):t}function S(e,t){return new o({code:"output-invalid",title:"Cannot write there",detail:`${e} could not be written to.`,hint:"Check that the path is valid and that you have permission to write to it.",cause:t})}function fe(e){return new o({code:"empty-directory",title:"No images found",detail:`${r(e)} contains no images Forge can convert.`,hint:"Try --recursive to look inside subfolders.",shellHint:"Only files directly inside a folder are read \u2014 drop the files themselves, or the folder that holds them."})}function me(e,t){return new o({code:"invalid-cut",title:"Cut past the end",detail:`The cut keeps nothing of ${r(e)}: it starts at or after its end.`,hint:`It is ${t} long.`})}function we(e){return new o({code:"unsupported-operation",title:"Cannot use --to here",detail:"--to is for video and sound: a picture or PDF gives its text as it is.",hint:`Try: forge transcribe ${e}`})}function be(e,t){let n=t?.code;return new o({code:n!==void 0&&h.has(n)?"permission-denied":"output-invalid",title:"Settings not saved",detail:`${e} is not a folder Forge can write to.`,cause:t})}function A(e,t){return new o({code:"invalid-arguments",title:"Invalid arguments",detail:e,hint:t})}function xe(e){return new o({code:"invalid-arguments",title:"No files given",detail:"",hint:e})}function $e(e,t="--background"){return A(`${t} takes a colour, not '${e}'.`,"Try a hex code (#ffffff), rgb(), hsl(), oklch() or a colour name.")}function Fe(e,t,n){let i=Math.max(n-1,0);return new o({code:"invalid-page-range",title:"Page range not understood",detail:`'${e}' is outside 1 and ${i}.`,hint:`${t} has ${n} pages, so it can be cut after page 1 to ${i}.`})}function ye(e,t,n){return new o({code:"invalid-page-range",title:"Page range not understood",detail:t,hint:`This document has ${n} pages. Use numbers and spans, like '3-7, 12, 20-'.`})}function ve(e){return new o({code:"empty-selection",title:"Nothing to write",detail:e,hint:"Select at least one page to keep."})}function Ee(e,t,n){return new o({code:"invalid-arguments",title:"Nothing to split",detail:`${r(e)} has ${t} pages; splitting every ${n} makes only one file.`,hint:`Use every=N with N below ${t}.`})}function ke(e){return new o({code:"invalid-dpi",title:"Invalid resolution",detail:`${String(e)} is not a resolution Forge can use.`,hint:"Give a number between 36 and 600. The default is 150."})}function Ce(e){return new o({code:"extension-missing",title:"Extension not installed",detail:`${e} is an optional extension and is not installed.`,hint:`Install it with: forge extensions add ${e}`,shellHint:"Open /extensions to install it."})}function Se(e,t,n,i){return new o({code:"extension-outdated",title:"Extension out of date",detail:`${e} ${n} cannot ${t}; that needs ${i} or later.`,hint:`Update it with: forge extensions add ${e}`,shellHint:"Open /extensions to update it."})}function Ae(e,t){return new o({code:"extension-corrupt",title:"Extension failed verification",detail:`${e}: ${t}`,hint:`Nothing was installed. Try again with: forge extensions add ${e}`,shellHint:"Nothing was installed. Try again from /extensions."})}function Ne(e,t,n=process.platform){let i=n==="win32"?"PC":n==="darwin"?"Mac":"computer";return new o({code:"extension-unsupported",title:"Extension not available here",detail:`${e} cannot be installed on this ${i}: ${t}`,hint:"See what is available with: forge extensions",shellHint:"See what is available in /extensions."})}function Te(e,t=process.platform){let n=t==="win32"?"Windows":t==="darwin"?"macOS":t==="linux"?"Linux":"this system";return new o({code:"extension-unsupported",title:"Extension not available here",detail:`${e} is not available on ${n}.`,hint:"See what is available with: forge extensions",shellHint:"See what is available in /extensions."})}function Ie(e){return new o({code:"update-unavailable",title:"Cannot update this Forge",detail:`This copy of Forge was not installed with npm i -g, so ${e} cannot be installed over it.`,hint:"npm i -g forge-terminal"})}function Oe(e,t=process.platform){return t==="win32"?new o({code:"update-denied",title:"Forge is in use",detail:`npm could not replace Forge's files to update it to ${e}. Windows keeps them locked while Forge runs: close every Forge window, then run the command below. If Node is installed for every user, run it in a terminal opened as administrator.`,short:"Windows locks Forge while it runs: close it, then run this",hint:`npm i -g forge-terminal@${e}`}):new o({code:"update-denied",title:"npm needs permission",detail:`npm needs permission to update Forge to ${e}.`,short:"npm needs permission to update Forge",hint:`sudo npm i -g forge-terminal@${e}`})}function Pe(e,t){return new o({code:"update-failed",title:"Update failed",detail:`npm could not install Forge ${e}: ${t}`,short:"npm could not install the update",hint:`npm i -g forge-terminal@${e}`})}function He(){return new o({code:"update-unreachable",title:"Could not check for updates",detail:"The npm registry could not be reached.",short:"could not reach npm",hint:"Check your connection, then run: forge update",shellHint:"Check your connection, then try again."})}function Re(e,t){return new o({code:"extension-download-failed",title:"Download failed",detail:`${e}: ${t}`,hint:`Check your connection, then run: forge extensions add ${e}`,shellHint:"Check your connection, then try again from /extensions."})}function We(e,t){return new o({code:"extension-download-failed",title:"Not enough disk space",detail:`${e}: ${t}`,hint:`Free some disk space, then run: forge extensions add ${e}`,shellHint:"Free some disk space, then try again from /extensions."})}function Me(e,t,n){let i=t?t.what?`${t.what} (forge, pid ${t.pid})`:`another forge (pid ${t.pid}) is using it`:"another forge is using it";return new o({code:"extension-in-use",title:"Extension in use",detail:`${e} is in use: ${i}.`,hint:n==="remove"?`Wait for that job to finish, then run: forge extensions remove ${e}`:"Wait for that job to finish, then try again.",shellHint:n==="remove"?"It can be removed when that job finishes.":"Try again when that job finishes."})}function De(e){return new o({code:"no-subject",title:"No subject found",detail:`${r(e)} has no clear subject to cut out.`,hint:"Try a photo where the subject stands apart from the background."})}function Ue(e,t,n){return n===1?new o({code:"boost-too-large",title:"Too large to sharpen",detail:`${r(e)} is too large to sharpen.`,hint:"Sharpen works on images up to 16,384 px a side and 100 megapixels."}):new o({code:"boost-too-large",title:"Too large to boost",detail:t>=2?`${r(e)} is too large to boost that far; ${t}x is the most it can take.`:`${r(e)} is already too large to boost.`,hint:t>=2?`Try --boost ${t}.`:"Boost works on images up to 100 megapixels.",shellHint:t>=2?`Choose ${t}x instead.`:void 0})}function je(e,t,n,i=process.platform){let a=n===1?"sharpen":"boost",l=i==="win32"?"PC":i==="darwin"?"Mac":"computer",d=Math.max(1,Math.round(t/60));return new o({code:"boost-too-slow",title:`Too slow to ${a}`,detail:`${r(e)} would take about ${d} ${d===1?"minute":"minutes"} to ${a} on this ${l}.`,hint:"Try a smaller photo."})}function Je(e,t){return new o({code:"resize-too-large",title:"Too large to resize to",detail:`${r(e)} would be ${t.width} \xD7 ${t.height}.`,hint:"Resize works up to 16,384 px a side and 100 megapixels."})}var N={darwin:"\u2303\u21E7\u23184",win32:"Win+Shift+S"};function Le(e,t=process.platform){let n=N[t];return new o({code:"no-clipboard-image",title:"No image",detail:e==="text"?"The clipboard holds text, not a picture.":"The clipboard is empty.",hint:n===void 0?"Copy a picture or a screenshot, then run forge clip again.":`Copy a picture, or take a screenshot with ${n}, then run forge clip again.`})}function ze(e=process.platform){return new o({code:"clipboard-unavailable",title:"No clipboard",detail:e==="linux"?"Forge reads the clipboard of a Wayland or X11 desktop, and not over SSH.":"Forge reads the clipboard on macOS, Windows and Linux, and not over SSH."})}function Ve(e){return new o({code:"clipboard-tool-missing",title:`Clipboard needs ${e}`,detail:`Forge reaches the clipboard through ${e}, and it is not on this computer.`,short:`${e} is not on this computer`,hint:`Install it with sudo apt install ${e} (or your distribution's package manager), then try again.`})}function qe(){return new o({code:"nothing-to-undo",title:"Nothing to undo",detail:"No copied image has been changed yet."})}function Ge(e,t,n,i=!1){let a=r(e);if(i)return new o({code:"cannot-compress-more",title:"Cannot compress more",detail:`${a} is no smaller even at the lowest quality, so nothing was written.`,short:"nothing written"});let l=n>t?`would grow from ${u(t)} to ${u(n)}`:`would stay at ${u(t)}`;return new o({code:"cannot-compress-more",title:"Cannot compress more",detail:`${a} ${l}, so nothing was written.`,short:"nothing written",hint:"Try a lower --quality.",shellHint:"Try a lower quality."})}function Qe(e,t,n){return new o({code:"cannot-compress-more",title:"Already small enough",detail:`${r(e)} is ${u(t)}, already under ${u(n)}, so nothing was written.`,short:"already under that size"})}function _e(e){return new o({code:"nothing-to-trim",title:"Nothing to trim",detail:`${r(e)} has no empty edges.`,short:"no empty edges"})}function Be(e){return new o({code:"animated-trim",title:"Cannot trim an animation",detail:`${r(e)} is animated; trimming works on still images.`})}function Ye(e,t){return new o({code:"nothing-to-crop",title:"Nothing to crop",detail:`${r(e)} is already ${t}.`,short:`already ${t}`})}function Ke(e){return new o({code:"animated-crop",title:"Cannot crop an animation",detail:`${r(e)} is animated; cropping works on still images.`})}function Xe(e){return new o({code:"animated-rotate",title:"Cannot rotate an animation",detail:`${r(e)} is animated; rotating works on still images.`})}function Ze(e,t=process.platform,n=!1){let i=p(t),a=n?`forge extensions add video (or ${i})`:t==="linux"?`${i} (or your distribution's package manager)`:i;return new o({code:"ffmpeg-missing",title:"Video and audio need ffmpeg",detail:`${r(e)} is a video or audio file, and ffmpeg is not on this computer.`,short:"ffmpeg is not on this computer",hint:`Install it with ${a}, then run Forge again.`})}function et(e,t,n=process.platform){let i=s[e].label,a=/^[AEFHILMNORSX]/.test(t.codec)?"an":"a",l=t.encoders,d=l.length>1?`${l.slice(0,-1).join(", ")} or ${l.at(-1)}`:l[0]??"",b=l.length>1?"any of them":"it",x=n==="linux"?"Install a full build of ffmpeg, then run Forge again. On Fedora, RPM Fusion's ffmpeg replaces ffmpeg-free.":n==="win32"?`Install a full build of ffmpeg, such as gyan.dev's (${p(n)}), then run Forge again.`:`Install a full build of ffmpeg (${p(n)}), then run Forge again.`;return new o({code:"encoder-missing",title:`Your ffmpeg cannot write ${i}`,detail:`${i} needs ${a} ${t.codec} encoder${t.sound?" for its sound":""}: ${d}. Your ffmpeg was built without ${b}.`,short:`Your ffmpeg has no ${t.codec} encoder`,hint:x})}function p(e=process.platform){return e==="win32"?"winget install ffmpeg":e==="linux"?"sudo apt install ffmpeg":"brew install ffmpeg"}function tt(e,t,n){return O(e,t,n)??T(e,t)}function T(e,t){return new o({code:"conversion-failed",title:"Conversion failed",detail:`${r(e)} could not be converted.`,hint:"Run again with --debug for the underlying error.",shellHint:"Run the same conversion with forge --debug from the command line to see why.",cause:t})}var I=/premature end|truncated|unexpected end of|libpng read error|corrupt/i;function O(e,t,n){let i=t?.code,a=t instanceof Error?t.message:typeof t=="string"?t:"",l=t?.path,d=typeof l=="string"?l:void 0;if(i==="ENOSPC"||i==="EDQUOT"||/no space left on device|quota exceeded/i.test(a))return m(e,t,d);if(i==="ENAMETOOLONG"||/file name too long/i.test(a))return w(d??e,t,d===void 0);if(d!==void 0&&i!==void 0&&h.has(i))return f(d,t);if(d!==void 0&&i==="ENOTDIR")return S(d,t);if(I.test(a))return n?C(e,n,t):k(e,t)}function m(e,t,n){return new o({code:"disk-full",title:"Disk full",detail:n!==void 0?`There is no space left to write ${r(n)}.`:`${r(e)} could not be converted: no disk space left.`,short:"The disk is full.",hint:"Free up disk space, or choose a different --output.",shellHint:"Free up disk space, or choose a different folder.",cause:t})}function w(e,t,n=!1){let i=n?`${r(e)} could not be converted: the name to write it under is too long.`:`${r(e)} is too long to write.`;return new o({code:"path-too-long",title:"Name too long",detail:i,short:n?"The name to write is too long.":`${r(e)} is too long to write.`,hint:"Choose a shorter name with --output.",shellHint:"Choose a shorter name.",cause:t})}function nt(e){return new o({code:"no-sound",title:"Nothing to transcribe",detail:`${r(e)} has no sound.`})}function ot(e){return new o({code:"no-sound",title:"No sound",detail:`${r(e)} has no sound.`,short:"no sound"})}function rt(e){return new o({code:"source-changed",title:"File changed",detail:`${r(e)} changed while converting, so nothing was written.`,short:"changed while converting"})}function it(e,t=process.platform,n=t==="darwin"?"apple":"whisper"){return n==="whisper"?new o({code:"unsupported-source",title:"Cannot transcribe this file",detail:`${r(e,t)} cannot be read by whisper.`,hint:"Video and sound files can be transcribed."}):new o({code:"unsupported-source",title:"Cannot transcribe this file",detail:`${r(e)} cannot be read by Apple's speech recogniser.`,hint:"MP4, MOV, M4A, MP3, WAV and AIFF can be transcribed; with ffmpeg (brew install ffmpeg), any video or sound file."})}function at(e,t=process.platform,n=t==="darwin"?"apple":"whisper"){let i=n==="apple"?"Apple's speech recogniser":"The whisper extension";return new o({code:"language-unsupported",title:"Language not supported",detail:`${i} does not support ${e}.`,hint:"Pass another with --language, for example --language en-US."})}function st(e,t,n={}){return new o({code:"link-unavailable",title:"Cannot transcribe this link",detail:e,...n,...t===void 0?{}:{cause:t}})}function lt(e){return new o({code:"transcribe-unavailable",title:"Transcribe is not available",detail:e})}function dt(e=!1){return e?new o({code:"read-unavailable",title:"Reading text is not available",detail:"Reading text needs Forge's free read-text extension.",short:"Needs the read-text extension.",hint:"Install it with: forge extensions add read-text",shellHint:"Open /extensions to install it."}):new o({code:"read-unavailable",title:"Reading text is not available",detail:"Reading text needs macOS 26 or later.",short:"Reading text needs macOS 26 or later."})}function ut(e){let t=r(e);return new o({code:"no-text",title:"No text found",detail:`No text found in ${t}.`,short:`No text found in ${t}.`})}function ct(e){let t=r(e);return new o({code:"no-speech",title:"No speech found",detail:`No speech found in ${t}.`,short:`No speech found in ${t}.`})}function pt(e){return new o({code:"unexpected",title:"Something went wrong",detail:e instanceof Error?e.message:String(e),hint:"This was not expected. Try again \u2014 if it keeps happening, it may be worth reporting.",cause:e})}function ht(e,t={}){let n=[`\u2715 ${e.title}`];e.detail!==""&&n.push("",` ${e.detail}`);let i=e.cause instanceof Error?e.cause.stack??e.cause.message:typeof e.cause=="string"?e.cause:void 0,a=t.debug===!0&&i!==void 0;return e.hint&&!(a&&e.hint.includes("--debug"))&&n.push("",` ${e.hint}`),a&&n.push("",` ${i}`),n}export{s as a,H as b,R as c,W as d,M as e,y as f,z as g,V as h,q as i,G as j,Q as k,_ as l,B as m,g as n,Y as o,K as p,X as q,Z as r,ee as s,te as t,ne as u,oe as v,re as w,ie as x,ae as y,se as z,le as A,k as B,C,de as D,ue as E,ce as F,pe as G,he as H,f as I,ge as J,S as K,fe as L,me as M,we as N,be as O,A as P,xe as Q,$e as R,Fe as S,ye as T,ve as U,Ee as V,ke as W,Ce as X,Se as Y,Ae as Z,Ne as _,Te as $,Ie as aa,Oe as ba,Pe as ca,He as da,Re as ea,We as fa,Me as ga,De as ha,Ue as ia,je as ja,Je as ka,Le as la,ze as ma,Ve as na,qe as oa,Ge as pa,Qe as qa,_e as ra,Be as sa,Ye as ta,Ke as ua,Xe as va,Ze as wa,et as xa,p as ya,tt as za,nt as Aa,ot as Ba,rt as Ca,it as Da,at as Ea,st as Fa,lt as Ga,dt as Ha,ut as Ia,ct as Ja,pt as Ka,ht as La};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as J}from"./chunk-O7DK3GJT.js";import{a as E}from"./chunk-65Y7YCZZ.js";import{i as R}from"./chunk-NMGQGYVM.js";import{f as F,za as y}from"./chunk-CCNRNCRU.js";function x(n=process.env){let r=Number(n.UV_THREADPOOL_SIZE),o=J();return Number.isInteger(r)&&r>0?Math.min(o,r):o}function w(n){let r=n!==void 0&&Number.isFinite(n)?n:void 0;return Math.max(1,r??x())}async function I(n,r,o,d){let b=[],l=[];for(let[i,u]of n.entries())(d?.(u)?l:b).push(i);let p=0,m=0,t,g=async()=>{for(;;){let i=b[p],u=t?void 0:l[m];if(i!==void 0&&(u===void 0||i<u))p++,await o(n[i],i);else if(u!==void 0)m++,t=o(n[u],u).finally(()=>{t=void 0}),await t;else if(t)await t;else return}},f=Math.min(w(r),n.length);await Promise.all(Array.from({length:f},g))}async function B(n,r){let o=r.onEvent??(()=>{}),d=r.engineFor??R,b=w(r.concurrency),l=n.length,p=[],m=[],t=0;await I(n,b,async(e,a)=>{if(r.signal?.aborted)return;o({type:"job:start",job:e,index:a,total:l});let h=d(e);if(!h){t++;let s=e.sources[0].path,c={path:s,error:y(s,new Error(`no engine runs ${e.op}`))};m[a]=c,o({type:"job:error",job:e,failure:c,completed:t,total:l});return}try{let s=await E(h.run(e,c=>o({type:"job:phase",job:e,progress:c}),r.signal));p[a]=s,t++,o({type:"job:done",job:e,result:s,completed:t,total:l})}catch(s){t++;let c=e.sources[0].path,P=F(s)?s:y(c,s,e.sources[0].format),v={path:c,error:P};m[a]=v,o({type:"job:error",job:e,failure:v,completed:t,total:l})}},e=>d(e)?.alone===!0);let f=p.filter(e=>e!==void 0),i=m.filter(e=>e!==void 0),u={results:f,failures:i,inputBytes:f.reduce((e,a)=>e+a.job.sources[0].bytes,0),outputBytes:f.reduce((e,a)=>e+a.outputBytes,0)};return o({type:"batch:done",summary:u}),u}export{x as a,w as b,I as c,B as d};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{b as c,c as a}from"./chunk-65Y7YCZZ.js";var p=["SIGINT","SIGTERM","SIGHUP"],m={SIGHUP:129,SIGINT:130,SIGTERM:143};function d(n,o=process.platform){if(process.removeAllListeners(n),o!=="win32")try{process.kill(process.pid,n);return}catch{}process.exit(m[n])}function T(n,o={}){let r=o.die??(e=>d(e)),s=o.on??((e,t)=>process.on(e,t)),f=o.off??((e,t)=>process.removeListener(e,t)),g=new Set(o.graceful??p),l=!1,i,S=e=>{a(),r(e)},u=p.map(e=>{let t=()=>{if(l||!g.has(e))return S(e);l=!0,n(e),o.graceMs!==void 0&&(i=setTimeout(()=>S(e),o.graceMs),i.unref())};return s(e,t),[e,t]});return()=>{i&&clearTimeout(i);for(let[e,t]of u)f(e,t)}}var I={inFlight:c,abandon:a,die:n=>d(n),graceMs:1e3,pollMs:25};async function G(n={}){let o={...I,...n},r=Date.now()+o.graceMs;for(;o.inFlight()&&Date.now()<r;)await new Promise(s=>setTimeout(s,o.pollMs));o.inFlight()&&(o.abandon(),o.die("SIGINT"))}export{m as a,d as b,T as c,G as d};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{b as A,c as y,g as o,m as x,n as v,t as O,u as P,v as k}from"./chunk-UI4EUC3S.js";import{a as S,b as m,d as I}from"./chunk-NMGQGYVM.js";import{g as c,h as g,j as b,k as h,l,m as a}from"./chunk-UN5DSJE2.js";import{P as d}from"./chunk-CCNRNCRU.js";var f=e=>e.filter(t=>t.kind==="document"&&t.format==="pdf"),D={id:"merge",label:"Merge",verb:"Merging",hint:"several files into one",appliesTo:e=>f(e).length>=2&&f(e).length===e.length,unavailable:e=>f(e).length!==e.length?"PDFs only":"needs 2+ files",options:()=>[],plan(e,t){let n=a(h(e.map(r=>r.path)),o(t.destination),o(t.name));return[{op:"merge",sources:e,outputs:[n]}]}},z=e=>e.length>=2&&e.every(t=>t.kind==="image"||t.kind==="document"&&t.format==="pdf");function i(e){return e.filter(n=>n.kind==="document"&&n.format==="pdf").length===0?"PDFs only":"one PDF at a time"}var u=e=>e.length===1&&e[0]?.kind==="document"&&e[0].format==="pdf"?e[0]:void 0,T={id:"split",label:"Split",verb:"Splitting",hint:"into several files",appliesTo:e=>(u(e)?.pages??0)>1,unavailable:e=>u(e)===void 0?i(e):"only one page",options(e){let t=u(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=u(e);if(!n)return[];let r=Array.isArray(t.cuts)?t.cuts:[],p=I(r,n.pages).length,q=l(g(n.path,p),o(t.destination),o(t.name));return[{op:"split",sources:[n],outputs:q,cuts:r}]}};function Q(e){return Array.from({length:Math.max(0,e-1)},(t,n)=>n)}function U(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 s=e=>e.length===1&&e[0]?.kind==="document"&&e[0].format==="pdf"?e[0]:void 0;function w(e,t){return Array.isArray(t.pages)?m(t.pages):typeof t.pages=="string"?m(S(t.pages,e.pages)):[]}var R=e=>({kind:"text",id:"pages",label:"Pages",placeholder:`1-${e.pages}`}),j={id:"extract",label:"Extract",verb:"Extracting",hint:"keep only some pages",appliesTo:e=>s(e)!==void 0,unavailable:i,options:e=>{let t=s(e);return t?[R(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=s(e);if(!n)return[];let r=w(n,t),p=t.separate==="many";return[{op:"extract",sources:[n],outputs:l(b(n.path,r,p),o(t.destination),o(t.name)),pages:r,separate:p}]}},J={id:"delete",label:"Delete",verb:"Deleting",hint:"drop some pages",appliesTo:e=>s(e)!==void 0,unavailable:i,options:e=>{let t=s(e);return t?[R(t)]:[]},plan(e,t){let n=s(e);return n?[{op:"delete",sources:[n],outputs:[a(c(n.path,"trimmed"),o(t.destination),o(t.name))],pages:w(n,t)}]:[]}};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:i,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 p=Number(t.degrees??90)/90%4||1;return[{op:"rotate",sources:[n],outputs:[a(c(n.path,"rotated"),o(t.destination),o(t.name))],turns:p}]}};var C=[v,x,D,T,j,J,E,O,P,k],de=C.filter(e=>!["convert","compress","trim","resize","crop"].includes(e.id)),F=[A,y];function ge(e,t=new Set){return[...C,...F.filter(n=>n.requires&&t.has(n.requires))].filter(n=>n.appliesTo(e))}function be(e,t){return e.appliesTo(t)?void 0:e.unavailable?.(t)}export{D as a,z as b,E as c,T as d,Q as e,U as f,C as g,de as h,ge as i,be as j};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ var g=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,C=e=>e<=.0031308?12.92*e:1.055*e**.4166666666666667-.055;function H(e){let r=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!r)return;let a=r[1],n=a.length===3?[...a].map(f=>f+f).join(""):a;return{r:Number.parseInt(n.slice(0,2),16),g:Number.parseInt(n.slice(2,4),16),b:Number.parseInt(n.slice(4,6),16)}}function m({r:e,g:r,b:a}){return`#${[e,r,a].map(n=>n.toString(16).padStart(2,"0")).join("").toUpperCase()}`}function $({r:e,g:r,b:a}){let n=g(e/255),f=g(r/255),d=g(a/255),l=Math.cbrt(.4122214708*n+.5363325363*f+.0514459929*d),b=Math.cbrt(.2119034982*n+.6806995451*f+.1073969566*d),i=Math.cbrt(.0883024619*n+.2817188376*f+.6299787005*d);return{L:.2104542553*l+.793617785*b-.0040720468*i,a:1.9779984951*l-2.428592205*b+.4505937099*i,b:.0259040371*l+.7827717662*b-.808675766*i}}function y({L:e,a:r,b:a}){let n=(e+.3963377774*r+.2158037573*a)**3,f=(e-.1055613458*r-.0638541728*a)**3,d=(e-.0894841775*r-1.291485548*a)**3;return[4.0767416621*n-3.3077115913*f+.2309699292*d,-1.2684380046*n+2.6097574011*f-.3413193965*d,-.0041960863*n-.7034186147*f+1.707614701*d]}function s(e){let[r,a,n]=y(e).map(f=>Math.round(Math.max(0,Math.min(1,C(Math.max(0,f))))*255));return{r,g:a,b:n}}function O(e){return y(e).every(r=>r>=-1e-4&&r<=1+1e-4)}function S({L:e,a:r,b:a}){return{L:e,C:Math.hypot(r,a),h:(Math.atan2(a,r)*180/Math.PI+360)%360}}function k({L:e,C:r,h:a}){let n=a*Math.PI/180;return{L:e,a:r*Math.cos(n),b:r*Math.sin(n)}}function F({r:e,g:r,b:a}){return`rgb(${e} ${r} ${a})`}function G(e){let{L:r,C:a,h:n}=S($(e)),f=a<5e-4?0:n;return`oklch(${(r*100).toFixed(0)}% ${a.toFixed(3)} ${f.toFixed(0)})`}var w={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},v={"cloudy blue":"#acc2d9","dark pastel green":"#56ae57",dust:"#b2996e","electric lime":"#a8ff04","fresh green":"#69d84f","light eggplant":"#894585","nasty green":"#70b23f","really light blue":"#d4ffff",tea:"#65ab7c","warm purple":"#952e8f","yellowish tan":"#fcfc81",cement:"#a5a391","dark grass green":"#388004","dusty teal":"#4c9085","grey teal":"#5e9b8a","macaroni and cheese":"#efb435","pinkish tan":"#d99b82",spruce:"#0a5f38","strong blue":"#0c06f7","toxic green":"#61de2a","windows blue":"#3778bf","blue blue":"#2242c7","blue with a hint of purple":"#533cc6",booger:"#9bb53c","bright sea green":"#05ffa6","dark green blue":"#1f6357","deep turquoise":"#017374","green teal":"#0cb577","strong pink":"#ff0789",bland:"#afa88b","deep aqua":"#08787f","lavender pink":"#dd85d7","light moss green":"#a6c875","light seafoam green":"#a7ffb5","olive yellow":"#c2b709","pig pink":"#e78ea5","deep lilac":"#966ebd",desert:"#ccad60","dusty lavender":"#ac86a8","purpley grey":"#947e94",purply:"#983fb2","candy pink":"#ff63e9","light pastel green":"#b2fba5","boring green":"#63b365","kiwi green":"#8ee53f","light grey green":"#b7e1a1","orange pink":"#ff6f52","tea green":"#bdf8a3","very light brown":"#d3b683","egg shell":"#fffcc4","eggplant purple":"#430541","powder pink":"#ffb2d0","reddish grey":"#997570","baby shit brown":"#ad900d",liliac:"#c48efd","stormy blue":"#507b9c","ugly brown":"#7d7103",custard:"#fffd78","darkish pink":"#da467d","deep brown":"#410200","greenish beige":"#c9d179",manilla:"#fffa86","off blue":"#5684ae","battleship grey":"#6b7c85","browny green":"#6f6c0a",bruise:"#7e4071","kelley green":"#009337","sickly yellow":"#d0e429","sunny yellow":"#fff917",azul:"#1d5dec",darkgreen:"#054907","green/yellow":"#b5ce08",lichen:"#8fb67b","light light green":"#c8ffb0","pale gold":"#fdde6c","sun yellow":"#ffdf22","tan green":"#a9be70",burple:"#6832e3",butterscotch:"#fdb147",toupe:"#c7ac7d","dark cream":"#fff39a","indian red":"#850e04","light lavendar":"#efc0fe","poison green":"#40fd14","baby puke green":"#b6c406","bright yellow green":"#9dff00","charcoal grey":"#3c4142",squash:"#f2ab15",cinnamon:"#ac4f06","light pea green":"#c4fe82","radioactive green":"#2cfa1f","raw sienna":"#9a6200","baby purple":"#ca9bf7",cocoa:"#875f42","light royal blue":"#3a2efe",orangeish:"#fd8d49","rust brown":"#8b3103","sand brown":"#cba560",swamp:"#698339","tealish green":"#0cdc73","burnt siena":"#b75203",camo:"#7f8f4e","dusk blue":"#26538d",fern:"#63a950","old rose":"#c87f89","pale light green":"#b1fc99","peachy pink":"#ff9a8a","rosy pink":"#f6688e","light bluish green":"#76fda8","light bright green":"#53fe5c","light neon green":"#4efd54","light seafoam":"#a0febf","tiffany blue":"#7bf2da","washed out green":"#bcf5a6","browny orange":"#ca6b02","nice blue":"#107ab0",sapphire:"#2138ab","greyish teal":"#719f91","orangey yellow":"#fdb915",parchment:"#fefcaf",straw:"#fcf679","very dark brown":"#1d0200",terracota:"#cb6843","ugly blue":"#31668a","clear blue":"#247afd",creme:"#ffffb6","foam green":"#90fda9","grey/green":"#86a17d","light gold":"#fddc5c","seafoam blue":"#78d1b6",topaz:"#13bbaf","violet pink":"#fb5ffc",wintergreen:"#20f986","yellow tan":"#ffe36e","dark fuchsia":"#9d0759","indigo blue":"#3a18b1","light yellowish green":"#c2ff89","pale magenta":"#d767ad","rich purple":"#720058","sunflower yellow":"#ffda03","green/blue":"#01c08d",leather:"#ac7434","racing green":"#014600","vivid purple":"#9900fa","dark royal blue":"#02066f",hazel:"#8e7618","muted pink":"#d1768f","booger green":"#96b403",canary:"#fdff63","cool grey":"#95a3a6","dark taupe":"#7f684e","darkish purple":"#751973","true green":"#089404","coral pink":"#ff6163","dark sage":"#598556","dark slate blue":"#214761","flat blue":"#3c73a8",mushroom:"#ba9e88","rich blue":"#021bf9","dirty purple":"#734a65",greenblue:"#23c48b","icky green":"#8fae22","light khaki":"#e6f2a2","warm blue":"#4b57db","dark hot pink":"#d90166","deep sea blue":"#015482",carmine:"#9d0216","dark yellow green":"#728f02","pale peach":"#ffe5ad","plum purple":"#4e0550","golden rod":"#f9bc08","neon red":"#ff073a","old pink":"#c77986","very pale blue":"#d6fffe","blood orange":"#fe4b03",grapefruit:"#fd5956","sand yellow":"#fce166","clay brown":"#b2713d","dark blue grey":"#1f3b4d","flat green":"#699d4c","light green blue":"#56fca2","warm pink":"#fb5581","dodger blue":"#3e82fc","gross green":"#a0bf16",ice:"#d6fffa","metallic blue":"#4f738e","pale salmon":"#ffb19a","sap green":"#5c8b15",algae:"#54ac68","bluey grey":"#89a0b0","greeny grey":"#7ea07a","highlighter green":"#1bfc06","light light blue":"#cafffb","light mint":"#b6ffbb","raw umber":"#a75e09","vivid blue":"#152eff","deep lavender":"#8d5eb7","dull teal":"#5f9e8f","light greenish blue":"#63f7b4","mud green":"#606602",pinky:"#fc86aa","red wine":"#8c0034","shit green":"#758000","tan brown":"#ab7e4c",darkblue:"#030764",rosa:"#fe86a4",lipstick:"#d5174e","pale mauve":"#fed0fc",claret:"#680018",dandelion:"#fedf08",orangered:"#fe420f","poop green":"#6f7c00",ruby:"#ca0147",dark:"#1b2431","greenish turquoise":"#00fbb0","pastel red":"#db5856","piss yellow":"#ddd618","bright cyan":"#41fdfe","dark coral":"#cf524e","algae green":"#21c36f","darkish red":"#a90308","reddy brown":"#6e1005","blush pink":"#fe828c","camouflage green":"#4b6113","lawn green":"#4da409",putty:"#beae8a","vibrant blue":"#0339f8","dark sand":"#a88f59","purple/blue":"#5d21d0",saffron:"#feb209",twilight:"#4e518b","warm brown":"#964e02",bluegrey:"#85a3b2","bubble gum pink":"#ff69af","duck egg blue":"#c3fbf4","greenish cyan":"#2afeb7",petrol:"#005f6a",royal:"#0c1793",butter:"#ffff81","dusty orange":"#f0833a","off yellow":"#f1f33f","pale olive green":"#b1d27b",orangish:"#fc824a",leaf:"#71aa34","light blue grey":"#b7c9e2","dried blood":"#4b0101","lightish purple":"#a552e6","rusty red":"#af2f0d","lavender blue":"#8b88f8","light grass green":"#9af764","light mint green":"#a6fbb2",sunflower:"#ffc512",velvet:"#750851","brick orange":"#c14a09","lightish red":"#fe2f4a","pure blue":"#0203e2","twilight blue":"#0a437a","violet red":"#a50055","yellowy brown":"#ae8b0c",carnation:"#fd798f","muddy yellow":"#bfac05","dark seafoam green":"#3eaf76","deep rose":"#c74767","dusty red":"#b9484e","grey/blue":"#647d8e","lemon lime":"#bffe28","purple/pink":"#d725de","brown yellow":"#b29705","purple brown":"#673a3f",wisteria:"#a87dc2","banana yellow":"#fafe4b","lipstick red":"#c0022f","water blue":"#0e87cc","brown grey":"#8d8468","vibrant purple":"#ad03de","baby green":"#8cff9e","barf green":"#94ac02","eggshell blue":"#c4fff7","sandy yellow":"#fdee73","cool green":"#33b864",pale:"#fff9d0","blue/grey":"#758da3","hot magenta":"#f504c9",greyblue:"#77a1b5",purpley:"#8756e4","baby shit green":"#889717","brownish pink":"#c27e79","dark aquamarine":"#017371",diarrhea:"#9f8303","light mustard":"#f7d560","pale sky blue":"#bdf6fe","turtle green":"#75b84f","bright olive":"#9cbb04","dark grey blue":"#29465b","greeny brown":"#696006","lemon green":"#adf802","light periwinkle":"#c1c6fc","seaweed green":"#35ad6b","sunshine yellow":"#fffd37","ugly purple":"#a442a0","medium pink":"#f36196","puke brown":"#947706","very light pink":"#fff4f2",viridian:"#1e9167",bile:"#b5c306","faded yellow":"#feff7f","very pale green":"#cffdbc","vibrant green":"#0add08","bright lime":"#87fd05",spearmint:"#1ef876","light aquamarine":"#7bfdc7","light sage":"#bcecac",yellowgreen:"#bbf90f","baby poo":"#ab9004","dark seafoam":"#1fb57a","deep teal":"#00555a",heather:"#a484ac","rust orange":"#c45508","dirty blue":"#3f829d","fern green":"#548d44","bright lilac":"#c95efb","weird green":"#3ae57f","peacock blue":"#016795","avocado green":"#87a922","faded orange":"#f0944d","grape purple":"#5d1451","hot green":"#25ff29","lime yellow":"#d0fe1d",mango:"#ffa62b",shamrock:"#01b44c",bubblegum:"#ff6cb5","purplish brown":"#6b4247","vomit yellow":"#c7c10c","pale cyan":"#b7fffa","key lime":"#aeff6e","tomato red":"#ec2d01",lightgreen:"#76ff7b",merlot:"#730039","night blue":"#040348","purpleish pink":"#df4ec8",apple:"#6ecb3c","baby poop green":"#8f9805","green apple":"#5edc1f",heliotrope:"#d94ff5","yellow/green":"#c8fd3d","almost black":"#070d0d","cool blue":"#4984b8","leafy green":"#51b73b","mustard brown":"#ac7e04",dusk:"#4e5481","dull brown":"#876e4b","frog green":"#58bc08","vivid green":"#2fef10","bright light green":"#2dfe54","fluro green":"#0aff02",kiwi:"#9cef43",seaweed:"#18d17b","navy green":"#35530a","ultramarine blue":"#1805db",iris:"#6258c4","pastel orange":"#ff964f","yellowish orange":"#ffab0f",perrywinkle:"#8f8ce7",tealish:"#24bca8","dark plum":"#3f012c",pear:"#cbf85f","pinkish orange":"#ff724c","midnight purple":"#280137","light urple":"#b36ff6","dark mint":"#48c072","greenish tan":"#bccb7a","light burgundy":"#a8415b","turquoise blue":"#06b1c4","ugly pink":"#cd7584",sandy:"#f1da7a","electric pink":"#ff0490","muted purple":"#805b87","mid green":"#50a747",greyish:"#a8a495","neon yellow":"#cfff04",banana:"#ffff7e","carnation pink":"#ff7fa7",tomato:"#ef4026",sea:"#3c9992","muddy brown":"#886806","turquoise green":"#04f489",buff:"#fef69e",fawn:"#cfaf7b","muted blue":"#3b719f","pale rose":"#fdc1c5","dark mint green":"#20c073",amethyst:"#9b5fc0","blue/green":"#0f9b8e",chestnut:"#742802","sick green":"#9db92c",pea:"#a4bf20","rusty orange":"#cd5909",stone:"#ada587","rose red":"#be013c","pale aqua":"#b8ffeb","deep orange":"#dc4d01",earth:"#a2653e","mossy green":"#638b27","grassy green":"#419c03","pale lime green":"#b1ff65","light grey blue":"#9dbcd4","pale grey":"#fdfdfe",asparagus:"#77ab56",blueberry:"#464196","purple red":"#990147","pale lime":"#befd73","greenish teal":"#32bf84",caramel:"#af6f09","deep magenta":"#a0025c","light peach":"#ffd8b1","milk chocolate":"#7f4e1e",ocher:"#bf9b0c","off green":"#6ba353","purply pink":"#f075e6",lightblue:"#7bc8f6","dusky blue":"#475f94",golden:"#f5bf03","light beige":"#fffeb6","butter yellow":"#fffd74","dusky purple":"#895b7b","french blue":"#436bad","ugly yellow":"#d0c101","greeny yellow":"#c6f808","orangish red":"#f43605","shamrock green":"#02c14d","orangish brown":"#b25f03","tree green":"#2a7e19","deep violet":"#490648",gunmetal:"#536267","blue/purple":"#5a06ef",cherry:"#cf0234","sandy brown":"#c4a661","warm grey":"#978a84","dark indigo":"#1f0954",midnight:"#03012d","bluey green":"#2bb179","grey pink":"#c3909b","soft purple":"#a66fb5",blood:"#770001","brown red":"#922b05","medium grey":"#7d7f7c",berry:"#990f4b",poo:"#8f7303","purpley pink":"#c83cb9","light salmon":"#fea993",snot:"#acbb0d","easter purple":"#c071fe","light yellow green":"#ccfd7f","dark navy blue":"#00022e",drab:"#828344","light rose":"#ffc5cb",rouge:"#ab1239","purplish red":"#b0054b","slime green":"#99cc04","baby poop":"#937c00","irish green":"#019529","pink/purple":"#ef1de7","dark navy":"#000435","greeny blue":"#42b395","light plum":"#9d5783","pinkish grey":"#c8aca9","dirty orange":"#c87606","rust red":"#aa2704","pale lilac":"#e4cbff","orangey red":"#fa4224","primary blue":"#0804f9","kermit green":"#5cb200","brownish purple":"#76424e","murky green":"#6c7a0e",wheat:"#fbdd7e","very dark purple":"#2a0134","bottle green":"#044a05",watermelon:"#fd4659","deep sky blue":"#0d75f8","fire engine red":"#fe0002","yellow ochre":"#cb9d06","pumpkin orange":"#fb7d07","pale olive":"#b9cc81","light lilac":"#edc8ff","lightish green":"#61e160","carolina blue":"#8ab8fe",mulberry:"#920a4e","shocking pink":"#fe02a2",auburn:"#9a3001","bright lime green":"#65fe08",celadon:"#befdb7","pinkish brown":"#b17261","poo brown":"#885f01","bright sky blue":"#02ccfe",celery:"#c1fd95","dirt brown":"#836539",strawberry:"#fb2943","dark lime":"#84b701",copper:"#b66325","medium brown":"#7f5112","muted green":"#5fa052","robin's egg":"#6dedfd","bright aqua":"#0bf9ea","bright lavender":"#c760ff",ivory:"#ffffcb","very light purple":"#f6cefc","light navy":"#155084","pink red":"#f5054f","olive brown":"#645403","poop brown":"#7a5901","mustard green":"#a8b504","ocean green":"#3d9973","very dark blue":"#000133","dusty green":"#76a973","light navy blue":"#2e5a88","minty green":"#0bf77d",adobe:"#bd6c48",barney:"#ac1db8","jade green":"#2baf6a","bright light blue":"#26f7fd","light lime":"#aefd6c","dark khaki":"#9b8f55","orange yellow":"#ffad01",ocre:"#c69c04",maize:"#f4d054","faded pink":"#de9dac","british racing green":"#05480d",sandstone:"#c9ae74","mud brown":"#60460f","light sea green":"#98f6b0","robin egg blue":"#8af1fe","aqua marine":"#2ee8bb","dark sea green":"#11875d","soft pink":"#fdb0c0","orangey brown":"#b16002","cherry red":"#f7022a","burnt yellow":"#d5ab09","brownish grey":"#86775f",camel:"#c69f59","purplish grey":"#7a687f",marine:"#042e60","greyish pink":"#c88d94","pale turquoise":"#a5fbd5","pastel yellow":"#fffe71","bluey purple":"#6241c7","canary yellow":"#fffe40","faded red":"#d3494e",sepia:"#985e2b",coffee:"#a6814c","bright magenta":"#ff08e8",mocha:"#9d7651",ecru:"#feffca",purpleish:"#98568d",cranberry:"#9e003a","darkish green":"#287c37","brown orange":"#b96902","dusky rose":"#ba6873",melon:"#ff7855","sickly green":"#94b21c",silver:"#c5c9c7","purply blue":"#661aee","purpleish blue":"#6140ef","hospital green":"#9be5aa","shit brown":"#7b5804","mid blue":"#276ab3",amber:"#feb308","easter green":"#8cfd7e","soft blue":"#6488ea","cerulean blue":"#056eee","golden brown":"#b27a01","bright turquoise":"#0ffef9","red pink":"#fa2a55","red purple":"#820747","greyish brown":"#7a6a4f",vermillion:"#f4320c",russet:"#a13905","steel grey":"#6f828a","lighter purple":"#a55af4","bright violet":"#ad0afd","prussian blue":"#004577","slate green":"#658d6d","dirty pink":"#ca7b80","dark blue green":"#005249",pine:"#2b5d34","yellowy green":"#bff128","dark gold":"#b59410",bluish:"#2976bb","darkish blue":"#014182","dull red":"#bb3f3f","pinky red":"#fc2647",bronze:"#a87900","pale teal":"#82cbb2","military green":"#667c3e","barbie pink":"#fe46a5","bubblegum pink":"#fe83cc","pea soup green":"#94a617","dark mustard":"#a88905",shit:"#7f5f00","medium purple":"#9e43a2","very dark green":"#062e03",dirt:"#8a6e45","dusky pink":"#cc7a8b","red violet":"#9e0168","lemon yellow":"#fdff38",pistachio:"#c0fa8b","dull yellow":"#eedc5b","dark lime green":"#7ebd01","denim blue":"#3b5b92","teal blue":"#01889f","lightish blue":"#3d7afd","purpley blue":"#5f34e7","light indigo":"#6d5acf","swamp green":"#748500","brown green":"#706c11","dark maroon":"#3c0008","hot purple":"#cb00f5","dark forest green":"#002d04","faded blue":"#658cbb","drab green":"#749551","light lime green":"#b9ff66","snot green":"#9dc100",yellowish:"#faee66","light blue green":"#7efbb3",bordeaux:"#7b002c","light mauve":"#c292a1",ocean:"#017b92",marigold:"#fcc006","muddy green":"#657432","dull orange":"#d8863b",steel:"#738595","electric purple":"#aa23ff","fluorescent green":"#08ff08","yellowish brown":"#9b7a01",blush:"#f29e8e","soft green":"#6fc276","bright orange":"#ff5b00",lemon:"#fdff52","purple grey":"#866f85","acid green":"#8ffe09","pale lavender":"#eecffe","violet blue":"#510ac9","light forest green":"#4f9153","burnt red":"#9f2305","khaki green":"#728639",cerise:"#de0c62","faded purple":"#916e99",apricot:"#ffb16d","dark olive green":"#3c4d03","grey brown":"#7f7053","green grey":"#77926f","true blue":"#010fcc","pale violet":"#ceaefa","periwinkle blue":"#8f99fb","light sky blue":"#c6fcff",blurple:"#5539cc","green brown":"#544e03",bluegreen:"#017a79","bright teal":"#01f9c6","brownish yellow":"#c9b003","pea soup":"#929901",forest:"#0b5509","barney purple":"#a00498",ultramarine:"#2000b1",purplish:"#94568c","puke yellow":"#c2be0e","bluish grey":"#748b97","dark periwinkle":"#665fd1","dark lilac":"#9c6da5",reddish:"#c44240","light maroon":"#a24857","dusty purple":"#825f87","terra cotta":"#c9643b",avocado:"#90b134","marine blue":"#01386a","teal green":"#25a36f","slate grey":"#59656d","lighter green":"#75fd63","electric green":"#21fc0d","dusty blue":"#5a86ad","golden yellow":"#fec615","bright yellow":"#fffd01","light lavender":"#dfc5fe",umber:"#b26400",poop:"#7f5e00","dark peach":"#de7e5d","jungle green":"#048243",eggshell:"#ffffd4",denim:"#3b638c","yellow brown":"#b79400","dull purple":"#84597e","chocolate brown":"#411900","wine red":"#7b0323","neon blue":"#04d9ff","dirty green":"#667e2c","light tan":"#fbeeac","ice blue":"#d7fffe","cadet blue":"#4e7496","dark mauve":"#874c62","very light blue":"#d5ffff","grey purple":"#826d8c","pastel pink":"#ffbacd","very light green":"#d1ffbd","dark sky blue":"#448ee4",evergreen:"#05472a","dull pink":"#d5869d",aubergine:"#3d0734",mahogany:"#4a0100","reddish orange":"#f8481c","deep green":"#02590f","vomit green":"#89a203","purple pink":"#e03fd8","dusty pink":"#d58a94","faded green":"#7bb274","camo green":"#526525","pinky purple":"#c94cbe","pink purple":"#db4bda","brownish red":"#9e3623","dark rose":"#b5485d",mud:"#735c12",brownish:"#9c6d57","emerald green":"#028f1e","pale brown":"#b1916e","dull blue":"#49759c","burnt umber":"#a0450e","medium green":"#39ad48",clay:"#b66a50","light aqua":"#8cffdb","light olive green":"#a4be5c","brownish orange":"#cb7723","dark aqua":"#05696b","purplish pink":"#ce5dae","dark salmon":"#c85a53","greenish grey":"#96ae8d",jade:"#1fa774","ugly green":"#7a9703","dark beige":"#ac9362",emerald:"#01a049","pale red":"#d9544d","light magenta":"#fa5ff7",sky:"#82cafc","light cyan":"#acfffc","yellow orange":"#fcb001","reddish purple":"#910951","reddish pink":"#fe2c54",orchid:"#c875c4","dirty yellow":"#cdc50a","orange red":"#fd411e","deep red":"#9a0200","orange brown":"#be6400","cobalt blue":"#030aa7","neon pink":"#fe019a","rose pink":"#f7879a","greyish purple":"#887191",raspberry:"#b00149","aqua green":"#12e193","salmon pink":"#fe7b7c",tangerine:"#ff9408","brownish green":"#6a6e09","red brown":"#8b2e16","greenish brown":"#696112",pumpkin:"#e17701","pine green":"#0a481e",charcoal:"#343837","baby pink":"#ffb7ce",cornflower:"#6a79f7","blue violet":"#5d06e9",chocolate:"#3d1c02","greyish green":"#82a67d",scarlet:"#be0119","green yellow":"#c9ff27","dark olive":"#373e02",sienna:"#a9561e","pastel purple":"#caa0ff",terracotta:"#ca6641","aqua blue":"#02d8e9","sage green":"#88b378","blood red":"#980002","deep pink":"#cb0162",grass:"#5cac2d",moss:"#769958","pastel blue":"#a2bffe","bluish green":"#10a674","green blue":"#06b48b","dark tan":"#af884a","greenish blue":"#0b8b87","pale orange":"#ffa756",vomit:"#a2a415","forrest green":"#154406","dark lavender":"#856798","dark violet":"#34013f","purple blue":"#632de9","dark cyan":"#0a888a","olive drab":"#6f7632",pinkish:"#d46a7e",cobalt:"#1e488f","neon purple":"#bc13fe","light turquoise":"#7ef4cc","apple green":"#76cd26","dull green":"#74a662",wine:"#80013f","powder blue":"#b1d1fc","off white":"#ffffe4","electric blue":"#0652ff","dark turquoise":"#045c5a","blue purple":"#5729ce",azure:"#069af3","bright red":"#ff000d","pinkish red":"#f10c45","cornflower blue":"#5170d7","light olive":"#acbf69",grape:"#6c3461","greyish blue":"#5e819d","purplish blue":"#601ef9","yellowish green":"#b0dd16","greenish yellow":"#cdfd02","medium blue":"#2c6fbb","dusty rose":"#c0737a","light violet":"#d6b4fc","midnight blue":"#020035","bluish purple":"#703be7","red orange":"#fd3c06","dark magenta":"#960056",greenish:"#40a368","ocean blue":"#03719c",coral:"#fc5a50",cream:"#ffffc2","reddish brown":"#7f2b0a","burnt sienna":"#b04e0f",brick:"#a03623",sage:"#87ae73","grey green":"#789b73",white:"#ffffff","robin's egg blue":"#98eff9","moss green":"#658b38","steel blue":"#5a7d9a",eggplant:"#380835","light yellow":"#fffe7a","leaf green":"#5ca904","light grey":"#d8dcd6",puke:"#a5a502","pinkish purple":"#d648d7","sea blue":"#047495","pale purple":"#b790d4","slate blue":"#5b7c99","blue grey":"#607c8e","hunter green":"#0b4008",fuchsia:"#ed0dd9",crimson:"#8c000f","pale yellow":"#ffff84",ochre:"#bf9005","mustard yellow":"#d2bd0a","light red":"#ff474c",cerulean:"#0485d1","pale pink":"#ffcfdc","deep blue":"#040273",rust:"#a83c09","light teal":"#90e4c1",slate:"#516572",goldenrod:"#fac205","dark yellow":"#d5b60a","dark grey":"#363737","army green":"#4b5d16","grey blue":"#6b8ba4",seafoam:"#80f9ad",puce:"#a57e52","spring green":"#a9f971","dark orange":"#c65102",sand:"#e2ca76","pastel green":"#b0ff9d",mint:"#9ffeb0","light orange":"#fdaa48","bright pink":"#fe01b1",chartreuse:"#c1f80a","deep purple":"#36013f","dark brown":"#341c02",taupe:"#b9a281","pea green":"#8eab12","puke green":"#9aae07","kelly green":"#02ab2e","seafoam green":"#7af9ab","blue green":"#137e6d",khaki:"#aaa662",burgundy:"#610023","dark teal":"#014d4e","brick red":"#8f1402","royal purple":"#4b006e",plum:"#580f41","mint green":"#8fff9f",gold:"#dbb40c","baby blue":"#a2cffe","yellow green":"#c0fb2d","bright purple":"#be03fd","dark red":"#840000","pale blue":"#d0fefe","grass green":"#3f9b0b",navy:"#01153e",aquamarine:"#04d8b2","burnt orange":"#c04e01","neon green":"#0cff0c","bright blue":"#0165fc",rose:"#cf6275","light pink":"#ffd1df",mustard:"#ceb301",indigo:"#380282",lime:"#aaff32","sea green":"#53fca1",periwinkle:"#8e82fe","dark pink":"#cb416b","olive green":"#677a04",peach:"#ffb07c","pale green":"#c7fdb5","light brown":"#ad8150","hot pink":"#ff028d",black:"#000000",lilac:"#cea2fd","navy blue":"#001146","royal blue":"#0504aa",beige:"#e6daa6",salmon:"#ff796c",olive:"#6e750e",maroon:"#650021","bright green":"#01ff07","dark purple":"#35063e",mauve:"#ae7181","forest green":"#06470c",aqua:"#13eac9",cyan:"#00ffff",tan:"#d1b26f","dark blue":"#00035b",lavender:"#c79fef",turquoise:"#06c2ac","dark green":"#033500",violet:"#9a0eea","light purple":"#bf77f6","lime green":"#89fe05",grey:"#929591","sky blue":"#75bbfd",yellow:"#ffff14",magenta:"#c20078","light green":"#96f97b",orange:"#f97306",teal:"#029386","light blue":"#95d0fc",red:"#e50000",brown:"#653700",pink:"#ff81c0",blue:"#0343df",green:"#15b01a",purple:"#7e1e9c"};function j(e){let r=e.trim().toLowerCase().replace(/\s+/g," ");if(r!=="")return L(r)??T(r)??E(r)}function U(e){let r=j(e)?.rgb;return r?m(r).toLowerCase():void 0}function L(e){let r=/^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(e);if(!r)return;let a=r[1],n=a.length<=4?[...a].map(l=>l+l).join(""):a,f=l=>Number.parseInt(n.slice(l,l+2),16),d={r:f(0),g:f(2),b:f(4)};return n.length===8?{rgb:d,alpha:f(6)/255}:{rgb:d}}function x(e){let r=/^([+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)(%|deg|grad|rad|turn)?$/.exec(e);return r?{n:Number(r[1]),unit:r[2]??""}:void 0}var t=(e,r,a)=>e>=r&&e<=a?e:void 0;function P(e){return e.unit==="%"?t(e.n/100,0,1):e.unit===""?t(e.n,0,1):void 0}var c=e=>Math.round(Math.round(e*255*1e6)/1e6);function p(e){return e.unit==="%"?t(e.n,0,100)===void 0?void 0:c(e.n/100):e.unit===""&&t(e.n,0,255)!==void 0?Math.round(e.n):void 0}function q(e){let a={"":1,deg:1,grad:.9,rad:180/Math.PI,turn:360}[e.unit];return a===void 0?void 0:(e.n*a%360+360)%360}function N(e){return e.unit==="%"?t(e.n/100,0,1):void 0}function M(e){return e.unit==="%"?t(e.n/100,0,1):e.unit===""?t(e.n,0,1):void 0}function h(e){return e.unit==="%"?e.n/100*.4:e.unit===""?e.n:void 0}function I(e,r){let a,n;if(e.includes(",")){if(!r||e.includes("/")||(a=e.split(",").map(l=>l.trim()),a.some(l=>l===""||l.includes(" "))))return;a.length===4&&(n=a.pop())}else{let l=e.split("/").map(b=>b.trim());if(l.length>2||(a=l[0].split(" ").filter(b=>b!==""),l.length===2&&(n=l[1],n===""||n.includes(" "))))return}if(a.length!==3)return;let f=a.map(x);if(f.some(l=>l===void 0))return;if(n===void 0)return{parts:f};let d=x(n);return d?{parts:f,alpha:d}:void 0}function z(e,r,a){let n=f=>{let d=(f+e/30)%12;return a-r*Math.min(a,1-a)*Math.max(-1,Math.min(d-3,9-d,1))};return{r:c(n(0)),g:c(n(8)),b:c(n(4))}}function T(e){let r=/^([a-z]+) ?\((.*)\)$/.exec(e);if(!r)return;let a=r[1],n=r[2],f=I(n,a==="rgb"||a==="rgba"||a==="hsl"||a==="hsla");if(!f)return;let[d,l,b]=f.parts,i;if(f.alpha&&(i=P(f.alpha),i===void 0))return;let o=_(a,d,l,b);if(o)return i===void 0?{rgb:o}:{rgb:o,alpha:i}}function _(e,r,a,n){switch(e){case"rgb":case"rgba":{let f=p(r),d=p(a),l=p(n);return f===void 0||d===void 0||l===void 0?void 0:{r:f,g:d,b:l}}case"hsl":case"hsla":{let f=q(r),d=N(a),l=N(n);return f===void 0||d===void 0||l===void 0?void 0:z(f,d,l)}case"oklch":{let f=M(r),d=h(a),l=q(n);return f===void 0||d===void 0||d<0||l===void 0?void 0:s(k({L:f,C:d,h:l}))}case"oklab":{let f=M(r),d=h(a),l=h(n);return f===void 0||d===void 0||l===void 0?void 0:s({L:f,a:d,b:l})}default:return}}var R=e=>e.toLowerCase().replace(/[\s_-]+/g,""),u;function A(){if(u)return u;u=new Map;for(let e of[w,v])for(let[r,a]of Object.entries(e)){let n=R(r);u.has(n)||u.set(n,a)}return u}function E(e){let r=A().get(R(e)),a=r===void 0?void 0:L(r)?.rgb;return a&&{rgb:a}}export{H as a,m as b,$ as c,s as d,O as e,S as f,k as g,F as h,G as i,j,U as k};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ function o(n){let[e,r]=n>=1e9?[n/1e9,"GB"]:n>=1e6?[n/1e6,"MB"]:n>=1e3?[n/1e3,"KB"]:[n,"B"];return r==="B"?`${Math.round(e)} B`:`${e>=100?Math.round(e).toString():(Math.round(e*10)/10).toString()} ${r}`}function i(n,e){if(n===e)return{pct:0,direction:"same"};if(n===0)return{pct:0,direction:"larger"};let r=(n-e)/n*100;return{pct:Math.round(Math.abs(r)*10)/10,direction:r>0?"smaller":"larger"}}function a(n,e){let r=i(n,e);if(r.direction==="same"||n===0)return r;let t=Math.round(Math.abs((n-e)/n)*100);return t===0?{pct:0,direction:"same"}:{pct:t,direction:r.direction}}var u={b:1,kb:1e3,mb:1e6,gb:1e9},c={b:"B",kb:"KB",mb:"MB",gb:"GB"};function s(n){if(d(n)===void 0)return;let e=/^\s*(\d+(?:\.\d+)?)\s*(b|kb|mb|gb)?\s*$/i.exec(n);if(e)return`${Number(e[1])} ${c[(e[2]??"b").toLowerCase()]}`}function d(n){let e=/^\s*(\d+(?:\.\d+)?)\s*(b|kb|mb|gb)?\s*$/i.exec(n);if(!e)return;let r=Number(e[1]);if(!Number.isFinite(r)||r<=0)return;let t=u[(e[2]??"b").toLowerCase()];if(t!==void 0)return Math.round(r*t)}export{o as a,i as b,a as c,s as d,d as e};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{d as U,k as j}from"./chunk-QO4JUY6B.js";import{n as Se,o as ve,p as Ie,s as J,u as Ee}from"./chunk-UN5DSJE2.js";import{a as Me,b as Be,c as Ae,d as Oe,e as Fe,f as ze,g as $}from"./chunk-6HUYBVQA.js";import{b as M}from"./chunk-KXKQDFHX.js";import{B as de,C as _,J as he,P as H,Y as me,a as w,f as C,g as te,h as re,i as W,j as ne,k as ie,ka as pe,l as oe,m as ae,n as se,o as V,pa as le,ra as ge,sa as we,t as fe,ta as be,u as ce,ua as ye,v as ue,va as xe,za as q}from"./chunk-CCNRNCRU.js";import{c as N}from"./chunk-VLVNA4T3.js";import{constants as it}from"node:fs";import{access as ot,readFile as at,rm as st,stat as ft,writeFile as ct}from"node:fs/promises";import{dirname as ut}from"node:path";var Te=[{id:"light",label:"Light",passes:[{threshold:12,range:24}]},{id:"medium",label:"Medium",passes:[{threshold:20,range:48},{threshold:20,range:24}]},{id:"strong",label:"Strong",passes:[{threshold:31,range:64},{threshold:31,range:32}]}],Bt=1,At=e=>Te.some(r=>r.id===e),De=e=>Te.find(r=>r.id===e),Ot=e=>`debanded-${e}`;function Dt(e){if(w[e].hasAlpha)return;let r=Object.keys(w).filter(t=>w[t].hasAlpha&&t!=="heic").join(", ");return H(`${w[e].label} cannot hold transparency, so a cutout cannot be saved as one.`,`Choose a format that can: ${r}.`)}var ke="1.1.0";function Le(e,r){let t=e.split(".").map(i=>Number.parseInt(i,10)||0),n=r.split(".").map(i=>Number.parseInt(i,10)||0);for(let i=0;i<Math.max(t.length,n.length);i++){let a=(t[i]??0)-(n[i]??0);if(a!==0)return a>0}return!0}var Je="1.4.0";function kt(e){return e!==void 0&&Le(e,Je)}function K(e){return e!==void 0&&Le(e,ke)?[2,3,4]:[2,4]}function Lt(e,r,t){if(e===1||K(r).some(i=>i===e))return;if(t!==void 0&&K(t).some(i=>i===e))return me("boost",`boost ${e}\xD7`,r,ke);let n=K(r).map(i=>`--boost ${i}`);return H(`No released boost makes ${e}\xD7 yet.`,`Try ${n.slice(0,-1).join(", ")} or ${n.at(-1)}.`)}var Ke=16384,Ye=1e8;function Re(e,r,t){let n=Math.max(e,r)*t;if(n>Ke)return{side:n};let i=e*t*r*t;if(i>Ye)return{megapixels:Math.round(i/1e6)}}var F=e=>Math.max(1,Math.round(e));function Y(e,r){return"percent"in r?{width:F(e.width*r.percent/100),height:F(e.height*r.percent/100)}:"width"in r?{width:F(r.width),height:F(e.height*r.width/e.width)}:{width:F(e.width*r.height/e.height),height:F(r.height)}}function Pe(e){return Re(e.width,e.height,1)}function Xe(e){let r=e>>>0;return()=>{r=r+1831565813>>>0;let t=r;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function Ne(e,r,t,n,{threshold:i,range:a},f=1){let m=Buffer.from(e),o=Math.min(3,n),s=Xe(f),d=c=>c<0?0:c>=r?r-1:c,h=c=>c<0?0:c>=t?t-1:c;for(let c=0;c<t;c++)for(let p=0;p<r;p++){let g=s()*a,l=s()*2*Math.PI,u=Math.round(Math.cos(l)*g),y=Math.round(Math.sin(l)*g),x=(h(c+y)*r+d(p+u))*n,v=(h(c-y)*r+d(p-u))*n,I=(h(c+y)*r+d(p-u))*n,B=(h(c-y)*r+d(p+u))*n,E=(c*r+p)*n;for(let S=0;S<o;S++){let T=(e[x+S]+e[v+S]+e[I+S]+e[B+S])/4;Math.abs(e[E+S]-T)<i&&(m[E+S]=Math.round(T))}}return m}function Ce(e,r){let t=new Map;for(let n=0;n<e.length;n+=3){let i=e[n],a=e[n+1],f=e[n+2],m=i<<16|a<<8|f;if(!t.has(m)){if(t.size>=r)return;t.set(m,[i,a,f])}}return[...t.values()]}function _e(e,r,t,n){let i=Buffer.alloc(e.length),a=Int16Array.from(n.flatMap(d=>[...d])),f=n.length,m=(r+2)*3,o=new Float32Array(m),s=new Float32Array(m);for(let d=0;d<t;d++){let h=d%2===0;for(let p=0;p<r;p++){let g=h?p:r-1-p,l=(d*r+g)*3,u=(g+1)*3,y=Math.min(255,Math.max(0,e[l]+o[u])),x=Math.min(255,Math.max(0,e[l+1]+o[u+1])),v=Math.min(255,Math.max(0,e[l+2]+o[u+2])),I=0,B=Number.POSITIVE_INFINITY;for(let O=0;O<f;O++){let G=y-a[O*3],Q=x-a[O*3+1],Z=v-a[O*3+2],ee=G*G+Q*Q+Z*Z;ee<B&&(B=ee,I=O)}let E=a[I*3],S=a[I*3+1],T=a[I*3+2];i[l]=E,i[l+1]=S,i[l+2]=T;let L=y-E,R=x-S,P=v-T,b=h?u+3:u-3,A=h?u-3:u+3;o[b]=o[b]+L*7/16,o[b+1]=o[b+1]+R*7/16,o[b+2]=o[b+2]+P*7/16,s[A]=s[A]+L*3/16,s[A+1]=s[A+1]+R*3/16,s[A+2]=s[A+2]+P*3/16,s[u]=s[u]+L*5/16,s[u+1]=s[u+1]+R*5/16,s[u+2]=s[u+2]+P*5/16,s[b]=s[b]+L/16,s[b+1]=s[b+1]+R/16,s[b+2]=s[b+2]+P/16}let c=o;o=s,s=c,s.fill(0)}return i}import{open as Ge}from"node:fs/promises";async function qe(e,r){let t=await Ge(e,"r");try{let n=Buffer.alloc(r),{bytesRead:i}=await t.read(n,0,r,0);return n.subarray(0,i)}finally{await t.close()}}var z=(e,r,t)=>e.subarray(r,r+t).toString("latin1"),Qe=new Set(["heic","heix","hevc","hevx","heim","heis","mif1","msf1","avif","avis","crx "]),Ze=new Set(["M4A ","M4B ","M4P ","F4A ","F4B "]);function et(e){let r=z(e,8,4);if(!Qe.has(r))return r==="qt "?"mov":Ze.has(r)?"m4a":"mp4"}function Ue(e){if(e.length<4)return;if(z(e,4,4)==="ftyp")return et(e);if(e[0]===26&&e[1]===69&&e[2]===223&&e[3]===163)return e.includes("webm",0,"latin1")?"webm":"mkv";let r=z(e,0,4);if(r==="RIFF"){let t=z(e,8,4);return t==="WAVE"?"wav":t==="AVI "?"avi":void 0}if(r==="FORM"){let t=z(e,8,4);return t==="AIFF"||t==="AIFC"?"aiff":void 0}if(r==="fLaC")return"flac";if(r==="OggS")return e.includes("OpusHead",0,"latin1")?"opus":"ogg";if(z(e,0,3)==="ID3"||e[0]===255&&((e[1]??0)&224)===224&&((e[1]??0)&6)===2)return"mp3"}var $e=1029,tt=Buffer.from([80,75,3,4]),rt=Buffer.from([208,207,17,224]);function nt(e){for(let t of e)if(t===127||t<32&&t!==9&&t!==10&&t!==13)return!1;return!new TextDecoder("utf-8").decode(e).slice(0,-1).includes("\uFFFD")}function We(e){if(e.length!==0&&!e.includes("%PDF-",0,"latin1")&&Ue(e)===void 0&&!(e.subarray(0,4).equals(tt)||e.subarray(0,4).equals(rt))){if(e.length>=26&&e.toString("latin1",0,2)==="BM"&&e.readUInt32LE(14)>=12)return"a BMP image";if(nt(e))return/<svg[\s>]/i.test(e.toString("utf8"))?"an SVG image":"text"}}var dt=new Set(["jpeg","png","webp","avif","heic","raw","gif","tiff"]),ht=new Set(["jpeg","png","webp","avif","gif","tiff"]),mt={jpeg:"jpeg",png:"png",webp:"webp",gif:"gif",tiff:"tiff"};function pt(e,r){if(r.format==="heif")return r.compression==="av1"?"avif":"heic";let t=mt[r.format??""];if(!t)throw V(e,r.format?`${se(r.format.toUpperCase())} image`:"an unknown format");return t}async function lt(e){let r;try{r=await ft(e)}catch(a){let f=a.code;throw f==="ENOENT"?te(e):f==="EACCES"||f==="EPERM"?W(e):f==="ENOTDIR"?ne(e):f==="ELOOP"?ie(e):f==="ENAMETOOLONG"?oe(e):ae(e,a)}if(!r.isFile())throw re(e);try{await ot(e,it.R_OK)}catch{throw W(e)}if(await Be(e)){if(!await Me())throw fe(e);let a;try{a=await Ae(e)}catch(f){throw _(e,"heic",f)}if(a.width===0||a.height===0)throw _(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 Oe(e);if(t){if(!await Fe())throw ce(e);let a;try{a=await ze(e,t)}catch(f){throw _(e,"raw",f)}if(!a)throw ue(e);return{kind:"image",path:e,format:"raw",width:a.width,height:a.height,bytes:r.size,hasAlpha:!1,frames:1}}let n=await M(),i;try{i=await n(e).metadata()}catch(a){let f=We(await qe(e,$e).catch(()=>Buffer.alloc(0)));throw f?V(e,f):de(e,a)}return{kind:"image",path:e,format:pt(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 Ve(e,r,t,n){let i=t??w[r].defaultQuality;if(n&&w[r].quantisable)return gt(e,r,t,n);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 gt(e,r,t,{dither:n}){let i=t??100,a=n?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})}async function X(e,r,t,n){if(t.deband){let u=await M(),{data:y,info:x}=await e.clone().withIccProfile("srgb").raw().toBuffer({resolveWithObject:!0}),v=y;De(t.deband).passes.forEach((B,E)=>{v=Ne(v,x.width,x.height,x.channels,B,E+1)});let I={width:x.width,height:x.height,channels:x.channels};return await Ve(u(v,{raw:I}).withIccProfile("srgb"),r,t.quality,t.compress).toBuffer()}let i=t.dither;if(i===void 0||!w[r].quantisable)return await Ve(e,r,t.quality,t.compress).toBuffer();let a=u=>r==="gif"?u.gif({colours:i,dither:0,effort:10}):u.png({palette:!0,colours:i,quality:100,dither:0,compressionLevel:9,effort:10}),f=()=>r==="gif"?e.gif({colours:i,dither:1,effort:10}):e.png({palette:!0,colours:i,quality:100,dither:1,compressionLevel:9,effort:10});if(n)return await f().toBuffer();let m=await M(),o=e.clone().withIccProfile("srgb"),{data:s,info:d}=await o.raw().toBuffer({resolveWithObject:!0});if(d.channels===4){for(let u=3;u<s.length;u+=4)if(s[u]!==255)return await f().toBuffer()}let h=d.channels===3?s:wt(s),c=await a(m(h,{raw:{width:d.width,height:d.height,channels:3}})).toBuffer(),p=await m(c).removeAlpha().raw().toBuffer(),g=Ce(p,i);if(!g)return await f().toBuffer();let l=_e(h,d.width,d.height,g);return await a(m(l,{raw:{width:d.width,height:d.height,channels:3}}).withIccProfile("srgb")).toBuffer()}function wt(e){let r=Buffer.alloc(e.length/4*3);for(let t=0,n=0;t<e.length;t+=4,n+=3)r[n]=e[t],r[n+1]=e[t+1],r[n+2]=e[t+2];return r}var D=(e,r)=>e.kind==="image"&&e.frames>1&&w[r].animatable;async function bt(e,r){let t=ut(r);await J(r);let n=ve(Se(r));try{return await ct(n,e),await Ee(n,r),e.length}catch(i){throw await st(n,{force:!0}).catch(()=>{}),he(r,i)}finally{Ie(n)}}async function k(e,r,t,n,i,a){if(e.kind!=="image")throw new Error("pipelineFor received a non-image source");let f=i??await $(e.path,e.format),o=(await M())(f,n?{animated:!0}:{});if(o=o.rotate(),t.trim&&(o=o.trim()),t.crop){if(!t.crop.box)throw new Error("pipelineFor needs the crop placed (run does it)");o=o.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 s=a??Y(e,t.resize);o=o.resize(s.width,s.height,{fit:"fill"})}return t.rotate&&(o=o.rotate(t.rotate)),e.hasAlpha&&!w[r].hasAlpha&&(o=o.flatten({background:t.background})),o=t.keepMetadata?o.keepMetadata():o.keepIccProfile(),{pipeline:o}}async function cr(e,r){let t={background:"#ffffff",keepMetadata:!1},{pipeline:n}=await k(e,"png",t,!1);await n.png({compressionLevel:1}).toFile(r)}async function ur(e,r,t){let{pipeline:n}=await k(e,r,t,D(e,r));return await X(n,r,t,D(e,r))}async function yt(e){let r={width:e.width,height:e.height};if(e.frames>1)return{upright:r,trimmed:"animated"};if(r.width<3||r.height<3)return{upright:r,trimmed:"nothing"};let t=await $(e.path,e.format);try{let n=await M(),{info:i}=await n(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(n){throw C(n)?n:q(e.path,n,e.format)}}var He=1024;async function xt(e){let r={background:"#ffffff",keepMetadata:!1},{pipeline:t}=await k(e,"png",r,!1);try{let{data:n,info:i}=await t.resize(He,He,{fit:"inside",withoutEnlargement:!0}).ensureAlpha().raw().toBuffer({resolveWithObject:!0}),a=i.width*i.height,f=i.channels,m=new Uint8Array(a*3),o=new Uint8Array(a),s=!1;for(let d=0;d<a;d++){for(let h=0;h<3;h++)m[d*3+h]=n[d*f+(f>=4?h:0)]??0;o[d]=n[d*f+f-1]??255,o[d]!==255&&(s=!0)}return{size:{width:e.width,height:e.height},thumb:{width:i.width,height:i.height,rgb:m,...s?{alpha:o}:{}}}}catch(n){throw C(n)?n:q(e.path,n,e.format)}}var je=128;async function St(e,r){let{thumb:t,size:n}=e,i=U(t,r),a=await M(),{info:f}=await a(vt(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}),m=U(n,r),o=Math.round(-(f.cropOffsetLeft??0)*n.width/t.width),s=Math.round(-(f.cropOffsetTop??0)*n.height/t.height);return{...m,left:Math.min(Math.max(o,0),n.width-m.width),top:Math.min(Math.max(s,0),n.height-m.height)}}function vt(e){let{alpha:r}=e;if(!r)return e.rgb;let t=new Uint8Array(e.rgb.length);for(let n=0;n<t.length;n++){let i=(r[Math.floor(n/3)]??255)/255;t[n]=Math.round(je+((e.rgb[n]??0)-je)*i)}return t}async function It(e,r){if(e.op!=="convert")throw new Error(`image engine cannot ${e.op}`);let t=e.sources[0],n=e.outputs[0];if(t.kind!=="image")throw new Error("the image engine cannot convert a document source");let i=w[e.target],a=[];r({phase:"reading"});let f=t.frames>1,m=D(t,e.target);f&&!i.animatable&&a.push({code:"animation-flattened",message:`${N(t.path)} has ${t.frames} frames, and ${i.label} cannot animate. Only the first frame was converted.`});let o=e.options,s;if(o.rotate&&f)throw xe(t.path);if(o.trim||o.crop||o.resize){let h={width:t.width,height:t.height};if(o.trim&&o.crop)throw new Error("a job cannot both trim and crop");if(o.crop){if(f)throw ye(t.path);let{aspect:c}=o.crop,p=u=>u.width===t.width&&u.height===t.height,g=U(h,c),l=o.crop.box??(p(g)?g:await St(await xt(t),c));if(p(l)){if(!o.resize)throw be(t.path,j(c));a.push({code:"nothing-cropped",message:`${N(t.path)} is already ${j(c)}; resized only.`});let{crop:u,...y}=o;o=y}else o={...o,crop:{aspect:c,box:l}},h={width:l.width,height:l.height}}if(o.trim){if(f)throw we(t.path);let{trimmed:c}=await yt(t);if(c==="nothing"){if(!o.resize)throw ge(t.path);a.push({code:"nothing-trimmed",message:`${N(t.path)} has no empty edges; resized only.`});let{trim:p,...g}=o;o=g}else c!=="animated"&&(h=c)}if(o.resize&&(s=Y(h,o.resize),Pe(s)))throw pe(t.path,s)}r({phase:"decoding"});let{pipeline:d}=await k(t,e.target,o,m,void 0,s);try{await J(n),r({phase:"encoding"});let h=await X(d,e.target,o,m);if(o.compress&&h.length>=t.bytes)throw le(t.path,t.bytes,h.length);r({phase:"writing"});let c=await bt(h,n);return{job:e,outputBytes:c,warnings:a}}catch(h){throw C(h)?h:q(t.path,h,t.format)}}async function Et(e){let r=await $(e.path,e.format);return typeof r=="string"?await at(r):r}async function Mt(e){if(e.op!=="convert")return;let r=w[e.target];if(!r.lossy&&!(r.quantisable&&e.options.compress))return;let t=e.sources[0];if(t.kind!=="image")return;let n=await Et(t);return{ladder:[{}],measure:async i=>{let{pipeline:a}=await k(t,e.target,i,D(t,e.target),n);return(await X(a,e.target,i,D(t,e.target))).length}}}var dr={id:"image",reads:dt,writes:ht,ops:new Set(["convert"]),probe:lt,run:It,measurer:Mt};export{Dt as a,kt as b,K as c,Lt as d,Ke as e,Re as f,Te as g,Bt as h,At as i,Ot as j,Y as k,Pe as l,qe as m,Ue as n,Ve as o,bt as p,cr as q,ur as r,yt as s,xt as t,St as u,dr as v};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{e as a}from"./chunk-4MJEEEFA.js";import{a as t}from"./chunk-H3DIRJFE.js";var p=[{op:"compress",label:"Compress"},{op:"resize",label:"Resize"},{op:"crop",label:"Crop to shape"},{op:"trim",label:"Trim edges"},{op:"format",label:"Convert to another format"},{op:"sharpen",label:"Sharpen"},{op:"boost",label:"Boost resolution"},{op:"cutout",label:"Remove background"}],n=r=>t[r]?.label??r.toUpperCase(),i=r=>`under ${Math.round(r/1e3)} KB`,u=r=>"width"in r?`${r.width} wide`:"height"in r?`${r.height} high`:`${r.percent}%`;function l(r,e){let o={...r};switch(e.op){case"compress":return"quality"in e?(delete o.maxBytes,o.quality=e.quality,o.compress=r.compress??{dither:!1}):o.maxBytes=e.bytes,o;case"resize":return o.resize=e.spec,o;case"crop":return o.crop=e.aspect,o;case"trim":return o.trim=!0,o;case"format":return o.to=e.to,e.quality===void 0?delete o.quality:o.quality=e.quality,o;case"sharpen":return o.sharpen=!0,o;case"boost":return o.boost=e.scale,o;case"cutout":return o.removeBackground=!0,o}}function d(r){switch(r.op){case"compress":return"quality"in r?`quality ${r.quality}`:i(r.bytes);case"resize":return u(r.spec);case"crop":return`${r.aspect.w}:${r.aspect.h}`;case"trim":return"Trim";case"format":return`${n(r.to)}${r.quality===void 0?"":` ${r.quality}`}`;case"sharpen":return"Sharpen";case"boost":return`Boost ${r.scale}\xD7`;case"cutout":return"Remove background"}}function b(r,e){return[...!(e.to===void 0||e.to===r)&&e.to?[`${n(e.to)}${e.quality===void 0?"":` ${e.quality}`}`]:e.quality!==void 0?[`quality ${e.quality}`]:[],...e.resize?[u(e.resize)]:[],...e.trim?["Trim"]:[],...e.crop?[`${e.crop.w}:${e.crop.h}`]:[],...e.sharpen&&!e.boost?["Sharpen"]:[],...e.boost?[`Boost ${e.boost}\xD7`]:[],...e.removeBackground?["Remove background"]:[],...e.maxBytes?[i(e.maxBytes)]:[]]}function h(r,e){if(r.frames>1)return{trim:"animated",crop:"animated"};let o={};return e?.trimmed==="nothing"&&(o.trim="no empty edges"),a(r).length===0&&(o.crop="no shape to cut"),o}export{p as a,l as b,d as c,b as d,h as e};
3
+ import{e as a}from"./chunk-QO4JUY6B.js";import{a as t}from"./chunk-CCNRNCRU.js";var p=[{op:"compress",label:"Compress"},{op:"resize",label:"Resize"},{op:"crop",label:"Crop to shape"},{op:"trim",label:"Trim edges"},{op:"format",label:"Convert to another format"},{op:"sharpen",label:"Sharpen"},{op:"boost",label:"Boost resolution"},{op:"cutout",label:"Remove background"}],n=r=>t[r]?.label??r.toUpperCase(),i=r=>`under ${Math.round(r/1e3)} KB`,u=r=>"width"in r?`${r.width} wide`:"height"in r?`${r.height} high`:`${r.percent}%`;function l(r,e){let o={...r};switch(e.op){case"compress":return"quality"in e?(delete o.maxBytes,o.quality=e.quality,o.compress=r.compress??{dither:!1}):o.maxBytes=e.bytes,o;case"resize":return o.resize=e.spec,o;case"crop":return o.crop=e.aspect,o;case"trim":return o.trim=!0,o;case"format":return o.to=e.to,e.quality===void 0?delete o.quality:o.quality=e.quality,o;case"sharpen":return o.sharpen=!0,o;case"boost":return o.boost=e.scale,o;case"cutout":return o.removeBackground=!0,o}}function d(r){switch(r.op){case"compress":return"quality"in r?`quality ${r.quality}`:i(r.bytes);case"resize":return u(r.spec);case"crop":return`${r.aspect.w}:${r.aspect.h}`;case"trim":return"Trim";case"format":return`${n(r.to)}${r.quality===void 0?"":` ${r.quality}`}`;case"sharpen":return"Sharpen";case"boost":return`Boost ${r.scale}\xD7`;case"cutout":return"Remove background"}}function b(r,e){return[...!(e.to===void 0||e.to===r)&&e.to?[`${n(e.to)}${e.quality===void 0?"":` ${e.quality}`}`]:e.quality!==void 0?[`quality ${e.quality}`]:[],...e.resize?[u(e.resize)]:[],...e.trim?["Trim"]:[],...e.crop?[`${e.crop.w}:${e.crop.h}`]:[],...e.sharpen&&!e.boost?["Sharpen"]:[],...e.boost?[`Boost ${e.boost}\xD7`]:[],...e.removeBackground?["Remove background"]:[],...e.maxBytes?[i(e.maxBytes)]:[]]}function h(r,e){if(r.frames>1)return{trim:"animated",crop:"animated"};let o={};return e?.trimmed==="nothing"&&(o.trim="no empty edges"),a(r).length===0&&(o.crop="no shape to cut"),o}export{p as a,l as b,d as c,b as d,h as e};
@@ -0,0 +1,19 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as w,h as nt,i as P}from"./chunk-5FJT4BNY.js";import{b as y,c as F,d as D,f as O,g as K,h as et}from"./chunk-EYOO35US.js";import{a as tt}from"./chunk-I2LPGKUU.js";var ct=[[15,"rose"],[45,"red"],[70,"orange"],[95,"amber"],[120,"yellow"],[140,"lime"],[165,"green"],[185,"teal"],[215,"cyan"],[250,"sky"],[280,"blue"],[295,"indigo"],[315,"violet"],[340,"purple"],[355,"pink"],[360,"rose"]];function S(t){let{C:e,h:n}=O(F(t));return e<.03?"grey":B(n)}function B(t){let e=(t%360+360)%360;return(ct.find(([n])=>e<n)??[360,"rose"])[1]}var St=["full","mono","analogous","opposite","split","triad","pastel"],rt={full:"Full set",mono:"Monochromatic",analogous:"Analogous",opposite:"Complementary",split:"Split complementary",triad:"Triadic",pastel:"Pastel"},W={brightness:0,saturation:0,hue:0,contrast:0},Mt=t=>!!(t.brightness||t.saturation||t.hue||t.contrast),Y=[{name:"red",hex:{r:251,g:44,b:54},role:"danger"},{name:"orange",hex:{r:255,g:105,b:0}},{name:"yellow",hex:{r:239,g:177,b:0},role:"warning"},{name:"green",hex:{r:0,g:201,b:80},role:"success"},{name:"teal",hex:{r:0,g:187,b:167}},{name:"blue",hex:{r:43,g:127,b:255},role:"info"},{name:"purple",hex:{r:173,g:70,b:255}},{name:"pink",hex:{r:246,g:51,b:154}}],ut={analogous:[-30,0,30],opposite:[0,180],split:[0,150,210],triad:[0,120,240]},gt=.553,mt=.024,d=t=>O(F(t)),T=(t,e,n)=>D(K({L:t,C:Math.max(0,e),h:(n+360)%360})),G=(t,e)=>(t-e+540)%360-180;function ot(t,e,n){let r=K({L:t,C:e,h:n}),a=F(D(r));return Math.hypot(a.L-r.L,a.a-r.a,a.b-r.b)<.003}function L(t,e){let n=0,r=.4;for(let a=0;a<30;a++){let o=(n+r)/2;ot(t,o,e)?n=o:r=o}return n}function q({L:t,C:e,h:n}){let r=L(t,n);return r>0?Math.min(1,e/r):0}var z=(t,e)=>e>=0?t+(.98-t)*(e/100):t+(t-.05)*(e/100),Q=(t,e,n)=>n>=0?t+(Math.max(t,e)-t)*(n/100):t*(1+n/100);function N(t,e){if(!(e.brightness||e.saturation||e.hue))return t;let{L:n,C:r,h:a}=d(t),o=z(n,e.brightness),s=(a+e.hue+360)%360,l=Q(r,L(o,s),e.saturation);for(let i=0;i<40&&l>0&&!ot(o,l,s);i++)l-=.005;return T(o,l,s)}function v(t,e,n,r){let a=z(t,r.brightness),o=(n+r.hue+360)%360,s=L(a,o);return T(a,Math.min(s,Q(e,s,r.saturation)),o)}function J(t,e,n){if(!e)return t;let r=d(t[n].rgb).L;return t.map((a,o)=>{if(o===n)return a;let s=d(a.rgb),l=Math.max(.02,Math.min(.995,r+(s.L-r)*(1+e/100))),i=T(l,Math.min(s.C,L(l,s.h)),s.h);return{...a,rgb:i,hex:y(i)}})}function Lt(t,e,n,r){return J(t(N(e,n)),n.contrast,r)}function at(t,e){let n=d(t),r=Y.map(i=>d(i.hex)),a=0;r.forEach((i,h)=>{Math.abs(G(n.h,i.h))<Math.abs(G(n.h,r[a].h))&&(a=h)});let o=r[a],s=Math.max(-10,Math.min(10,G(n.h,o.h)/2)),l=q(n);return Y.map((i,h)=>{if(h===a)return{name:i.name,role:i.role,rgb:N(t,e),yours:!0};let u=r[h],c=n.L>=o.L?u.L+(n.L-o.L)*(1-u.L)/(1-o.L):u.L*n.L/o.L,x=z(c,e.brightness),m=(u.h+s+e.hue+360)%360,f=L(x,m),$=Math.min(1,q(u)),b=Math.min(f,Q(l*$*f,f,e.saturation));return{name:i.name,role:i.role,rgb:T(x,b,m),yours:!1}})}function pt(t,e,n){let r=d(t),a=S(t);if(e==="mono")return[{name:a,rgb:N(t,n),yours:!0},{name:`${a} soft`,rgb:v(r.L,r.C*.5,r.h,n),yours:!1},{name:`${a} dusty`,rgb:v(r.L,r.C*.22,r.h,n),yours:!1}];if(e==="pastel")return at(t,W).map((l,i)=>{let h=d(l.rgb),u=h.C<.01?d(Y[i].hex).h:h.h;return{...l,rgb:v(.86,Math.min(.1,L(.86,u))*.85,u,n)}});let o=q(r);return(ut[e]??[0]).map(l=>{if(l===0)return{name:a,rgb:N(t,n),yours:!0};let i=(r.h+l+360)%360,h=o*L(r.L,i);return{name:o>0?B(i):S(v(r.L,h,i,W)),rgb:v(r.L,h,i,n),yours:!1}}).sort((l,i)=>Number(i.yours)-Number(l.yours))}function ft(t,e,n){let r=d(t).h+e.hue,a=Math.max(0,mt*(1+e.saturation/100));return P(T(z(gt,e.brightness),a,r),n)}function Rt(t,e,n=W,r=w){let a=nt(r);return{rows:(e==="full"?at(t,n):pt(t,e,n)).map(({name:l,role:i,rgb:h,yours:u})=>({name:l,...i?{role:i}:{},steps:J(P(h,r),n.contrast,a),yours:u})),neutral:J(ft(t,n,r),n.contrast,a)}}var R=t=>tt(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),I=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"colour",M='font-family="Inter"',U=t=>`${t[0]?.toUpperCase()??""}${t.slice(1)}`;function st(t){let e=t==="dark";return{ink:e?"#FAFAFA":"#111111",grey:e?"#A1A1AA":"#71717A",edge:e?"#FFFFFF":"#000000",paper:e?"#18181B":"#FFFFFF"}}var xt=`<defs><pattern id="checker" width="16" height="16" patternUnits="userSpaceOnUse"><rect width="16" height="16" fill="#FFFFFF"/><rect width="8" height="8" fill="#E5E5E5"/><rect x="8" y="8" width="8" height="8" fill="#E5E5E5"/></pattern></defs>
4
+ `;function H(t,e,n,r="light",a={}){let{ink:o,grey:s,edge:l,paper:i}=st(r),h=Math.min(n.length,a.perRow??n.length),u=Math.ceil(n.length/Math.max(1,h)),c=h>8?64:104,x=10,m=Math.max(c,...n.map(g=>Math.max(g.name.length*8,Math.ceil(g.value.length*6.5)))),f=c+56,$=48+h*m+Math.max(0,h-1)*x,b=84+u*f,k=c>80?12:10,j=`<text id="title" x="24" y="38" ${M} font-size="15" font-weight="600" fill="${o}">${R(t)}</text><text id="subtitle" x="24" y="58" ${M} font-size="12" fill="${s}">${R(e)}</text>`,C=n.map((g,E)=>`<g id="${I(g.id)}" transform="translate(${24+E%h*(m+x)} ${80+Math.floor(E/h)*f})">`+(g.alpha===void 0?"":`<rect id="checker" width="${c}" height="${c}" rx="${k}" fill="url(#checker)"/>`)+`<rect id="swatch" width="${c}" height="${c}" rx="${k}" fill="${g.hex}"`+(g.alpha===void 0?"":` fill-opacity="${g.alpha.toFixed(3)}"`)+` stroke="${l}" stroke-opacity="0.08"/><text id="name" x="1" y="${c+22}" ${M} font-size="13" font-weight="600" fill="${o}">${R(g.name)}</text><text id="value" x="1" y="${c+40}" ${M} font-size="11" fill="${s}">${R(g.value)}</text></g>`).join(`
5
+ `);return`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${b}" viewBox="0 0 ${$} ${b}">
6
+ `+(n.some(g=>g.alpha!==void 0)?xt:"")+`<g id="${I(t)}">
7
+ <rect id="card" width="${$}" height="${b}" rx="0" fill="${i}"/>
8
+ ${j}
9
+ ${C}
10
+ </g>
11
+ </svg>`}function At(t,e,n="light",r){let a=t.replace(/\.[^.]+$/,""),o=e.length;return H(t,r?`${o} shade${o===1?"":"s"} of ${r}`:`${o} colour${o===1?"":"s"}, most of the image first`,e.map((s,l)=>({id:`${a}-${l+1}`,name:s.hex,value:et(s.rgb),hex:s.hex})),n)}function _(t){if(t.set==="radix")return"Radix 1\u201312";if(t.set==="even")return`${t.start}\u2013${t.end}, ${t.count} even steps`;let e=w;return t.start===e.start&&t.end===e.end?"50\u2013950":`Tailwind ${t.start}\u2013${t.end}`}function Ot(t,e,n="light",r=w){let a=S(t);return H(U(a),`from ${y(t)} \xB7 ${_(r)} in OKLCH`,e.map(o=>({id:`${a}-${o.step}`,name:String(o.step),value:o.hex,hex:o.hex})),n)}function Nt(t,e,n,r=w,a="light"){let{ink:o,grey:s,edge:l,paper:i}=st(a),h=`${U(S(t))} palette`,u=`from ${y(t)} \xB7 ${rt[n]} \xB7 ${_(r)} in OKLCH`,c=[...e.rows.map(p=>({name:p.name,steps:p.steps})),{name:"neutral",steps:e.neutral}],x=c[0]?.steps.map(p=>p.step)??[],m=44,f=6,$=m+10,b=92,k=24+Math.max(92,...c.map(p=>p.name.length*8+12)),j=k+x.length*m+Math.max(0,x.length-1)*f+24,C=Math.max(j,48+Math.ceil(u.length*6.5)),g=b+c.length*$+24+10,E=`<text id="title" x="24" y="38" ${M} font-size="15" font-weight="600" fill="${o}">${R(h)}</text><text id="subtitle" x="24" y="58" ${M} font-size="12" fill="${s}">${R(u)}</text>`,it=x.map((p,A)=>`<text id="step-${p}" x="${k+A*(m+f)+1}" y="${b-10}" ${M} font-size="11" font-weight="600" fill="${s}">${p}</text>`).join(""),lt=c.map((p,A)=>{let V=b+A*$+(A===c.length-1?10:0),X=I(p.name);return`<g id="${X}"><text id="name" x="24" y="${V+m/2+4}" ${M} font-size="13" font-weight="600" fill="${o}">${R(p.name)}</text>`+p.steps.map((Z,ht)=>`<g id="${X}-${Z.step}"><rect id="swatch" x="${k+ht*(m+f)}" y="${V}" width="${m}" height="${m}" rx="8" fill="${Z.hex}" stroke="${l}" stroke-opacity="0.08"/></g>`).join("")+"</g>"}).join(`
12
+ `);return`<svg xmlns="http://www.w3.org/2000/svg" width="${C}" height="${g}" viewBox="0 0 ${C} ${g}">
13
+ <g id="${I(h)}">
14
+ <rect id="card" width="${C}" height="${g}" rx="0" fill="${i}"/>
15
+ ${E}
16
+ <g id="steps">${it}</g>
17
+ ${lt}
18
+ </g>
19
+ </svg>`}function zt(t,e,n,r="light",a=w){return H(`${U(S(t))} neutral`,`from ${y(t)} \xB7 ${n} tint \xB7 ${_(a)} in OKLCH`,e.map(o=>({id:`neutral-${o.step}`,name:String(o.step),value:o.hex,hex:o.hex})),r)}function It(t,e,n,r="light",a=w){let o=S(t);return H(`${U(o)} alpha`,`from ${y(t)} \xB7 over ${n} \xB7 ${_(a)}`,e.map(s=>({id:`${o}-alpha-${s.step}`,name:String(s.step),value:s.hex8,hex:y(s.rgb),alpha:s.a})),r)}export{St as a,rt as b,W as c,Mt as d,Lt as e,Rt as f,H as g,At as h,Ot as i,Nt as j,zt as k,It as l};
@@ -0,0 +1,23 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{c as A}from"./chunk-MF3KKEFB.js";import{b as F}from"./chunk-I25E2XDH.js";import{b as se}from"./chunk-HZDYZ5RD.js";import{a as ae,b as de,d as D}from"./chunk-BSFBZBAI.js";import{c as G}from"./chunk-BWJNZT75.js";import{a as j}from"./chunk-PON65UTS.js";import{i as oe}from"./chunk-KXKQDFHX.js";import{f as ne,g as v,h as te,i as re,j as ie}from"./chunk-NUCGWLOY.js";import{a as ee}from"./chunk-I2LPGKUU.js";import{Aa as O,Da as B,Ea as V,Ga as I,Ha as H,Ja as Z,za as S}from"./chunk-CCNRNCRU.js";import{spawn as xe}from"node:child_process";import{existsSync as M}from"node:fs";import{mkdtemp as K,readFile as _,rm as Y,writeFile as We}from"node:fs/promises";import{tmpdir as q}from"node:os";import{dirname as ye,join as g}from"node:path";import{createInterface as Ce}from"node:readline";import{fileURLToPath as Je}from"node:url";var Ae=(e,n)=>{let t=e[0]+e[2]/2,r=e[1]+e[3]/2;return t>=n[0]&&t<=n[0]+n[2]&&r>=n[1]&&r<=n[1]+n[3]};function Le(e){let n=e.filter(t=>t.kind!=="text").map(t=>t.box);return e.filter(t=>t.kind!=="text"||!n.some(r=>Ae(t.box,r)))}var $e=.002;function fe(e,n){let t=d=>d.box[n],r=d=>d.box[n]+(n===0?d.box[2]:d.box[3]),o=[...e].sort((d,s)=>t(d)-t(s)),i=[],a=-1;for(let d of o){let s=i[i.length-1];s&&t(d)<=a+$e?(s.push(d),a=Math.max(a,r(d))):(i.push([d]),a=r(d))}return i}function Be(e){let n=fe(e,1);if(n.length<2)return;let t=i=>Math.max(...i.map(a=>a.box[1]+a.box[3])),r=i=>Math.min(...i.map(a=>a.box[1])),o=1;for(let i=2;i<n.length;i++){let a=d=>r(n[d]??[])-t(n[d-1]??[]);a(i)>a(o)&&(o=i)}return[n.slice(0,o).flat(),n.slice(o).flat()]}function C(e){if(e.length<=1)return[...e];let n=fe(e,0);if(n.length>1)return n.flatMap(C);let t=Be(e);return t?t.flatMap(C):[...e].sort((r,o)=>r.box[1]-o.box[1]||r.box[0]-o.box[0])}function He(e){let n=[];for(let t of e){let r=n[n.length-1],o=Math.max(t.lineHeight,r?.lineHeight??0);if(!(r!==void 0&&t.box[1]-(r.box[1]+r.box[3])<o&&Math.abs(t.box[0]-r.box[0])<2*o)){n.push({...t});continue}let a=Math.max(r.box[0]+r.box[2],t.box[0]+t.box[2]),d=t.box[1]+t.box[3];n[n.length-1]={...r,text:`${r.text} ${t.text}`,lines:r.lines+1,box:[r.box[0],r.box[1],a-r.box[0],d-r.box[1]]}}return n}function Me(e){let n=e.flatMap(t=>Array(Math.max(1,t.lines)).fill(t.lineHeight));return n.sort((t,r)=>t-r),n[Math.floor(n.length/2)]??0}var Ne=1.2,_e=80,W=e=>e.replace(/\s*\n\s*/g," ").trim();function Oe(e,n,t){if(e.kind==="list")return{kind:"list",ordered:e.items.some(a=>a.marker==="decimal"||a.marker==="lowercase"||a.marker==="uppercase"),items:e.items.map(a=>W(a.text))};if(e.kind==="table"){let a=Math.max(...e.rows.map(d=>d.length));return{kind:"table",rows:e.rows.map(d=>Array.from({length:a},(s,m)=>W(d[m]??"")))}}let r=W(e.text);return!t&&e.lineHeight>=n*Ne&&e.lines===1&&r.length<=_e&&!/[.,;:!?]$/.test(r)?{kind:"heading",level:e.title?1:2,text:r}:{kind:"paragraph",text:r}}function un(e){return e.map(n=>{let t=C(Le(n.blocks.filter(i=>i.kind!=="text"||i.text.trim()!=="")));n.lines&&(t=He(t.filter(i=>i.kind==="text")));let r=t.filter(i=>i.kind==="text"),o=Me(r);return t.map(i=>Oe(i,o,t.length===1))})}var pn=e=>e.some(n=>n.length>0);function J(e){return e.replace(/[\\`*[\]<]/g,n=>`\\${n}`).replace(/(^|[^\p{L}\p{N}])_|_(?=[^\p{L}\p{N}]|$)/gu,n=>n.replace("_","\\_"))}function Ie(e){return e.replace(/^(#|>|[-+](?= )|(?<=^\d+)\.(?= ))/,"\\$1").replace(/^(\d+)\.(?= )/,"$1\\.")}var le=e=>Ie(J(e));function Fe(e){if(e.kind==="heading")return`${"#".repeat(e.level)} ${J(e.text)}`;if(e.kind==="paragraph")return le(e.text);if(e.kind==="list")return e.items.map((i,a)=>`${e.ordered?`${a+1}.`:"-"} ${le(i)}`).join(`
4
+ `);let n=i=>J(i).replace(/\|/g,"\\|"),t=i=>`| ${i.map(n).join(" | ")} |`,[r=[],...o]=e.rows;return[t(r),`| ${r.map(()=>"---").join(" | ")} |`,...o.map(t)].join(`
5
+ `)}var U=e=>e.filter(n=>n.length>0);function ue(e){let n=U(e).map(t=>t.map(Fe).join(`
6
+
7
+ `));return n.length?`${n.join(`
8
+
9
+ ---
10
+
11
+ `)}
12
+ `:""}function je(e){return e.kind==="heading"||e.kind==="paragraph"?e.text:e.kind==="list"?e.items.map((n,t)=>`${e.ordered?`${t+1}.`:"-"} ${n}`).join(`
13
+ `):e.rows.map(n=>n.join(" ")).join(`
14
+ `)}function pe(e){let n=U(e).map(t=>t.map(je).join(`
15
+
16
+ `));return n.length?`${n.join(`
17
+
18
+ `)}
19
+ `:""}var De="table{border-collapse:collapse;width:100%;margin:0 0 8pt}th,td{border:1px solid #c7c7cc;padding:2pt 6pt;text-align:left;vertical-align:top}ol{margin:0 0 8pt}",ce='<p style="margin:0;font-size:5pt">&nbsp;</p>';function Ge(e){if(e.kind==="heading")return`<h${e.level}>${v(e.text)}</h${e.level}>`;if(e.kind==="paragraph")return`<p>${v(e.text)}</p>`;if(e.kind==="list"){let i=e.ordered?"ol":"ul";return`<${i}>${e.items.map(a=>`<li>${v(a)}</li>`).join("")}</${i}>`}let[n=[],...t]=e.rows,r=(i,a)=>`<tr>${i.map(d=>`<${a}>${v(d)}</${a}>`).join("")}</tr>`,o=`<table>${r(n,"th")}${t.map(i=>r(i,"td")).join("")}</table>`;return`${ce}${o}${ce}`}function ge(e,n){let t=U(e).map(r=>r.map(Ge).join(`
20
+ `));return["<!doctype html>",`<html><head><meta charset="utf-8"><title>${v(n)}</title><style>${te}${De}</style></head><body>`,t.join(`
21
+ <hr>
22
+ `),"</body></html>"].join(`
23
+ `)}var N="forge-transcribe",z="forge-transcribe-whisper.mjs",Ue=["darwin","win32","linux"];function ze(e=process.platform,n=["whisper"]){let t=n.includes("whisper")||!n.includes("ffmpeg"),r=n.includes("ffmpeg"),o=[t&&"the whisper extension (forge extensions add whisper, or /extensions)",r&&(e==="darwin"?"ffmpeg (brew install ffmpeg)":e==="win32"?"ffmpeg (winget install ffmpeg)":"ffmpeg on your PATH")].filter(Boolean);return e==="darwin"?`Transcribe on this Mac needs ${o.join(" and ")}.`:e==="win32"?`Transcribe on Windows needs ${o.join(" and ")}.`:e==="linux"?`Transcribe on Linux needs ${o.join(" and ")}.`:"Transcribe needs macOS, Windows or Linux."}function _n(e=process.platform,n=e==="darwin"?"off":"unsupported"){return n==="off"?"Summary and notes need Apple Intelligence, and it is off.":`Summary and notes need Apple Intelligence, which this ${F(e)} does not have.`}function Xe(e){return{apple:[g(e,"helpers",N),g(e,"..","helpers",N),g(e,"..","..","dist","helpers",N)],whisper:[g(e,"helpers",z),g(e,"..","helpers",z),g(e,"..","..","helpers","transcribe",z)]}}function L(e=process.platform,n=process.env){let t=n.FORGE_TRANSCRIBE_HELPER;if(t!==void 0)return M(t)?t.endsWith(".mjs")?{whisper:t}:{apple:t}:{};if(!Ue.includes(e))return{};let r=Xe(ye(Je(import.meta.url))),o=e==="darwin"?r.apple.find(a=>M(a)):void 0,i=r.whisper.find(a=>M(a));return{...o?{apple:o}:{},...i?{whisper:i}:{}}}async function Ke(e){return e.apple!==void 0&&e.whisper===void 0?{path:e.apple,kind:"apple"}:e.apple!==void 0&&await e.appleHears(e.apple).catch(()=>!1)?{path:e.apple,kind:"apple"}:e.whisper===void 0?void 0:{path:e.whisper,kind:"whisper"}}var me=new Map;function $(e,n={}){let{apple:t}=L();if(t===void 0)return Promise.resolve(void 0);let r=`${t}\0${e??""}`,o=n.fresh?void 0:me.get(r);if(o)return o;let i=["status",...e?["--locale",e]:[]],a=R({path:t,kind:"apple"},i,"").catch(()=>{});return me.set(r,a),a}var X;function Ye(){return process.env.FORGE_TRANSCRIBE_HELPER!==void 0&&(X=void 0),X??=Ke({...L(),appleHears:async()=>(await $())?.speech===!0}),X}function qe(e){let{apple:n}=L();if(n===void 0)throw e();return{path:n,kind:"apple"}}async function Qe(){let e={...process.env,FORGE_HELPER_STOP_ON_EOF:"1"};if(!e.FORGE_FFMPEG){let n=await G().catch(()=>{});n&&(e.FORGE_FFMPEG=n.ffmpeg)}if(!e.FORGE_WHISPER_CLI){let n=await A("whisper");n&&(e.FORGE_WHISPER_CLI=n.entry)}if(!e.FORGE_WHISPER_MODEL){let n=await A("whisper"),t=n&&g(ye(n.entry),"model.bin");t&&M(t)&&(e.FORGE_WHISPER_MODEL=t)}return e}var Ve=5e3;async function R(e,n,t,r={}){let{signal:o}=r;if(o?.aborted)throw o.reason??new Error("aborted");let i=e.kind==="whisper",a=i?await Qe():process.env;if(o?.aborted)throw o.reason??new Error("aborted");return new Promise((d,s)=>{let m=/\.[cm]?js$/.test(e.path),[w,h]=m?[process.execPath,[e.path,...n]]:[e.path,n],u=j(xe(w,h,{stdio:[i?"pipe":"ignore","pipe","ignore"],env:a,windowsHide:!0}));u.stdin?.on("error",()=>{});let f,x=!1,P=y=>{x||(x=!0,o?.removeEventListener("abort",T),y())},T=()=>{i&&u.stdin?(u.stdin.end(),setTimeout(()=>u.kill("SIGKILL"),Ve).unref()):u.kill("SIGKILL"),P(()=>s(o?.reason??new Error("aborted")))};o?.addEventListener("abort",T,{once:!0}),Ce({input:u.stdout}).on("line",y=>{let k;try{k=JSON.parse(y)}catch{return}"ok"in k?f=k:r.onLine?.(k)}),u.on("error",y=>P(()=>s(S(t,y)))),u.on("close",()=>P(()=>{if(f===void 0)return s(S(t,new Error(`${N} gave no result`)));if(f.ok===!0)return d(f);s(Ze(String(f.code??""),String(f.message??""),t,n,e.kind))}))})}function Ze(e,n,t,r,o){if(e==="no-sound")return O(t);if(e==="unreadable")return B(t,process.platform,o);if(e==="locale"){let i=r.indexOf("--locale");return V(i>=0?r[i+1]??"this language":`this ${F()}'s language`,process.platform,o)}return e==="unsupported"||e==="runtime"?I(n):S(t,new Error(`${e}: ${n}`))}var en=["whisper","ffmpeg"];async function nn(e={}){let n=L();if(n.apple===void 0&&n.whisper===void 0)return;let t=await $(e.locale,{fresh:!0}),o={read:t?.read===!0||await A("read-text")!==void 0};if(t?.speech===!0)return{speech:!0,hears:"apple",locale:typeof t.locale=="string"?t.locale:null,...Array.isArray(t.locales)?{locales:t.locales.filter(s=>typeof s=="string")}:{},notes:t.notes==="available"||t.notes==="off"?t.notes:"unsupported",...o};if(n.whisper===void 0)return t===void 0?void 0:{speech:!1,locale:null,notes:"unsupported",...o};let i=["status",...e.locale?["--locale",e.locale]:[]],a=await R({path:n.whisper,kind:"whisper"},i,""),d=Array.isArray(a.missing)?en.filter(s=>a.missing.includes(s)):[];return{speech:a.speech===!0,...a.speech===!0?{hears:"whisper"}:{},locale:typeof a.locale=="string"?a.locale:null,notes:"unsupported",...o,...d.length>0?{missing:d}:{}}}async function On(e=process.platform){return e!=="darwin"?!0:(await nn().catch(()=>{}))?.hears!=="apple"}async function In(e=process.platform){if(e!=="darwin")return{hears:!1,reads:!1};let n=await $().catch(()=>{});return{hears:n?.speech===!0,reads:n?.read===!0}}async function Pe(){let e=await Ye();if(e===void 0)throw I(ze());return e}var tn=new Set(["mp4","mov","m4a","mp3","wav","aiff"]);async function ke(e,n){if(e.kind!=="apple")return;let{probe:t}=await import("./registry-DWFV4GBG.js"),r=await t(n).catch(()=>{});if(r===void 0||r.kind!=="media"||tn.has(r.format))return;let o=await G().catch(()=>{});return o?{tools:o}:void 0}async function rn(e,n,t){let r=await K(g(q(),"forge-sound-")),o=()=>Y(r,{recursive:!0,force:!0}),i=g(r,"sound.wav");try{return await new Promise((a,d)=>{let s=j(xe(n,["-nostdin","-v","error","-i",e,"-vn","-ac","1","-ar","16000","-c:a","pcm_s16le",i],{stdio:["ignore","ignore","pipe"],windowsHide:!0})),m="";s.stderr?.setEncoding("utf8").on("data",h=>{m+=h});let w=()=>s.kill("SIGKILL");t?.addEventListener("abort",w,{once:!0}),s.on("error",d),s.on("close",h=>{if(t?.removeEventListener("abort",w),t?.aborted)return d(t.reason??new Error("aborted"));h===0?a():d(S(e,new Error(`ffmpeg: ${m.trim()}`)))})}),{path:i,cleanup:o}}catch(a){throw await o(),a}}async function Fn(e){let n=await Pe(),t=await ke(n,e);if(t){let{probeMedia:o}=await import("./ffmpeg-G4TRWUTV.js"),i=await o(e,t.tools).catch(()=>{});if(i===void 0)throw B(e);if(i.audio===void 0)throw O(e);return{seconds:i.duration}}let r=await R(n,["probe",e],e);return{seconds:Number(r.seconds)}}async function jn(e,n){let t=await Pe(),r=await ke(t,e),o=r?await rn(e,r.tools.ffmpeg,n.signal):void 0;try{return await on(t,o?.path??e,e,n)}finally{await o?.cleanup()}}async function on(e,n,t,r){let o=["run",n,...r.locale?["--locale",r.locale]:[],...r.notes?["--notes"]:[],...r.notes&&r.detail&&r.detail!==se?["--detail",r.detail]:[]],i=await R(e,o,t,{signal:r.signal,onLine:d=>{let s=an(d);s&&r.onEvent?.(s)}}),a=i.segments??[];if(!a.some(d=>/\S/.test(d.text)))throw Z(t);return{locale:String(i.locale),seconds:Number(i.seconds),segments:a,...i.notes?{notes:i.notes}:{}}}function an(e){if(e.event==="model")return{kind:"model",fraction:Number(e.fraction)};if(e.event==="heard")return{kind:"heard",seconds:Number(e.seconds),of:Number(e.of)};if(e.event==="notes")return{kind:"notes",part:Number(e.part),of:Number(e.of)}}async function sn(e){let n=await _(e).catch(()=>{});if(n?.subarray(0,5).toString("latin1")!=="%PDF-")return;let[{pdfTextLayer:t},{layerPage:r}]=await Promise.all([import("./pdfium-MHPBLZY5.js"),import("./text-layer-PFIDCTEL.js")]);return(await t(n).catch(()=>{}))?.map(r)}function he(e,n,t){let r=(o,i)=>(t.length===e.length?t[o]:t[i])??{blocks:[]};return e.map((o,i)=>o??r(i,n.indexOf(i)))}async function Dn(e,n={}){let t=await sn(e);if(t&&t.length>0&&t.every(s=>s!==void 0))return t;let r=t?.flatMap((s,m)=>s===void 0?[m]:[])??[],o=t!==void 0&&r.length<t.length;if((await $())?.read!==!0){let s=await ln(e,{...n,...o?{pages:r}:{}});return t&&o?he(t,r,s):s}let i=["read",e,...o?["--pages",r.map(s=>s+1).join(",")]:[],...n.language?["--language",n.language]:[]],d=(await R(qe(H),i,e,{signal:n.signal,onLine:s=>{s.event==="page"&&n.onEvent?.({kind:"page",page:Number(s.page),of:Number(s.of)})}})).pages??[];return t&&o?he(t,r,d):d}var dn=200,we=4e3;async function Gn(){return H(await Ee())}async function Ee(){let{catalogEntry:e,assetFor:n}=await import("./catalog-FMHWWMUX.js"),t=e("read-text");return t!==void 0&&n(t)!==void 0}async function ln(e,n){let t=await A("read-text");if(t===void 0)throw H(await Ee());let[{probe:r},{decodedInput:o},{loadSharp:i},{runExtension:a}]=await Promise.all([import("./registry-DWFV4GBG.js"),import("./decoded-SK6W44WW.js"),import("./libs-EK64ACG3.js"),import("./run-3DX3SROY.js")]),d=await i(),s=await r(e),m=await K(g(q(),"forge-read-")),w={width:we,height:we,fit:"inside",withoutEnlargement:!0};try{let h=[],u=s.kind==="document"&&s.format==="pdf",f=u?n.pages??Array.from({length:s.pages},(c,l)=>l):[0];if(s.kind==="document"&&s.format==="pdf"){let{openPdf:c}=await import("./pdfium-MHPBLZY5.js"),l=await c(await _(e));try{for(let p of f){let E=await l.getPage(p).render({scale:dn/72,render:"bitmap"}),b=g(m,`page-${p+1}.png`);await d(Buffer.from(E.data),{raw:{width:E.width,height:E.height,channels:4}}).flatten({background:"#ffffff"}).resize(w).png().toFile(b),h.push(b)}}finally{l.destroy()}}else if(s.kind==="image"){let c=g(m,"page-1.png");await d(await o(e,s.format)).rotate().flatten({background:"#ffffff"}).resize(w).png().toFile(c),h.push(c)}else throw B(e);let P=(await a({id:"read-text",entry:t.entry,kind:t.kind},h.flatMap(c=>["--in",c]),{subject:e,what:`Reading the text of ${e}`,...n.signal?{signal:n.signal}:{},onLine:c=>{if(c.event!=="page")return;let l=u?(f[Number(c.page)-1]??0)+1:Number(c.page);n.onEvent?.({kind:"page",page:l,of:u?s.pages:Number(c.of)})}})).pages??[];if(!u)return P;let[{extractPdfText:T},{mendPage:y}]=await Promise.all([import("./pdfium-MHPBLZY5.js"),import("./text-layer-PFIDCTEL.js")]),k=await T(await _(e)).catch(()=>[]);return P.map((c,l)=>y(c,k[f[l]??l]??""))}finally{await Y(m,{recursive:!0,force:!0})}}async function ve(){let{apple:e}=L();if(!(e===void 0||await $()===void 0))return{path:e,kind:"apple"}}async function Re(e,n,t,r){let o=await K(g(q(),"forge-render-"));try{let i=g(o,"transcript.html"),a=g(o,`transcript.${t}`);return await We(i,n,"utf8"),await R(e,["render",i,a,"--as",t],a,{signal:r.signal}),await _(a)}finally{await Y(o,{recursive:!0,force:!0})}}var be=9026;async function Te(e,n){let t=await oe(),{Document:r,Packer:o,Paragraph:i,TextRun:a,Table:d,TableRow:s,TableCell:m,HeadingLevel:w}=t,h="forge-numbers",u=0,f=(c,l=!1)=>de(c,n).map(p=>new a({text:ee(p.text),...l?{bold:!0}:{},...p.kind==="eastAsia"?{font:{hint:"eastAsia"},language:p.lang?{eastAsia:p.lang}:{}}:{},...p.kind==="complex"?{font:{hint:"cs"},...p.rtl?{rightToLeft:!0}:{},...l?{boldComplexScript:!0}:{},...p.lang?{language:{bidirectional:p.lang}}:{}}:{}})),x=c=>ae(c)?{bidirectional:!0}:{},P=c=>c.flatMap(l=>{if(l.kind==="heading")return[new i({children:f(l.text),heading:l.level===1?w.HEADING_1:w.HEADING_2,...x(l.text)})];if(l.kind==="paragraph")return[new i({children:f(l.text),spacing:{after:160},...x(l.text)})];if(l.kind==="list"){let E=++u;return l.items.map(b=>l.ordered?new i({children:f(b),numbering:{reference:h,level:0,instance:E},...x(b)}):new i({children:f(b),bullet:{level:0},...x(b)}))}let p=l.rows[0]?.length??1;return[new d({width:{size:100,type:t.WidthType.PERCENTAGE},columnWidths:Array(p).fill(Math.floor(be/p)),margins:{top:40,bottom:40,left:100,right:100},rows:l.rows.map((E,b)=>new s({tableHeader:b===0,children:E.map(Q=>new m({width:{size:Math.floor(be/p),type:t.WidthType.DXA},children:[new i({children:f(Q,b===0),...x(Q)})]}))}))}),new i({text:""})]}),y=e.filter(c=>c.length>0).flatMap((c,l)=>[...l>0?[new i({children:[new t.PageBreak]})]:[],...P(c)]),k=new r({numbering:{config:[{reference:h,levels:[{level:0,format:t.LevelFormat.DECIMAL,text:"%1.",alignment:t.AlignmentType.START}]}]},sections:[{children:y}]});return o.toBuffer(k)}var Se=e=>({...e.lang!==void 0?{lang:e.lang}:{},...e.onMissing!==void 0?{onMissing:e.onMissing}:{}});async function Wn(e,n,t,r={}){if(n==="md")return Buffer.from(ue(e),"utf8");if(n==="txt")return Buffer.from(pe(e),"utf8");if(n==="docx")return Te(e,r.lang);let o=await ve();return o?Re(o,ge(e,t),"pdf",r):D(e,{title:t,...Se(r)})}function cn(e){for(let n of e.flat())if(n.kind==="heading"&&n.level===1)return n.text;return"Transcript"}async function Cn(e,n,t={}){if(n==="md")return Buffer.from(e,"utf8");if(n==="txt")return Buffer.from(ne(e),"utf8");let r=await ve();if(r)return Re(r,ie(e),n,t);let o=re(e);return n==="docx"?Te(o,t.lang):D(o,{title:cn(o),...Se(t)})}export{un as a,pn as b,ue as c,pe as d,ge as e,ze as f,_n as g,Xe as h,L as i,Ke as j,nn as k,On as l,In as m,Fn as n,jn as o,Dn as p,Gn as q,Wn as r,Cn as s};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{c as O}from"./chunk-UUTBDIFR.js";import{a as E}from"./chunk-PON65UTS.js";import{ha as k,ia as P,ja as L,za as b}from"./chunk-CCNRNCRU.js";import{spawn as N}from"node:child_process";var A=new Map;function q(e,n,t={}){let r=()=>(t.onStart?.(),e.serve?C(e,n,t):$(e,n,t)),o=(t.platform??process.platform)==="darwin"?void 0:e.id,s=(A.get(o)??Promise.resolve()).then(()=>e.id===void 0?r():O(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 A.set(o,s.catch(()=>{})),s}function J(e){let n=e.indexOf("--in");return(n>=0?e[n+1]:e[0])??""}function W(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 F(e,n,t,r,o,i){return e==="no-subject"?k(t):e==="boost-too-large"?P(t,r.maxScale??0):e==="boost-too-slow"?L(t,i??0,Number(o[o.indexOf("--scale")+1])):b(t,new Error(n))}function T(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 I(e,n,t,r){return F(String(e.code??""),String(e.message??""),n,t,r,typeof e.seconds=="number"?e.seconds:void 0)}function $(e,n,t){let{signal:r}=t,o=t.subject??J(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=E(N(f,w,{stdio:["ignore","pipe","pipe"]})),m="",d="",g=!1,a=u=>{g||(g=!0,r?.removeEventListener("abort",R),u())},R=()=>l.kill("SIGKILL");l.on("exit",()=>{r?.aborted&&a(()=>s(r.reason??new Error("aborted")))}),r?.addEventListener("abort",R,{once:!0});let S="";l.stdout.setEncoding("utf8").on("data",u=>{if(m+=u,!t.onProgress&&!t.onLine)return;let v=(S+u).split(`
4
+ `);S=v.pop()??"";for(let h of v){let c=W(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=m.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(T(c));if(c&&c.ok===!1)return s(I(c,o,t,n));s(b(o,new Error(`extension exited ${u} without a result: ${(d||m).trim().slice(-500)}`)))}))})}var M=5e3,x=class{constructor(n){this.ext=n;let[t,r]=n.kind==="node"?[process.execPath,[n.entry,"--serve"]]:[n.entry,["--serve"]];this.child=E(N(t,r,{stdio:["pipe","pipe","pipe"]}),{pooled:!0});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 j(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 x(e);return p.set(e.entry,t),t}async function D(e){await Promise.all([...p.values()].filter(n=>(e===void 0||n.ext.id===e)&&!n.listener).map(n=>n.close()))}function C(e,n,t){let{signal:r}=t,o=t.subject??J(n);if(r?.aborted)return Promise.reject(r.reason??new Error("aborted"));let i=j(e);return new Promise((s,f)=>{let w=!1,l=d=>{w||(w=!0,r?.removeEventListener("abort",m),d())},m=()=>i.child.kill("SIGKILL");r?.addEventListener("abort",m,{once:!0}),i.hold({line(d){let g=W(d);if(g)return t.onProgress?.(g.done,g.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??M),a.ok===!0?s(T(a)):f(I(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{q as a,D as b};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ var n=new RegExp("[^\\P{Cc}\\t\\n\\r\\u{7F}-\\u{9F}]|[\\u{FFFE}\\u{FFFF}]|\\p{Cs}","gu");function r(F){return F.replace(n,"")}export{r as a};