mdast2docx 0.3.6 → 0.4.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.
@@ -1 +1 @@
1
- import{a,b}from"../../chunk-NMFJ4KIZ.mjs";import"../../chunk-KWOFOD3W.mjs";export{a as SUPPORTED_IMAGE_TYPES,b as nodeImagePlugin};
1
+ import{a,b}from"../../chunk-UK2VDQ4V.mjs";import"../../chunk-KWOFOD3W.mjs";export{a as SUPPORTED_IMAGE_TYPES,b as nodeImagePlugin};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "mdast2docx",
3
3
  "author": "Mayank Kumar Chaudhari (https://mayank-chaudhari.vercel.app)",
4
4
  "private": false,
5
- "version": "0.3.6",
5
+ "version": "0.4.0",
6
6
  "description": "Convert Markdown Abstract Syntax Tree (MDAST) to DOCX seamlessly. Supports footnotes, images, links, and customizable document properties.",
7
7
  "license": "MPL-2.0",
8
8
  "main": "./dist/index.js",
@@ -54,28 +54,29 @@
54
54
  "devDependencies": {
55
55
  "@repo/eslint-config": "workspace:*",
56
56
  "@repo/typescript-config": "workspace:*",
57
- "@types/node": "^22.13.14",
57
+ "@types/node": "^22.14.0",
58
58
  "@types/unist": "^3.0.3",
59
- "@vitest/coverage-v8": "^3.0.9",
59
+ "@vitest/coverage-v8": "^3.1.1",
60
60
  "esbuild-plugin-rdi": "^0.0.0",
61
61
  "jsdom": "^26.0.0",
62
62
  "node-fetch": "^3.3.2",
63
63
  "remark-gfm": "^4.0.1",
64
64
  "remark-parse": "^11.0.0",
65
- "sharp": "0.33.5",
65
+ "sharp": "0.34.1",
66
66
  "tsup": "^8.4.0",
67
- "typescript": "^5.8.2",
67
+ "typescript": "^5.8.3",
68
68
  "unified": "^11.0.5",
69
69
  "vite-tsconfig-paths": "^5.1.4",
70
- "vitest": "^3.0.9"
70
+ "vitest": "^3.1.1"
71
71
  },
72
72
  "dependencies": {
73
- "@m2d/core": "^0.0.3",
73
+ "@m2d/core": "^0.0.4",
74
74
  "@m2d/emoji": "^0.1.0",
75
- "@m2d/html": "^0.0.3",
76
- "@m2d/image": "^0.0.3",
75
+ "@m2d/html": "^1.0.0",
76
+ "@m2d/image": "^0.0.4",
77
77
  "@m2d/list": "^0.0.3",
78
78
  "@m2d/math": "^0.0.3",
79
+ "@m2d/mermaid": "^0.0.2",
79
80
  "@m2d/table": "^0.0.3",
80
81
  "docx": "^9.3.0"
81
82
  },
@@ -1,4 +0,0 @@
1
- import{a as R,b as y,c as Gn,d as mr,f as Le,g as Vr}from"./chunk-KWOFOD3W.mjs";var J=y((bc,Qr)=>{"use strict";var Xr=function(e){return typeof e!="undefined"&&e!==null},Hn=function(e){return typeof e=="object"},Wn=function(e){return Object.prototype.toString.call(e)==="[object Object]"},Vn=function(e){return typeof e=="function"},Xn=function(e){return typeof e=="boolean"},Qn=function(e){return e instanceof Buffer},Jn=function(e){if(Xr(e))switch(e.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},Kn=function(e){return e instanceof ArrayBuffer},Yn=function(e){return typeof e=="string"&&e.length>0},Zn=function(e){return typeof e=="number"&&!Number.isNaN(e)},es=function(e){return Number.isInteger(e)},rs=function(e,r,t){return e>=r&&e<=t},ts=function(e,r){return r.includes(e)},is=function(e,r,t){return new Error(`Expected ${r} for ${e} but received ${t} of type ${typeof t}`)},ns=function(e,r){return r.message=e.message,r};Qr.exports={defined:Xr,object:Hn,plainObject:Wn,fn:Vn,bool:Xn,buffer:Qn,typedArray:Jn,arrayBuffer:Kn,string:Yn,number:Zn,integer:es,inRange:rs,inArray:ts,invalidParameterError:is,nativeError:ns}});var Yr=y((wc,Kr)=>{"use strict";var Jr=()=>process.platform==="linux",Me=null,ss=()=>{if(!Me)if(Jr()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,Me=process.report.getReport(),process.report.excludeNetwork=e}else Me={};return Me};Kr.exports={isLinux:Jr,getReport:ss}});var rt=y((yc,et)=>{"use strict";var Zr=R("fs"),as="/usr/bin/ldd",os=e=>Zr.readFileSync(e,"utf-8"),ls=e=>new Promise((r,t)=>{Zr.readFile(e,"utf-8",(i,n)=>{i?t(i):r(n)})});et.exports={LDD_PATH:as,readFileSync:os,readFile:ls}});var _e=y((Ec,wt)=>{"use strict";var it=R("child_process"),{isLinux:be,getReport:nt}=Yr(),{LDD_PATH:De,readFile:st,readFileSync:at}=rt(),K,Y,ot="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",ae="",lt=()=>ae||new Promise(e=>{it.exec(ot,(r,t)=>{ae=r?" ":t,e(ae)})}),ct=()=>{if(!ae)try{ae=it.execSync(ot,{encoding:"utf8"})}catch{ae=" "}return ae},oe="glibc",ft=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,pe="musl",cs=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),ht=()=>{let e=nt();return e.header&&e.header.glibcVersionRuntime?oe:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(cs)?pe:null},ut=e=>{let[r,t]=e.split(/[\r\n]+/);return r&&r.includes(oe)?oe:t&&t.includes(pe)?pe:null},dt=e=>e.includes("musl")?pe:e.includes("GNU C Library")?oe:null,fs=async()=>{if(K!==void 0)return K;K=null;try{let e=await st(De);K=dt(e)}catch{}return K},hs=()=>{if(K!==void 0)return K;K=null;try{let e=at(De);K=dt(e)}catch{}return K},mt=async()=>{let e=null;if(be()&&(e=await fs(),e||(e=ht()),!e)){let r=await lt();e=ut(r)}return e},gt=()=>{let e=null;if(be()&&(e=hs(),e||(e=ht()),!e)){let r=ct();e=ut(r)}return e},us=async()=>be()&&await mt()!==oe,ds=()=>be()&&gt()!==oe,ms=async()=>{if(Y!==void 0)return Y;Y=null;try{let r=(await st(De)).match(ft);r&&(Y=r[1])}catch{}return Y},gs=()=>{if(Y!==void 0)return Y;Y=null;try{let r=at(De).match(ft);r&&(Y=r[1])}catch{}return Y},pt=()=>{let e=nt();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},tt=e=>e.trim().split(/\s+/)[1],bt=e=>{let[r,t,i]=e.split(/[\r\n]+/);return r&&r.includes(oe)?tt(r):t&&i&&t.includes(pe)?tt(i):null},ps=async()=>{let e=null;if(be()&&(e=await ms(),e||(e=pt()),!e)){let r=await lt();e=bt(r)}return e},bs=()=>{let e=null;if(be()&&(e=gs(),e||(e=pt()),!e)){let r=ct();e=bt(r)}return e};wt.exports={GLIBC:oe,MUSL:pe,family:mt,familySync:gt,isNonGlibcLinux:us,isNonGlibcLinuxSync:ds,version:ps,versionSync:bs}});var Te=y((vc,yt)=>{"use strict";var ws=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};yt.exports=ws});var ze=y((xc,Et)=>{"use strict";var ys="2.0.0",Es=Number.MAX_SAFE_INTEGER||9007199254740991,vs=16,xs=250,Ps=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Et.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:vs,MAX_SAFE_BUILD_LENGTH:xs,MAX_SAFE_INTEGER:Es,RELEASE_TYPES:Ps,SEMVER_SPEC_VERSION:ys,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var ke=y((Z,vt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:gr,MAX_SAFE_BUILD_LENGTH:Rs,MAX_LENGTH:Is}=ze(),Ss=Te();Z=vt.exports={};var As=Z.re=[],$s=Z.safeRe=[],d=Z.src=[],Ls=Z.safeSrc=[],m=Z.t={},Ts=0,pr="[a-zA-Z0-9-]",ks=[["\\s",1],["\\d",Is],[pr,Rs]],js=e=>{for(let[r,t]of ks)e=e.split(`${r}*`).join(`${r}{0,${t}}`).split(`${r}+`).join(`${r}{1,${t}}`);return e},E=(e,r,t)=>{let i=js(r),n=Ts++;Ss(e,n,r),m[e]=n,d[n]=r,Ls[n]=i,As[n]=new RegExp(r,t?"g":void 0),$s[n]=new RegExp(i,t?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*");E("NUMERICIDENTIFIERLOOSE","\\d+");E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${pr}*`);E("MAINVERSION",`(${d[m.NUMERICIDENTIFIER]})\\.(${d[m.NUMERICIDENTIFIER]})\\.(${d[m.NUMERICIDENTIFIER]})`);E("MAINVERSIONLOOSE",`(${d[m.NUMERICIDENTIFIERLOOSE]})\\.(${d[m.NUMERICIDENTIFIERLOOSE]})\\.(${d[m.NUMERICIDENTIFIERLOOSE]})`);E("PRERELEASEIDENTIFIER",`(?:${d[m.NUMERICIDENTIFIER]}|${d[m.NONNUMERICIDENTIFIER]})`);E("PRERELEASEIDENTIFIERLOOSE",`(?:${d[m.NUMERICIDENTIFIERLOOSE]}|${d[m.NONNUMERICIDENTIFIER]})`);E("PRERELEASE",`(?:-(${d[m.PRERELEASEIDENTIFIER]}(?:\\.${d[m.PRERELEASEIDENTIFIER]})*))`);E("PRERELEASELOOSE",`(?:-?(${d[m.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[m.PRERELEASEIDENTIFIERLOOSE]})*))`);E("BUILDIDENTIFIER",`${pr}+`);E("BUILD",`(?:\\+(${d[m.BUILDIDENTIFIER]}(?:\\.${d[m.BUILDIDENTIFIER]})*))`);E("FULLPLAIN",`v?${d[m.MAINVERSION]}${d[m.PRERELEASE]}?${d[m.BUILD]}?`);E("FULL",`^${d[m.FULLPLAIN]}$`);E("LOOSEPLAIN",`[v=\\s]*${d[m.MAINVERSIONLOOSE]}${d[m.PRERELEASELOOSE]}?${d[m.BUILD]}?`);E("LOOSE",`^${d[m.LOOSEPLAIN]}$`);E("GTLT","((?:<|>)?=?)");E("XRANGEIDENTIFIERLOOSE",`${d[m.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);E("XRANGEIDENTIFIER",`${d[m.NUMERICIDENTIFIER]}|x|X|\\*`);E("XRANGEPLAIN",`[v=\\s]*(${d[m.XRANGEIDENTIFIER]})(?:\\.(${d[m.XRANGEIDENTIFIER]})(?:\\.(${d[m.XRANGEIDENTIFIER]})(?:${d[m.PRERELEASE]})?${d[m.BUILD]}?)?)?`);E("XRANGEPLAINLOOSE",`[v=\\s]*(${d[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[m.XRANGEIDENTIFIERLOOSE]})(?:${d[m.PRERELEASELOOSE]})?${d[m.BUILD]}?)?)?`);E("XRANGE",`^${d[m.GTLT]}\\s*${d[m.XRANGEPLAIN]}$`);E("XRANGELOOSE",`^${d[m.GTLT]}\\s*${d[m.XRANGEPLAINLOOSE]}$`);E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${gr}})(?:\\.(\\d{1,${gr}}))?(?:\\.(\\d{1,${gr}}))?`);E("COERCE",`${d[m.COERCEPLAIN]}(?:$|[^\\d])`);E("COERCEFULL",d[m.COERCEPLAIN]+`(?:${d[m.PRERELEASE]})?(?:${d[m.BUILD]})?(?:$|[^\\d])`);E("COERCERTL",d[m.COERCE],!0);E("COERCERTLFULL",d[m.COERCEFULL],!0);E("LONETILDE","(?:~>?)");E("TILDETRIM",`(\\s*)${d[m.LONETILDE]}\\s+`,!0);Z.tildeTrimReplace="$1~";E("TILDE",`^${d[m.LONETILDE]}${d[m.XRANGEPLAIN]}$`);E("TILDELOOSE",`^${d[m.LONETILDE]}${d[m.XRANGEPLAINLOOSE]}$`);E("LONECARET","(?:\\^)");E("CARETTRIM",`(\\s*)${d[m.LONECARET]}\\s+`,!0);Z.caretTrimReplace="$1^";E("CARET",`^${d[m.LONECARET]}${d[m.XRANGEPLAIN]}$`);E("CARETLOOSE",`^${d[m.LONECARET]}${d[m.XRANGEPLAINLOOSE]}$`);E("COMPARATORLOOSE",`^${d[m.GTLT]}\\s*(${d[m.LOOSEPLAIN]})$|^$`);E("COMPARATOR",`^${d[m.GTLT]}\\s*(${d[m.FULLPLAIN]})$|^$`);E("COMPARATORTRIM",`(\\s*)${d[m.GTLT]}\\s*(${d[m.LOOSEPLAIN]}|${d[m.XRANGEPLAIN]})`,!0);Z.comparatorTrimReplace="$1$2$3";E("HYPHENRANGE",`^\\s*(${d[m.XRANGEPLAIN]})\\s+-\\s+(${d[m.XRANGEPLAIN]})\\s*$`);E("HYPHENRANGELOOSE",`^\\s*(${d[m.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[m.XRANGEPLAINLOOSE]})\\s*$`);E("STAR","(<|>)?=?\\s*\\*");E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Ue=y((Pc,xt)=>{"use strict";var Ns=Object.freeze({loose:!0}),Fs=Object.freeze({}),Os=e=>e?typeof e!="object"?Ns:e:Fs;xt.exports=Os});var St=y((Rc,It)=>{"use strict";var Pt=/^[0-9]+$/,Rt=(e,r)=>{let t=Pt.test(e),i=Pt.test(r);return t&&i&&(e=+e,r=+r),e===r?0:t&&!i?-1:i&&!t?1:e<r?-1:1},Cs=(e,r)=>Rt(r,e);It.exports={compareIdentifiers:Rt,rcompareIdentifiers:Cs}});var ye=y((Ic,Tt)=>{"use strict";var Ge=Te(),{MAX_LENGTH:At,MAX_SAFE_INTEGER:He}=ze(),{safeRe:$t,safeSrc:Lt,t:We}=ke(),Bs=Ue(),{compareIdentifiers:we}=St(),br=class e{constructor(r,t){if(t=Bs(t),r instanceof e){if(r.loose===!!t.loose&&r.includePrerelease===!!t.includePrerelease)return r;r=r.version}else if(typeof r!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof r}".`);if(r.length>At)throw new TypeError(`version is longer than ${At} characters`);Ge("SemVer",r,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let i=r.trim().match(t.loose?$t[We.LOOSE]:$t[We.FULL]);if(!i)throw new TypeError(`Invalid Version: ${r}`);if(this.raw=r,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>He||this.major<0)throw new TypeError("Invalid major version");if(this.minor>He||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>He||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s<He)return s}return n}):this.prerelease=[],this.build=i[5]?i[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(r){if(Ge("SemVer.compare",this.version,this.options,r),!(r instanceof e)){if(typeof r=="string"&&r===this.version)return 0;r=new e(r,this.options)}return r.version===this.version?0:this.compareMain(r)||this.comparePre(r)}compareMain(r){return r instanceof e||(r=new e(r,this.options)),we(this.major,r.major)||we(this.minor,r.minor)||we(this.patch,r.patch)}comparePre(r){if(r instanceof e||(r=new e(r,this.options)),this.prerelease.length&&!r.prerelease.length)return-1;if(!this.prerelease.length&&r.prerelease.length)return 1;if(!this.prerelease.length&&!r.prerelease.length)return 0;let t=0;do{let i=this.prerelease[t],n=r.prerelease[t];if(Ge("prerelease compare",t,i,n),i===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(i===void 0)return-1;if(i===n)continue;return we(i,n)}while(++t)}compareBuild(r){r instanceof e||(r=new e(r,this.options));let t=0;do{let i=this.build[t],n=r.build[t];if(Ge("build compare",t,i,n),i===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(i===void 0)return-1;if(i===n)continue;return we(i,n)}while(++t)}inc(r,t,i){if(r.startsWith("pre")){if(!t&&i===!1)throw new Error("invalid increment argument: identifier is empty");if(t){let n=new RegExp(`^${this.options.loose?Lt[We.PRERELEASELOOSE]:Lt[We.PRERELEASE]}$`),s=`-${t}`.match(n);if(!s||s[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(r){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,i),this.inc("pre",t,i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t,i),this.inc("pre",t,i);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let n=Number(i)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(t===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let s=[t,n];i===!1&&(s=[t]),we(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${r}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Tt.exports=br});var Nt=y((Sc,jt)=>{"use strict";var kt=ye(),qs=(e,r,t=!1)=>{if(e instanceof kt)return e;try{return new kt(e,r)}catch(i){if(!t)return null;throw i}};jt.exports=qs});var Ot=y((Ac,Ft)=>{"use strict";var Ms=ye(),Ds=Nt(),{safeRe:Ve,t:Xe}=ke(),_s=(e,r)=>{if(e instanceof Ms)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;r=r||{};let t=null;if(!r.rtl)t=e.match(r.includePrerelease?Ve[Xe.COERCEFULL]:Ve[Xe.COERCE]);else{let f=r.includePrerelease?Ve[Xe.COERCERTLFULL]:Ve[Xe.COERCERTL],u;for(;(u=f.exec(e))&&(!t||t.index+t[0].length!==e.length);)(!t||u.index+u[0].length!==t.index+t[0].length)&&(t=u),f.lastIndex=u.index+u[1].length+u[2].length;f.lastIndex=-1}if(t===null)return null;let i=t[2],n=t[3]||"0",s=t[4]||"0",o=r.includePrerelease&&t[5]?`-${t[5]}`:"",l=r.includePrerelease&&t[6]?`+${t[6]}`:"";return Ds(`${i}.${n}.${s}${o}${l}`,r)};Ft.exports=_s});var ue=y(($c,Bt)=>{"use strict";var Ct=ye(),zs=(e,r,t)=>new Ct(e,t).compare(new Ct(r,t));Bt.exports=zs});var wr=y((Lc,qt)=>{"use strict";var Us=ue(),Gs=(e,r,t)=>Us(e,r,t)>=0;qt.exports=Gs});var Dt=y((Tc,Mt)=>{"use strict";var yr=class{constructor(){this.max=1e3,this.map=new Map}get(r){let t=this.map.get(r);if(t!==void 0)return this.map.delete(r),this.map.set(r,t),t}delete(r){return this.map.delete(r)}set(r,t){if(!this.delete(r)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(r,t)}return this}};Mt.exports=yr});var zt=y((kc,_t)=>{"use strict";var Hs=ue(),Ws=(e,r,t)=>Hs(e,r,t)===0;_t.exports=Ws});var Gt=y((jc,Ut)=>{"use strict";var Vs=ue(),Xs=(e,r,t)=>Vs(e,r,t)!==0;Ut.exports=Xs});var Wt=y((Nc,Ht)=>{"use strict";var Qs=ue(),Js=(e,r,t)=>Qs(e,r,t)>0;Ht.exports=Js});var Xt=y((Fc,Vt)=>{"use strict";var Ks=ue(),Ys=(e,r,t)=>Ks(e,r,t)<0;Vt.exports=Ys});var Jt=y((Oc,Qt)=>{"use strict";var Zs=ue(),ea=(e,r,t)=>Zs(e,r,t)<=0;Qt.exports=ea});var Yt=y((Cc,Kt)=>{"use strict";var ra=zt(),ta=Gt(),ia=Wt(),na=wr(),sa=Xt(),aa=Jt(),oa=(e,r,t,i)=>{switch(r){case"===":return typeof e=="object"&&(e=e.version),typeof t=="object"&&(t=t.version),e===t;case"!==":return typeof e=="object"&&(e=e.version),typeof t=="object"&&(t=t.version),e!==t;case"":case"=":case"==":return ra(e,t,i);case"!=":return ta(e,t,i);case">":return ia(e,t,i);case">=":return na(e,t,i);case"<":return sa(e,t,i);case"<=":return aa(e,t,i);default:throw new TypeError(`Invalid operator: ${r}`)}};Kt.exports=oa});var si=y((Bc,ni)=>{"use strict";var je=Symbol("SemVer ANY"),xr=class e{static get ANY(){return je}constructor(r,t){if(t=Zt(t),r instanceof e){if(r.loose===!!t.loose)return r;r=r.value}r=r.trim().split(/\s+/).join(" "),vr("comparator",r,t),this.options=t,this.loose=!!t.loose,this.parse(r),this.semver===je?this.value="":this.value=this.operator+this.semver.version,vr("comp",this)}parse(r){let t=this.options.loose?ei[ri.COMPARATORLOOSE]:ei[ri.COMPARATOR],i=r.match(t);if(!i)throw new TypeError(`Invalid comparator: ${r}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new ti(i[2],this.options.loose):this.semver=je}toString(){return this.value}test(r){if(vr("Comparator.test",r,this.options.loose),this.semver===je||r===je)return!0;if(typeof r=="string")try{r=new ti(r,this.options)}catch{return!1}return Er(r,this.operator,this.semver,this.options)}intersects(r,t){if(!(r instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new ii(r.value,t).test(this.value):r.operator===""?r.value===""?!0:new ii(this.value,t).test(r.semver):(t=Zt(t),t.includePrerelease&&(this.value==="<0.0.0-0"||r.value==="<0.0.0-0")||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||r.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&r.operator.startsWith(">")||this.operator.startsWith("<")&&r.operator.startsWith("<")||this.semver.version===r.semver.version&&this.operator.includes("=")&&r.operator.includes("=")||Er(this.semver,"<",r.semver,t)&&this.operator.startsWith(">")&&r.operator.startsWith("<")||Er(this.semver,">",r.semver,t)&&this.operator.startsWith("<")&&r.operator.startsWith(">")))}};ni.exports=xr;var Zt=Ue(),{safeRe:ei,t:ri}=ke(),Er=Yt(),vr=Te(),ti=ye(),ii=Pr()});var Pr=y((qc,ci)=>{"use strict";var la=/\s+/g,Rr=class e{constructor(r,t){if(t=fa(t),r instanceof e)return r.loose===!!t.loose&&r.includePrerelease===!!t.includePrerelease?r:new e(r.raw,t);if(r instanceof Ir)return this.raw=r.value,this.set=[[r]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=r.trim().replace(la," "),this.set=this.raw.split("||").map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(n=>!oi(n[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&ba(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let r=0;r<this.set.length;r++){r>0&&(this.formatted+="||");let t=this.set[r];for(let i=0;i<t.length;i++)i>0&&(this.formatted+=" "),this.formatted+=t[i].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(r){let i=((this.options.includePrerelease&&ga)|(this.options.loose&&pa))+":"+r,n=ai.get(i);if(n)return n;let s=this.options.loose,o=s?C[N.HYPHENRANGELOOSE]:C[N.HYPHENRANGE];r=r.replace(o,Aa(this.options.includePrerelease)),P("hyphen replace",r),r=r.replace(C[N.COMPARATORTRIM],ua),P("comparator trim",r),r=r.replace(C[N.TILDETRIM],da),P("tilde trim",r),r=r.replace(C[N.CARETTRIM],ma),P("caret trim",r);let l=r.split(" ").map(w=>wa(w,this.options)).join(" ").split(/\s+/).map(w=>Sa(w,this.options));s&&(l=l.filter(w=>(P("loose invalid filter",w,this.options),!!w.match(C[N.COMPARATORLOOSE])))),P("range list",l);let f=new Map,u=l.map(w=>new Ir(w,this.options));for(let w of u){if(oi(w))return[w];f.set(w.value,w)}f.size>1&&f.has("")&&f.delete("");let b=[...f.values()];return ai.set(i,b),b}intersects(r,t){if(!(r instanceof e))throw new TypeError("a Range is required");return this.set.some(i=>li(i,t)&&r.set.some(n=>li(n,t)&&i.every(s=>n.every(o=>s.intersects(o,t)))))}test(r){if(!r)return!1;if(typeof r=="string")try{r=new ha(r,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if($a(this.set[t],r,this.options))return!0;return!1}};ci.exports=Rr;var ca=Dt(),ai=new ca,fa=Ue(),Ir=si(),P=Te(),ha=ye(),{safeRe:C,t:N,comparatorTrimReplace:ua,tildeTrimReplace:da,caretTrimReplace:ma}=ke(),{FLAG_INCLUDE_PRERELEASE:ga,FLAG_LOOSE:pa}=ze(),oi=e=>e.value==="<0.0.0-0",ba=e=>e.value==="",li=(e,r)=>{let t=!0,i=e.slice(),n=i.pop();for(;t&&i.length;)t=i.every(s=>n.intersects(s,r)),n=i.pop();return t},wa=(e,r)=>(P("comp",e,r),e=va(e,r),P("caret",e),e=ya(e,r),P("tildes",e),e=Pa(e,r),P("xrange",e),e=Ia(e,r),P("stars",e),e),F=e=>!e||e.toLowerCase()==="x"||e==="*",ya=(e,r)=>e.trim().split(/\s+/).map(t=>Ea(t,r)).join(" "),Ea=(e,r)=>{let t=r.loose?C[N.TILDELOOSE]:C[N.TILDE];return e.replace(t,(i,n,s,o,l)=>{P("tilde",e,i,n,s,o,l);let f;return F(n)?f="":F(s)?f=`>=${n}.0.0 <${+n+1}.0.0-0`:F(o)?f=`>=${n}.${s}.0 <${n}.${+s+1}.0-0`:l?(P("replaceTilde pr",l),f=`>=${n}.${s}.${o}-${l} <${n}.${+s+1}.0-0`):f=`>=${n}.${s}.${o} <${n}.${+s+1}.0-0`,P("tilde return",f),f})},va=(e,r)=>e.trim().split(/\s+/).map(t=>xa(t,r)).join(" "),xa=(e,r)=>{P("caret",e,r);let t=r.loose?C[N.CARETLOOSE]:C[N.CARET],i=r.includePrerelease?"-0":"";return e.replace(t,(n,s,o,l,f)=>{P("caret",e,n,s,o,l,f);let u;return F(s)?u="":F(o)?u=`>=${s}.0.0${i} <${+s+1}.0.0-0`:F(l)?s==="0"?u=`>=${s}.${o}.0${i} <${s}.${+o+1}.0-0`:u=`>=${s}.${o}.0${i} <${+s+1}.0.0-0`:f?(P("replaceCaret pr",f),s==="0"?o==="0"?u=`>=${s}.${o}.${l}-${f} <${s}.${o}.${+l+1}-0`:u=`>=${s}.${o}.${l}-${f} <${s}.${+o+1}.0-0`:u=`>=${s}.${o}.${l}-${f} <${+s+1}.0.0-0`):(P("no pr"),s==="0"?o==="0"?u=`>=${s}.${o}.${l}${i} <${s}.${o}.${+l+1}-0`:u=`>=${s}.${o}.${l}${i} <${s}.${+o+1}.0-0`:u=`>=${s}.${o}.${l} <${+s+1}.0.0-0`),P("caret return",u),u})},Pa=(e,r)=>(P("replaceXRanges",e,r),e.split(/\s+/).map(t=>Ra(t,r)).join(" ")),Ra=(e,r)=>{e=e.trim();let t=r.loose?C[N.XRANGELOOSE]:C[N.XRANGE];return e.replace(t,(i,n,s,o,l,f)=>{P("xRange",e,i,n,s,o,l,f);let u=F(s),b=u||F(o),w=b||F(l),S=w;return n==="="&&S&&(n=""),f=r.includePrerelease?"-0":"",u?n===">"||n==="<"?i="<0.0.0-0":i="*":n&&S?(b&&(o=0),l=0,n===">"?(n=">=",b?(s=+s+1,o=0,l=0):(o=+o+1,l=0)):n==="<="&&(n="<",b?s=+s+1:o=+o+1),n==="<"&&(f="-0"),i=`${n+s}.${o}.${l}${f}`):b?i=`>=${s}.0.0${f} <${+s+1}.0.0-0`:w&&(i=`>=${s}.${o}.0${f} <${s}.${+o+1}.0-0`),P("xRange return",i),i})},Ia=(e,r)=>(P("replaceStars",e,r),e.trim().replace(C[N.STAR],"")),Sa=(e,r)=>(P("replaceGTE0",e,r),e.trim().replace(C[r.includePrerelease?N.GTE0PRE:N.GTE0],"")),Aa=e=>(r,t,i,n,s,o,l,f,u,b,w,S)=>(F(i)?t="":F(n)?t=`>=${i}.0.0${e?"-0":""}`:F(s)?t=`>=${i}.${n}.0${e?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${e?"-0":""}`,F(u)?f="":F(b)?f=`<${+u+1}.0.0-0`:F(w)?f=`<${u}.${+b+1}.0-0`:S?f=`<=${u}.${b}.${w}-${S}`:e?f=`<${u}.${b}.${+w+1}-0`:f=`<=${f}`,`${t} ${f}`.trim()),$a=(e,r,t)=>{for(let i=0;i<e.length;i++)if(!e[i].test(r))return!1;if(r.prerelease.length&&!t.includePrerelease){for(let i=0;i<e.length;i++)if(P(e[i].semver),e[i].semver!==Ir.ANY&&e[i].semver.prerelease.length>0){let n=e[i].semver;if(n.major===r.major&&n.minor===r.minor&&n.patch===r.patch)return!0}return!1}return!0}});var hi=y((Mc,fi)=>{"use strict";var La=Pr(),Ta=(e,r,t)=>{try{r=new La(r,t)}catch{return!1}return r.test(e)};fi.exports=Ta});var Sr=y((Dc,ka)=>{ka.exports={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.33.5",author:"Lovell Fuller <npm@lovell.info>",homepage:"https://sharp.pixelplumbing.com",contributors:["Pierre Inglebert <pierre.inglebert@gmail.com>","Jonathan Ong <jonathanrichardong@gmail.com>","Chanon Sajjamanochai <chanon.s@gmail.com>","Juliano Julio <julianojulio@gmail.com>","Daniel Gasienica <daniel@gasienica.ch>","Julian Walker <julian@fiftythree.com>","Amit Pitaru <pitaru.amit@gmail.com>","Brandon Aaron <hello.brandon@aaron.sh>","Andreas Lind <andreas@one.com>","Maurus Cuelenaere <mcuelenaere@gmail.com>","Linus Unneb\xE4ck <linus@folkdatorn.se>","Victor Mateevitsi <mvictoras@gmail.com>","Alaric Holloway <alaric.holloway@gmail.com>","Bernhard K. Weisshuhn <bkw@codingforce.com>","Chris Riley <criley@primedia.com>","David Carley <dacarley@gmail.com>","John Tobin <john@limelightmobileinc.com>","Kenton Gray <kentongray@gmail.com>","Felix B\xFCnemann <Felix.Buenemann@gmail.com>","Samy Al Zahrani <samyalzahrany@gmail.com>","Chintan Thakkar <lemnisk8@gmail.com>","F. Orlando Galashan <frulo@gmx.de>","Kleis Auke Wolthuizen <info@kleisauke.nl>","Matt Hirsch <mhirsch@media.mit.edu>","Matthias Thoemmes <thoemmes@gmail.com>","Patrick Paskaris <patrick@paskaris.gr>","J\xE9r\xE9my Lal <kapouer@melix.org>","Rahul Nanwani <r.nanwani@gmail.com>","Alice Monday <alice0meta@gmail.com>","Kristo Jorgenson <kristo.jorgenson@gmail.com>","YvesBos <yves_bos@outlook.com>","Guy Maliar <guy@tailorbrands.com>","Nicolas Coden <nicolas@ncoden.fr>","Matt Parrish <matt.r.parrish@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Matthew McEachen <matthew+github@mceachen.org>","Jarda Kot\u011B\u0161ovec <jarda.kotesovec@gmail.com>","Kenric D'Souza <kenric.dsouza@gmail.com>","Oleh Aleinyk <oleg.aleynik@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Andrea Bianco <andrea.bianco@unibas.ch>","Rik Heywood <rik@rik.org>","Thomas Parisot <hi@oncletom.io>","Nathan Graves <nathanrgraves+github@gmail.com>","Tom Lokhorst <tom@lokhorst.eu>","Espen Hovlandsdal <espen@hovlandsdal.com>","Sylvain Dumont <sylvain.dumont35@gmail.com>","Alun Davies <alun.owain.davies@googlemail.com>","Aidan Hoolachan <ajhoolachan21@gmail.com>","Axel Eirola <axel.eirola@iki.fi>","Freezy <freezy@xbmc.org>","Daiz <taneli.vatanen@gmail.com>","Julian Aubourg <j@ubourg.net>","Keith Belovay <keith@picthrive.com>","Michael B. Klein <mbklein@gmail.com>","Jordan Prudhomme <jordan@raboland.fr>","Ilya Ovdin <iovdin@gmail.com>","Andargor <andargor@yahoo.com>","Paul Neave <paul.neave@gmail.com>","Brendan Kennedy <brenwken@gmail.com>","Brychan Bennett-Odlum <git@brychan.io>","Edward Silverton <e.silverton@gmail.com>","Roman Malieiev <aromaleev@gmail.com>","Tomas Szabo <tomas.szabo@deftomat.com>","Robert O'Rourke <robert@o-rourke.org>","Guillermo Alfonso Varela Chouci\xF1o <guillevch@gmail.com>","Christian Flintrup <chr@gigahost.dk>","Manan Jadhav <manan@motionden.com>","Leon Radley <leon@radley.se>","alza54 <alza54@thiocod.in>","Jacob Smith <jacob@frende.me>","Michael Nutt <michael@nutt.im>","Brad Parham <baparham@gmail.com>","Taneli Vatanen <taneli.vatanen@gmail.com>","Joris Dugu\xE9 <zaruike10@gmail.com>","Chris Banks <christopher.bradley.banks@gmail.com>","Ompal Singh <ompal.hitm09@gmail.com>","Brodan <christopher.hranj@gmail.com>","Ankur Parihar <ankur.github@gmail.com>","Brahim Ait elhaj <brahima@gmail.com>","Mart Jansink <m.jansink@gmail.com>","Lachlan Newman <lachnewman007@gmail.com>","Dennis Beatty <dennis@dcbeatty.com>","Ingvar Stepanyan <me@rreverser.com>","Don Denton <don@happycollision.com>"],scripts:{install:"node install/check",clean:"rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",test:"npm run test-lint && npm run test-unit && npm run test-licensing && npm run test-types","test-lint":"semistandard && cpplint","test-unit":"nyc --reporter=lcov --reporter=text --check-coverage --branches=100 mocha","test-licensing":'license-checker --production --summary --onlyAllow="Apache-2.0;BSD;ISC;LGPL-3.0-or-later;MIT"',"test-leak":"./test/leak/leak.sh","test-types":"tsd","package-from-local-build":"node npm/from-local-build","package-from-github-release":"node npm/from-github-release","docs-build":"node docs/build && node docs/search-index/build","docs-serve":"cd docs && npx serve","docs-publish":"cd docs && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",main:"lib/index.js",types:"lib/index.d.ts",files:["install","lib","src/*.{cc,h,gyp}"],repository:{type:"git",url:"git://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{color:"^4.2.3","detect-libc":"^2.0.3",semver:"^7.6.3"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.33.5","@img/sharp-darwin-x64":"0.33.5","@img/sharp-libvips-darwin-arm64":"1.0.4","@img/sharp-libvips-darwin-x64":"1.0.4","@img/sharp-libvips-linux-arm":"1.0.5","@img/sharp-libvips-linux-arm64":"1.0.4","@img/sharp-libvips-linux-s390x":"1.0.4","@img/sharp-libvips-linux-x64":"1.0.4","@img/sharp-libvips-linuxmusl-arm64":"1.0.4","@img/sharp-libvips-linuxmusl-x64":"1.0.4","@img/sharp-linux-arm":"0.33.5","@img/sharp-linux-arm64":"0.33.5","@img/sharp-linux-s390x":"0.33.5","@img/sharp-linux-x64":"0.33.5","@img/sharp-linuxmusl-arm64":"0.33.5","@img/sharp-linuxmusl-x64":"0.33.5","@img/sharp-wasm32":"0.33.5","@img/sharp-win32-ia32":"0.33.5","@img/sharp-win32-x64":"0.33.5"},devDependencies:{"@emnapi/runtime":"^1.2.0","@img/sharp-libvips-dev":"1.0.4","@img/sharp-libvips-dev-wasm32":"1.0.5","@img/sharp-libvips-win32-ia32":"1.0.4","@img/sharp-libvips-win32-x64":"1.0.4","@types/node":"*",async:"^3.2.5",cc:"^3.0.1",emnapi:"^1.2.0","exif-reader":"^2.0.1","extract-zip":"^2.0.1",icc:"^3.0.0","jsdoc-to-markdown":"^8.0.3","license-checker":"^25.0.1",mocha:"^10.7.3","node-addon-api":"^8.1.0",nyc:"^17.0.0",prebuild:"^13.0.1",semistandard:"^17.0.0","tar-fs":"^3.0.6",tsd:"^0.31.1"},license:"Apache-2.0",engines:{node:"^18.17.0 || ^20.3.0 || >=21.0.0"},config:{libvips:">=8.15.3"},funding:{url:"https://opencollective.com/libvips"},binary:{napi_versions:[9]},semistandard:{env:["mocha"]},cc:{linelength:"120",filter:["build/include"]},nyc:{include:["lib"]},tsd:{directory:"test/types/"}}});var $r=y((_c,vi)=>{"use strict";var{spawnSync:Qe}=R("node:child_process"),{createHash:ja}=R("node:crypto"),gi=Ot(),Na=wr(),Fa=hi(),ui=_e(),{config:Oa,engines:di,optionalDependencies:Ca}=Sr(),Ba=process.env.npm_package_config_libvips||Oa.libvips,pi=gi(Ba).version,qa=["darwin-arm64","darwin-x64","linux-arm","linux-arm64","linux-s390x","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-ia32","win32-x64"],Je={encoding:"utf8",shell:!0},Ma=e=>{e instanceof Error?console.error(`sharp: Installation error: ${e.message}`):console.log(`sharp: ${e}`)},bi=()=>ui.isNonGlibcLinuxSync()?ui.familySync():"",Da=()=>`${process.platform}${bi()}-${process.arch}`,Ee=()=>{if(wi())return"wasm32";let{npm_config_arch:e,npm_config_platform:r,npm_config_libc:t}=process.env,i=typeof t=="string"?t:bi();return`${r||process.platform}${i}-${e||process.arch}`},_a=()=>{try{return R(`@img/sharp-libvips-dev-${Ee()}/include`)}catch{try{return R("@img/sharp-libvips-dev/include")}catch{}}return""},za=()=>{try{return R("@img/sharp-libvips-dev/cplusplus")}catch{}return""},Ua=()=>{try{return R(`@img/sharp-libvips-dev-${Ee()}/lib`)}catch{try{return R(`@img/sharp-libvips-${Ee()}/lib`)}catch{}}return""},Ga=()=>{var e;if(((e=process.release)==null?void 0:e.name)==="node"&&process.versions&&!Fa(process.versions.node,di.node))return{found:process.versions.node,expected:di.node}},wi=()=>{let{CC:e}=process.env;return!!(e&&e.endsWith("/emcc"))},Ha=()=>process.platform==="darwin"&&process.arch==="x64"?(Qe("sysctl sysctl.proc_translated",Je).stdout||"").trim()==="sysctl.proc_translated: 1":!1,mi=e=>ja("sha512").update(e).digest("hex"),Wa=()=>{try{let e=mi(`imgsharp-libvips-${Ee()}`),r=gi(Ca[`@img/sharp-libvips-${Ee()}`]).version;return mi(`${e}npm:${r}`).slice(0,10)}catch{}return""},Va=()=>Qe(`node-gyp rebuild --directory=src ${wi()?"--nodedir=emscripten":""}`,{...Je,stdio:"inherit"}).status,yi=()=>process.platform!=="win32"?(Qe("pkg-config --modversion vips-cpp",{...Je,env:{...process.env,PKG_CONFIG_PATH:Ei()}}).stdout||"").trim():"",Ei=()=>process.platform!=="win32"?[(Qe('which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',Je).stdout||"").trim(),process.env.PKG_CONFIG_PATH,"/usr/local/lib/pkgconfig","/usr/lib/pkgconfig","/usr/local/libdata/pkgconfig","/usr/libdata/pkgconfig"].filter(Boolean).join(":"):"",Ar=(e,r,t)=>(t&&t(`Detected ${r}, skipping search for globally-installed libvips`),e),Xa=e=>{if(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)return Ar(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)return Ar(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(Ha())return Ar(!1,"Rosetta",e);let r=yi();return!!r&&Na(r,pi)};vi.exports={minimumLibvipsVersion:pi,prebuiltPlatforms:qa,buildPlatformArch:Ee,buildSharpLibvipsIncludeDir:_a,buildSharpLibvipsCPlusPlusDir:za,buildSharpLibvipsLibDir:Ua,isUnsupportedNodeRuntime:Ga,runtimePlatformArch:Da,log:Ma,yarnLocator:Wa,spawnRebuild:Va,globalLibvipsVersion:yi,pkgConfigPath:Ei,useGlobalLibvips:Xa}});var Ne=y((Uc,Pi)=>{"use strict";var{familySync:Qa,versionSync:Ja}=_e(),{runtimePlatformArch:Ka,isUnsupportedNodeRuntime:xi,prebuiltPlatforms:Ya,minimumLibvipsVersion:Za}=$r(),de=Ka(),eo=[`../src/build/Release/sharp-${de}.node`,"../src/build/Release/sharp-wasm32.node",`@img/sharp-${de}/sharp.node`,"@img/sharp-wasm32/sharp.node"],Lr,Ke=[];for(let e of eo)try{Lr=R(e);break}catch(r){Ke.push(r)}if(Lr)Pi.exports=Lr;else{let[e,r,t]=["linux","darwin","win32"].map(s=>de.startsWith(s)),i=[`Could not load the "sharp" module using the ${de} runtime`];Ke.forEach(s=>{s.code!=="MODULE_NOT_FOUND"&&i.push(`${s.code}: ${s.message}`)});let n=Ke.map(s=>s.message).join(" ");if(i.push("Possible solutions:"),xi()){let{found:s,expected:o}=xi();i.push("- Please upgrade Node.js:",` Found ${s}`,` Requires ${o}`)}else if(Ya.includes(de)){let[s,o]=de.split("-"),l=s.endsWith("musl")?" --libc=musl":"";i.push("- Ensure optional dependencies can be installed:"," npm install --include=optional sharp","- Ensure your package manager supports multi-platform installation:"," See https://sharp.pixelplumbing.com/install#cross-platform","- Add platform-specific dependencies:",` npm install --os=${s.replace("musl","")}${l} --cpu=${o} sharp`)}else i.push(`- Manually install libvips >= ${Za}`,"- Add experimental WebAssembly-based dependencies:"," npm install --cpu=wasm32 sharp"," npm install @img/sharp-wasm32");if(e&&/(symbol not found|CXXABI_)/i.test(n))try{let{config:s}=R(`@img/sharp-libvips-${de}/package`),o=`${Qa()} ${Ja()}`,l=`${s.musl?"musl":"glibc"} ${s.musl||s.glibc}`;i.push("- Update your OS:",` Found ${o}`,` Requires ${l}`)}catch{}throw e&&/\/snap\/core[0-9]{2}/.test(n)&&i.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node"),r&&/Incompatible library version/.test(n)&&i.push("- Update Homebrew:"," brew update && brew upgrade vips"),Ke.some(s=>s.code==="ERR_DLOPEN_DISABLED")&&i.push("- Run Node.js without using the --no-addons flag"),t&&/The specified procedure could not be found/.test(n)&&i.push("- Using the canvas package on Windows?"," See https://sharp.pixelplumbing.com/install#canvas-and-windows","- Check for outdated versions of sharp in the dependency tree:"," npm ls sharp"),i.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),new Error(i.join(`
2
- `))}});var Ii=y((Hc,Ri)=>{"use strict";var ro=R("node:util"),Tr=R("node:stream"),to=J();Ne();var io=ro.debuglog("sharp"),me=function(e,r){if(arguments.length===1&&!to.defined(e))throw new Error("Invalid input");return this instanceof me?(Tr.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:"crop",position:0,resizeBackground:[0,0,0,255],useExifOrientation:!1,angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBeforePreExtract:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:"background",withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:"lanczos3",fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:"integer",minAmpl:.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:"",joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:"srgb",colourspacePipeline:"last",composite:[],fileOut:"",formatOut:"input",streamOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:"",withExif:{},withExifMerge:!0,resolveWithObject:!1,jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:"4:2:0",jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:"4:4:4",webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:"jpeg",tiffPredictor:"horizontal",tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:8,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:"inch",heifQuality:50,heifLossless:!1,heifCompression:"av1",heifEffort:4,heifChromaSubsampling:"4:4:4",heifBitdepth:8,jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:"uchar",tileSize:256,tileOverlap:0,tileContainer:"fs",tileLayout:"dz",tileFormat:"last",tileDepth:"last",tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:"https://example.com/iiif",tileBasename:"",timeoutSeconds:0,linearA:[],linearB:[],debuglog:t=>{this.emit("warning",t),io(t)},queueListener:function(t){me.queue.emit("change",t)}},this.options.input=this._createInputDescriptor(e,r,{allowStream:!0}),this):new me(e,r)};Object.setPrototypeOf(me.prototype,Tr.Duplex.prototype);Object.setPrototypeOf(me,Tr.Duplex);function no(){let e=this.constructor.call(),{debuglog:r,queueListener:t,...i}=this.options;return e.options=structuredClone(i),e.options.debuglog=r,e.options.queueListener=t,this._isStreamInput()&&this.on("finish",()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit("finish")}),e}Object.assign(me.prototype,{clone:no});Ri.exports=me});var kr=y((Wc,Si)=>{"use strict";Si.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var $i=y((Vc,Ai)=>{"use strict";Ai.exports=function(r){return!r||typeof r=="string"?!1:r instanceof Array||Array.isArray(r)||r.length>=0&&(r.splice instanceof Function||Object.getOwnPropertyDescriptor(r,r.length-1)&&r.constructor.name!=="String")}});var ki=y((Xc,Ti)=>{"use strict";var so=$i(),ao=Array.prototype.concat,oo=Array.prototype.slice,Li=Ti.exports=function(r){for(var t=[],i=0,n=r.length;i<n;i++){var s=r[i];so(s)?t=ao.call(t,oo.call(s)):t.push(s)}return t};Li.wrap=function(e){return function(){return e(Li(arguments))}}});var Oi=y((Qc,Fi)=>{"use strict";var Fe=kr(),Oe=ki(),ji=Object.hasOwnProperty,Ni=Object.create(null);for(Ye in Fe)ji.call(Fe,Ye)&&(Ni[Fe[Ye]]=Ye);var Ye,M=Fi.exports={to:{},get:{}};M.get=function(e){var r=e.substring(0,3).toLowerCase(),t,i;switch(r){case"hsl":t=M.get.hsl(e),i="hsl";break;case"hwb":t=M.get.hwb(e),i="hwb";break;default:t=M.get.rgb(e),i="rgb";break}return t?{model:i,value:t}:null};M.get.rgb=function(e){if(!e)return null;var r=/^#([a-f0-9]{3,4})$/i,t=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,i=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,n=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,s=/^(\w+)$/,o=[0,0,0,1],l,f,u;if(l=e.match(t)){for(u=l[2],l=l[1],f=0;f<3;f++){var b=f*2;o[f]=parseInt(l.slice(b,b+2),16)}u&&(o[3]=parseInt(u,16)/255)}else if(l=e.match(r)){for(l=l[1],u=l[3],f=0;f<3;f++)o[f]=parseInt(l[f]+l[f],16);u&&(o[3]=parseInt(u+u,16)/255)}else if(l=e.match(i)){for(f=0;f<3;f++)o[f]=parseInt(l[f+1],0);l[4]&&(l[5]?o[3]=parseFloat(l[4])*.01:o[3]=parseFloat(l[4]))}else if(l=e.match(n)){for(f=0;f<3;f++)o[f]=Math.round(parseFloat(l[f+1])*2.55);l[4]&&(l[5]?o[3]=parseFloat(l[4])*.01:o[3]=parseFloat(l[4]))}else return(l=e.match(s))?l[1]==="transparent"?[0,0,0,0]:ji.call(Fe,l[1])?(o=Fe[l[1]],o[3]=1,o):null:null;for(f=0;f<3;f++)o[f]=le(o[f],0,255);return o[3]=le(o[3],0,1),o};M.get.hsl=function(e){if(!e)return null;var r=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,t=e.match(r);if(t){var i=parseFloat(t[4]),n=(parseFloat(t[1])%360+360)%360,s=le(parseFloat(t[2]),0,100),o=le(parseFloat(t[3]),0,100),l=le(isNaN(i)?1:i,0,1);return[n,s,o,l]}return null};M.get.hwb=function(e){if(!e)return null;var r=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,t=e.match(r);if(t){var i=parseFloat(t[4]),n=(parseFloat(t[1])%360+360)%360,s=le(parseFloat(t[2]),0,100),o=le(parseFloat(t[3]),0,100),l=le(isNaN(i)?1:i,0,1);return[n,s,o,l]}return null};M.to.hex=function(){var e=Oe(arguments);return"#"+Ze(e[0])+Ze(e[1])+Ze(e[2])+(e[3]<1?Ze(Math.round(e[3]*255)):"")};M.to.rgb=function(){var e=Oe(arguments);return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};M.to.rgb.percent=function(){var e=Oe(arguments),r=Math.round(e[0]/255*100),t=Math.round(e[1]/255*100),i=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+r+"%, "+t+"%, "+i+"%)":"rgba("+r+"%, "+t+"%, "+i+"%, "+e[3]+")"};M.to.hsl=function(){var e=Oe(arguments);return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};M.to.hwb=function(){var e=Oe(arguments),r="";return e.length>=4&&e[3]!==1&&(r=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+r+")"};M.to.keyword=function(e){return Ni[e.slice(0,3)]};function le(e,r,t){return Math.min(Math.max(r,e),t)}function Ze(e){var r=Math.round(e).toString(16).toUpperCase();return r.length<2?"0"+r:r}});var jr=y((Jc,Bi)=>{"use strict";var Ce=kr(),Ci={};for(let e of Object.keys(Ce))Ci[Ce[e]]=e;var g={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Bi.exports=g;for(let e of Object.keys(g)){if(!("channels"in g[e]))throw new Error("missing channels property: "+e);if(!("labels"in g[e]))throw new Error("missing channel labels property: "+e);if(g[e].labels.length!==g[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:r,labels:t}=g[e];delete g[e].channels,delete g[e].labels,Object.defineProperty(g[e],"channels",{value:r}),Object.defineProperty(g[e],"labels",{value:t})}g.rgb.hsl=function(e){let r=e[0]/255,t=e[1]/255,i=e[2]/255,n=Math.min(r,t,i),s=Math.max(r,t,i),o=s-n,l,f;s===n?l=0:r===s?l=(t-i)/o:t===s?l=2+(i-r)/o:i===s&&(l=4+(r-t)/o),l=Math.min(l*60,360),l<0&&(l+=360);let u=(n+s)/2;return s===n?f=0:u<=.5?f=o/(s+n):f=o/(2-s-n),[l,f*100,u*100]};g.rgb.hsv=function(e){let r,t,i,n,s,o=e[0]/255,l=e[1]/255,f=e[2]/255,u=Math.max(o,l,f),b=u-Math.min(o,l,f),w=function(S){return(u-S)/6/b+1/2};return b===0?(n=0,s=0):(s=b/u,r=w(o),t=w(l),i=w(f),o===u?n=i-t:l===u?n=1/3+r-i:f===u&&(n=2/3+t-r),n<0?n+=1:n>1&&(n-=1)),[n*360,s*100,u*100]};g.rgb.hwb=function(e){let r=e[0],t=e[1],i=e[2],n=g.rgb.hsl(e)[0],s=1/255*Math.min(r,Math.min(t,i));return i=1-1/255*Math.max(r,Math.max(t,i)),[n,s*100,i*100]};g.rgb.cmyk=function(e){let r=e[0]/255,t=e[1]/255,i=e[2]/255,n=Math.min(1-r,1-t,1-i),s=(1-r-n)/(1-n)||0,o=(1-t-n)/(1-n)||0,l=(1-i-n)/(1-n)||0;return[s*100,o*100,l*100,n*100]};function lo(e,r){return(e[0]-r[0])**2+(e[1]-r[1])**2+(e[2]-r[2])**2}g.rgb.keyword=function(e){let r=Ci[e];if(r)return r;let t=1/0,i;for(let n of Object.keys(Ce)){let s=Ce[n],o=lo(e,s);o<t&&(t=o,i=n)}return i};g.keyword.rgb=function(e){return Ce[e]};g.rgb.xyz=function(e){let r=e[0]/255,t=e[1]/255,i=e[2]/255;r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;let n=r*.4124+t*.3576+i*.1805,s=r*.2126+t*.7152+i*.0722,o=r*.0193+t*.1192+i*.9505;return[n*100,s*100,o*100]};g.rgb.lab=function(e){let r=g.rgb.xyz(e),t=r[0],i=r[1],n=r[2];t/=95.047,i/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let s=116*i-16,o=500*(t-i),l=200*(i-n);return[s,o,l]};g.hsl.rgb=function(e){let r=e[0]/360,t=e[1]/100,i=e[2]/100,n,s,o;if(t===0)return o=i*255,[o,o,o];i<.5?n=i*(1+t):n=i+t-i*t;let l=2*i-n,f=[0,0,0];for(let u=0;u<3;u++)s=r+1/3*-(u-1),s<0&&s++,s>1&&s--,6*s<1?o=l+(n-l)*6*s:2*s<1?o=n:3*s<2?o=l+(n-l)*(2/3-s)*6:o=l,f[u]=o*255;return f};g.hsl.hsv=function(e){let r=e[0],t=e[1]/100,i=e[2]/100,n=t,s=Math.max(i,.01);i*=2,t*=i<=1?i:2-i,n*=s<=1?s:2-s;let o=(i+t)/2,l=i===0?2*n/(s+n):2*t/(i+t);return[r,l*100,o*100]};g.hsv.rgb=function(e){let r=e[0]/60,t=e[1]/100,i=e[2]/100,n=Math.floor(r)%6,s=r-Math.floor(r),o=255*i*(1-t),l=255*i*(1-t*s),f=255*i*(1-t*(1-s));switch(i*=255,n){case 0:return[i,f,o];case 1:return[l,i,o];case 2:return[o,i,f];case 3:return[o,l,i];case 4:return[f,o,i];case 5:return[i,o,l]}};g.hsv.hsl=function(e){let r=e[0],t=e[1]/100,i=e[2]/100,n=Math.max(i,.01),s,o;o=(2-t)*i;let l=(2-t)*n;return s=t*n,s/=l<=1?l:2-l,s=s||0,o/=2,[r,s*100,o*100]};g.hwb.rgb=function(e){let r=e[0]/360,t=e[1]/100,i=e[2]/100,n=t+i,s;n>1&&(t/=n,i/=n);let o=Math.floor(6*r),l=1-i;s=6*r-o,(o&1)!==0&&(s=1-s);let f=t+s*(l-t),u,b,w;switch(o){default:case 6:case 0:u=l,b=f,w=t;break;case 1:u=f,b=l,w=t;break;case 2:u=t,b=l,w=f;break;case 3:u=t,b=f,w=l;break;case 4:u=f,b=t,w=l;break;case 5:u=l,b=t,w=f;break}return[u*255,b*255,w*255]};g.cmyk.rgb=function(e){let r=e[0]/100,t=e[1]/100,i=e[2]/100,n=e[3]/100,s=1-Math.min(1,r*(1-n)+n),o=1-Math.min(1,t*(1-n)+n),l=1-Math.min(1,i*(1-n)+n);return[s*255,o*255,l*255]};g.xyz.rgb=function(e){let r=e[0]/100,t=e[1]/100,i=e[2]/100,n,s,o;return n=r*3.2406+t*-1.5372+i*-.4986,s=r*-.9689+t*1.8758+i*.0415,o=r*.0557+t*-.204+i*1.057,n=n>.0031308?1.055*n**(1/2.4)-.055:n*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,n=Math.min(Math.max(0,n),1),s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),[n*255,s*255,o*255]};g.xyz.lab=function(e){let r=e[0],t=e[1],i=e[2];r/=95.047,t/=100,i/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let n=116*t-16,s=500*(r-t),o=200*(t-i);return[n,s,o]};g.lab.xyz=function(e){let r=e[0],t=e[1],i=e[2],n,s,o;s=(r+16)/116,n=t/500+s,o=s-i/200;let l=s**3,f=n**3,u=o**3;return s=l>.008856?l:(s-16/116)/7.787,n=f>.008856?f:(n-16/116)/7.787,o=u>.008856?u:(o-16/116)/7.787,n*=95.047,s*=100,o*=108.883,[n,s,o]};g.lab.lch=function(e){let r=e[0],t=e[1],i=e[2],n;n=Math.atan2(i,t)*360/2/Math.PI,n<0&&(n+=360);let o=Math.sqrt(t*t+i*i);return[r,o,n]};g.lch.lab=function(e){let r=e[0],t=e[1],n=e[2]/360*2*Math.PI,s=t*Math.cos(n),o=t*Math.sin(n);return[r,s,o]};g.rgb.ansi16=function(e,r=null){let[t,i,n]=e,s=r===null?g.rgb.hsv(e)[2]:r;if(s=Math.round(s/50),s===0)return 30;let o=30+(Math.round(n/255)<<2|Math.round(i/255)<<1|Math.round(t/255));return s===2&&(o+=60),o};g.hsv.ansi16=function(e){return g.rgb.ansi16(g.hsv.rgb(e),e[2])};g.rgb.ansi256=function(e){let r=e[0],t=e[1],i=e[2];return r===t&&t===i?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(t/255*5)+Math.round(i/255*5)};g.ansi16.rgb=function(e){let r=e%10;if(r===0||r===7)return e>50&&(r+=3.5),r=r/10.5*255,[r,r,r];let t=(~~(e>50)+1)*.5,i=(r&1)*t*255,n=(r>>1&1)*t*255,s=(r>>2&1)*t*255;return[i,n,s]};g.ansi256.rgb=function(e){if(e>=232){let s=(e-232)*10+8;return[s,s,s]}e-=16;let r,t=Math.floor(e/36)/5*255,i=Math.floor((r=e%36)/6)/5*255,n=r%6/5*255;return[t,i,n]};g.rgb.hex=function(e){let t=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t};g.hex.rgb=function(e){let r=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!r)return[0,0,0];let t=r[0];r[0].length===3&&(t=t.split("").map(l=>l+l).join(""));let i=parseInt(t,16),n=i>>16&255,s=i>>8&255,o=i&255;return[n,s,o]};g.rgb.hcg=function(e){let r=e[0]/255,t=e[1]/255,i=e[2]/255,n=Math.max(Math.max(r,t),i),s=Math.min(Math.min(r,t),i),o=n-s,l,f;return o<1?l=s/(1-o):l=0,o<=0?f=0:n===r?f=(t-i)/o%6:n===t?f=2+(i-r)/o:f=4+(r-t)/o,f/=6,f%=1,[f*360,o*100,l*100]};g.hsl.hcg=function(e){let r=e[1]/100,t=e[2]/100,i=t<.5?2*r*t:2*r*(1-t),n=0;return i<1&&(n=(t-.5*i)/(1-i)),[e[0],i*100,n*100]};g.hsv.hcg=function(e){let r=e[1]/100,t=e[2]/100,i=r*t,n=0;return i<1&&(n=(t-i)/(1-i)),[e[0],i*100,n*100]};g.hcg.rgb=function(e){let r=e[0]/360,t=e[1]/100,i=e[2]/100;if(t===0)return[i*255,i*255,i*255];let n=[0,0,0],s=r%1*6,o=s%1,l=1-o,f=0;switch(Math.floor(s)){case 0:n[0]=1,n[1]=o,n[2]=0;break;case 1:n[0]=l,n[1]=1,n[2]=0;break;case 2:n[0]=0,n[1]=1,n[2]=o;break;case 3:n[0]=0,n[1]=l,n[2]=1;break;case 4:n[0]=o,n[1]=0,n[2]=1;break;default:n[0]=1,n[1]=0,n[2]=l}return f=(1-t)*i,[(t*n[0]+f)*255,(t*n[1]+f)*255,(t*n[2]+f)*255]};g.hcg.hsv=function(e){let r=e[1]/100,t=e[2]/100,i=r+t*(1-r),n=0;return i>0&&(n=r/i),[e[0],n*100,i*100]};g.hcg.hsl=function(e){let r=e[1]/100,i=e[2]/100*(1-r)+.5*r,n=0;return i>0&&i<.5?n=r/(2*i):i>=.5&&i<1&&(n=r/(2*(1-i))),[e[0],n*100,i*100]};g.hcg.hwb=function(e){let r=e[1]/100,t=e[2]/100,i=r+t*(1-r);return[e[0],(i-r)*100,(1-i)*100]};g.hwb.hcg=function(e){let r=e[1]/100,i=1-e[2]/100,n=i-r,s=0;return n<1&&(s=(i-n)/(1-n)),[e[0],n*100,s*100]};g.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};g.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};g.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};g.gray.hsl=function(e){return[0,0,e[0]]};g.gray.hsv=g.gray.hsl;g.gray.hwb=function(e){return[0,100,e[0]]};g.gray.cmyk=function(e){return[0,0,0,e[0]]};g.gray.lab=function(e){return[e[0],0,0]};g.gray.hex=function(e){let r=Math.round(e[0]/100*255)&255,i=((r<<16)+(r<<8)+r).toString(16).toUpperCase();return"000000".substring(i.length)+i};g.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}});var Mi=y((Kc,qi)=>{"use strict";var er=jr();function co(){let e={},r=Object.keys(er);for(let t=r.length,i=0;i<t;i++)e[r[i]]={distance:-1,parent:null};return e}function fo(e){let r=co(),t=[e];for(r[e].distance=0;t.length;){let i=t.pop(),n=Object.keys(er[i]);for(let s=n.length,o=0;o<s;o++){let l=n[o],f=r[l];f.distance===-1&&(f.distance=r[i].distance+1,f.parent=i,t.unshift(l))}}return r}function ho(e,r){return function(t){return r(e(t))}}function uo(e,r){let t=[r[e].parent,e],i=er[r[e].parent][e],n=r[e].parent;for(;r[n].parent;)t.unshift(r[n].parent),i=ho(er[r[n].parent][n],i),n=r[n].parent;return i.conversion=t,i}qi.exports=function(e){let r=fo(e),t={},i=Object.keys(r);for(let n=i.length,s=0;s<n;s++){let o=i[s];r[o].parent!==null&&(t[o]=uo(o,r))}return t}});var _i=y((Yc,Di)=>{"use strict";var Nr=jr(),mo=Mi(),ve={},go=Object.keys(Nr);function po(e){let r=function(...t){let i=t[0];return i==null?i:(i.length>1&&(t=i),e(t))};return"conversion"in e&&(r.conversion=e.conversion),r}function bo(e){let r=function(...t){let i=t[0];if(i==null)return i;i.length>1&&(t=i);let n=e(t);if(typeof n=="object")for(let s=n.length,o=0;o<s;o++)n[o]=Math.round(n[o]);return n};return"conversion"in e&&(r.conversion=e.conversion),r}go.forEach(e=>{ve[e]={},Object.defineProperty(ve[e],"channels",{value:Nr[e].channels}),Object.defineProperty(ve[e],"labels",{value:Nr[e].labels});let r=mo(e);Object.keys(r).forEach(i=>{let n=r[i];ve[e][i]=bo(n),ve[e][i].raw=po(n)})});Di.exports=ve});var tr=y((Zc,Ui)=>{"use strict";var xe=Oi(),D=_i(),zi=["keyword","gray","hex"],Fr={};for(let e of Object.keys(D))Fr[[...D[e].labels].sort().join("")]=e;var rr={};function L(e,r){if(!(this instanceof L))return new L(e,r);if(r&&r in zi&&(r=null),r&&!(r in D))throw new Error("Unknown model: "+r);let t,i;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof L)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){let n=xe.get(e);if(n===null)throw new Error("Unable to parse color from string: "+e);this.model=n.model,i=D[this.model].channels,this.color=n.value.slice(0,i),this.valpha=typeof n.value[i]=="number"?n.value[i]:1}else if(e.length>0){this.model=r||"rgb",i=D[this.model].channels;let n=Array.prototype.slice.call(e,0,i);this.color=Or(n,i),this.valpha=typeof e[i]=="number"?e[i]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let n=Object.keys(e);"alpha"in e&&(n.splice(n.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);let s=n.sort().join("");if(!(s in Fr))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Fr[s];let{labels:o}=D[this.model],l=[];for(t=0;t<o.length;t++)l.push(e[o[t]]);this.color=Or(l)}if(rr[this.model])for(i=D[this.model].channels,t=0;t<i;t++){let n=rr[this.model][t];n&&(this.color[t]=n(this.color[t]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}L.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let r=this.model in xe.to?this:this.rgb();r=r.round(typeof e=="number"?e:1);let t=r.valpha===1?r.color:[...r.color,this.valpha];return xe.to[r.model](t)},percentString(e){let r=this.rgb().round(typeof e=="number"?e:1),t=r.valpha===1?r.color:[...r.color,this.valpha];return xe.to.rgb.percent(t)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:r}=D[this.model],{labels:t}=D[this.model];for(let i=0;i<r;i++)e[t[i]]=this.color[i];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){let e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){let e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new L([...this.color.map(yo(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new L([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:I("rgb",0,$(255)),green:I("rgb",1,$(255)),blue:I("rgb",2,$(255)),hue:I(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:I("hsl",1,$(100)),lightness:I("hsl",2,$(100)),saturationv:I("hsv",1,$(100)),value:I("hsv",2,$(100)),chroma:I("hcg",1,$(100)),gray:I("hcg",2,$(100)),white:I("hwb",1,$(100)),wblack:I("hwb",2,$(100)),cyan:I("cmyk",0,$(100)),magenta:I("cmyk",1,$(100)),yellow:I("cmyk",2,$(100)),black:I("cmyk",3,$(100)),x:I("xyz",0,$(95.047)),y:I("xyz",1,$(100)),z:I("xyz",2,$(108.833)),l:I("lab",0,$(100)),a:I("lab",1),b:I("lab",2),keyword(e){return e!==void 0?new L(e):D[this.model].keyword(this.color)},hex(e){return e!==void 0?new L(e):xe.to.hex(this.rgb().round().color)},hexa(e){if(e!==void 0)return new L(e);let r=this.rgb().round().color,t=Math.round(this.valpha*255).toString(16).toUpperCase();return t.length===1&&(t="0"+t),xe.to.hex(r)+t},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,r=[];for(let[t,i]of e.entries()){let n=i/255;r[t]=n<=.04045?n/12.92:((n+.055)/1.055)**2.4}return .2126*r[0]+.7152*r[1]+.0722*r[2]},contrast(e){let r=this.luminosity(),t=e.luminosity();return r>t?(r+.05)/(t+.05):(t+.05)/(r+.05)},level(e){let r=this.contrast(e);return r>=7?"AAA":r>=4.5?"AA":""},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let r=0;r<3;r++)e.color[r]=255-e.color[r];return e},lighten(e){let r=this.hsl();return r.color[2]+=r.color[2]*e,r},darken(e){let r=this.hsl();return r.color[2]-=r.color[2]*e,r},saturate(e){let r=this.hsl();return r.color[1]+=r.color[1]*e,r},desaturate(e){let r=this.hsl();return r.color[1]-=r.color[1]*e,r},whiten(e){let r=this.hwb();return r.color[1]+=r.color[1]*e,r},blacken(e){let r=this.hwb();return r.color[2]+=r.color[2]*e,r},grayscale(){let e=this.rgb().color,r=e[0]*.3+e[1]*.59+e[2]*.11;return L.rgb(r,r,r)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let r=this.hsl(),t=r.color[0];return t=(t+e)%360,t=t<0?360+t:t,r.color[0]=t,r},mix(e,r){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);let t=e.rgb(),i=this.rgb(),n=r===void 0?.5:r,s=2*n-1,o=t.alpha()-i.alpha(),l=((s*o===-1?s:(s+o)/(1+s*o))+1)/2,f=1-l;return L.rgb(l*t.red()+f*i.red(),l*t.green()+f*i.green(),l*t.blue()+f*i.blue(),t.alpha()*n+i.alpha()*(1-n))}};for(let e of Object.keys(D)){if(zi.includes(e))continue;let{channels:r}=D[e];L.prototype[e]=function(...t){return this.model===e?new L(this):t.length>0?new L(t,e):new L([...Eo(D[this.model][e].raw(this.color)),this.valpha],e)},L[e]=function(...t){let i=t[0];return typeof i=="number"&&(i=Or(t,r)),new L(i,e)}}function wo(e,r){return Number(e.toFixed(r))}function yo(e){return function(r){return wo(r,e)}}function I(e,r,t){e=Array.isArray(e)?e:[e];for(let i of e)(rr[i]||(rr[i]=[]))[r]=t;return e=e[0],function(i){let n;return i!==void 0?(t&&(i=t(i)),n=this[e](),n.color[r]=i,n):(n=this[e]().color[r],t&&(n=t(n)),n)}}function $(e){return function(r){return Math.max(0,Math.min(e,r))}}function Eo(e){return Array.isArray(e)?e:[e]}function Or(e,r){for(let t=0;t<r;t++)typeof e[t]!="number"&&(e[t]=0);return e}Ui.exports=L});var Wi=y((ef,Hi)=>{"use strict";var vo=tr(),h=J(),ce=Ne(),xo={left:"low",center:"centre",centre:"centre",right:"high"};function Gi(e){let{raw:r,density:t,limitInputPixels:i,ignoreIcc:n,unlimited:s,sequentialRead:o,failOn:l,failOnError:f,animated:u,page:b,pages:w,subifd:S}=e;return[r,t,i,n,s,o,l,f,u,b,w,S].some(h.defined)?{raw:r,density:t,limitInputPixels:i,ignoreIcc:n,unlimited:s,sequentialRead:o,failOn:l,failOnError:f,animated:u,page:b,pages:w,subifd:S}:void 0}function Po(e,r,t){let i={failOn:"warning",limitInputPixels:Math.pow(16383,2),ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(h.string(e))i.file=e;else if(h.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");i.buffer=e}else if(h.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");i.buffer=Buffer.from(e,0,e.byteLength)}else if(h.typedArray(e)){if(e.length===0)throw Error("Input Bit Array is empty");i.buffer=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(h.plainObject(e)&&!h.defined(r))r=e,Gi(r)&&(i.buffer=[]);else if(!h.defined(e)&&!h.defined(r)&&h.object(t)&&t.allowStream)i.buffer=[];else throw new Error(`Unsupported input '${e}' of type ${typeof e}${h.defined(r)?` when also providing options of type ${typeof r}`:""}`);if(h.object(r)){if(h.defined(r.failOnError))if(h.bool(r.failOnError))i.failOn=r.failOnError?"warning":"none";else throw h.invalidParameterError("failOnError","boolean",r.failOnError);if(h.defined(r.failOn))if(h.string(r.failOn)&&h.inArray(r.failOn,["none","truncated","error","warning"]))i.failOn=r.failOn;else throw h.invalidParameterError("failOn","one of: none, truncated, error, warning",r.failOn);if(h.defined(r.density))if(h.inRange(r.density,1,1e5))i.density=r.density;else throw h.invalidParameterError("density","number between 1 and 100000",r.density);if(h.defined(r.ignoreIcc))if(h.bool(r.ignoreIcc))i.ignoreIcc=r.ignoreIcc;else throw h.invalidParameterError("ignoreIcc","boolean",r.ignoreIcc);if(h.defined(r.limitInputPixels))if(h.bool(r.limitInputPixels))i.limitInputPixels=r.limitInputPixels?Math.pow(16383,2):0;else if(h.integer(r.limitInputPixels)&&h.inRange(r.limitInputPixels,0,Number.MAX_SAFE_INTEGER))i.limitInputPixels=r.limitInputPixels;else throw h.invalidParameterError("limitInputPixels","positive integer",r.limitInputPixels);if(h.defined(r.unlimited))if(h.bool(r.unlimited))i.unlimited=r.unlimited;else throw h.invalidParameterError("unlimited","boolean",r.unlimited);if(h.defined(r.sequentialRead))if(h.bool(r.sequentialRead))i.sequentialRead=r.sequentialRead;else throw h.invalidParameterError("sequentialRead","boolean",r.sequentialRead);if(h.defined(r.raw))if(h.object(r.raw)&&h.integer(r.raw.width)&&r.raw.width>0&&h.integer(r.raw.height)&&r.raw.height>0&&h.integer(r.raw.channels)&&h.inRange(r.raw.channels,1,4))switch(i.rawWidth=r.raw.width,i.rawHeight=r.raw.height,i.rawChannels=r.raw.channels,i.rawPremultiplied=!!r.raw.premultiplied,e.constructor){case Uint8Array:case Uint8ClampedArray:i.rawDepth="uchar";break;case Int8Array:i.rawDepth="char";break;case Uint16Array:i.rawDepth="ushort";break;case Int16Array:i.rawDepth="short";break;case Uint32Array:i.rawDepth="uint";break;case Int32Array:i.rawDepth="int";break;case Float32Array:i.rawDepth="float";break;case Float64Array:i.rawDepth="double";break;default:i.rawDepth="uchar";break}else throw new Error("Expected width, height and channels for raw pixel input");if(h.defined(r.animated))if(h.bool(r.animated))i.pages=r.animated?-1:1;else throw h.invalidParameterError("animated","boolean",r.animated);if(h.defined(r.pages))if(h.integer(r.pages)&&h.inRange(r.pages,-1,1e5))i.pages=r.pages;else throw h.invalidParameterError("pages","integer between -1 and 100000",r.pages);if(h.defined(r.page))if(h.integer(r.page)&&h.inRange(r.page,0,1e5))i.page=r.page;else throw h.invalidParameterError("page","integer between 0 and 100000",r.page);if(h.defined(r.level))if(h.integer(r.level)&&h.inRange(r.level,0,256))i.level=r.level;else throw h.invalidParameterError("level","integer between 0 and 256",r.level);if(h.defined(r.subifd))if(h.integer(r.subifd)&&h.inRange(r.subifd,-1,1e5))i.subifd=r.subifd;else throw h.invalidParameterError("subifd","integer between -1 and 100000",r.subifd);if(h.defined(r.create))if(h.object(r.create)&&h.integer(r.create.width)&&r.create.width>0&&h.integer(r.create.height)&&r.create.height>0&&h.integer(r.create.channels)){if(i.createWidth=r.create.width,i.createHeight=r.create.height,i.createChannels=r.create.channels,h.defined(r.create.noise)){if(!h.object(r.create.noise))throw new Error("Expected noise to be an object");if(!h.inArray(r.create.noise.type,["gaussian"]))throw new Error("Only gaussian noise is supported at the moment");if(!h.inRange(r.create.channels,1,4))throw h.invalidParameterError("create.channels","number between 1 and 4",r.create.channels);if(i.createNoiseType=r.create.noise.type,h.number(r.create.noise.mean)&&h.inRange(r.create.noise.mean,0,1e4))i.createNoiseMean=r.create.noise.mean;else throw h.invalidParameterError("create.noise.mean","number between 0 and 10000",r.create.noise.mean);if(h.number(r.create.noise.sigma)&&h.inRange(r.create.noise.sigma,0,1e4))i.createNoiseSigma=r.create.noise.sigma;else throw h.invalidParameterError("create.noise.sigma","number between 0 and 10000",r.create.noise.sigma)}else if(h.defined(r.create.background)){if(!h.inRange(r.create.channels,3,4))throw h.invalidParameterError("create.channels","number between 3 and 4",r.create.channels);let n=vo(r.create.background);i.createBackground=[n.red(),n.green(),n.blue(),Math.round(n.alpha()*255)]}else throw new Error("Expected valid noise or background to create a new input image");delete i.buffer}else throw new Error("Expected valid width, height and channels to create a new input image");if(h.defined(r.text))if(h.object(r.text)&&h.string(r.text.text)){if(i.textValue=r.text.text,h.defined(r.text.height)&&h.defined(r.text.dpi))throw new Error("Expected only one of dpi or height");if(h.defined(r.text.font))if(h.string(r.text.font))i.textFont=r.text.font;else throw h.invalidParameterError("text.font","string",r.text.font);if(h.defined(r.text.fontfile))if(h.string(r.text.fontfile))i.textFontfile=r.text.fontfile;else throw h.invalidParameterError("text.fontfile","string",r.text.fontfile);if(h.defined(r.text.width))if(h.integer(r.text.width)&&r.text.width>0)i.textWidth=r.text.width;else throw h.invalidParameterError("text.width","positive integer",r.text.width);if(h.defined(r.text.height))if(h.integer(r.text.height)&&r.text.height>0)i.textHeight=r.text.height;else throw h.invalidParameterError("text.height","positive integer",r.text.height);if(h.defined(r.text.align))if(h.string(r.text.align)&&h.string(this.constructor.align[r.text.align]))i.textAlign=this.constructor.align[r.text.align];else throw h.invalidParameterError("text.align","valid alignment",r.text.align);if(h.defined(r.text.justify))if(h.bool(r.text.justify))i.textJustify=r.text.justify;else throw h.invalidParameterError("text.justify","boolean",r.text.justify);if(h.defined(r.text.dpi))if(h.integer(r.text.dpi)&&h.inRange(r.text.dpi,1,1e6))i.textDpi=r.text.dpi;else throw h.invalidParameterError("text.dpi","integer between 1 and 1000000",r.text.dpi);if(h.defined(r.text.rgba))if(h.bool(r.text.rgba))i.textRgba=r.text.rgba;else throw h.invalidParameterError("text.rgba","bool",r.text.rgba);if(h.defined(r.text.spacing))if(h.integer(r.text.spacing)&&h.inRange(r.text.spacing,-1e6,1e6))i.textSpacing=r.text.spacing;else throw h.invalidParameterError("text.spacing","integer between -1000000 and 1000000",r.text.spacing);if(h.defined(r.text.wrap))if(h.string(r.text.wrap)&&h.inArray(r.text.wrap,["word","char","word-char","none"]))i.textWrap=r.text.wrap;else throw h.invalidParameterError("text.wrap","one of: word, char, word-char, none",r.text.wrap);delete i.buffer}else throw new Error("Expected a valid string to create an image with text.")}else if(h.defined(r))throw new Error("Invalid input options "+r);return i}function Ro(e,r,t){Array.isArray(this.options.input.buffer)?h.buffer(e)?(this.options.input.buffer.length===0&&this.on("finish",()=>{this.streamInFinished=!0}),this.options.input.buffer.push(e),t()):t(new Error("Non-Buffer data on Writable Stream")):t(new Error("Unexpected data on Writable Stream"))}function Io(){this._isStreamInput()&&(this.options.input.buffer=Buffer.concat(this.options.input.buffer))}function So(){return Array.isArray(this.options.input.buffer)}function Ao(e){let r=Error();return h.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),ce.metadata(this.options,(t,i)=>{t?e(h.nativeError(t,r)):e(null,i)})}):ce.metadata(this.options,(t,i)=>{t?e(h.nativeError(t,r)):e(null,i)}),this):this._isStreamInput()?new Promise((t,i)=>{let n=()=>{this._flattenBufferIn(),ce.metadata(this.options,(s,o)=>{s?i(h.nativeError(s,r)):t(o)})};this.writableFinished?n():this.once("finish",n)}):new Promise((t,i)=>{ce.metadata(this.options,(n,s)=>{n?i(h.nativeError(n,r)):t(s)})})}function $o(e){let r=Error();return h.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),ce.stats(this.options,(t,i)=>{t?e(h.nativeError(t,r)):e(null,i)})}):ce.stats(this.options,(t,i)=>{t?e(h.nativeError(t,r)):e(null,i)}),this):this._isStreamInput()?new Promise((t,i)=>{this.on("finish",function(){this._flattenBufferIn(),ce.stats(this.options,(n,s)=>{n?i(h.nativeError(n,r)):t(s)})})}):new Promise((t,i)=>{ce.stats(this.options,(n,s)=>{n?i(h.nativeError(n,r)):t(s)})})}Hi.exports=function(e){Object.assign(e.prototype,{_inputOptionsFromObject:Gi,_createInputDescriptor:Po,_write:Ro,_flattenBufferIn:Io,_isStreamInput:So,metadata:Ao,stats:$o}),e.align=xo}});var Yi=y((rf,Ki)=>{"use strict";var p=J(),Xi={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},Qi={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},Vi={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},Ji={entropy:16,attention:17},Cr={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3"},Lo={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},To={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"};function Br(e){return e.angle%360!==0||e.useExifOrientation===!0||e.rotationAngle!==0}function ir(e){return e.width!==-1||e.height!==-1}function ko(e,r,t){if(ir(this.options)&&this.options.debuglog("ignoring previous resize options"),this.options.widthPost!==-1&&this.options.debuglog("operation order will be: extract, resize, extract"),p.defined(e))if(p.object(e)&&!p.defined(t))t=e;else if(p.integer(e)&&e>0)this.options.width=e;else throw p.invalidParameterError("width","positive integer",e);else this.options.width=-1;if(p.defined(r))if(p.integer(r)&&r>0)this.options.height=r;else throw p.invalidParameterError("height","positive integer",r);else this.options.height=-1;if(p.object(t)){if(p.defined(t.width))if(p.integer(t.width)&&t.width>0)this.options.width=t.width;else throw p.invalidParameterError("width","positive integer",t.width);if(p.defined(t.height))if(p.integer(t.height)&&t.height>0)this.options.height=t.height;else throw p.invalidParameterError("height","positive integer",t.height);if(p.defined(t.fit)){let i=To[t.fit];if(p.string(i))this.options.canvas=i;else throw p.invalidParameterError("fit","valid fit",t.fit)}if(p.defined(t.position)){let i=p.integer(t.position)?t.position:Ji[t.position]||Qi[t.position]||Xi[t.position];if(p.integer(i)&&(p.inRange(i,0,8)||p.inRange(i,16,17)))this.options.position=i;else throw p.invalidParameterError("position","valid position/gravity/strategy",t.position)}if(this._setBackgroundColourOption("resizeBackground",t.background),p.defined(t.kernel))if(p.string(Cr[t.kernel]))this.options.kernel=Cr[t.kernel];else throw p.invalidParameterError("kernel","valid kernel name",t.kernel);p.defined(t.withoutEnlargement)&&this._setBooleanOption("withoutEnlargement",t.withoutEnlargement),p.defined(t.withoutReduction)&&this._setBooleanOption("withoutReduction",t.withoutReduction),p.defined(t.fastShrinkOnLoad)&&this._setBooleanOption("fastShrinkOnLoad",t.fastShrinkOnLoad)}return Br(this.options)&&ir(this.options)&&(this.options.rotateBeforePreExtract=!0),this}function jo(e){if(p.integer(e)&&e>0)this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else if(p.object(e)){if(p.defined(e.top))if(p.integer(e.top)&&e.top>=0)this.options.extendTop=e.top;else throw p.invalidParameterError("top","positive integer",e.top);if(p.defined(e.bottom))if(p.integer(e.bottom)&&e.bottom>=0)this.options.extendBottom=e.bottom;else throw p.invalidParameterError("bottom","positive integer",e.bottom);if(p.defined(e.left))if(p.integer(e.left)&&e.left>=0)this.options.extendLeft=e.left;else throw p.invalidParameterError("left","positive integer",e.left);if(p.defined(e.right))if(p.integer(e.right)&&e.right>=0)this.options.extendRight=e.right;else throw p.invalidParameterError("right","positive integer",e.right);if(this._setBackgroundColourOption("extendBackground",e.background),p.defined(e.extendWith))if(p.string(Vi[e.extendWith]))this.options.extendWith=Vi[e.extendWith];else throw p.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",e.extendWith)}else throw p.invalidParameterError("extend","integer or object",e);return this}function No(e){let r=ir(this.options)||this.options.widthPre!==-1?"Post":"Pre";return this.options[`width${r}`]!==-1&&this.options.debuglog("ignoring previous extract options"),["left","top","width","height"].forEach(function(t){let i=e[t];if(p.integer(i)&&i>=0)this.options[t+(t==="left"||t==="top"?"Offset":"")+r]=i;else throw p.invalidParameterError(t,"integer",i)},this),Br(this.options)&&!ir(this.options)&&(this.options.widthPre===-1||this.options.widthPost===-1)&&(this.options.rotateBeforePreExtract=!0),this}function Fo(e){if(this.options.trimThreshold=10,p.defined(e))if(p.object(e)){if(p.defined(e.background)&&this._setBackgroundColourOption("trimBackground",e.background),p.defined(e.threshold))if(p.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw p.invalidParameterError("threshold","positive number",e.threshold);p.defined(e.lineArt)&&this._setBooleanOption("trimLineArt",e.lineArt)}else throw p.invalidParameterError("trim","object",e);return Br(this.options)&&(this.options.rotateBeforePreExtract=!0),this}Ki.exports=function(e){Object.assign(e.prototype,{resize:ko,extend:jo,extract:No,trim:Fo}),e.gravity=Xi,e.strategy=Ji,e.kernel=Cr,e.fit=Lo,e.position=Qi}});var en=y((tf,Zi)=>{"use strict";var x=J(),qr={clear:"clear",source:"source",over:"over",in:"in",out:"out",atop:"atop",dest:"dest","dest-over":"dest-over","dest-in":"dest-in","dest-out":"dest-out","dest-atop":"dest-atop",xor:"xor",add:"add",saturate:"saturate",multiply:"multiply",screen:"screen",overlay:"overlay",darken:"darken",lighten:"lighten","colour-dodge":"colour-dodge","color-dodge":"colour-dodge","colour-burn":"colour-burn","color-burn":"colour-burn","hard-light":"hard-light","soft-light":"soft-light",difference:"difference",exclusion:"exclusion"};function Oo(e){if(!Array.isArray(e))throw x.invalidParameterError("images to composite","array",e);return this.options.composite=e.map(r=>{if(!x.object(r))throw x.invalidParameterError("image to composite","object",r);let t=this._inputOptionsFromObject(r),i={input:this._createInputDescriptor(r.input,t,{allowStream:!1}),blend:"over",tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(x.defined(r.blend))if(x.string(qr[r.blend]))i.blend=qr[r.blend];else throw x.invalidParameterError("blend","valid blend name",r.blend);if(x.defined(r.tile))if(x.bool(r.tile))i.tile=r.tile;else throw x.invalidParameterError("tile","boolean",r.tile);if(x.defined(r.left))if(x.integer(r.left))i.left=r.left;else throw x.invalidParameterError("left","integer",r.left);if(x.defined(r.top))if(x.integer(r.top))i.top=r.top;else throw x.invalidParameterError("top","integer",r.top);if(x.defined(r.top)!==x.defined(r.left))throw new Error("Expected both left and top to be set");if(i.hasOffset=x.integer(r.top)&&x.integer(r.left),x.defined(r.gravity))if(x.integer(r.gravity)&&x.inRange(r.gravity,0,8))i.gravity=r.gravity;else if(x.string(r.gravity)&&x.integer(this.constructor.gravity[r.gravity]))i.gravity=this.constructor.gravity[r.gravity];else throw x.invalidParameterError("gravity","valid gravity",r.gravity);if(x.defined(r.premultiplied))if(x.bool(r.premultiplied))i.premultiplied=r.premultiplied;else throw x.invalidParameterError("premultiplied","boolean",r.premultiplied);return i}),this}Zi.exports=function(e){e.prototype.composite=Oo,e.blend=qr}});var nn=y((nf,tn)=>{"use strict";var Co=tr(),c=J(),rn={integer:"integer",float:"float",approximate:"approximate"};function Bo(e,r){if((this.options.useExifOrientation||this.options.angle||this.options.rotationAngle)&&this.options.debuglog("ignoring previous rotate options"),!c.defined(e))this.options.useExifOrientation=!0;else if(c.integer(e)&&!(e%90))this.options.angle=e;else if(c.number(e)){if(this.options.rotationAngle=e,c.object(r)&&r.background){let t=Co(r.background);this.options.rotationBackground=[t.red(),t.green(),t.blue(),Math.round(t.alpha()*255)]}}else throw c.invalidParameterError("angle","numeric",e);return this}function qo(e){return this.options.flip=c.bool(e)?e:!0,this}function Mo(e){return this.options.flop=c.bool(e)?e:!0,this}function Do(e,r){let t=[].concat(...e);if(t.length===4&&t.every(c.number))this.options.affineMatrix=t;else throw c.invalidParameterError("matrix","1x4 or 2x2 array",e);if(c.defined(r))if(c.object(r)){if(this._setBackgroundColourOption("affineBackground",r.background),c.defined(r.idx))if(c.number(r.idx))this.options.affineIdx=r.idx;else throw c.invalidParameterError("options.idx","number",r.idx);if(c.defined(r.idy))if(c.number(r.idy))this.options.affineIdy=r.idy;else throw c.invalidParameterError("options.idy","number",r.idy);if(c.defined(r.odx))if(c.number(r.odx))this.options.affineOdx=r.odx;else throw c.invalidParameterError("options.odx","number",r.odx);if(c.defined(r.ody))if(c.number(r.ody))this.options.affineOdy=r.ody;else throw c.invalidParameterError("options.ody","number",r.ody);if(c.defined(r.interpolator))if(c.inArray(r.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=r.interpolator;else throw c.invalidParameterError("options.interpolator","valid interpolator name",r.interpolator)}else throw c.invalidParameterError("options","object",r);return this}function _o(e,r,t){if(!c.defined(e))this.options.sharpenSigma=-1;else if(c.bool(e))this.options.sharpenSigma=e?-1:0;else if(c.number(e)&&c.inRange(e,.01,1e4)){if(this.options.sharpenSigma=e,c.defined(r))if(c.number(r)&&c.inRange(r,0,1e4))this.options.sharpenM1=r;else throw c.invalidParameterError("flat","number between 0 and 10000",r);if(c.defined(t))if(c.number(t)&&c.inRange(t,0,1e4))this.options.sharpenM2=t;else throw c.invalidParameterError("jagged","number between 0 and 10000",t)}else if(c.plainObject(e)){if(c.number(e.sigma)&&c.inRange(e.sigma,1e-6,10))this.options.sharpenSigma=e.sigma;else throw c.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(c.defined(e.m1))if(c.number(e.m1)&&c.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw c.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(c.defined(e.m2))if(c.number(e.m2)&&c.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw c.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(c.defined(e.x1))if(c.number(e.x1)&&c.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw c.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(c.defined(e.y2))if(c.number(e.y2)&&c.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw c.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(c.defined(e.y3))if(c.number(e.y3)&&c.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw c.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else throw c.invalidParameterError("sigma","number between 0.01 and 10000",e);return this}function zo(e){if(!c.defined(e))this.options.medianSize=3;else if(c.integer(e)&&c.inRange(e,1,1e3))this.options.medianSize=e;else throw c.invalidParameterError("size","integer between 1 and 1000",e);return this}function Uo(e){let r;if(c.number(e))r=e;else if(c.plainObject(e)){if(!c.number(e.sigma))throw c.invalidParameterError("options.sigma","number between 0.3 and 1000",r);if(r=e.sigma,"precision"in e)if(c.string(rn[e.precision]))this.options.precision=rn[e.precision];else throw c.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(c.number(e.minAmplitude)&&c.inRange(e.minAmplitude,.001,1))this.options.minAmpl=e.minAmplitude;else throw c.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!c.defined(e))this.options.blurSigma=-1;else if(c.bool(e))this.options.blurSigma=e?-1:0;else if(c.number(r)&&c.inRange(r,.3,1e3))this.options.blurSigma=r;else throw c.invalidParameterError("sigma","number between 0.3 and 1000",r);return this}function Go(e){return this.options.flatten=c.bool(e)?e:!0,c.object(e)&&this._setBackgroundColourOption("flattenBackground",e.background),this}function Ho(){return this.options.unflatten=!0,this}function Wo(e,r){if(!c.defined(e))this.options.gamma=2.2;else if(c.number(e)&&c.inRange(e,1,3))this.options.gamma=e;else throw c.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!c.defined(r))this.options.gammaOut=this.options.gamma;else if(c.number(r)&&c.inRange(r,1,3))this.options.gammaOut=r;else throw c.invalidParameterError("gammaOut","number between 1.0 and 3.0",r);return this}function Vo(e){if(this.options.negate=c.bool(e)?e:!0,c.plainObject(e)&&"alpha"in e)if(c.bool(e.alpha))this.options.negateAlpha=e.alpha;else throw c.invalidParameterError("alpha","should be boolean value",e.alpha);return this}function Xo(e){if(c.plainObject(e)){if(c.defined(e.lower))if(c.number(e.lower)&&c.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw c.invalidParameterError("lower","number between 0 and 99",e.lower);if(c.defined(e.upper))if(c.number(e.upper)&&c.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw c.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw c.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function Qo(e){return this.normalise(e)}function Jo(e){if(c.plainObject(e)){if(c.integer(e.width)&&e.width>0)this.options.claheWidth=e.width;else throw c.invalidParameterError("width","integer greater than zero",e.width);if(c.integer(e.height)&&e.height>0)this.options.claheHeight=e.height;else throw c.invalidParameterError("height","integer greater than zero",e.height);if(c.defined(e.maxSlope))if(c.integer(e.maxSlope)&&c.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw c.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw c.invalidParameterError("options","plain object",e);return this}function Ko(e){if(!c.object(e)||!Array.isArray(e.kernel)||!c.integer(e.width)||!c.integer(e.height)||!c.inRange(e.width,3,1001)||!c.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length)throw new Error("Invalid convolution kernel");return c.integer(e.scale)||(e.scale=e.kernel.reduce(function(r,t){return r+t},0)),e.scale<1&&(e.scale=1),c.integer(e.offset)||(e.offset=0),this.options.convKernel=e,this}function Yo(e,r){if(!c.defined(e))this.options.threshold=128;else if(c.bool(e))this.options.threshold=e?128:0;else if(c.integer(e)&&c.inRange(e,0,255))this.options.threshold=e;else throw c.invalidParameterError("threshold","integer between 0 and 255",e);return!c.object(r)||r.greyscale===!0||r.grayscale===!0?this.options.thresholdGrayscale=!0:this.options.thresholdGrayscale=!1,this}function Zo(e,r,t){if(this.options.boolean=this._createInputDescriptor(e,t),c.string(r)&&c.inArray(r,["and","or","eor"]))this.options.booleanOp=r;else throw c.invalidParameterError("operator","one of: and, or, eor",r);return this}function el(e,r){if(!c.defined(e)&&c.number(r)?e=1:c.number(e)&&!c.defined(r)&&(r=0),!c.defined(e))this.options.linearA=[];else if(c.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&e.length&&e.every(c.number))this.options.linearA=e;else throw c.invalidParameterError("a","number or array of numbers",e);if(!c.defined(r))this.options.linearB=[];else if(c.number(r))this.options.linearB=[r];else if(Array.isArray(r)&&r.length&&r.every(c.number))this.options.linearB=r;else throw c.invalidParameterError("b","number or array of numbers",r);if(this.options.linearA.length!==this.options.linearB.length)throw new Error("Expected a and b to be arrays of the same length");return this}function rl(e){if(!Array.isArray(e))throw c.invalidParameterError("inputMatrix","array",e);if(e.length!==3&&e.length!==4)throw c.invalidParameterError("inputMatrix","3x3 or 4x4 array",e.length);let r=e.flat().map(Number);if(r.length!==9&&r.length!==16)throw c.invalidParameterError("inputMatrix","cardinality of 9 or 16",r.length);return this.options.recombMatrix=r,this}function tl(e){if(!c.plainObject(e))throw c.invalidParameterError("options","plain object",e);if("brightness"in e)if(c.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw c.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(c.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw c.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(c.integer(e.hue))this.options.hue=e.hue%360;else throw c.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(c.number(e.lightness))this.options.lightness=e.lightness;else throw c.invalidParameterError("lightness","number",e.lightness);return this}tn.exports=function(e){Object.assign(e.prototype,{rotate:Bo,flip:qo,flop:Mo,affine:Do,sharpen:_o,median:zo,blur:Uo,flatten:Go,unflatten:Ho,gamma:Wo,negate:Vo,normalise:Xo,normalize:Qo,clahe:Jo,convolve:Ko,threshold:Yo,boolean:Zo,linear:el,recomb:rl,modulate:tl})}});var on=y((sf,an)=>{"use strict";var il=tr(),ie=J(),sn={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"};function nl(e){return this._setBackgroundColourOption("tint",e),this}function sl(e){return this.options.greyscale=ie.bool(e)?e:!0,this}function al(e){return this.greyscale(e)}function ol(e){if(!ie.string(e))throw ie.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function ll(e){return this.pipelineColourspace(e)}function cl(e){if(!ie.string(e))throw ie.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function fl(e){return this.toColourspace(e)}function hl(e,r){if(ie.defined(r))if(ie.object(r)||ie.string(r)){let t=il(r);this.options[e]=[t.red(),t.green(),t.blue(),Math.round(t.alpha()*255)]}else throw ie.invalidParameterError("background","object or string",r)}an.exports=function(e){Object.assign(e.prototype,{tint:nl,greyscale:sl,grayscale:al,pipelineColourspace:ol,pipelineColorspace:ll,toColourspace:cl,toColorspace:fl,_setBackgroundColourOption:hl}),e.colourspace=sn,e.colorspace=sn}});var cn=y((af,ln)=>{"use strict";var ee=J(),ul={and:"and",or:"or",eor:"eor"};function dl(){return this.options.removeAlpha=!0,this}function ml(e){if(ee.defined(e))if(ee.number(e)&&ee.inRange(e,0,1))this.options.ensureAlpha=e;else throw ee.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function gl(e){let r={red:0,green:1,blue:2,alpha:3};if(Object.keys(r).includes(e)&&(e=r[e]),ee.integer(e)&&ee.inRange(e,0,4))this.options.extractChannel=e;else throw ee.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function pl(e,r){return Array.isArray(e)?e.forEach(function(t){this.options.joinChannelIn.push(this._createInputDescriptor(t,r))},this):this.options.joinChannelIn.push(this._createInputDescriptor(e,r)),this}function bl(e){if(ee.string(e)&&ee.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw ee.invalidParameterError("boolOp","one of: and, or, eor",e);return this}ln.exports=function(e){Object.assign(e.prototype,{removeAlpha:dl,ensureAlpha:ml,extractChannel:gl,joinChannel:pl,bandbool:bl}),e.bool=ul}});var gn=y((of,mn)=>{"use strict";var Mr=R("node:path"),a=J(),Pe=Ne(),fn=new Map([["heic","heif"],["heif","heif"],["avif","avif"],["jpeg","jpeg"],["jpg","jpeg"],["jpe","jpeg"],["tile","tile"],["dz","tile"],["png","png"],["raw","raw"],["tiff","tiff"],["tif","tiff"],["webp","webp"],["gif","gif"],["jp2","jp2"],["jpx","jp2"],["j2k","jp2"],["j2c","jp2"],["jxl","jxl"]]),wl=/\.(jp[2x]|j2[kc])$/i,hn=()=>new Error("JP2 output requires libvips with support for OpenJPEG"),un=e=>1<<31-Math.clz32(Math.ceil(Math.log2(e)));function yl(e,r){let t;if(a.string(e)?a.string(this.options.input.file)&&Mr.resolve(this.options.input.file)===Mr.resolve(e)?t=new Error("Cannot use same file for input and output"):wl.test(Mr.extname(e))&&!this.constructor.format.jp2k.output.file&&(t=hn()):t=new Error("Missing output file path"),t)if(a.fn(r))r(t);else return Promise.reject(t);else{this.options.fileOut=e;let i=Error();return this._pipeline(r,i)}return this}function El(e,r){a.object(e)?this._setBooleanOption("resolveWithObject",e.resolveWithObject):this.options.resolveWithObject&&(this.options.resolveWithObject=!1),this.options.fileOut="";let t=Error();return this._pipeline(a.fn(e)?e:r,t)}function vl(){return this.options.keepMetadata|=1,this}function xl(e){if(a.object(e))for(let[r,t]of Object.entries(e))if(a.object(t))for(let[i,n]of Object.entries(t))if(a.string(n))this.options.withExif[`exif-${r.toLowerCase()}-${i}`]=n;else throw a.invalidParameterError(`${r}.${i}`,"string",n);else throw a.invalidParameterError(r,"object",t);else throw a.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function Pl(e){return this.withExif(e),this.options.withExifMerge=!0,this}function Rl(){return this.options.keepMetadata|=8,this}function Il(e,r){if(a.string(e))this.options.withIccProfile=e;else throw a.invalidParameterError("icc","string",e);if(this.keepIccProfile(),a.object(r)&&a.defined(r.attach))if(a.bool(r.attach))r.attach||(this.options.keepMetadata&=-9);else throw a.invalidParameterError("attach","boolean",r.attach);return this}function Sl(){return this.options.keepMetadata=31,this}function Al(e){if(this.keepMetadata(),this.withIccProfile("srgb"),a.object(e)){if(a.defined(e.orientation))if(a.integer(e.orientation)&&a.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw a.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(a.defined(e.density))if(a.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw a.invalidParameterError("density","positive number",e.density);a.defined(e.icc)&&this.withIccProfile(e.icc),a.defined(e.exif)&&this.withExifMerge(e.exif)}return this}function $l(e,r){let t=fn.get((a.object(e)&&a.string(e.id)?e.id:e).toLowerCase());if(!t)throw a.invalidParameterError("format",`one of: ${[...fn.keys()].join(", ")}`,e);return this[t](r)}function Ll(e){if(a.object(e)){if(a.defined(e.quality))if(a.integer(e.quality)&&a.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw a.invalidParameterError("quality","integer between 1 and 100",e.quality);if(a.defined(e.progressive)&&this._setBooleanOption("jpegProgressive",e.progressive),a.defined(e.chromaSubsampling))if(a.string(e.chromaSubsampling)&&a.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw a.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let r=a.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(a.defined(r)&&this._setBooleanOption("jpegOptimiseCoding",r),a.defined(e.mozjpeg))if(a.bool(e.mozjpeg))e.mozjpeg&&(this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3);else throw a.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let t=a.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;a.defined(t)&&this._setBooleanOption("jpegTrellisQuantisation",t),a.defined(e.overshootDeringing)&&this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let i=a.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;a.defined(i)&&(this._setBooleanOption("jpegOptimiseScans",i),i&&(this.options.jpegProgressive=!0));let n=a.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(a.defined(n))if(a.integer(n)&&a.inRange(n,0,8))this.options.jpegQuantisationTable=n;else throw a.invalidParameterError("quantisationTable","integer between 0 and 8",n)}return this._updateFormatOut("jpeg",e)}function Tl(e){if(a.object(e)){if(a.defined(e.progressive)&&this._setBooleanOption("pngProgressive",e.progressive),a.defined(e.compressionLevel))if(a.integer(e.compressionLevel)&&a.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw a.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);a.defined(e.adaptiveFiltering)&&this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let r=e.colours||e.colors;if(a.defined(r))if(a.integer(r)&&a.inRange(r,2,256))this.options.pngBitdepth=un(r);else throw a.invalidParameterError("colours","integer between 2 and 256",r);if(a.defined(e.palette)?this._setBooleanOption("pngPalette",e.palette):[e.quality,e.effort,e.colours,e.colors,e.dither].some(a.defined)&&this._setBooleanOption("pngPalette",!0),this.options.pngPalette){if(a.defined(e.quality))if(a.integer(e.quality)&&a.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw a.invalidParameterError("quality","integer between 0 and 100",e.quality);if(a.defined(e.effort))if(a.integer(e.effort)&&a.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw a.invalidParameterError("effort","integer between 1 and 10",e.effort);if(a.defined(e.dither))if(a.number(e.dither)&&a.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw a.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function kl(e){if(a.object(e)){if(a.defined(e.quality))if(a.integer(e.quality)&&a.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw a.invalidParameterError("quality","integer between 1 and 100",e.quality);if(a.defined(e.alphaQuality))if(a.integer(e.alphaQuality)&&a.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw a.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(a.defined(e.lossless)&&this._setBooleanOption("webpLossless",e.lossless),a.defined(e.nearLossless)&&this._setBooleanOption("webpNearLossless",e.nearLossless),a.defined(e.smartSubsample)&&this._setBooleanOption("webpSmartSubsample",e.smartSubsample),a.defined(e.preset))if(a.string(e.preset)&&a.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw a.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(a.defined(e.effort))if(a.integer(e.effort)&&a.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw a.invalidParameterError("effort","integer between 0 and 6",e.effort);a.defined(e.minSize)&&this._setBooleanOption("webpMinSize",e.minSize),a.defined(e.mixed)&&this._setBooleanOption("webpMixed",e.mixed)}return dn(e,this.options),this._updateFormatOut("webp",e)}function jl(e){if(a.object(e)){a.defined(e.reuse)&&this._setBooleanOption("gifReuse",e.reuse),a.defined(e.progressive)&&this._setBooleanOption("gifProgressive",e.progressive);let r=e.colours||e.colors;if(a.defined(r))if(a.integer(r)&&a.inRange(r,2,256))this.options.gifBitdepth=un(r);else throw a.invalidParameterError("colours","integer between 2 and 256",r);if(a.defined(e.effort))if(a.number(e.effort)&&a.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw a.invalidParameterError("effort","integer between 1 and 10",e.effort);if(a.defined(e.dither))if(a.number(e.dither)&&a.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw a.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(a.defined(e.interFrameMaxError))if(a.number(e.interFrameMaxError)&&a.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw a.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(a.defined(e.interPaletteMaxError))if(a.number(e.interPaletteMaxError)&&a.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw a.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError)}return dn(e,this.options),this._updateFormatOut("gif",e)}function Nl(e){if(!this.constructor.format.jp2k.output.buffer)throw hn();if(a.object(e)){if(a.defined(e.quality))if(a.integer(e.quality)&&a.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw a.invalidParameterError("quality","integer between 1 and 100",e.quality);if(a.defined(e.lossless))if(a.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw a.invalidParameterError("lossless","boolean",e.lossless);if(a.defined(e.tileWidth))if(a.integer(e.tileWidth)&&a.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw a.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(a.defined(e.tileHeight))if(a.integer(e.tileHeight)&&a.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw a.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(a.defined(e.chromaSubsampling))if(a.string(e.chromaSubsampling)&&a.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw a.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function dn(e,r){if(a.object(e)&&a.defined(e.loop))if(a.integer(e.loop)&&a.inRange(e.loop,0,65535))r.loop=e.loop;else throw a.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(a.object(e)&&a.defined(e.delay))if(a.integer(e.delay)&&a.inRange(e.delay,0,65535))r.delay=[e.delay];else if(Array.isArray(e.delay)&&e.delay.every(a.integer)&&e.delay.every(t=>a.inRange(t,0,65535)))r.delay=e.delay;else throw a.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function Fl(e){if(a.object(e)){if(a.defined(e.quality))if(a.integer(e.quality)&&a.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw a.invalidParameterError("quality","integer between 1 and 100",e.quality);if(a.defined(e.bitdepth))if(a.integer(e.bitdepth)&&a.inArray(e.bitdepth,[1,2,4,8]))this.options.tiffBitdepth=e.bitdepth;else throw a.invalidParameterError("bitdepth","1, 2, 4 or 8",e.bitdepth);if(a.defined(e.tile)&&this._setBooleanOption("tiffTile",e.tile),a.defined(e.tileWidth))if(a.integer(e.tileWidth)&&e.tileWidth>0)this.options.tiffTileWidth=e.tileWidth;else throw a.invalidParameterError("tileWidth","integer greater than zero",e.tileWidth);if(a.defined(e.tileHeight))if(a.integer(e.tileHeight)&&e.tileHeight>0)this.options.tiffTileHeight=e.tileHeight;else throw a.invalidParameterError("tileHeight","integer greater than zero",e.tileHeight);if(a.defined(e.miniswhite)&&this._setBooleanOption("tiffMiniswhite",e.miniswhite),a.defined(e.pyramid)&&this._setBooleanOption("tiffPyramid",e.pyramid),a.defined(e.xres))if(a.number(e.xres)&&e.xres>0)this.options.tiffXres=e.xres;else throw a.invalidParameterError("xres","number greater than zero",e.xres);if(a.defined(e.yres))if(a.number(e.yres)&&e.yres>0)this.options.tiffYres=e.yres;else throw a.invalidParameterError("yres","number greater than zero",e.yres);if(a.defined(e.compression))if(a.string(e.compression)&&a.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw a.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(a.defined(e.predictor))if(a.string(e.predictor)&&a.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw a.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(a.defined(e.resolutionUnit))if(a.string(e.resolutionUnit)&&a.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw a.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function Ol(e){return this.heif({...e,compression:"av1"})}function Cl(e){if(a.object(e)){if(a.string(e.compression)&&a.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw a.invalidParameterError("compression","one of: av1, hevc",e.compression);if(a.defined(e.quality))if(a.integer(e.quality)&&a.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw a.invalidParameterError("quality","integer between 1 and 100",e.quality);if(a.defined(e.lossless))if(a.bool(e.lossless))this.options.heifLossless=e.lossless;else throw a.invalidParameterError("lossless","boolean",e.lossless);if(a.defined(e.effort))if(a.integer(e.effort)&&a.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw a.invalidParameterError("effort","integer between 0 and 9",e.effort);if(a.defined(e.chromaSubsampling))if(a.string(e.chromaSubsampling)&&a.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw a.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(a.defined(e.bitdepth))if(a.integer(e.bitdepth)&&a.inArray(e.bitdepth,[8,10,12])){if(e.bitdepth!==8&&this.constructor.versions.heif)throw a.invalidParameterError("bitdepth when using prebuilt binaries",8,e.bitdepth);this.options.heifBitdepth=e.bitdepth}else throw a.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth)}else throw a.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function Bl(e){if(a.object(e)){if(a.defined(e.quality))if(a.integer(e.quality)&&a.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?.1+(100-e.quality)*.09:53/3e3*e.quality*e.quality-23/20*e.quality+25;else throw a.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(a.defined(e.distance))if(a.number(e.distance)&&a.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw a.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(a.defined(e.decodingTier))if(a.integer(e.decodingTier)&&a.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw a.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(a.defined(e.lossless))if(a.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw a.invalidParameterError("lossless","boolean",e.lossless);if(a.defined(e.effort))if(a.integer(e.effort)&&a.inRange(e.effort,3,9))this.options.jxlEffort=e.effort;else throw a.invalidParameterError("effort","integer between 3 and 9",e.effort)}return this._updateFormatOut("jxl",e)}function ql(e){if(a.object(e)&&a.defined(e.depth))if(a.string(e.depth)&&a.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw a.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth);return this._updateFormatOut("raw")}function Ml(e){if(a.object(e)){if(a.defined(e.size))if(a.integer(e.size)&&a.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw a.invalidParameterError("size","integer between 1 and 8192",e.size);if(a.defined(e.overlap))if(a.integer(e.overlap)&&a.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw a.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw a.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(a.defined(e.container))if(a.string(e.container)&&a.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw a.invalidParameterError("container","one of: fs, zip",e.container);if(a.defined(e.layout))if(a.string(e.layout)&&a.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw a.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(a.defined(e.angle))if(a.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw a.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),a.defined(e.depth))if(a.string(e.depth)&&a.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw a.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(a.defined(e.skipBlanks))if(a.integer(e.skipBlanks)&&a.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw a.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else a.defined(e.layout)&&e.layout==="google"&&(this.options.tileSkipBlanks=5);let r=a.bool(e.center)?e.center:e.centre;if(a.defined(r)&&this._setBooleanOption("tileCentre",r),a.defined(e.id))if(a.string(e.id))this.options.tileId=e.id;else throw a.invalidParameterError("id","string",e.id);if(a.defined(e.basename))if(a.string(e.basename))this.options.tileBasename=e.basename;else throw a.invalidParameterError("basename","string",e.basename)}if(a.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw a.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function Dl(e){if(!a.plainObject(e))throw a.invalidParameterError("options","object",e);if(a.integer(e.seconds)&&a.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw a.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function _l(e,r){return a.object(r)&&r.force===!1||(this.options.formatOut=e),this}function zl(e,r){if(a.bool(r))this.options[e]=r;else throw a.invalidParameterError(e,"boolean",r)}function Ul(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function Gl(e,r){return typeof e=="function"?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),Pe.pipeline(this.options,(t,i,n)=>{t?e(a.nativeError(t,r)):e(null,i,n)})}):Pe.pipeline(this.options,(t,i,n)=>{t?e(a.nativeError(t,r)):e(null,i,n)}),this):this.options.streamOut?(this._isStreamInput()?(this.once("finish",()=>{this._flattenBufferIn(),Pe.pipeline(this.options,(t,i,n)=>{t?this.emit("error",a.nativeError(t,r)):(this.emit("info",n),this.push(i)),this.push(null),this.on("end",()=>this.emit("close"))})}),this.streamInFinished&&this.emit("finish")):Pe.pipeline(this.options,(t,i,n)=>{t?this.emit("error",a.nativeError(t,r)):(this.emit("info",n),this.push(i)),this.push(null),this.on("end",()=>this.emit("close"))}),this):this._isStreamInput()?new Promise((t,i)=>{this.once("finish",()=>{this._flattenBufferIn(),Pe.pipeline(this.options,(n,s,o)=>{n?i(a.nativeError(n,r)):this.options.resolveWithObject?t({data:s,info:o}):t(s)})})}):new Promise((t,i)=>{Pe.pipeline(this.options,(n,s,o)=>{n?i(a.nativeError(n,r)):this.options.resolveWithObject?t({data:s,info:o}):t(s)})})}mn.exports=function(e){Object.assign(e.prototype,{toFile:yl,toBuffer:El,keepExif:vl,withExif:xl,withExifMerge:Pl,keepIccProfile:Rl,withIccProfile:Il,keepMetadata:Sl,withMetadata:Al,toFormat:$l,jpeg:Ll,jp2:Nl,png:Tl,webp:kl,tiff:Fl,avif:Ol,heif:Cl,jxl:Bl,gif:jl,raw:ql,tile:Ml,timeout:Dl,_updateFormatOut:_l,_setBooleanOption:zl,_read:Ul,_pipeline:Gl})}});var yn=y((lf,wn)=>{"use strict";var Hl=R("node:events"),nr=_e(),G=J(),{runtimePlatformArch:Wl}=$r(),O=Ne(),pn=Wl(),Dr=O.libvipsVersion(),fe=O.format();fe.heif.output.alias=["avif","heic"];fe.jpeg.output.alias=["jpe","jpg"];fe.tiff.output.alias=["tif"];fe.jp2k.output.alias=["j2c","j2k","jp2","jpx"];var Vl={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},Re={vips:Dr.semver};if(!Dr.isGlobal)if(Dr.isWasm)try{Re=R("@img/sharp-wasm32/versions")}catch{}else try{Re=R(`@img/sharp-${pn}/versions`)}catch{try{Re=R(`@img/sharp-libvips-${pn}/versions`)}catch{}}Re.sharp=Sr().version;Re.heif&&fe.heif&&(fe.heif.input.fileSuffix=[".avif"],fe.heif.output.alias=["avif"]);function bn(e){return G.bool(e)?e?O.cache(50,20,100):O.cache(0,0,0):G.object(e)?O.cache(e.memory,e.files,e.items):O.cache()}bn(!0);function Xl(e){return O.concurrency(G.integer(e)?e:null)}nr.familySync()===nr.GLIBC&&!O._isUsingJemalloc()?O.concurrency(1):nr.familySync()===nr.MUSL&&O.concurrency()===1024&&O.concurrency(R("node:os").availableParallelism());var Ql=new Hl.EventEmitter;function Jl(){return O.counters()}function Kl(e){return O.simd(G.bool(e)?e:null)}function Yl(e){if(G.object(e))if(Array.isArray(e.operation)&&e.operation.every(G.string))O.block(e.operation,!0);else throw G.invalidParameterError("operation","Array<string>",e.operation);else throw G.invalidParameterError("options","object",e)}function Zl(e){if(G.object(e))if(Array.isArray(e.operation)&&e.operation.every(G.string))O.block(e.operation,!1);else throw G.invalidParameterError("operation","Array<string>",e.operation);else throw G.invalidParameterError("options","object",e)}wn.exports=function(e){e.cache=bn,e.concurrency=Xl,e.counters=Jl,e.simd=Kl,e.format=fe,e.interpolators=Vl,e.versions=Re,e.queue=Ql,e.block=Yl,e.unblock=Zl}});var vn=y((ff,En)=>{"use strict";var ne=Ii();Wi()(ne);Yi()(ne);en()(ne);nn()(ne);on()(ne);cn()(ne);gn()(ne);yn()(ne);En.exports=ne});var dr=Gn(vn());import fc from"node:http";import hc from"node:https";import Ae from"node:zlib";import Dn,{PassThrough as _n,pipeline as $e}from"node:stream";import{Buffer as hr}from"node:buffer";function ec(e){if(!/^data:/i.test(e))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');e=e.replace(/\r?\n/g,"");let r=e.indexOf(",");if(r===-1||r<=4)throw new TypeError("malformed data: URI");let t=e.substring(5,r).split(";"),i="",n=!1,s=t[0]||"text/plain",o=s;for(let b=1;b<t.length;b++)t[b]==="base64"?n=!0:t[b]&&(o+=`;${t[b]}`,t[b].indexOf("charset=")===0&&(i=t[b].substring(8)));!t[0]&&!i.length&&(o+=";charset=US-ASCII",i="US-ASCII");let l=n?"base64":"ascii",f=unescape(e.substring(r+1)),u=Buffer.from(f,l);return u.type=s,u.typeFull=o,u.charset=i,u}var xn=ec;import he,{PassThrough as Sn}from"node:stream";import{types as An,deprecate as Ur,promisify as rc}from"node:util";import{Buffer as H}from"node:buffer";var se=class extends Error{constructor(r,t){super(r),Error.captureStackTrace(this,this.constructor),this.type=t}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}};var B=class extends se{constructor(r,t,i){super(r,t),i&&(this.code=this.errno=i.code,this.erroredSysCall=i.syscall)}};var sr=Symbol.toStringTag,_r=e=>typeof e=="object"&&typeof e.append=="function"&&typeof e.delete=="function"&&typeof e.get=="function"&&typeof e.getAll=="function"&&typeof e.has=="function"&&typeof e.set=="function"&&typeof e.sort=="function"&&e[sr]==="URLSearchParams",Be=e=>e&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&typeof e.constructor=="function"&&/^(Blob|File)$/.test(e[sr]),Pn=e=>typeof e=="object"&&(e[sr]==="AbortSignal"||e[sr]==="EventTarget"),Rn=(e,r)=>{let t=new URL(r).hostname,i=new URL(e).hostname;return t===i||t.endsWith(`.${i}`)},In=(e,r)=>{let t=new URL(r).protocol,i=new URL(e).protocol;return t===i};var tc=rc(he.pipeline),q=Symbol("Body internals"),re=class{constructor(r,{size:t=0}={}){let i=null;r===null?r=null:_r(r)?r=H.from(r.toString()):Be(r)||H.isBuffer(r)||(An.isAnyArrayBuffer(r)?r=H.from(r):ArrayBuffer.isView(r)?r=H.from(r.buffer,r.byteOffset,r.byteLength):r instanceof he||(r instanceof Le?(r=Vr(r),i=r.type.split("=")[1]):r=H.from(String(r))));let n=r;H.isBuffer(r)?n=he.Readable.from(r):Be(r)&&(n=he.Readable.from(r.stream())),this[q]={body:r,stream:n,boundary:i,disturbed:!1,error:null},this.size=t,r instanceof he&&r.on("error",s=>{let o=s instanceof se?s:new B(`Invalid response body while trying to fetch ${this.url}: ${s.message}`,"system",s);this[q].error=o})}get body(){return this[q].stream}get bodyUsed(){return this[q].disturbed}async arrayBuffer(){let{buffer:r,byteOffset:t,byteLength:i}=await zr(this);return r.slice(t,t+i)}async formData(){let r=this.headers.get("content-type");if(r.startsWith("application/x-www-form-urlencoded")){let i=new Le,n=new URLSearchParams(await this.text());for(let[s,o]of n)i.append(s,o);return i}let{toFormData:t}=await import("./multipart-parser-I4OTWNXG.mjs");return t(this.body,r)}async blob(){let r=this.headers&&this.headers.get("content-type")||this[q].body&&this[q].body.type||"",t=await this.arrayBuffer();return new mr([t],{type:r})}async json(){let r=await this.text();return JSON.parse(r)}async text(){let r=await zr(this);return new TextDecoder().decode(r)}buffer(){return zr(this)}};re.prototype.buffer=Ur(re.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(re.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:Ur(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function zr(e){if(e[q].disturbed)throw new TypeError(`body used already for: ${e.url}`);if(e[q].disturbed=!0,e[q].error)throw e[q].error;let{body:r}=e;if(r===null)return H.alloc(0);if(!(r instanceof he))return H.alloc(0);let t=[],i=0;try{for await(let n of r){if(e.size>0&&i+n.length>e.size){let s=new B(`content size at ${e.url} over limit: ${e.size}`,"max-size");throw r.destroy(s),s}i+=n.length,t.push(n)}}catch(n){throw n instanceof se?n:new B(`Invalid response body while trying to fetch ${e.url}: ${n.message}`,"system",n)}if(r.readableEnded===!0||r._readableState.ended===!0)try{return t.every(n=>typeof n=="string")?H.from(t.join("")):H.concat(t,i)}catch(n){throw new B(`Could not create Buffer from response body for ${e.url}: ${n.message}`,"system",n)}else throw new B(`Premature close of server response while trying to fetch ${e.url}`)}var Ie=(e,r)=>{let t,i,{body:n}=e[q];if(e.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof he&&typeof n.getBoundary!="function"&&(t=new Sn({highWaterMark:r}),i=new Sn({highWaterMark:r}),n.pipe(t),n.pipe(i),e[q].stream=t,n=i),n},ic=Ur(e=>e.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),ar=(e,r)=>e===null?null:typeof e=="string"?"text/plain;charset=UTF-8":_r(e)?"application/x-www-form-urlencoded;charset=UTF-8":Be(e)?e.type||null:H.isBuffer(e)||An.isAnyArrayBuffer(e)||ArrayBuffer.isView(e)?null:e instanceof Le?`multipart/form-data; boundary=${r[q].boundary}`:e&&typeof e.getBoundary=="function"?`multipart/form-data;boundary=${ic(e)}`:e instanceof he?null:"text/plain;charset=UTF-8",$n=e=>{let{body:r}=e[q];return r===null?0:Be(r)?r.size:H.isBuffer(r)?r.length:r&&typeof r.getLengthSync=="function"&&r.hasKnownLength&&r.hasKnownLength()?r.getLengthSync():null},Ln=async(e,{body:r})=>{r===null?e.end():await tc(r,e)};import{types as Tn}from"node:util";import lr from"node:http";var or=typeof lr.validateHeaderName=="function"?lr.validateHeaderName:e=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let r=new TypeError(`Header name must be a valid HTTP token [${e}]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),r}},Gr=typeof lr.validateHeaderValue=="function"?lr.validateHeaderValue:(e,r)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(r)){let t=new TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(t,"code",{value:"ERR_INVALID_CHAR"}),t}},_=class e extends URLSearchParams{constructor(r){let t=[];if(r instanceof e){let i=r.raw();for(let[n,s]of Object.entries(i))t.push(...s.map(o=>[n,o]))}else if(r!=null)if(typeof r=="object"&&!Tn.isBoxedPrimitive(r)){let i=r[Symbol.iterator];if(i==null)t.push(...Object.entries(r));else{if(typeof i!="function")throw new TypeError("Header pairs must be iterable");t=[...r].map(n=>{if(typeof n!="object"||Tn.isBoxedPrimitive(n))throw new TypeError("Each header pair must be an iterable object");return[...n]}).map(n=>{if(n.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...n]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return t=t.length>0?t.map(([i,n])=>(or(i),Gr(i,String(n)),[String(i).toLowerCase(),String(n)])):void 0,super(t),new Proxy(this,{get(i,n,s){switch(n){case"append":case"set":return(o,l)=>(or(o),Gr(o,String(l)),URLSearchParams.prototype[n].call(i,String(o).toLowerCase(),String(l)));case"delete":case"has":case"getAll":return o=>(or(o),URLSearchParams.prototype[n].call(i,String(o).toLowerCase()));case"keys":return()=>(i.sort(),new Set(URLSearchParams.prototype.keys.call(i)).keys());default:return Reflect.get(i,n,s)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(r){let t=this.getAll(r);if(t.length===0)return null;let i=t.join(", ");return/^content-encoding$/i.test(r)&&(i=i.toLowerCase()),i}forEach(r,t=void 0){for(let i of this.keys())Reflect.apply(r,t,[this.get(i),i,this])}*values(){for(let r of this.keys())yield this.get(r)}*entries(){for(let r of this.keys())yield[r,this.get(r)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((r,t)=>(r[t]=this.getAll(t),r),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((r,t)=>{let i=this.getAll(t);return t==="host"?r[t]=i[0]:r[t]=i.length>1?i:i[0],r},{})}};Object.defineProperties(_.prototype,["get","entries","forEach","values"].reduce((e,r)=>(e[r]={enumerable:!0},e),{}));function kn(e=[]){return new _(e.reduce((r,t,i,n)=>(i%2===0&&r.push(n.slice(i,i+2)),r),[]).filter(([r,t])=>{try{return or(r),Gr(r,String(t)),!0}catch{return!1}}))}var nc=new Set([301,302,303,307,308]),cr=e=>nc.has(e);var V=Symbol("Response internals"),W=class e extends re{constructor(r=null,t={}){super(r,t);let i=t.status!=null?t.status:200,n=new _(t.headers);if(r!==null&&!n.has("Content-Type")){let s=ar(r,this);s&&n.append("Content-Type",s)}this[V]={type:"default",url:t.url,status:i,statusText:t.statusText||"",headers:n,counter:t.counter,highWaterMark:t.highWaterMark}}get type(){return this[V].type}get url(){return this[V].url||""}get status(){return this[V].status}get ok(){return this[V].status>=200&&this[V].status<300}get redirected(){return this[V].counter>0}get statusText(){return this[V].statusText}get headers(){return this[V].headers}get highWaterMark(){return this[V].highWaterMark}clone(){return new e(Ie(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(r,t=302){if(!cr(t))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new e(null,{headers:{location:new URL(r).toString()},status:t})}static error(){let r=new e(null,{status:0,statusText:""});return r[V].type="error",r}static json(r=void 0,t={}){let i=JSON.stringify(r);if(i===void 0)throw new TypeError("data is not JSON serializable");let n=new _(t&&t.headers);return n.has("content-type")||n.set("content-type","application/json"),new e(i,{...t,headers:n})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(W.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});import{format as oc}from"node:url";import{deprecate as lc}from"node:util";var jn=e=>{if(e.search)return e.search;let r=e.href.length-1,t=e.hash||(e.href[r]==="#"?"#":"");return e.href[r-t.length]==="?"?"?":""};import{isIP as sc}from"node:net";function Nn(e,r=!1){return e==null||(e=new URL(e),/^(about|blob|data):$/.test(e.protocol))?"no-referrer":(e.username="",e.password="",e.hash="",r&&(e.pathname="",e.search=""),e)}var Fn=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),On="strict-origin-when-cross-origin";function Cn(e){if(!Fn.has(e))throw new TypeError(`Invalid referrerPolicy: ${e}`);return e}function ac(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let r=e.host.replace(/(^\[)|(]$)/g,""),t=sc(r);return t===4&&/^127\./.test(r)||t===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(r)?!0:e.host==="localhost"||e.host.endsWith(".localhost")?!1:e.protocol==="file:"}function Se(e){return/^about:(blank|srcdoc)$/.test(e)||e.protocol==="data:"||/^(blob|filesystem):$/.test(e.protocol)?!0:ac(e)}function Bn(e,{referrerURLCallback:r,referrerOriginCallback:t}={}){if(e.referrer==="no-referrer"||e.referrerPolicy==="")return null;let i=e.referrerPolicy;if(e.referrer==="about:client")return"no-referrer";let n=e.referrer,s=Nn(n),o=Nn(n,!0);s.toString().length>4096&&(s=o),r&&(s=r(s)),t&&(o=t(o));let l=new URL(e.url);switch(i){case"no-referrer":return"no-referrer";case"origin":return o;case"unsafe-url":return s;case"strict-origin":return Se(s)&&!Se(l)?"no-referrer":o.toString();case"strict-origin-when-cross-origin":return s.origin===l.origin?s:Se(s)&&!Se(l)?"no-referrer":o;case"same-origin":return s.origin===l.origin?s:"no-referrer";case"origin-when-cross-origin":return s.origin===l.origin?s:o;case"no-referrer-when-downgrade":return Se(s)&&!Se(l)?"no-referrer":s;default:throw new TypeError(`Invalid referrerPolicy: ${i}`)}}function qn(e){let r=(e.get("referrer-policy")||"").split(/[,\s]+/),t="";for(let i of r)i&&Fn.has(i)&&(t=i);return t}var T=Symbol("Request internals"),qe=e=>typeof e=="object"&&typeof e[T]=="object",cc=lc(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),ge=class e extends re{constructor(r,t={}){let i;if(qe(r)?i=new URL(r.url):(i=new URL(r),r={}),i.username!==""||i.password!=="")throw new TypeError(`${i} is an url with embedded credentials.`);let n=t.method||r.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(n)&&(n=n.toUpperCase()),!qe(t)&&"data"in t&&cc(),(t.body!=null||qe(r)&&r.body!==null)&&(n==="GET"||n==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let s=t.body?t.body:qe(r)&&r.body!==null?Ie(r):null;super(s,{size:t.size||r.size||0});let o=new _(t.headers||r.headers||{});if(s!==null&&!o.has("Content-Type")){let u=ar(s,this);u&&o.set("Content-Type",u)}let l=qe(r)?r.signal:null;if("signal"in t&&(l=t.signal),l!=null&&!Pn(l))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let f=t.referrer==null?r.referrer:t.referrer;if(f==="")f="no-referrer";else if(f){let u=new URL(f);f=/^about:(\/\/)?client$/.test(u)?"client":u}else f=void 0;this[T]={method:n,redirect:t.redirect||r.redirect||"follow",headers:o,parsedURL:i,signal:l,referrer:f},this.follow=t.follow===void 0?r.follow===void 0?20:r.follow:t.follow,this.compress=t.compress===void 0?r.compress===void 0?!0:r.compress:t.compress,this.counter=t.counter||r.counter||0,this.agent=t.agent||r.agent,this.highWaterMark=t.highWaterMark||r.highWaterMark||16384,this.insecureHTTPParser=t.insecureHTTPParser||r.insecureHTTPParser||!1,this.referrerPolicy=t.referrerPolicy||r.referrerPolicy||""}get method(){return this[T].method}get url(){return oc(this[T].parsedURL)}get headers(){return this[T].headers}get redirect(){return this[T].redirect}get signal(){return this[T].signal}get referrer(){if(this[T].referrer==="no-referrer")return"";if(this[T].referrer==="client")return"about:client";if(this[T].referrer)return this[T].referrer.toString()}get referrerPolicy(){return this[T].referrerPolicy}set referrerPolicy(r){this[T].referrerPolicy=Cn(r)}clone(){return new e(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(ge.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var Mn=e=>{let{parsedURL:r}=e[T],t=new _(e[T].headers);t.has("Accept")||t.set("Accept","*/*");let i=null;if(e.body===null&&/^(post|put)$/i.test(e.method)&&(i="0"),e.body!==null){let l=$n(e);typeof l=="number"&&!Number.isNaN(l)&&(i=String(l))}i&&t.set("Content-Length",i),e.referrerPolicy===""&&(e.referrerPolicy=On),e.referrer&&e.referrer!=="no-referrer"?e[T].referrer=Bn(e):e[T].referrer="no-referrer",e[T].referrer instanceof URL&&t.set("Referer",e.referrer),t.has("User-Agent")||t.set("User-Agent","node-fetch"),e.compress&&!t.has("Accept-Encoding")&&t.set("Accept-Encoding","gzip, deflate, br");let{agent:n}=e;typeof n=="function"&&(n=n(r));let s=jn(r),o={path:r.pathname+s,method:e.method,headers:t[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:e.insecureHTTPParser,agent:n};return{parsedURL:r,options:o}};var fr=class extends se{constructor(r,t="aborted"){super(r,t)}};var uc=new Set(["data:","http:","https:"]);async function ur(e,r){return new Promise((t,i)=>{let n=new ge(e,r),{parsedURL:s,options:o}=Mn(n);if(!uc.has(s.protocol))throw new TypeError(`node-fetch cannot load ${e}. URL scheme "${s.protocol.replace(/:$/,"")}" is not supported.`);if(s.protocol==="data:"){let v=xn(n.url),k=new W(v,{headers:{"Content-Type":v.typeFull}});t(k);return}let l=(s.protocol==="https:"?hc:fc).request,{signal:f}=n,u=null,b=()=>{let v=new fr("The operation was aborted.");i(v),n.body&&n.body instanceof Dn.Readable&&n.body.destroy(v),!(!u||!u.body)&&u.body.emit("error",v)};if(f&&f.aborted){b();return}let w=()=>{b(),X()},S=l(s.toString(),o);f&&f.addEventListener("abort",w);let X=()=>{S.abort(),f&&f.removeEventListener("abort",w)};S.on("error",v=>{i(new B(`request to ${n.url} failed, reason: ${v.message}`,"system",v)),X()}),dc(S,v=>{u&&u.body&&u.body.destroy(v)}),process.version<"v14"&&S.on("socket",v=>{let k;v.prependListener("end",()=>{k=v._eventsCount}),v.prependListener("close",A=>{if(u&&k<v._eventsCount&&!A){let z=new Error("Premature close");z.code="ERR_STREAM_PREMATURE_CLOSE",u.body.emit("error",z)}})}),S.on("response",v=>{S.setTimeout(0);let k=kn(v.rawHeaders);if(cr(v.statusCode)){let j=k.get("Location"),Q=null;try{Q=j===null?null:new URL(j,n.url)}catch{if(n.redirect!=="manual"){i(new B(`uri requested responds with an invalid redirect URL: ${j}`,"invalid-redirect")),X();return}}switch(n.redirect){case"error":i(new B(`uri requested responds with a redirect, redirect mode is set to error: ${n.url}`,"no-redirect")),X();return;case"manual":break;case"follow":{if(Q===null)break;if(n.counter>=n.follow){i(new B(`maximum redirect reached at: ${n.url}`,"max-redirect")),X();return}let U={headers:new _(n.headers),follow:n.follow,counter:n.counter+1,agent:n.agent,compress:n.compress,method:n.method,body:Ie(n),signal:n.signal,size:n.size,referrer:n.referrer,referrerPolicy:n.referrerPolicy};if(!Rn(n.url,Q)||!In(n.url,Q))for(let Un of["authorization","www-authenticate","cookie","cookie2"])U.headers.delete(Un);if(v.statusCode!==303&&n.body&&r.body instanceof Dn.Readable){i(new B("Cannot follow redirect with body being a readable stream","unsupported-redirect")),X();return}(v.statusCode===303||(v.statusCode===301||v.statusCode===302)&&n.method==="POST")&&(U.method="GET",U.body=void 0,U.headers.delete("content-length"));let Wr=qn(k);Wr&&(U.referrerPolicy=Wr),t(ur(new ge(Q,U))),X();return}default:return i(new TypeError(`Redirect option '${n.redirect}' is not a valid value of RequestRedirect`))}}f&&v.once("end",()=>{f.removeEventListener("abort",w)});let A=$e(v,new _n,j=>{j&&i(j)});process.version<"v12.10"&&v.on("aborted",w);let z={url:n.url,status:v.statusCode,statusText:v.statusMessage,headers:k,size:n.size,counter:n.counter,highWaterMark:n.highWaterMark},te=k.get("Content-Encoding");if(!n.compress||n.method==="HEAD"||te===null||v.statusCode===204||v.statusCode===304){u=new W(A,z),t(u);return}let zn={flush:Ae.Z_SYNC_FLUSH,finishFlush:Ae.Z_SYNC_FLUSH};if(te==="gzip"||te==="x-gzip"){A=$e(A,Ae.createGunzip(zn),j=>{j&&i(j)}),u=new W(A,z),t(u);return}if(te==="deflate"||te==="x-deflate"){let j=$e(v,new _n,Q=>{Q&&i(Q)});j.once("data",Q=>{(Q[0]&15)===8?A=$e(A,Ae.createInflate(),U=>{U&&i(U)}):A=$e(A,Ae.createInflateRaw(),U=>{U&&i(U)}),u=new W(A,z),t(u)}),j.once("end",()=>{u||(u=new W(A,z),t(u))});return}if(te==="br"){A=$e(A,Ae.createBrotliDecompress(),j=>{j&&i(j)}),u=new W(A,z),t(u);return}u=new W(A,z),t(u)}),Ln(S,n).catch(i)})}function dc(e,r){let t=hr.from(`0\r
3
- \r
4
- `),i=!1,n=!1,s;e.on("response",o=>{let{headers:l}=o;i=l["transfer-encoding"]==="chunked"&&!l["content-length"]}),e.on("socket",o=>{let l=()=>{if(i&&!n){let u=new Error("Premature close");u.code="ERR_STREAM_PREMATURE_CLOSE",r(u)}},f=u=>{n=hr.compare(u.slice(-5),t)===0,!n&&s&&(n=hr.compare(s.slice(-3),t.slice(0,3))===0&&hr.compare(u.slice(-2),t.slice(3))===0),s=u};o.prependListener("close",l),o.on("data",f),e.on("close",()=>{o.removeListener("close",l),o.removeListener("data",f)})})}var Hr=["jpg","gif","png"],mc=async(e,r)=>{var u,b,w;let t=(0,dr.default)(e),i=await t.metadata(),n=(u=i.width)!=null?u:100,s=(b=i.height)!=null?b:100,o=e.split(";")[0].split("/")[1];if(Hr.includes(o))return{type:o,data:e,transformation:{width:n,height:s}};let l=(w=r==null?void 0:r.fallbackImageType)!=null?w:"png",f={data:await t.toFormat(l).toBuffer(),type:l,transformation:{width:n,height:s}};return e.includes("svg")?{...f,type:"svg",data:e,fallback:{type:l,data:f.data}}:f},gc=async(e,r)=>{var o,l,f,u,b,w,S,X;let t,i,n;if(e.startsWith("http")){let v=await ur(e),k=await v.arrayBuffer(),z=((l=(o=v.headers.get("content-type"))==null?void 0:o.split(";")[0])!=null?l:"image/png").split("/")[1];t=(0,dr.default)(k);let te=await t.metadata();if(i=(f=te.width)!=null?f:100,n=(u=te.height)!=null?u:100,Hr.includes(z))return{type:z,data:k,transformation:{width:i,height:n}}}else{let v=(b=r==null?void 0:r.pathPrefix)!=null?b:"";t=(0,dr.default)(v+e);let k=await t.metadata();i=(w=k.width)!=null?w:100,n=(S=k.height)!=null?S:100;let A=e.split(".").pop();if(Hr.includes(A))return{type:A,data:await t.toBuffer(),transformation:{width:i,height:n}}}let s=(X=r==null?void 0:r.fallbackImageType)!=null?X:"png";return{data:await t.toFormat(s).toBuffer(),type:s,transformation:{width:i,height:n}}},pc=async(e,r)=>{try{return e.startsWith("data:")?await mc(e,r):await gc(e,r)}catch(t){return console.error(`Error resolving image: ${e}`,t),{type:"png",data:Buffer.from([]),transformation:{width:100,height:100}}}},ph=e=>({inline:async(r,t,i,n)=>{var s,o,l,f;if(/^image/.test(t.type)){let u=(o=t.url)!=null?o:n[(s=t.identifier)==null?void 0:s.toUpperCase()],b=(l=t.alt)!=null?l:u==null?void 0:u.split("/").pop();return t.type="",[new r.ImageRun({...await((f=e==null?void 0:e.imageResolver)!=null?f:pc)(u,e),altText:{description:b,name:b,title:b}})]}return[]}});export{Hr as a,ph as b};