mdast2docx 1.5.1 → 1.6.1

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,4 +1,4 @@
1
- import{a as R,b as E,c as On,d as wr,f as _e,g as Yr}from"./chunk-3B7PIKIS.mjs";var K=E(($f,Et)=>{"use strict";var yt=function(e){return typeof e!="undefined"&&e!==null},ta=function(e){return typeof e=="object"},ia=function(e){return Object.prototype.toString.call(e)==="[object Object]"},na=function(e){return typeof e=="function"},aa=function(e){return typeof e=="boolean"},sa=function(e){return e instanceof Buffer},oa=function(e){if(yt(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},la=function(e){return e instanceof ArrayBuffer},ca=function(e){return typeof e=="string"&&e.length>0},fa=function(e){return typeof e=="number"&&!Number.isNaN(e)},ha=function(e){return Number.isInteger(e)},ua=function(e,r,t){return e>=r&&e<=t},da=function(e,r){return r.includes(e)},ma=function(e,r,t){return new Error(`Expected ${r} for ${e} but received ${t} of type ${typeof t}`)},ga=function(e,r){return r.message=e.message,r};Et.exports={defined:yt,object:ta,plainObject:ia,fn:na,bool:aa,buffer:sa,typedArray:oa,arrayBuffer:la,string:ca,number:fa,integer:ha,inRange:ua,inArray:da,invalidParameterError:ma,nativeError:ga}});var xt=E((jf,Pt)=>{"use strict";var vt=()=>process.platform==="linux",er=null,pa=()=>{if(!er)if(vt()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,er=process.report.getReport(),process.report.excludeNetwork=e}else er={};return er};Pt.exports={isLinux:vt,getReport:pa}});var It=E((Tf,Rt)=>{"use strict";var Ie=R("fs"),ba="/usr/bin/ldd",wa="/proc/self/exe",rr=2048,ya=e=>{let r=Ie.openSync(e,"r"),t=Buffer.alloc(rr),i=Ie.readSync(r,t,0,rr,0);return Ie.close(r),t.subarray(0,i)},Ea=e=>new Promise((r,t)=>{Ie.open(e,"r",(i,n)=>{if(i)t(i);else{let a=Buffer.alloc(rr);Ie.read(n,a,0,rr,0,(o,l)=>{r(a.subarray(0,l)),Ie.close(n)})}})});Rt.exports={LDD_PATH:ba,SELF_PATH:wa,readFileSync:ya,readFile:Ea}});var At=E((Nf,St)=>{"use strict";var va=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let r=e.readUInt32LE(32),t=e.readUInt16LE(54),i=e.readUInt16LE(56);for(let n=0;n<i;n++){let a=r+n*t;if(e.readUInt32LE(a)===3){let l=e.readUInt32LE(a+8),h=e.readUInt32LE(a+32);return e.subarray(l,l+h).toString().replace(/\0.*$/g,"")}}return null};St.exports={interpreterPath:va}});var ir=E((Cf,Gt)=>{"use strict";var Lt=R("child_process"),{isLinux:Se,getReport:$t}=xt(),{LDD_PATH:tr,SELF_PATH:jt,readFile:xr,readFileSync:Rr}=It(),{interpreterPath:Tt}=At(),Y,Z,ee,Nt="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",he="",Ct=()=>he||new Promise(e=>{Lt.exec(Nt,(r,t)=>{he=r?" ":t,e(he)})}),Bt=()=>{if(!he)try{he=Lt.execSync(Nt,{encoding:"utf8"})}catch{he=" "}return he},se="glibc",Ft=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,pe="musl",Pa=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),_t=()=>{let e=$t();return e.header&&e.header.glibcVersionRuntime?se:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(Pa)?pe:null},Mt=e=>{let[r,t]=e.split(/[\r\n]+/);return r&&r.includes(se)?se:t&&t.includes(pe)?pe:null},qt=e=>{if(e){if(e.includes("/ld-musl-"))return pe;if(e.includes("/ld-linux-"))return se}return null},Dt=e=>(e=e.toString(),e.includes("musl")?pe:e.includes("GNU C Library")?se:null),xa=async()=>{if(Z!==void 0)return Z;Z=null;try{let e=await xr(tr);Z=Dt(e)}catch{}return Z},Ra=()=>{if(Z!==void 0)return Z;Z=null;try{let e=Rr(tr);Z=Dt(e)}catch{}return Z},Ia=async()=>{if(Y!==void 0)return Y;Y=null;try{let e=await xr(jt),r=Tt(e);Y=qt(r)}catch{}return Y},Sa=()=>{if(Y!==void 0)return Y;Y=null;try{let e=Rr(jt),r=Tt(e);Y=qt(r)}catch{}return Y},Ot=async()=>{let e=null;if(Se()&&(e=await Ia(),!e&&(e=await xa(),e||(e=_t()),!e))){let r=await Ct();e=Mt(r)}return e},Ut=()=>{let e=null;if(Se()&&(e=Sa(),!e&&(e=Ra(),e||(e=_t()),!e))){let r=Bt();e=Mt(r)}return e},Aa=async()=>Se()&&await Ot()!==se,ka=()=>Se()&&Ut()!==se,La=async()=>{if(ee!==void 0)return ee;ee=null;try{let r=(await xr(tr)).match(Ft);r&&(ee=r[1])}catch{}return ee},$a=()=>{if(ee!==void 0)return ee;ee=null;try{let r=Rr(tr).match(Ft);r&&(ee=r[1])}catch{}return ee},zt=()=>{let e=$t();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},kt=e=>e.trim().split(/\s+/)[1],Ht=e=>{let[r,t,i]=e.split(/[\r\n]+/);return r&&r.includes(se)?kt(r):t&&i&&t.includes(pe)?kt(i):null},ja=async()=>{let e=null;if(Se()&&(e=await La(),e||(e=zt()),!e)){let r=await Ct();e=Ht(r)}return e},Ta=()=>{let e=null;if(Se()&&(e=$a(),e||(e=zt()),!e)){let r=Bt();e=Ht(r)}return e};Gt.exports={GLIBC:se,MUSL:pe,family:Ot,familySync:Ut,isNonGlibcLinux:Aa,isNonGlibcLinuxSync:ka,version:ja,versionSync:Ta}});var De=E((Bf,Wt)=>{"use strict";var Na=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Wt.exports=Na});var nr=E((Ff,Xt)=>{"use strict";var Ca="2.0.0",Ba=Number.MAX_SAFE_INTEGER||9007199254740991,Fa=16,_a=250,Ma=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Xt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Fa,MAX_SAFE_BUILD_LENGTH:_a,MAX_SAFE_INTEGER:Ba,RELEASE_TYPES:Ma,SEMVER_SPEC_VERSION:Ca,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Oe=E((re,Vt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Ir,MAX_SAFE_BUILD_LENGTH:qa,MAX_LENGTH:Da}=nr(),Oa=De();re=Vt.exports={};var Ua=re.re=[],za=re.safeRe=[],m=re.src=[],Ha=re.safeSrc=[],g=re.t={},Ga=0,Sr="[a-zA-Z0-9-]",Wa=[["\\s",1],["\\d",Da],[Sr,qa]],Xa=e=>{for(let[r,t]of Wa)e=e.split(`${r}*`).join(`${r}{0,${t}}`).split(`${r}+`).join(`${r}{1,${t}}`);return e},y=(e,r,t)=>{let i=Xa(r),n=Ga++;Oa(e,n,r),g[e]=n,m[n]=r,Ha[n]=i,Ua[n]=new RegExp(r,t?"g":void 0),za[n]=new RegExp(i,t?"g":void 0)};y("NUMERICIDENTIFIER","0|[1-9]\\d*");y("NUMERICIDENTIFIERLOOSE","\\d+");y("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Sr}*`);y("MAINVERSION",`(${m[g.NUMERICIDENTIFIER]})\\.(${m[g.NUMERICIDENTIFIER]})\\.(${m[g.NUMERICIDENTIFIER]})`);y("MAINVERSIONLOOSE",`(${m[g.NUMERICIDENTIFIERLOOSE]})\\.(${m[g.NUMERICIDENTIFIERLOOSE]})\\.(${m[g.NUMERICIDENTIFIERLOOSE]})`);y("PRERELEASEIDENTIFIER",`(?:${m[g.NONNUMERICIDENTIFIER]}|${m[g.NUMERICIDENTIFIER]})`);y("PRERELEASEIDENTIFIERLOOSE",`(?:${m[g.NONNUMERICIDENTIFIER]}|${m[g.NUMERICIDENTIFIERLOOSE]})`);y("PRERELEASE",`(?:-(${m[g.PRERELEASEIDENTIFIER]}(?:\\.${m[g.PRERELEASEIDENTIFIER]})*))`);y("PRERELEASELOOSE",`(?:-?(${m[g.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${m[g.PRERELEASEIDENTIFIERLOOSE]})*))`);y("BUILDIDENTIFIER",`${Sr}+`);y("BUILD",`(?:\\+(${m[g.BUILDIDENTIFIER]}(?:\\.${m[g.BUILDIDENTIFIER]})*))`);y("FULLPLAIN",`v?${m[g.MAINVERSION]}${m[g.PRERELEASE]}?${m[g.BUILD]}?`);y("FULL",`^${m[g.FULLPLAIN]}$`);y("LOOSEPLAIN",`[v=\\s]*${m[g.MAINVERSIONLOOSE]}${m[g.PRERELEASELOOSE]}?${m[g.BUILD]}?`);y("LOOSE",`^${m[g.LOOSEPLAIN]}$`);y("GTLT","((?:<|>)?=?)");y("XRANGEIDENTIFIERLOOSE",`${m[g.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);y("XRANGEIDENTIFIER",`${m[g.NUMERICIDENTIFIER]}|x|X|\\*`);y("XRANGEPLAIN",`[v=\\s]*(${m[g.XRANGEIDENTIFIER]})(?:\\.(${m[g.XRANGEIDENTIFIER]})(?:\\.(${m[g.XRANGEIDENTIFIER]})(?:${m[g.PRERELEASE]})?${m[g.BUILD]}?)?)?`);y("XRANGEPLAINLOOSE",`[v=\\s]*(${m[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${m[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${m[g.XRANGEIDENTIFIERLOOSE]})(?:${m[g.PRERELEASELOOSE]})?${m[g.BUILD]}?)?)?`);y("XRANGE",`^${m[g.GTLT]}\\s*${m[g.XRANGEPLAIN]}$`);y("XRANGELOOSE",`^${m[g.GTLT]}\\s*${m[g.XRANGEPLAINLOOSE]}$`);y("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ir}})(?:\\.(\\d{1,${Ir}}))?(?:\\.(\\d{1,${Ir}}))?`);y("COERCE",`${m[g.COERCEPLAIN]}(?:$|[^\\d])`);y("COERCEFULL",m[g.COERCEPLAIN]+`(?:${m[g.PRERELEASE]})?(?:${m[g.BUILD]})?(?:$|[^\\d])`);y("COERCERTL",m[g.COERCE],!0);y("COERCERTLFULL",m[g.COERCEFULL],!0);y("LONETILDE","(?:~>?)");y("TILDETRIM",`(\\s*)${m[g.LONETILDE]}\\s+`,!0);re.tildeTrimReplace="$1~";y("TILDE",`^${m[g.LONETILDE]}${m[g.XRANGEPLAIN]}$`);y("TILDELOOSE",`^${m[g.LONETILDE]}${m[g.XRANGEPLAINLOOSE]}$`);y("LONECARET","(?:\\^)");y("CARETTRIM",`(\\s*)${m[g.LONECARET]}\\s+`,!0);re.caretTrimReplace="$1^";y("CARET",`^${m[g.LONECARET]}${m[g.XRANGEPLAIN]}$`);y("CARETLOOSE",`^${m[g.LONECARET]}${m[g.XRANGEPLAINLOOSE]}$`);y("COMPARATORLOOSE",`^${m[g.GTLT]}\\s*(${m[g.LOOSEPLAIN]})$|^$`);y("COMPARATOR",`^${m[g.GTLT]}\\s*(${m[g.FULLPLAIN]})$|^$`);y("COMPARATORTRIM",`(\\s*)${m[g.GTLT]}\\s*(${m[g.LOOSEPLAIN]}|${m[g.XRANGEPLAIN]})`,!0);re.comparatorTrimReplace="$1$2$3";y("HYPHENRANGE",`^\\s*(${m[g.XRANGEPLAIN]})\\s+-\\s+(${m[g.XRANGEPLAIN]})\\s*$`);y("HYPHENRANGELOOSE",`^\\s*(${m[g.XRANGEPLAINLOOSE]})\\s+-\\s+(${m[g.XRANGEPLAINLOOSE]})\\s*$`);y("STAR","(<|>)?=?\\s*\\*");y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ar=E((_f,Qt)=>{"use strict";var Va=Object.freeze({loose:!0}),Qa=Object.freeze({}),Ja=e=>e?typeof e!="object"?Va:e:Qa;Qt.exports=Ja});var Zt=E((Mf,Yt)=>{"use strict";var Jt=/^[0-9]+$/,Kt=(e,r)=>{let t=Jt.test(e),i=Jt.test(r);return t&&i&&(e=+e,r=+r),e===r?0:t&&!i?-1:i&&!t?1:e<r?-1:1},Ka=(e,r)=>Kt(r,e);Yt.exports={compareIdentifiers:Kt,rcompareIdentifiers:Ka}});var ke=E((qf,ri)=>{"use strict";var sr=De(),{MAX_LENGTH:ei,MAX_SAFE_INTEGER:or}=nr(),{safeRe:lr,t:cr}=Oe(),Ya=ar(),{compareIdentifiers:Ae}=Zt(),Ar=class e{constructor(r,t){if(t=Ya(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>ei)throw new TypeError(`version is longer than ${ei} characters`);sr("SemVer",r,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let i=r.trim().match(t.loose?lr[cr.LOOSE]:lr[cr.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>or||this.major<0)throw new TypeError("Invalid major version");if(this.minor>or||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>or||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let a=+n;if(a>=0&&a<or)return a}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(sr("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)),Ae(this.major,r.major)||Ae(this.minor,r.minor)||Ae(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(sr("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 Ae(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(sr("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 Ae(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=`-${t}`.match(this.options.loose?lr[cr.PRERELEASELOOSE]:lr[cr.PRERELEASE]);if(!n||n[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 a=this.prerelease.length;for(;--a>=0;)typeof this.prerelease[a]=="number"&&(this.prerelease[a]++,a=-2);if(a===-1){if(t===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let a=[t,n];i===!1&&(a=[t]),Ae(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=a):this.prerelease=a}break}default:throw new Error(`invalid increment argument: ${r}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};ri.exports=Ar});var ni=E((Df,ii)=>{"use strict";var ti=ke(),Za=(e,r,t=!1)=>{if(e instanceof ti)return e;try{return new ti(e,r)}catch(i){if(!t)return null;throw i}};ii.exports=Za});var si=E((Of,ai)=>{"use strict";var es=ke(),rs=ni(),{safeRe:fr,t:hr}=Oe(),ts=(e,r)=>{if(e instanceof es)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?fr[hr.COERCEFULL]:fr[hr.COERCE]);else{let h=r.includePrerelease?fr[hr.COERCERTLFULL]:fr[hr.COERCERTL],u;for(;(u=h.exec(e))&&(!t||t.index+t[0].length!==e.length);)(!t||u.index+u[0].length!==t.index+t[0].length)&&(t=u),h.lastIndex=u.index+u[1].length+u[2].length;h.lastIndex=-1}if(t===null)return null;let i=t[2],n=t[3]||"0",a=t[4]||"0",o=r.includePrerelease&&t[5]?`-${t[5]}`:"",l=r.includePrerelease&&t[6]?`+${t[6]}`:"";return rs(`${i}.${n}.${a}${o}${l}`,r)};ai.exports=ts});var be=E((Uf,li)=>{"use strict";var oi=ke(),is=(e,r,t)=>new oi(e,t).compare(new oi(r,t));li.exports=is});var kr=E((zf,ci)=>{"use strict";var ns=be(),as=(e,r,t)=>ns(e,r,t)>=0;ci.exports=as});var hi=E((Hf,fi)=>{"use strict";var Lr=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}};fi.exports=Lr});var di=E((Gf,ui)=>{"use strict";var ss=be(),os=(e,r,t)=>ss(e,r,t)===0;ui.exports=os});var gi=E((Wf,mi)=>{"use strict";var ls=be(),cs=(e,r,t)=>ls(e,r,t)!==0;mi.exports=cs});var bi=E((Xf,pi)=>{"use strict";var fs=be(),hs=(e,r,t)=>fs(e,r,t)>0;pi.exports=hs});var yi=E((Vf,wi)=>{"use strict";var us=be(),ds=(e,r,t)=>us(e,r,t)<0;wi.exports=ds});var vi=E((Qf,Ei)=>{"use strict";var ms=be(),gs=(e,r,t)=>ms(e,r,t)<=0;Ei.exports=gs});var xi=E((Jf,Pi)=>{"use strict";var ps=di(),bs=gi(),ws=bi(),ys=kr(),Es=yi(),vs=vi(),Ps=(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 ps(e,t,i);case"!=":return bs(e,t,i);case">":return ws(e,t,i);case">=":return ys(e,t,i);case"<":return Es(e,t,i);case"<=":return vs(e,t,i);default:throw new TypeError(`Invalid operator: ${r}`)}};Pi.exports=Ps});var $i=E((Kf,Li)=>{"use strict";var Ue=Symbol("SemVer ANY"),Tr=class e{static get ANY(){return Ue}constructor(r,t){if(t=Ri(t),r instanceof e){if(r.loose===!!t.loose)return r;r=r.value}r=r.trim().split(/\s+/).join(" "),jr("comparator",r,t),this.options=t,this.loose=!!t.loose,this.parse(r),this.semver===Ue?this.value="":this.value=this.operator+this.semver.version,jr("comp",this)}parse(r){let t=this.options.loose?Ii[Si.COMPARATORLOOSE]:Ii[Si.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 Ai(i[2],this.options.loose):this.semver=Ue}toString(){return this.value}test(r){if(jr("Comparator.test",r,this.options.loose),this.semver===Ue||r===Ue)return!0;if(typeof r=="string")try{r=new Ai(r,this.options)}catch{return!1}return $r(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 ki(r.value,t).test(this.value):r.operator===""?r.value===""?!0:new ki(this.value,t).test(r.semver):(t=Ri(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("=")||$r(this.semver,"<",r.semver,t)&&this.operator.startsWith(">")&&r.operator.startsWith("<")||$r(this.semver,">",r.semver,t)&&this.operator.startsWith("<")&&r.operator.startsWith(">")))}};Li.exports=Tr;var Ri=ar(),{safeRe:Ii,t:Si}=Oe(),$r=xi(),jr=De(),Ai=ke(),ki=Nr()});var Nr=E((Yf,Ci)=>{"use strict";var xs=/\s+/g,Cr=class e{constructor(r,t){if(t=Is(t),r instanceof e)return r.loose===!!t.loose&&r.includePrerelease===!!t.includePrerelease?r:new e(r.raw,t);if(r instanceof Br)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(xs," "),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=>!Ti(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&&Ts(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&&$s)|(this.options.loose&&js))+":"+r,n=ji.get(i);if(n)return n;let a=this.options.loose,o=a?M[N.HYPHENRANGELOOSE]:M[N.HYPHENRANGE];r=r.replace(o,Us(this.options.includePrerelease)),x("hyphen replace",r),r=r.replace(M[N.COMPARATORTRIM],As),x("comparator trim",r),r=r.replace(M[N.TILDETRIM],ks),x("tilde trim",r),r=r.replace(M[N.CARETTRIM],Ls),x("caret trim",r);let l=r.split(" ").map(w=>Ns(w,this.options)).join(" ").split(/\s+/).map(w=>Os(w,this.options));a&&(l=l.filter(w=>(x("loose invalid filter",w,this.options),!!w.match(M[N.COMPARATORLOOSE])))),x("range list",l);let h=new Map,u=l.map(w=>new Br(w,this.options));for(let w of u){if(Ti(w))return[w];h.set(w.value,w)}h.size>1&&h.has("")&&h.delete("");let b=[...h.values()];return ji.set(i,b),b}intersects(r,t){if(!(r instanceof e))throw new TypeError("a Range is required");return this.set.some(i=>Ni(i,t)&&r.set.some(n=>Ni(n,t)&&i.every(a=>n.every(o=>a.intersects(o,t)))))}test(r){if(!r)return!1;if(typeof r=="string")try{r=new Ss(r,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(zs(this.set[t],r,this.options))return!0;return!1}};Ci.exports=Cr;var Rs=hi(),ji=new Rs,Is=ar(),Br=$i(),x=De(),Ss=ke(),{safeRe:M,t:N,comparatorTrimReplace:As,tildeTrimReplace:ks,caretTrimReplace:Ls}=Oe(),{FLAG_INCLUDE_PRERELEASE:$s,FLAG_LOOSE:js}=nr(),Ti=e=>e.value==="<0.0.0-0",Ts=e=>e.value==="",Ni=(e,r)=>{let t=!0,i=e.slice(),n=i.pop();for(;t&&i.length;)t=i.every(a=>n.intersects(a,r)),n=i.pop();return t},Ns=(e,r)=>(x("comp",e,r),e=Fs(e,r),x("caret",e),e=Cs(e,r),x("tildes",e),e=Ms(e,r),x("xrange",e),e=Ds(e,r),x("stars",e),e),C=e=>!e||e.toLowerCase()==="x"||e==="*",Cs=(e,r)=>e.trim().split(/\s+/).map(t=>Bs(t,r)).join(" "),Bs=(e,r)=>{let t=r.loose?M[N.TILDELOOSE]:M[N.TILDE];return e.replace(t,(i,n,a,o,l)=>{x("tilde",e,i,n,a,o,l);let h;return C(n)?h="":C(a)?h=`>=${n}.0.0 <${+n+1}.0.0-0`:C(o)?h=`>=${n}.${a}.0 <${n}.${+a+1}.0-0`:l?(x("replaceTilde pr",l),h=`>=${n}.${a}.${o}-${l} <${n}.${+a+1}.0-0`):h=`>=${n}.${a}.${o} <${n}.${+a+1}.0-0`,x("tilde return",h),h})},Fs=(e,r)=>e.trim().split(/\s+/).map(t=>_s(t,r)).join(" "),_s=(e,r)=>{x("caret",e,r);let t=r.loose?M[N.CARETLOOSE]:M[N.CARET],i=r.includePrerelease?"-0":"";return e.replace(t,(n,a,o,l,h)=>{x("caret",e,n,a,o,l,h);let u;return C(a)?u="":C(o)?u=`>=${a}.0.0${i} <${+a+1}.0.0-0`:C(l)?a==="0"?u=`>=${a}.${o}.0${i} <${a}.${+o+1}.0-0`:u=`>=${a}.${o}.0${i} <${+a+1}.0.0-0`:h?(x("replaceCaret pr",h),a==="0"?o==="0"?u=`>=${a}.${o}.${l}-${h} <${a}.${o}.${+l+1}-0`:u=`>=${a}.${o}.${l}-${h} <${a}.${+o+1}.0-0`:u=`>=${a}.${o}.${l}-${h} <${+a+1}.0.0-0`):(x("no pr"),a==="0"?o==="0"?u=`>=${a}.${o}.${l}${i} <${a}.${o}.${+l+1}-0`:u=`>=${a}.${o}.${l}${i} <${a}.${+o+1}.0-0`:u=`>=${a}.${o}.${l} <${+a+1}.0.0-0`),x("caret return",u),u})},Ms=(e,r)=>(x("replaceXRanges",e,r),e.split(/\s+/).map(t=>qs(t,r)).join(" ")),qs=(e,r)=>{e=e.trim();let t=r.loose?M[N.XRANGELOOSE]:M[N.XRANGE];return e.replace(t,(i,n,a,o,l,h)=>{x("xRange",e,i,n,a,o,l,h);let u=C(a),b=u||C(o),w=b||C(l),S=w;return n==="="&&S&&(n=""),h=r.includePrerelease?"-0":"",u?n===">"||n==="<"?i="<0.0.0-0":i="*":n&&S?(b&&(o=0),l=0,n===">"?(n=">=",b?(a=+a+1,o=0,l=0):(o=+o+1,l=0)):n==="<="&&(n="<",b?a=+a+1:o=+o+1),n==="<"&&(h="-0"),i=`${n+a}.${o}.${l}${h}`):b?i=`>=${a}.0.0${h} <${+a+1}.0.0-0`:w&&(i=`>=${a}.${o}.0${h} <${a}.${+o+1}.0-0`),x("xRange return",i),i})},Ds=(e,r)=>(x("replaceStars",e,r),e.trim().replace(M[N.STAR],"")),Os=(e,r)=>(x("replaceGTE0",e,r),e.trim().replace(M[r.includePrerelease?N.GTE0PRE:N.GTE0],"")),Us=e=>(r,t,i,n,a,o,l,h,u,b,w,S)=>(C(i)?t="":C(n)?t=`>=${i}.0.0${e?"-0":""}`:C(a)?t=`>=${i}.${n}.0${e?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${e?"-0":""}`,C(u)?h="":C(b)?h=`<${+u+1}.0.0-0`:C(w)?h=`<${u}.${+b+1}.0-0`:S?h=`<=${u}.${b}.${w}-${S}`:e?h=`<${u}.${b}.${+w+1}-0`:h=`<=${h}`,`${t} ${h}`.trim()),zs=(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(x(e[i].semver),e[i].semver!==Br.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 Fi=E((Zf,Bi)=>{"use strict";var Hs=Nr(),Gs=(e,r,t)=>{try{r=new Hs(r,t)}catch{return!1}return r.test(e)};Bi.exports=Gs});var Fr=E((eh,Ws)=>{Ws.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.34.4",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.js",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.js","package-release-notes":"node npm/release-notes.js","docs-build":"node docs/build.mjs","docs-serve":"cd docs && npm start","docs-publish":"cd docs && npm run build && 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:{"@img/colour":"^1.0.0","detect-libc":"^2.1.0",semver:"^7.7.2"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.34.4","@img/sharp-darwin-x64":"0.34.4","@img/sharp-libvips-darwin-arm64":"1.2.3","@img/sharp-libvips-darwin-x64":"1.2.3","@img/sharp-libvips-linux-arm":"1.2.3","@img/sharp-libvips-linux-arm64":"1.2.3","@img/sharp-libvips-linux-ppc64":"1.2.3","@img/sharp-libvips-linux-s390x":"1.2.3","@img/sharp-libvips-linux-x64":"1.2.3","@img/sharp-libvips-linuxmusl-arm64":"1.2.3","@img/sharp-libvips-linuxmusl-x64":"1.2.3","@img/sharp-linux-arm":"0.34.4","@img/sharp-linux-arm64":"0.34.4","@img/sharp-linux-ppc64":"0.34.4","@img/sharp-linux-s390x":"0.34.4","@img/sharp-linux-x64":"0.34.4","@img/sharp-linuxmusl-arm64":"0.34.4","@img/sharp-linuxmusl-x64":"0.34.4","@img/sharp-wasm32":"0.34.4","@img/sharp-win32-arm64":"0.34.4","@img/sharp-win32-ia32":"0.34.4","@img/sharp-win32-x64":"0.34.4"},devDependencies:{"@emnapi/runtime":"^1.5.0","@img/sharp-libvips-dev":"1.2.3","@img/sharp-libvips-dev-wasm32":"1.2.3","@img/sharp-libvips-win32-arm64":"1.2.3","@img/sharp-libvips-win32-ia32":"1.2.3","@img/sharp-libvips-win32-x64":"1.2.3","@types/node":"*",cc:"^3.0.1",emnapi:"^1.5.0","exif-reader":"^2.0.2","extract-zip":"^2.0.1",icc:"^3.0.0","jsdoc-to-markdown":"^9.1.2","license-checker":"^25.0.1",mocha:"^11.7.2","node-addon-api":"^8.5.0","node-gyp":"^11.4.2",nyc:"^17.1.0",semistandard:"^17.0.0","tar-fs":"^3.1.1",tsd:"^0.33.0"},license:"Apache-2.0",engines:{node:"^18.17.0 || ^20.3.0 || >=21.0.0"},config:{libvips:">=8.17.2"},funding:{url:"https://opencollective.com/libvips"},semistandard:{env:["mocha"]},cc:{linelength:"120",filter:["build/include"]},nyc:{include:["lib"]},tsd:{directory:"test/types/"}}});var Mr=E((rh,Wi)=>{"use strict";var{spawnSync:ur}=R("child_process"),{createHash:Xs}=R("crypto"),Di=si(),Vs=kr(),Qs=Fi(),_i=ir(),{config:Js,engines:Mi,optionalDependencies:Ks}=Fr(),Ys=process.env.npm_package_config_libvips||Js.libvips,Oi=Di(Ys).version,Zs=["darwin-arm64","darwin-x64","linux-arm","linux-arm64","linux-ppc64","linux-s390x","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-arm64","win32-ia32","win32-x64"],dr={encoding:"utf8",shell:!0},eo=e=>{e instanceof Error?console.error(`sharp: Installation error: ${e.message}`):console.log(`sharp: ${e}`)},Ui=()=>_i.isNonGlibcLinuxSync()?_i.familySync():"",ro=()=>`${process.platform}${Ui()}-${process.arch}`,Le=()=>{if(zi())return"wasm32";let{npm_config_arch:e,npm_config_platform:r,npm_config_libc:t}=process.env,i=typeof t=="string"?t:Ui();return`${r||process.platform}${i}-${e||process.arch}`},to=()=>{try{return R(`@img/sharp-libvips-dev-${Le()}/include`)}catch{try{return R("@img/sharp-libvips-dev/include")}catch{}}return""},io=()=>{try{return R("@img/sharp-libvips-dev/cplusplus")}catch{}return""},no=()=>{try{return R(`@img/sharp-libvips-dev-${Le()}/lib`)}catch{try{return R(`@img/sharp-libvips-${Le()}/lib`)}catch{}}return""},ao=()=>{var e;if(((e=process.release)==null?void 0:e.name)==="node"&&process.versions&&!Qs(process.versions.node,Mi.node))return{found:process.versions.node,expected:Mi.node}},zi=()=>{let{CC:e}=process.env;return!!(e&&e.endsWith("/emcc"))},so=()=>process.platform==="darwin"&&process.arch==="x64"?(ur("sysctl sysctl.proc_translated",dr).stdout||"").trim()==="sysctl.proc_translated: 1":!1,qi=e=>Xs("sha512").update(e).digest("hex"),oo=()=>{try{let e=qi(`imgsharp-libvips-${Le()}`),r=Di(Ks[`@img/sharp-libvips-${Le()}`],{includePrerelease:!0}).version;return qi(`${e}npm:${r}`).slice(0,10)}catch{}return""},lo=()=>ur(`node-gyp rebuild --directory=src ${zi()?"--nodedir=emscripten":""}`,{...dr,stdio:"inherit"}).status,Hi=()=>process.platform!=="win32"?(ur("pkg-config --modversion vips-cpp",{...dr,env:{...process.env,PKG_CONFIG_PATH:Gi()}}).stdout||"").trim():"",Gi=()=>process.platform!=="win32"?[(ur('which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',dr).stdout||"").trim(),process.env.PKG_CONFIG_PATH,"/usr/local/lib/pkgconfig","/usr/lib/pkgconfig","/usr/local/libdata/pkgconfig","/usr/libdata/pkgconfig"].filter(Boolean).join(":"):"",_r=(e,r,t)=>(t&&t(`Detected ${r}, skipping search for globally-installed libvips`),e),co=e=>{if(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)return _r(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)return _r(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(so())return _r(!1,"Rosetta",e);let r=Hi();return!!r&&Vs(r,Oi)};Wi.exports={minimumLibvipsVersion:Oi,prebuiltPlatforms:Zs,buildPlatformArch:Le,buildSharpLibvipsIncludeDir:to,buildSharpLibvipsCPlusPlusDir:io,buildSharpLibvipsLibDir:no,isUnsupportedNodeRuntime:ao,runtimePlatformArch:ro,log:eo,yarnLocator:oo,spawnRebuild:lo,globalLibvipsVersion:Hi,pkgConfigPath:Gi,useGlobalLibvips:co}});var He=E((ih,Vi)=>{"use strict";var{familySync:fo,versionSync:ho}=ir(),{runtimePlatformArch:uo,isUnsupportedNodeRuntime:Xi,prebuiltPlatforms:mo,minimumLibvipsVersion:go}=Mr(),we=uo(),po=[`../src/build/Release/sharp-${we}.node`,"../src/build/Release/sharp-wasm32.node",`@img/sharp-${we}/sharp.node`,"@img/sharp-wasm32/sharp.node"],qr,$e,ze=[];for(qr of po)try{$e=R(qr);break}catch(e){ze.push(e)}if($e&&qr.startsWith("@img/sharp-linux-x64")&&!$e._isUsingX64V2()){let e=new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");e.code="Unsupported CPU",ze.push(e),$e=null}if($e)Vi.exports=$e;else{let[e,r,t]=["linux","darwin","win32"].map(a=>we.startsWith(a)),i=[`Could not load the "sharp" module using the ${we} runtime`];ze.forEach(a=>{a.code!=="MODULE_NOT_FOUND"&&i.push(`${a.code}: ${a.message}`)});let n=ze.map(a=>a.message).join(" ");if(i.push("Possible solutions:"),Xi()){let{found:a,expected:o}=Xi();i.push("- Please upgrade Node.js:",` Found ${a}`,` Requires ${o}`)}else if(mo.includes(we)){let[a,o]=we.split("-"),l=a.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=${a.replace("musl","")}${l} --cpu=${o} sharp`)}else i.push(`- Manually install libvips >= ${go}`,"- 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:a}=R(`@img/sharp-libvips-${we}/package`),o=`${fo()} ${ho()}`,l=`${a.musl?"musl":"glibc"} ${a.musl||a.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"),ze.some(a=>a.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 Ji=E((ah,Qi)=>{"use strict";var bo=R("util"),Dr=R("stream"),wo=K();He();var yo=bo.debuglog("sharp"),ye=function(e,r){if(arguments.length===1&&!wo.defined(e))throw new Error("Invalid input");return this instanceof ye?(Dr.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],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!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,dilateWidth:0,erodeWidth:0,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,withXmp:"",resolveWithObject:!1,loop:-1,delay:[],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,webpSmartDeblock:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,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:[],pdfBackground:[255,255,255,255],debuglog:t=>{this.emit("warning",t),yo(t)},queueListener:function(t){ye.queue.emit("change",t)}},this.options.input=this._createInputDescriptor(e,r,{allowStream:!0}),this):new ye(e,r)};Object.setPrototypeOf(ye.prototype,Dr.Duplex.prototype);Object.setPrototypeOf(ye,Dr.Duplex);function Eo(){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(ye.prototype,{clone:Eo});Qi.exports=ye});var Zi=E((sh,Yi)=>{"use strict";var c=K(),ue=He(),vo={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},Po=["failOn","limitInputPixels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","failOnError","openSlideLevel","pdfBackground","tiffSubifd"];function Ki(e){let r=Po.filter(t=>c.defined(e[t])).map(t=>[t,e[t]]);return r.length?Object.fromEntries(r):void 0}function xo(e,r,t){let i={autoOrient:!1,failOn:"warning",limitInputPixels:Math.pow(16383,2),ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(c.string(e))i.file=e;else if(c.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");i.buffer=e}else if(c.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");i.buffer=Buffer.from(e,0,e.byteLength)}else if(c.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(c.plainObject(e)&&!c.defined(r))r=e,Ki(r)&&(i.buffer=[]);else if(!c.defined(e)&&!c.defined(r)&&c.object(t)&&t.allowStream)i.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map(n=>this._createInputDescriptor(n));else throw new Error("Recursive join is unsupported");else throw new Error("Expected at least two images to join");else throw new Error(`Unsupported input '${e}' of type ${typeof e}${c.defined(r)?` when also providing options of type ${typeof r}`:""}`);if(c.object(r)){if(c.defined(r.failOnError))if(c.bool(r.failOnError))i.failOn=r.failOnError?"warning":"none";else throw c.invalidParameterError("failOnError","boolean",r.failOnError);if(c.defined(r.failOn))if(c.string(r.failOn)&&c.inArray(r.failOn,["none","truncated","error","warning"]))i.failOn=r.failOn;else throw c.invalidParameterError("failOn","one of: none, truncated, error, warning",r.failOn);if(c.defined(r.autoOrient))if(c.bool(r.autoOrient))i.autoOrient=r.autoOrient;else throw c.invalidParameterError("autoOrient","boolean",r.autoOrient);if(c.defined(r.density))if(c.inRange(r.density,1,1e5))i.density=r.density;else throw c.invalidParameterError("density","number between 1 and 100000",r.density);if(c.defined(r.ignoreIcc))if(c.bool(r.ignoreIcc))i.ignoreIcc=r.ignoreIcc;else throw c.invalidParameterError("ignoreIcc","boolean",r.ignoreIcc);if(c.defined(r.limitInputPixels))if(c.bool(r.limitInputPixels))i.limitInputPixels=r.limitInputPixels?Math.pow(16383,2):0;else if(c.integer(r.limitInputPixels)&&c.inRange(r.limitInputPixels,0,Number.MAX_SAFE_INTEGER))i.limitInputPixels=r.limitInputPixels;else throw c.invalidParameterError("limitInputPixels","positive integer",r.limitInputPixels);if(c.defined(r.unlimited))if(c.bool(r.unlimited))i.unlimited=r.unlimited;else throw c.invalidParameterError("unlimited","boolean",r.unlimited);if(c.defined(r.sequentialRead))if(c.bool(r.sequentialRead))i.sequentialRead=r.sequentialRead;else throw c.invalidParameterError("sequentialRead","boolean",r.sequentialRead);if(c.defined(r.raw)){if(c.object(r.raw)&&c.integer(r.raw.width)&&r.raw.width>0&&c.integer(r.raw.height)&&r.raw.height>0&&c.integer(r.raw.channels)&&c.inRange(r.raw.channels,1,4))switch(i.rawWidth=r.raw.width,i.rawHeight=r.raw.height,i.rawChannels=r.raw.channels,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(i.rawPremultiplied=!1,c.defined(r.raw.premultiplied))if(c.bool(r.raw.premultiplied))i.rawPremultiplied=r.raw.premultiplied;else throw c.invalidParameterError("raw.premultiplied","boolean",r.raw.premultiplied);if(i.rawPageHeight=0,c.defined(r.raw.pageHeight))if(c.integer(r.raw.pageHeight)&&r.raw.pageHeight>0&&r.raw.pageHeight<=r.raw.height){if(r.raw.height%r.raw.pageHeight!==0)throw new Error(`Expected raw.height ${r.raw.height} to be a multiple of raw.pageHeight ${r.raw.pageHeight}`);i.rawPageHeight=r.raw.pageHeight}else throw c.invalidParameterError("raw.pageHeight","positive integer",r.raw.pageHeight)}if(c.defined(r.animated))if(c.bool(r.animated))i.pages=r.animated?-1:1;else throw c.invalidParameterError("animated","boolean",r.animated);if(c.defined(r.pages))if(c.integer(r.pages)&&c.inRange(r.pages,-1,1e5))i.pages=r.pages;else throw c.invalidParameterError("pages","integer between -1 and 100000",r.pages);if(c.defined(r.page))if(c.integer(r.page)&&c.inRange(r.page,0,1e5))i.page=r.page;else throw c.invalidParameterError("page","integer between 0 and 100000",r.page);if(c.object(r.openSlide)&&c.defined(r.openSlide.level))if(c.integer(r.openSlide.level)&&c.inRange(r.openSlide.level,0,256))i.openSlideLevel=r.openSlide.level;else throw c.invalidParameterError("openSlide.level","integer between 0 and 256",r.openSlide.level);else if(c.defined(r.level))if(c.integer(r.level)&&c.inRange(r.level,0,256))i.openSlideLevel=r.level;else throw c.invalidParameterError("level","integer between 0 and 256",r.level);if(c.object(r.tiff)&&c.defined(r.tiff.subifd))if(c.integer(r.tiff.subifd)&&c.inRange(r.tiff.subifd,-1,1e5))i.tiffSubifd=r.tiff.subifd;else throw c.invalidParameterError("tiff.subifd","integer between -1 and 100000",r.tiff.subifd);else if(c.defined(r.subifd))if(c.integer(r.subifd)&&c.inRange(r.subifd,-1,1e5))i.tiffSubifd=r.subifd;else throw c.invalidParameterError("subifd","integer between -1 and 100000",r.subifd);if(c.object(r.svg)){if(c.defined(r.svg.stylesheet))if(c.string(r.svg.stylesheet))i.svgStylesheet=r.svg.stylesheet;else throw c.invalidParameterError("svg.stylesheet","string",r.svg.stylesheet);if(c.defined(r.svg.highBitdepth))if(c.bool(r.svg.highBitdepth))i.svgHighBitdepth=r.svg.highBitdepth;else throw c.invalidParameterError("svg.highBitdepth","boolean",r.svg.highBitdepth)}if(c.object(r.pdf)&&c.defined(r.pdf.background)?i.pdfBackground=this._getBackgroundColourOption(r.pdf.background):c.defined(r.pdfBackground)&&(i.pdfBackground=this._getBackgroundColourOption(r.pdfBackground)),c.object(r.jp2)&&c.defined(r.jp2.oneshot))if(c.bool(r.jp2.oneshot))i.jp2Oneshot=r.jp2.oneshot;else throw c.invalidParameterError("jp2.oneshot","boolean",r.jp2.oneshot);if(c.defined(r.create))if(c.object(r.create)&&c.integer(r.create.width)&&r.create.width>0&&c.integer(r.create.height)&&r.create.height>0&&c.integer(r.create.channels)){if(i.createWidth=r.create.width,i.createHeight=r.create.height,i.createChannels=r.create.channels,i.createPageHeight=0,c.defined(r.create.pageHeight))if(c.integer(r.create.pageHeight)&&r.create.pageHeight>0&&r.create.pageHeight<=r.create.height){if(r.create.height%r.create.pageHeight!==0)throw new Error(`Expected create.height ${r.create.height} to be a multiple of create.pageHeight ${r.create.pageHeight}`);i.createPageHeight=r.create.pageHeight}else throw c.invalidParameterError("create.pageHeight","positive integer",r.create.pageHeight);if(c.defined(r.create.noise)){if(!c.object(r.create.noise))throw new Error("Expected noise to be an object");if(r.create.noise.type!=="gaussian")throw new Error("Only gaussian noise is supported at the moment");if(i.createNoiseType=r.create.noise.type,!c.inRange(r.create.channels,1,4))throw c.invalidParameterError("create.channels","number between 1 and 4",r.create.channels);if(i.createNoiseMean=128,c.defined(r.create.noise.mean))if(c.number(r.create.noise.mean)&&c.inRange(r.create.noise.mean,0,1e4))i.createNoiseMean=r.create.noise.mean;else throw c.invalidParameterError("create.noise.mean","number between 0 and 10000",r.create.noise.mean);if(i.createNoiseSigma=30,c.defined(r.create.noise.sigma))if(c.number(r.create.noise.sigma)&&c.inRange(r.create.noise.sigma,0,1e4))i.createNoiseSigma=r.create.noise.sigma;else throw c.invalidParameterError("create.noise.sigma","number between 0 and 10000",r.create.noise.sigma)}else if(c.defined(r.create.background)){if(!c.inRange(r.create.channels,3,4))throw c.invalidParameterError("create.channels","number between 3 and 4",r.create.channels);i.createBackground=this._getBackgroundColourOption(r.create.background)}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(c.defined(r.text))if(c.object(r.text)&&c.string(r.text.text)){if(i.textValue=r.text.text,c.defined(r.text.height)&&c.defined(r.text.dpi))throw new Error("Expected only one of dpi or height");if(c.defined(r.text.font))if(c.string(r.text.font))i.textFont=r.text.font;else throw c.invalidParameterError("text.font","string",r.text.font);if(c.defined(r.text.fontfile))if(c.string(r.text.fontfile))i.textFontfile=r.text.fontfile;else throw c.invalidParameterError("text.fontfile","string",r.text.fontfile);if(c.defined(r.text.width))if(c.integer(r.text.width)&&r.text.width>0)i.textWidth=r.text.width;else throw c.invalidParameterError("text.width","positive integer",r.text.width);if(c.defined(r.text.height))if(c.integer(r.text.height)&&r.text.height>0)i.textHeight=r.text.height;else throw c.invalidParameterError("text.height","positive integer",r.text.height);if(c.defined(r.text.align))if(c.string(r.text.align)&&c.string(this.constructor.align[r.text.align]))i.textAlign=this.constructor.align[r.text.align];else throw c.invalidParameterError("text.align","valid alignment",r.text.align);if(c.defined(r.text.justify))if(c.bool(r.text.justify))i.textJustify=r.text.justify;else throw c.invalidParameterError("text.justify","boolean",r.text.justify);if(c.defined(r.text.dpi))if(c.integer(r.text.dpi)&&c.inRange(r.text.dpi,1,1e6))i.textDpi=r.text.dpi;else throw c.invalidParameterError("text.dpi","integer between 1 and 1000000",r.text.dpi);if(c.defined(r.text.rgba))if(c.bool(r.text.rgba))i.textRgba=r.text.rgba;else throw c.invalidParameterError("text.rgba","bool",r.text.rgba);if(c.defined(r.text.spacing))if(c.integer(r.text.spacing)&&c.inRange(r.text.spacing,-1e6,1e6))i.textSpacing=r.text.spacing;else throw c.invalidParameterError("text.spacing","integer between -1000000 and 1000000",r.text.spacing);if(c.defined(r.text.wrap))if(c.string(r.text.wrap)&&c.inArray(r.text.wrap,["word","char","word-char","none"]))i.textWrap=r.text.wrap;else throw c.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.");if(c.defined(r.join))if(c.defined(this.options.join)){if(c.defined(r.join.animated))if(c.bool(r.join.animated))i.joinAnimated=r.join.animated;else throw c.invalidParameterError("join.animated","boolean",r.join.animated);if(c.defined(r.join.across))if(c.integer(r.join.across)&&c.inRange(r.join.across,1,1e6))i.joinAcross=r.join.across;else throw c.invalidParameterError("join.across","integer between 1 and 100000",r.join.across);if(c.defined(r.join.shim))if(c.integer(r.join.shim)&&c.inRange(r.join.shim,0,1e6))i.joinShim=r.join.shim;else throw c.invalidParameterError("join.shim","integer between 0 and 100000",r.join.shim);if(c.defined(r.join.background)&&(i.joinBackground=this._getBackgroundColourOption(r.join.background)),c.defined(r.join.halign))if(c.string(r.join.halign)&&c.string(this.constructor.align[r.join.halign]))i.joinHalign=this.constructor.align[r.join.halign];else throw c.invalidParameterError("join.halign","valid alignment",r.join.halign);if(c.defined(r.join.valign))if(c.string(r.join.valign)&&c.string(this.constructor.align[r.join.valign]))i.joinValign=this.constructor.align[r.join.valign];else throw c.invalidParameterError("join.valign","valid alignment",r.join.valign)}else throw new Error("Expected input to be an array of images to join")}else if(c.defined(r))throw new Error("Invalid input options "+r);return i}function Ro(e,r,t){Array.isArray(this.options.input.buffer)?c.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 c.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),ue.metadata(this.options,(t,i)=>{t?e(c.nativeError(t,r)):e(null,i)})}):ue.metadata(this.options,(t,i)=>{t?e(c.nativeError(t,r)):e(null,i)}),this):this._isStreamInput()?new Promise((t,i)=>{let n=()=>{this._flattenBufferIn(),ue.metadata(this.options,(a,o)=>{a?i(c.nativeError(a,r)):t(o)})};this.writableFinished?n():this.once("finish",n)}):new Promise((t,i)=>{ue.metadata(this.options,(n,a)=>{n?i(c.nativeError(n,r)):t(a)})})}function ko(e){let r=Error();return c.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),ue.stats(this.options,(t,i)=>{t?e(c.nativeError(t,r)):e(null,i)})}):ue.stats(this.options,(t,i)=>{t?e(c.nativeError(t,r)):e(null,i)}),this):this._isStreamInput()?new Promise((t,i)=>{this.on("finish",function(){this._flattenBufferIn(),ue.stats(this.options,(n,a)=>{n?i(c.nativeError(n,r)):t(a)})})}):new Promise((t,i)=>{ue.stats(this.options,(n,a)=>{n?i(c.nativeError(n,r)):t(a)})})}Yi.exports=function(e){Object.assign(e.prototype,{_inputOptionsFromObject:Ki,_createInputDescriptor:xo,_write:Ro,_flattenBufferIn:Io,_isStreamInput:So,metadata:Ao,stats:ko}),e.align=vo}});var sn=E((oh,an)=>{"use strict";var p=K(),rn={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},tn={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},en={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},nn={entropy:16,attention:17},Or={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},Lo={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},$o={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"};function Ur(e){return e.angle%360!==0||e.rotationAngle!==0}function mr(e){return e.width!==-1||e.height!==-1}function jo(e,r,t){if(mr(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=$o[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:nn[t.position]||tn[t.position]||rn[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(Or[t.kernel]))this.options.kernel=Or[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 Ur(this.options)&&mr(this.options)&&(this.options.rotateBefore=!0),this}function To(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(en[e.extendWith]))this.options.extendWith=en[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=mr(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),Ur(this.options)&&!mr(this.options)&&(this.options.widthPre===-1||this.options.widthPost===-1)&&(this.options.rotateBefore=!0),this.options.input.autoOrient&&(this.options.orientBefore=!0),this}function Co(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 Ur(this.options)&&(this.options.rotateBefore=!0),this}an.exports=function(e){Object.assign(e.prototype,{resize:jo,extend:To,extract:No,trim:Co}),e.gravity=rn,e.strategy=nn,e.kernel=Or,e.fit=Lo,e.position=tn}});var ln=E((lh,on)=>{"use strict";var P=K(),zr={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 Bo(e){if(!Array.isArray(e))throw P.invalidParameterError("images to composite","array",e);return this.options.composite=e.map(r=>{if(!P.object(r))throw P.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(P.defined(r.blend))if(P.string(zr[r.blend]))i.blend=zr[r.blend];else throw P.invalidParameterError("blend","valid blend name",r.blend);if(P.defined(r.tile))if(P.bool(r.tile))i.tile=r.tile;else throw P.invalidParameterError("tile","boolean",r.tile);if(P.defined(r.left))if(P.integer(r.left))i.left=r.left;else throw P.invalidParameterError("left","integer",r.left);if(P.defined(r.top))if(P.integer(r.top))i.top=r.top;else throw P.invalidParameterError("top","integer",r.top);if(P.defined(r.top)!==P.defined(r.left))throw new Error("Expected both left and top to be set");if(i.hasOffset=P.integer(r.top)&&P.integer(r.left),P.defined(r.gravity))if(P.integer(r.gravity)&&P.inRange(r.gravity,0,8))i.gravity=r.gravity;else if(P.string(r.gravity)&&P.integer(this.constructor.gravity[r.gravity]))i.gravity=this.constructor.gravity[r.gravity];else throw P.invalidParameterError("gravity","valid gravity",r.gravity);if(P.defined(r.premultiplied))if(P.bool(r.premultiplied))i.premultiplied=r.premultiplied;else throw P.invalidParameterError("premultiplied","boolean",r.premultiplied);return i}),this}on.exports=function(e){e.prototype.composite=Bo,e.blend=zr}});var dn=E((ch,un)=>{"use strict";var f=K(),cn={integer:"integer",float:"float",approximate:"approximate"};function Fo(e,r){if(!f.defined(e))return this.autoOrient();if((this.options.angle||this.options.rotationAngle)&&(this.options.debuglog("ignoring previous rotate options"),this.options.angle=0,this.options.rotationAngle=0),f.integer(e)&&!(e%90))this.options.angle=e;else if(f.number(e))this.options.rotationAngle=e,f.object(r)&&r.background&&this._setBackgroundColourOption("rotationBackground",r.background);else throw f.invalidParameterError("angle","numeric",e);return this}function _o(){return this.options.input.autoOrient=!0,this}function Mo(e){return this.options.flip=f.bool(e)?e:!0,this}function qo(e){return this.options.flop=f.bool(e)?e:!0,this}function Do(e,r){let t=[].concat(...e);if(t.length===4&&t.every(f.number))this.options.affineMatrix=t;else throw f.invalidParameterError("matrix","1x4 or 2x2 array",e);if(f.defined(r))if(f.object(r)){if(this._setBackgroundColourOption("affineBackground",r.background),f.defined(r.idx))if(f.number(r.idx))this.options.affineIdx=r.idx;else throw f.invalidParameterError("options.idx","number",r.idx);if(f.defined(r.idy))if(f.number(r.idy))this.options.affineIdy=r.idy;else throw f.invalidParameterError("options.idy","number",r.idy);if(f.defined(r.odx))if(f.number(r.odx))this.options.affineOdx=r.odx;else throw f.invalidParameterError("options.odx","number",r.odx);if(f.defined(r.ody))if(f.number(r.ody))this.options.affineOdy=r.ody;else throw f.invalidParameterError("options.ody","number",r.ody);if(f.defined(r.interpolator))if(f.inArray(r.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=r.interpolator;else throw f.invalidParameterError("options.interpolator","valid interpolator name",r.interpolator)}else throw f.invalidParameterError("options","object",r);return this}function Oo(e,r,t){if(!f.defined(e))this.options.sharpenSigma=-1;else if(f.bool(e))this.options.sharpenSigma=e?-1:0;else if(f.number(e)&&f.inRange(e,.01,1e4)){if(this.options.sharpenSigma=e,f.defined(r))if(f.number(r)&&f.inRange(r,0,1e4))this.options.sharpenM1=r;else throw f.invalidParameterError("flat","number between 0 and 10000",r);if(f.defined(t))if(f.number(t)&&f.inRange(t,0,1e4))this.options.sharpenM2=t;else throw f.invalidParameterError("jagged","number between 0 and 10000",t)}else if(f.plainObject(e)){if(f.number(e.sigma)&&f.inRange(e.sigma,1e-6,10))this.options.sharpenSigma=e.sigma;else throw f.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(f.defined(e.m1))if(f.number(e.m1)&&f.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw f.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(f.defined(e.m2))if(f.number(e.m2)&&f.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw f.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(f.defined(e.x1))if(f.number(e.x1)&&f.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw f.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(f.defined(e.y2))if(f.number(e.y2)&&f.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw f.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(f.defined(e.y3))if(f.number(e.y3)&&f.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw f.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else throw f.invalidParameterError("sigma","number between 0.01 and 10000",e);return this}function Uo(e){if(!f.defined(e))this.options.medianSize=3;else if(f.integer(e)&&f.inRange(e,1,1e3))this.options.medianSize=e;else throw f.invalidParameterError("size","integer between 1 and 1000",e);return this}function zo(e){let r;if(f.number(e))r=e;else if(f.plainObject(e)){if(!f.number(e.sigma))throw f.invalidParameterError("options.sigma","number between 0.3 and 1000",r);if(r=e.sigma,"precision"in e)if(f.string(cn[e.precision]))this.options.precision=cn[e.precision];else throw f.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(f.number(e.minAmplitude)&&f.inRange(e.minAmplitude,.001,1))this.options.minAmpl=e.minAmplitude;else throw f.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!f.defined(e))this.options.blurSigma=-1;else if(f.bool(e))this.options.blurSigma=e?-1:0;else if(f.number(r)&&f.inRange(r,.3,1e3))this.options.blurSigma=r;else throw f.invalidParameterError("sigma","number between 0.3 and 1000",r);return this}function fn(e){if(!f.defined(e))this.options.dilateWidth=1;else if(f.integer(e)&&e>0)this.options.dilateWidth=e;else throw f.invalidParameterError("dilate","positive integer",fn);return this}function hn(e){if(!f.defined(e))this.options.erodeWidth=1;else if(f.integer(e)&&e>0)this.options.erodeWidth=e;else throw f.invalidParameterError("erode","positive integer",hn);return this}function Ho(e){return this.options.flatten=f.bool(e)?e:!0,f.object(e)&&this._setBackgroundColourOption("flattenBackground",e.background),this}function Go(){return this.options.unflatten=!0,this}function Wo(e,r){if(!f.defined(e))this.options.gamma=2.2;else if(f.number(e)&&f.inRange(e,1,3))this.options.gamma=e;else throw f.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!f.defined(r))this.options.gammaOut=this.options.gamma;else if(f.number(r)&&f.inRange(r,1,3))this.options.gammaOut=r;else throw f.invalidParameterError("gammaOut","number between 1.0 and 3.0",r);return this}function Xo(e){if(this.options.negate=f.bool(e)?e:!0,f.plainObject(e)&&"alpha"in e)if(f.bool(e.alpha))this.options.negateAlpha=e.alpha;else throw f.invalidParameterError("alpha","should be boolean value",e.alpha);return this}function Vo(e){if(f.plainObject(e)){if(f.defined(e.lower))if(f.number(e.lower)&&f.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw f.invalidParameterError("lower","number between 0 and 99",e.lower);if(f.defined(e.upper))if(f.number(e.upper)&&f.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw f.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw f.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(f.plainObject(e)){if(f.integer(e.width)&&e.width>0)this.options.claheWidth=e.width;else throw f.invalidParameterError("width","integer greater than zero",e.width);if(f.integer(e.height)&&e.height>0)this.options.claheHeight=e.height;else throw f.invalidParameterError("height","integer greater than zero",e.height);if(f.defined(e.maxSlope))if(f.integer(e.maxSlope)&&f.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw f.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw f.invalidParameterError("options","plain object",e);return this}function Ko(e){if(!f.object(e)||!Array.isArray(e.kernel)||!f.integer(e.width)||!f.integer(e.height)||!f.inRange(e.width,3,1001)||!f.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length)throw new Error("Invalid convolution kernel");return f.integer(e.scale)||(e.scale=e.kernel.reduce(function(r,t){return r+t},0)),e.scale<1&&(e.scale=1),f.integer(e.offset)||(e.offset=0),this.options.convKernel=e,this}function Yo(e,r){if(!f.defined(e))this.options.threshold=128;else if(f.bool(e))this.options.threshold=e?128:0;else if(f.integer(e)&&f.inRange(e,0,255))this.options.threshold=e;else throw f.invalidParameterError("threshold","integer between 0 and 255",e);return!f.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),f.string(r)&&f.inArray(r,["and","or","eor"]))this.options.booleanOp=r;else throw f.invalidParameterError("operator","one of: and, or, eor",r);return this}function el(e,r){if(!f.defined(e)&&f.number(r)?e=1:f.number(e)&&!f.defined(r)&&(r=0),!f.defined(e))this.options.linearA=[];else if(f.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&e.length&&e.every(f.number))this.options.linearA=e;else throw f.invalidParameterError("a","number or array of numbers",e);if(!f.defined(r))this.options.linearB=[];else if(f.number(r))this.options.linearB=[r];else if(Array.isArray(r)&&r.length&&r.every(f.number))this.options.linearB=r;else throw f.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 f.invalidParameterError("inputMatrix","array",e);if(e.length!==3&&e.length!==4)throw f.invalidParameterError("inputMatrix","3x3 or 4x4 array",e.length);let r=e.flat().map(Number);if(r.length!==9&&r.length!==16)throw f.invalidParameterError("inputMatrix","cardinality of 9 or 16",r.length);return this.options.recombMatrix=r,this}function tl(e){if(!f.plainObject(e))throw f.invalidParameterError("options","plain object",e);if("brightness"in e)if(f.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw f.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(f.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw f.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(f.integer(e.hue))this.options.hue=e.hue%360;else throw f.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(f.number(e.lightness))this.options.lightness=e.lightness;else throw f.invalidParameterError("lightness","number",e.lightness);return this}un.exports=function(e){Object.assign(e.prototype,{autoOrient:_o,rotate:Fo,flip:Mo,flop:qo,affine:Do,sharpen:Oo,erode:hn,dilate:fn,median:Uo,blur:zo,flatten:Ho,unflatten:Go,gamma:Wo,negate:Xo,normalise:Vo,normalize:Qo,clahe:Jo,convolve:Ko,threshold:Yo,boolean:Zo,linear:el,recomb:rl,modulate:tl})}});var yn=E((fh,wn)=>{"use strict";var Wr=Object.defineProperty,il=Object.getOwnPropertyDescriptor,nl=Object.getOwnPropertyNames,al=Object.prototype.hasOwnProperty,sl=(e,r)=>{for(var t in r)Wr(e,t,{get:r[t],enumerable:!0})},ol=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of nl(r))!al.call(e,n)&&n!==t&&Wr(e,n,{get:()=>r[n],enumerable:!(i=il(r,n))||i.enumerable});return e},ll=e=>ol(Wr({},"__esModule",{value:!0}),e),mn={};sl(mn,{default:()=>Pl});wn.exports=ll(mn);var te={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]},gn=Object.create(null);for(let e in te)Object.hasOwn(te,e)&&(gn[te[e]]=e);var q={to:{},get:{}};q.get=function(e){let r=e.slice(0,3).toLowerCase(),t,i;switch(r){case"hsl":{t=q.get.hsl(e),i="hsl";break}case"hwb":{t=q.get.hwb(e),i="hwb";break}default:{t=q.get.rgb(e),i="rgb";break}}return t?{model:i,value:t}:null};q.get.rgb=function(e){if(!e)return null;let r=/^#([a-f\d]{3,4})$/i,t=/^#([a-f\d]{6})([a-f\d]{2})?$/i,i=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,n=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,a=/^(\w+)$/,o=[0,0,0,1],l,h,u;if(l=e.match(t)){for(u=l[2],l=l[1],h=0;h<3;h++){let b=h*2;o[h]=Number.parseInt(l.slice(b,b+2),16)}u&&(o[3]=Number.parseInt(u,16)/255)}else if(l=e.match(r)){for(l=l[1],u=l[3],h=0;h<3;h++)o[h]=Number.parseInt(l[h]+l[h],16);u&&(o[3]=Number.parseInt(u+u,16)/255)}else if(l=e.match(i)){for(h=0;h<3;h++)o[h]=Number.parseInt(l[h+1],10);l[4]&&(o[3]=l[5]?Number.parseFloat(l[4])*.01:Number.parseFloat(l[4]))}else if(l=e.match(n)){for(h=0;h<3;h++)o[h]=Math.round(Number.parseFloat(l[h+1])*2.55);l[4]&&(o[3]=l[5]?Number.parseFloat(l[4])*.01:Number.parseFloat(l[4]))}else return(l=e.match(a))?l[1]==="transparent"?[0,0,0,0]:Object.hasOwn(te,l[1])?(o=te[l[1]],o[3]=1,o):null:null;for(h=0;h<3;h++)o[h]=de(o[h],0,255);return o[3]=de(o[3],0,1),o};q.get.hsl=function(e){if(!e)return null;let 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){let i=Number.parseFloat(t[4]),n=(Number.parseFloat(t[1])%360+360)%360,a=de(Number.parseFloat(t[2]),0,100),o=de(Number.parseFloat(t[3]),0,100),l=de(Number.isNaN(i)?1:i,0,1);return[n,a,o,l]}return null};q.get.hwb=function(e){if(!e)return null;let r=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,t=e.match(r);if(t){let i=Number.parseFloat(t[4]),n=(Number.parseFloat(t[1])%360+360)%360,a=de(Number.parseFloat(t[2]),0,100),o=de(Number.parseFloat(t[3]),0,100),l=de(Number.isNaN(i)?1:i,0,1);return[n,a,o,l]}return null};q.to.hex=function(...e){return"#"+gr(e[0])+gr(e[1])+gr(e[2])+(e[3]<1?gr(Math.round(e[3]*255)):"")};q.to.rgb=function(...e){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]+")"};q.to.rgb.percent=function(...e){let 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]+")"};q.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};q.to.hwb=function(...e){let r="";return e.length>=4&&e[3]!==1&&(r=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+r+")"};q.to.keyword=function(...e){return gn[e.slice(0,3)]};function de(e,r,t){return Math.min(Math.max(r,e),t)}function gr(e){let r=Math.round(e).toString(16).toUpperCase();return r.length<2?"0"+r:r}var je=q,pn={};for(let e of Object.keys(te))pn[te[e]]=e;var d={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"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},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"]}},Ee=d,oe=(6/29)**3;function Ne(e){let r=e>.0031308?1.055*e**.4166666666666667-.055:e*12.92;return Math.min(Math.max(0,r),1)}function Ce(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(d)){if(!("channels"in d[e]))throw new Error("missing channels property: "+e);if(!("labels"in d[e]))throw new Error("missing channel labels property: "+e);if(d[e].labels.length!==d[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:r,labels:t}=d[e];delete d[e].channels,delete d[e].labels,Object.defineProperty(d[e],"channels",{value:r}),Object.defineProperty(d[e],"labels",{value:t})}d.rgb.hsl=function(e){let r=e[0]/255,t=e[1]/255,i=e[2]/255,n=Math.min(r,t,i),a=Math.max(r,t,i),o=a-n,l,h;switch(a){case n:{l=0;break}case r:{l=(t-i)/o;break}case t:{l=2+(i-r)/o;break}case i:{l=4+(r-t)/o;break}}l=Math.min(l*60,360),l<0&&(l+=360);let u=(n+a)/2;return a===n?h=0:u<=.5?h=o/(a+n):h=o/(2-a-n),[l,h*100,u*100]};d.rgb.hsv=function(e){let r,t,i,n,a,o=e[0]/255,l=e[1]/255,h=e[2]/255,u=Math.max(o,l,h),b=u-Math.min(o,l,h),w=function(S){return(u-S)/6/b+1/2};if(b===0)n=0,a=0;else{switch(a=b/u,r=w(o),t=w(l),i=w(h),u){case o:{n=i-t;break}case l:{n=1/3+r-i;break}case h:{n=2/3+t-r;break}}n<0?n+=1:n>1&&(n-=1)}return[n*360,a*100,u*100]};d.rgb.hwb=function(e){let r=e[0],t=e[1],i=e[2],n=d.rgb.hsl(e)[0],a=1/255*Math.min(r,Math.min(t,i));return i=1-1/255*Math.max(r,Math.max(t,i)),[n,a*100,i*100]};d.rgb.oklab=function(e){let r=Ce(e[0]/255),t=Ce(e[1]/255),i=Ce(e[2]/255),n=Math.cbrt(.4122214708*r+.5363325363*t+.0514459929*i),a=Math.cbrt(.2119034982*r+.6806995451*t+.1073969566*i),o=Math.cbrt(.0883024619*r+.2817188376*t+.6299787005*i),l=.2104542553*n+.793617785*a-.0040720468*o,h=1.9779984951*n-2.428592205*a+.4505937099*o,u=.0259040371*n+.7827717662*a-.808675766*o;return[l*100,h*100,u*100]};d.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),a=(1-r-n)/(1-n)||0,o=(1-t-n)/(1-n)||0,l=(1-i-n)/(1-n)||0;return[a*100,o*100,l*100,n*100]};function cl(e,r){return(e[0]-r[0])**2+(e[1]-r[1])**2+(e[2]-r[2])**2}d.rgb.keyword=function(e){let r=pn[e];if(r)return r;let t=Number.POSITIVE_INFINITY,i;for(let n of Object.keys(te)){let a=te[n],o=cl(e,a);o<t&&(t=o,i=n)}return i};d.keyword.rgb=function(e){return te[e]};d.rgb.xyz=function(e){let r=Ce(e[0]/255),t=Ce(e[1]/255),i=Ce(e[2]/255),n=r*.4124564+t*.3575761+i*.1804375,a=r*.2126729+t*.7151522+i*.072175,o=r*.0193339+t*.119192+i*.9503041;return[n*100,a*100,o*100]};d.rgb.lab=function(e){let r=d.rgb.xyz(e),t=r[0],i=r[1],n=r[2];t/=95.047,i/=100,n/=108.883,t=t>oe?t**(1/3):7.787*t+16/116,i=i>oe?i**(1/3):7.787*i+16/116,n=n>oe?n**(1/3):7.787*n+16/116;let a=116*i-16,o=500*(t-i),l=200*(i-n);return[a,o,l]};d.hsl.rgb=function(e){let r=e[0]/360,t=e[1]/100,i=e[2]/100,n,a;if(t===0)return a=i*255,[a,a,a];let o=i<.5?i*(1+t):i+t-i*t,l=2*i-o,h=[0,0,0];for(let u=0;u<3;u++)n=r+1/3*-(u-1),n<0&&n++,n>1&&n--,6*n<1?a=l+(o-l)*6*n:2*n<1?a=o:3*n<2?a=l+(o-l)*(2/3-n)*6:a=l,h[u]=a*255;return h};d.hsl.hsv=function(e){let r=e[0],t=e[1]/100,i=e[2]/100,n=t,a=Math.max(i,.01);i*=2,t*=i<=1?i:2-i,n*=a<=1?a:2-a;let o=(i+t)/2,l=i===0?2*n/(a+n):2*t/(i+t);return[r,l*100,o*100]};d.hsv.rgb=function(e){let r=e[0]/60,t=e[1]/100,i=e[2]/100,n=Math.floor(r)%6,a=r-Math.floor(r),o=255*i*(1-t),l=255*i*(1-t*a),h=255*i*(1-t*(1-a));switch(i*=255,n){case 0:return[i,h,o];case 1:return[l,i,o];case 2:return[o,i,h];case 3:return[o,l,i];case 4:return[h,o,i];case 5:return[i,o,l]}};d.hsv.hsl=function(e){let r=e[0],t=e[1]/100,i=e[2]/100,n=Math.max(i,.01),a,o;o=(2-t)*i;let l=(2-t)*n;return a=t*n,a/=l<=1?l:2-l,a=a||0,o/=2,[r,a*100,o*100]};d.hwb.rgb=function(e){let r=e[0]/360,t=e[1]/100,i=e[2]/100,n=t+i,a;n>1&&(t/=n,i/=n);let o=Math.floor(6*r),l=1-i;a=6*r-o,(o&1)!==0&&(a=1-a);let h=t+a*(l-t),u,b,w;switch(o){default:case 6:case 0:{u=l,b=h,w=t;break}case 1:{u=h,b=l,w=t;break}case 2:{u=t,b=l,w=h;break}case 3:{u=t,b=h,w=l;break}case 4:{u=h,b=t,w=l;break}case 5:{u=l,b=t,w=h;break}}return[u*255,b*255,w*255]};d.cmyk.rgb=function(e){let r=e[0]/100,t=e[1]/100,i=e[2]/100,n=e[3]/100,a=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[a*255,o*255,l*255]};d.xyz.rgb=function(e){let r=e[0]/100,t=e[1]/100,i=e[2]/100,n,a,o;return n=r*3.2404542+t*-1.5371385+i*-.4985314,a=r*-.969266+t*1.8760108+i*.041556,o=r*.0556434+t*-.2040259+i*1.0572252,n=Ne(n),a=Ne(a),o=Ne(o),[n*255,a*255,o*255]};d.xyz.lab=function(e){let r=e[0],t=e[1],i=e[2];r/=95.047,t/=100,i/=108.883,r=r>oe?r**(1/3):7.787*r+16/116,t=t>oe?t**(1/3):7.787*t+16/116,i=i>oe?i**(1/3):7.787*i+16/116;let n=116*t-16,a=500*(r-t),o=200*(t-i);return[n,a,o]};d.xyz.oklab=function(e){let r=e[0]/100,t=e[1]/100,i=e[2]/100,n=Math.cbrt(.8189330101*r+.3618667424*t-.1288597137*i),a=Math.cbrt(.0329845436*r+.9293118715*t+.0361456387*i),o=Math.cbrt(.0482003018*r+.2643662691*t+.633851707*i),l=.2104542553*n+.793617785*a-.0040720468*o,h=1.9779984951*n-2.428592205*a+.4505937099*o,u=.0259040371*n+.7827717662*a-.808675766*o;return[l*100,h*100,u*100]};d.oklab.oklch=function(e){return d.lab.lch(e)};d.oklab.xyz=function(e){let r=e[0]/100,t=e[1]/100,i=e[2]/100,n=(.999999998*r+.396337792*t+.215803758*i)**3,a=(1.000000008*r-.105561342*t-.063854175*i)**3,o=(1.000000055*r-.089484182*t-1.291485538*i)**3,l=1.227013851*n-.55779998*a+.281256149*o,h=-.040580178*n+1.11225687*a-.071676679*o,u=-.076381285*n-.421481978*a+1.58616322*o;return[l*100,h*100,u*100]};d.oklab.rgb=function(e){let r=e[0]/100,t=e[1]/100,i=e[2]/100,n=(r+.3963377774*t+.2158037573*i)**3,a=(r-.1055613458*t-.0638541728*i)**3,o=(r-.0894841775*t-1.291485548*i)**3,l=Ne(4.0767416621*n-3.3077115913*a+.2309699292*o),h=Ne(-1.2684380046*n+2.6097574011*a-.3413193965*o),u=Ne(-.0041960863*n-.7034186147*a+1.707614701*o);return[l*255,h*255,u*255]};d.oklch.oklab=function(e){return d.lch.lab(e)};d.lab.xyz=function(e){let r=e[0],t=e[1],i=e[2],n,a,o;a=(r+16)/116,n=t/500+a,o=a-i/200;let l=a**3,h=n**3,u=o**3;return a=l>oe?l:(a-16/116)/7.787,n=h>oe?h:(n-16/116)/7.787,o=u>oe?u:(o-16/116)/7.787,n*=95.047,a*=100,o*=108.883,[n,a,o]};d.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]};d.lch.lab=function(e){let r=e[0],t=e[1],n=e[2]/360*2*Math.PI,a=t*Math.cos(n),o=t*Math.sin(n);return[r,a,o]};d.rgb.ansi16=function(e,r=null){let[t,i,n]=e,a=r===null?d.rgb.hsv(e)[2]:r;if(a=Math.round(a/50),a===0)return 30;let o=30+(Math.round(n/255)<<2|Math.round(i/255)<<1|Math.round(t/255));return a===2&&(o+=60),o};d.hsv.ansi16=function(e){return d.rgb.ansi16(d.hsv.rgb(e),e[2])};d.rgb.ansi256=function(e){let r=e[0],t=e[1],i=e[2];return r>>4===t>>4&&t>>4===i>>4?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)};d.ansi16.rgb=function(e){e=e[0];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=(Math.trunc(e>50)+1)*.5,i=(r&1)*t*255,n=(r>>1&1)*t*255,a=(r>>2&1)*t*255;return[i,n,a]};d.ansi256.rgb=function(e){if(e=e[0],e>=232){let a=(e-232)*10+8;return[a,a,a]}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]};d.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".slice(t.length)+t};d.hex.rgb=function(e){let r=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!r)return[0,0,0];let t=r[0];r[0].length===3&&(t=[...t].map(l=>l+l).join(""));let i=Number.parseInt(t,16),n=i>>16&255,a=i>>8&255,o=i&255;return[n,a,o]};d.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),a=Math.min(Math.min(r,t),i),o=n-a,l,h=o<1?a/(1-o):0;return o<=0?l=0:n===r?l=(t-i)/o%6:n===t?l=2+(i-r)/o:l=4+(r-t)/o,l/=6,l%=1,[l*360,o*100,h*100]};d.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]};d.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]};d.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],a=r%1*6,o=a%1,l=1-o,h=0;switch(Math.floor(a)){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 h=(1-t)*i,[(t*n[0]+h)*255,(t*n[1]+h)*255,(t*n[2]+h)*255]};d.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]};d.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]};d.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]};d.hwb.hcg=function(e){let r=e[1]/100,i=1-e[2]/100,n=i-r,a=0;return n<1&&(a=(i-n)/(1-n)),[e[0],n*100,a*100]};d.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};d.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};d.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};d.gray.hsl=function(e){return[0,0,e[0]]};d.gray.hsv=d.gray.hsl;d.gray.hwb=function(e){return[0,100,e[0]]};d.gray.cmyk=function(e){return[0,0,0,e[0]]};d.gray.lab=function(e){return[e[0],0,0]};d.gray.hex=function(e){let r=Math.round(e[0]/100*255)&255,i=((r<<16)+(r<<8)+r).toString(16).toUpperCase();return"000000".slice(i.length)+i};d.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function fl(){let e={},r=Object.keys(Ee);for(let{length:t}=r,i=0;i<t;i++)e[r[i]]={distance:-1,parent:null};return e}function hl(e){let r=fl(),t=[e];for(r[e].distance=0;t.length>0;){let i=t.pop(),n=Object.keys(Ee[i]);for(let{length:a}=n,o=0;o<a;o++){let l=n[o],h=r[l];h.distance===-1&&(h.distance=r[i].distance+1,h.parent=i,t.unshift(l))}}return r}function ul(e,r){return function(t){return r(e(t))}}function dl(e,r){let t=[r[e].parent,e],i=Ee[r[e].parent][e],n=r[e].parent;for(;r[n].parent;)t.unshift(r[n].parent),i=ul(Ee[r[n].parent][n],i),n=r[n].parent;return i.conversion=t,i}function ml(e){let r=hl(e),t={},i=Object.keys(r);for(let{length:n}=i,a=0;a<n;a++){let o=i[a];r[o].parent!==null&&(t[o]=dl(o,r))}return t}var gl=ml,Te={},pl=Object.keys(Ee);function bl(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 wl(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{length:a}=n,o=0;o<a;o++)n[o]=Math.round(n[o]);return n};return"conversion"in e&&(r.conversion=e.conversion),r}for(let e of pl){Te[e]={},Object.defineProperty(Te[e],"channels",{value:Ee[e].channels}),Object.defineProperty(Te[e],"labels",{value:Ee[e].labels});let r=gl(e),t=Object.keys(r);for(let i of t){let n=r[i];Te[e][i]=wl(n),Te[e][i].raw=bl(n)}}var U=Te,bn=["keyword","gray","hex"],Hr={};for(let e of Object.keys(U))Hr[[...U[e].labels].sort().join("")]=e;var Ge={};function $(e,r){if(!(this instanceof $))return new $(e,r);if(r&&r in bn&&(r=null),r&&!(r in U))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 $)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){let n=je.get(e);if(n===null)throw new Error("Unable to parse color from string: "+e);this.model=n.model,i=U[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=U[this.model].channels;let n=Array.prototype.slice.call(e,0,i);this.color=Gr(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 a=n.sort().join("");if(!(a in Hr))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Hr[a];let{labels:o}=U[this.model],l=[];for(t=0;t<o.length;t++)l.push(e[o[t]]);this.color=Gr(l)}if(Ge[this.model])for(i=U[this.model].channels,t=0;t<i;t++){let n=Ge[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)}$.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let r=this.model in je.to?this:this.rgb();r=r.round(typeof e=="number"?e:1);let t=r.valpha===1?r.color:[...r.color,this.valpha];return je.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 je.to.rgb.percent(...t)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:r}=U[this.model],{labels:t}=U[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 $([...this.color.map(El(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new $([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:I("rgb",0,k(255)),green:I("rgb",1,k(255)),blue:I("rgb",2,k(255)),hue:I(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:I("hsl",1,k(100)),lightness:I("hsl",2,k(100)),saturationv:I("hsv",1,k(100)),value:I("hsv",2,k(100)),chroma:I("hcg",1,k(100)),gray:I("hcg",2,k(100)),white:I("hwb",1,k(100)),wblack:I("hwb",2,k(100)),cyan:I("cmyk",0,k(100)),magenta:I("cmyk",1,k(100)),yellow:I("cmyk",2,k(100)),black:I("cmyk",3,k(100)),x:I("xyz",0,k(95.047)),y:I("xyz",1,k(100)),z:I("xyz",2,k(108.833)),l:I("lab",0,k(100)),a:I("lab",1),b:I("lab",2),keyword(e){return e!==void 0?new $(e):U[this.model].keyword(this.color)},hex(e){return e!==void 0?new $(e):je.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new $(e);let r=this.rgb().round().color,t=Math.round(this.valpha*255).toString(16).toUpperCase();return t.length===1&&(t="0"+t),je.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 $.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,a=2*n-1,o=t.alpha()-i.alpha(),l=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,h=1-l;return $.rgb(l*t.red()+h*i.red(),l*t.green()+h*i.green(),l*t.blue()+h*i.blue(),t.alpha()*n+i.alpha()*(1-n))}};for(let e of Object.keys(U)){if(bn.includes(e))continue;let{channels:r}=U[e];$.prototype[e]=function(...t){return this.model===e?new $(this):t.length>0?new $(t,e):new $([...vl(U[this.model][e].raw(this.color)),this.valpha],e)},$[e]=function(...t){let i=t[0];return typeof i=="number"&&(i=Gr(t,r)),new $(i,e)}}function yl(e,r){return Number(e.toFixed(r))}function El(e){return function(r){return yl(r,e)}}function I(e,r,t){e=Array.isArray(e)?e:[e];for(let i of e)(Ge[i]||(Ge[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 k(e){return function(r){return Math.max(0,Math.min(e,r))}}function vl(e){return Array.isArray(e)?e:[e]}function Gr(e,r){for(let t=0;t<r;t++)typeof e[t]!="number"&&(e[t]=0);return e}var Pl=$});var vn=E((hh,En)=>{"use strict";En.exports=yn().default});var In=E((uh,Rn)=>{"use strict";var xl=vn(),le=K(),Pn={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"};function Rl(e){return this._setBackgroundColourOption("tint",e),this}function Il(e){return this.options.greyscale=le.bool(e)?e:!0,this}function Sl(e){return this.greyscale(e)}function Al(e){if(!le.string(e))throw le.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function kl(e){return this.pipelineColourspace(e)}function Ll(e){if(!le.string(e))throw le.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function $l(e){return this.toColourspace(e)}function xn(e){if(le.object(e)||le.string(e)){let r=xl(e);return[r.red(),r.green(),r.blue(),Math.round(r.alpha()*255)]}else throw le.invalidParameterError("background","object or string",e)}function jl(e,r){le.defined(r)&&(this.options[e]=xn(r))}Rn.exports=function(e){Object.assign(e.prototype,{tint:Rl,greyscale:Il,grayscale:Sl,pipelineColourspace:Al,pipelineColorspace:kl,toColourspace:Ll,toColorspace:$l,_getBackgroundColourOption:xn,_setBackgroundColourOption:jl}),e.colourspace=Pn,e.colorspace=Pn}});var An=E((dh,Sn)=>{"use strict";var ie=K(),Tl={and:"and",or:"or",eor:"eor"};function Nl(){return this.options.removeAlpha=!0,this}function Cl(e){if(ie.defined(e))if(ie.number(e)&&ie.inRange(e,0,1))this.options.ensureAlpha=e;else throw ie.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function Bl(e){let r={red:0,green:1,blue:2,alpha:3};if(Object.keys(r).includes(e)&&(e=r[e]),ie.integer(e)&&ie.inRange(e,0,4))this.options.extractChannel=e;else throw ie.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function Fl(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 _l(e){if(ie.string(e)&&ie.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw ie.invalidParameterError("boolOp","one of: and, or, eor",e);return this}Sn.exports=function(e){Object.assign(e.prototype,{removeAlpha:Nl,ensureAlpha:Cl,extractChannel:Bl,joinChannel:Fl,bandbool:_l}),e.bool=Tl}});var Tn=E((mh,jn)=>{"use strict";var Xr=R("path"),s=K(),Be=He(),kn=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"]]),Ml=/\.(jp[2x]|j2[kc])$/i,Ln=()=>new Error("JP2 output requires libvips with support for OpenJPEG"),$n=e=>1<<31-Math.clz32(Math.ceil(Math.log2(e)));function ql(e,r){let t;if(s.string(e)?s.string(this.options.input.file)&&Xr.resolve(this.options.input.file)===Xr.resolve(e)?t=new Error("Cannot use same file for input and output"):Ml.test(Xr.extname(e))&&!this.constructor.format.jp2k.output.file&&(t=Ln()):t=new Error("Missing output file path"),t)if(s.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 Dl(e,r){s.object(e)?this._setBooleanOption("resolveWithObject",e.resolveWithObject):this.options.resolveWithObject&&(this.options.resolveWithObject=!1),this.options.fileOut="";let t=Error();return this._pipeline(s.fn(e)?e:r,t)}function Ol(){return this.options.keepMetadata|=1,this}function Ul(e){if(s.object(e))for(let[r,t]of Object.entries(e))if(s.object(t))for(let[i,n]of Object.entries(t))if(s.string(n))this.options.withExif[`exif-${r.toLowerCase()}-${i}`]=n;else throw s.invalidParameterError(`${r}.${i}`,"string",n);else throw s.invalidParameterError(r,"object",t);else throw s.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function zl(e){return this.withExif(e),this.options.withExifMerge=!0,this}function Hl(){return this.options.keepMetadata|=8,this}function Gl(e,r){if(s.string(e))this.options.withIccProfile=e;else throw s.invalidParameterError("icc","string",e);if(this.keepIccProfile(),s.object(r)&&s.defined(r.attach))if(s.bool(r.attach))r.attach||(this.options.keepMetadata&=-9);else throw s.invalidParameterError("attach","boolean",r.attach);return this}function Wl(){return this.options.keepMetadata|=2,this}function Xl(e){if(s.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw s.invalidParameterError("xmp","non-empty string",e);return this}function Vl(){return this.options.keepMetadata=31,this}function Ql(e){if(this.keepMetadata(),this.withIccProfile("srgb"),s.object(e)){if(s.defined(e.orientation))if(s.integer(e.orientation)&&s.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw s.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(s.defined(e.density))if(s.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw s.invalidParameterError("density","positive number",e.density);s.defined(e.icc)&&this.withIccProfile(e.icc),s.defined(e.exif)&&this.withExifMerge(e.exif)}return this}function Jl(e,r){let t=kn.get((s.object(e)&&s.string(e.id)?e.id:e).toLowerCase());if(!t)throw s.invalidParameterError("format",`one of: ${[...kn.keys()].join(", ")}`,e);return this[t](r)}function Kl(e){if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.progressive)&&this._setBooleanOption("jpegProgressive",e.progressive),s.defined(e.chromaSubsampling))if(s.string(e.chromaSubsampling)&&s.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw s.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let r=s.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(s.defined(r)&&this._setBooleanOption("jpegOptimiseCoding",r),s.defined(e.mozjpeg))if(s.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 s.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let t=s.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;s.defined(t)&&this._setBooleanOption("jpegTrellisQuantisation",t),s.defined(e.overshootDeringing)&&this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let i=s.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;s.defined(i)&&(this._setBooleanOption("jpegOptimiseScans",i),i&&(this.options.jpegProgressive=!0));let n=s.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(s.defined(n))if(s.integer(n)&&s.inRange(n,0,8))this.options.jpegQuantisationTable=n;else throw s.invalidParameterError("quantisationTable","integer between 0 and 8",n)}return this._updateFormatOut("jpeg",e)}function Yl(e){if(s.object(e)){if(s.defined(e.progressive)&&this._setBooleanOption("pngProgressive",e.progressive),s.defined(e.compressionLevel))if(s.integer(e.compressionLevel)&&s.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw s.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);s.defined(e.adaptiveFiltering)&&this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let r=e.colours||e.colors;if(s.defined(r))if(s.integer(r)&&s.inRange(r,2,256))this.options.pngBitdepth=$n(r);else throw s.invalidParameterError("colours","integer between 2 and 256",r);if(s.defined(e.palette)?this._setBooleanOption("pngPalette",e.palette):[e.quality,e.effort,e.colours,e.colors,e.dither].some(s.defined)&&this._setBooleanOption("pngPalette",!0),this.options.pngPalette){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw s.invalidParameterError("quality","integer between 0 and 100",e.quality);if(s.defined(e.effort))if(s.integer(e.effort)&&s.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw s.invalidParameterError("effort","integer between 1 and 10",e.effort);if(s.defined(e.dither))if(s.number(e.dither)&&s.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw s.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function Zl(e){if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.alphaQuality))if(s.integer(e.alphaQuality)&&s.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw s.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(s.defined(e.lossless)&&this._setBooleanOption("webpLossless",e.lossless),s.defined(e.nearLossless)&&this._setBooleanOption("webpNearLossless",e.nearLossless),s.defined(e.smartSubsample)&&this._setBooleanOption("webpSmartSubsample",e.smartSubsample),s.defined(e.smartDeblock)&&this._setBooleanOption("webpSmartDeblock",e.smartDeblock),s.defined(e.preset))if(s.string(e.preset)&&s.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw s.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(s.defined(e.effort))if(s.integer(e.effort)&&s.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw s.invalidParameterError("effort","integer between 0 and 6",e.effort);s.defined(e.minSize)&&this._setBooleanOption("webpMinSize",e.minSize),s.defined(e.mixed)&&this._setBooleanOption("webpMixed",e.mixed)}return Vr(e,this.options),this._updateFormatOut("webp",e)}function ec(e){if(s.object(e)){s.defined(e.reuse)&&this._setBooleanOption("gifReuse",e.reuse),s.defined(e.progressive)&&this._setBooleanOption("gifProgressive",e.progressive);let r=e.colours||e.colors;if(s.defined(r))if(s.integer(r)&&s.inRange(r,2,256))this.options.gifBitdepth=$n(r);else throw s.invalidParameterError("colours","integer between 2 and 256",r);if(s.defined(e.effort))if(s.number(e.effort)&&s.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw s.invalidParameterError("effort","integer between 1 and 10",e.effort);if(s.defined(e.dither))if(s.number(e.dither)&&s.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw s.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(s.defined(e.interFrameMaxError))if(s.number(e.interFrameMaxError)&&s.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw s.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(s.defined(e.interPaletteMaxError))if(s.number(e.interPaletteMaxError)&&s.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw s.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(s.defined(e.keepDuplicateFrames))if(s.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw s.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return Vr(e,this.options),this._updateFormatOut("gif",e)}function rc(e){if(!this.constructor.format.jp2k.output.buffer)throw Ln();if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.lossless))if(s.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw s.invalidParameterError("lossless","boolean",e.lossless);if(s.defined(e.tileWidth))if(s.integer(e.tileWidth)&&s.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw s.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(s.defined(e.tileHeight))if(s.integer(e.tileHeight)&&s.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw s.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(s.defined(e.chromaSubsampling))if(s.string(e.chromaSubsampling)&&s.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw s.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function Vr(e,r){if(s.object(e)&&s.defined(e.loop))if(s.integer(e.loop)&&s.inRange(e.loop,0,65535))r.loop=e.loop;else throw s.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(s.object(e)&&s.defined(e.delay))if(s.integer(e.delay)&&s.inRange(e.delay,0,65535))r.delay=[e.delay];else if(Array.isArray(e.delay)&&e.delay.every(s.integer)&&e.delay.every(t=>s.inRange(t,0,65535)))r.delay=e.delay;else throw s.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function tc(e){if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.bitdepth))if(s.integer(e.bitdepth)&&s.inArray(e.bitdepth,[1,2,4,8]))this.options.tiffBitdepth=e.bitdepth;else throw s.invalidParameterError("bitdepth","1, 2, 4 or 8",e.bitdepth);if(s.defined(e.tile)&&this._setBooleanOption("tiffTile",e.tile),s.defined(e.tileWidth))if(s.integer(e.tileWidth)&&e.tileWidth>0)this.options.tiffTileWidth=e.tileWidth;else throw s.invalidParameterError("tileWidth","integer greater than zero",e.tileWidth);if(s.defined(e.tileHeight))if(s.integer(e.tileHeight)&&e.tileHeight>0)this.options.tiffTileHeight=e.tileHeight;else throw s.invalidParameterError("tileHeight","integer greater than zero",e.tileHeight);if(s.defined(e.miniswhite)&&this._setBooleanOption("tiffMiniswhite",e.miniswhite),s.defined(e.pyramid)&&this._setBooleanOption("tiffPyramid",e.pyramid),s.defined(e.xres))if(s.number(e.xres)&&e.xres>0)this.options.tiffXres=e.xres;else throw s.invalidParameterError("xres","number greater than zero",e.xres);if(s.defined(e.yres))if(s.number(e.yres)&&e.yres>0)this.options.tiffYres=e.yres;else throw s.invalidParameterError("yres","number greater than zero",e.yres);if(s.defined(e.compression))if(s.string(e.compression)&&s.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw s.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(s.defined(e.predictor))if(s.string(e.predictor)&&s.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw s.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(s.defined(e.resolutionUnit))if(s.string(e.resolutionUnit)&&s.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw s.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function ic(e){return this.heif({...e,compression:"av1"})}function nc(e){if(s.object(e)){if(s.string(e.compression)&&s.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw s.invalidParameterError("compression","one of: av1, hevc",e.compression);if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.lossless))if(s.bool(e.lossless))this.options.heifLossless=e.lossless;else throw s.invalidParameterError("lossless","boolean",e.lossless);if(s.defined(e.effort))if(s.integer(e.effort)&&s.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw s.invalidParameterError("effort","integer between 0 and 9",e.effort);if(s.defined(e.chromaSubsampling))if(s.string(e.chromaSubsampling)&&s.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw s.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(s.defined(e.bitdepth))if(s.integer(e.bitdepth)&&s.inArray(e.bitdepth,[8,10,12])){if(e.bitdepth!==8&&this.constructor.versions.heif)throw s.invalidParameterError("bitdepth when using prebuilt binaries",8,e.bitdepth);this.options.heifBitdepth=e.bitdepth}else throw s.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth)}else throw s.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function ac(e){if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.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 s.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(s.defined(e.distance))if(s.number(e.distance)&&s.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw s.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(s.defined(e.decodingTier))if(s.integer(e.decodingTier)&&s.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw s.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(s.defined(e.lossless))if(s.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw s.invalidParameterError("lossless","boolean",e.lossless);if(s.defined(e.effort))if(s.integer(e.effort)&&s.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw s.invalidParameterError("effort","integer between 1 and 9",e.effort)}return Vr(e,this.options),this._updateFormatOut("jxl",e)}function sc(e){if(s.object(e)&&s.defined(e.depth))if(s.string(e.depth)&&s.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw s.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth);return this._updateFormatOut("raw")}function oc(e){if(s.object(e)){if(s.defined(e.size))if(s.integer(e.size)&&s.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw s.invalidParameterError("size","integer between 1 and 8192",e.size);if(s.defined(e.overlap))if(s.integer(e.overlap)&&s.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw s.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw s.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(s.defined(e.container))if(s.string(e.container)&&s.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw s.invalidParameterError("container","one of: fs, zip",e.container);if(s.defined(e.layout))if(s.string(e.layout)&&s.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw s.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(s.defined(e.angle))if(s.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw s.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),s.defined(e.depth))if(s.string(e.depth)&&s.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw s.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(s.defined(e.skipBlanks))if(s.integer(e.skipBlanks)&&s.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw s.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else s.defined(e.layout)&&e.layout==="google"&&(this.options.tileSkipBlanks=5);let r=s.bool(e.center)?e.center:e.centre;if(s.defined(r)&&this._setBooleanOption("tileCentre",r),s.defined(e.id))if(s.string(e.id))this.options.tileId=e.id;else throw s.invalidParameterError("id","string",e.id);if(s.defined(e.basename))if(s.string(e.basename))this.options.tileBasename=e.basename;else throw s.invalidParameterError("basename","string",e.basename)}if(s.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw s.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function lc(e){if(!s.plainObject(e))throw s.invalidParameterError("options","object",e);if(s.integer(e.seconds)&&s.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw s.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function cc(e,r){return s.object(r)&&r.force===!1||(this.options.formatOut=e),this}function fc(e,r){if(s.bool(r))this.options[e]=r;else throw s.invalidParameterError(e,"boolean",r)}function hc(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function uc(e,r){return typeof e=="function"?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),Be.pipeline(this.options,(t,i,n)=>{t?e(s.nativeError(t,r)):e(null,i,n)})}):Be.pipeline(this.options,(t,i,n)=>{t?e(s.nativeError(t,r)):e(null,i,n)}),this):this.options.streamOut?(this._isStreamInput()?(this.once("finish",()=>{this._flattenBufferIn(),Be.pipeline(this.options,(t,i,n)=>{t?this.emit("error",s.nativeError(t,r)):(this.emit("info",n),this.push(i)),this.push(null),this.on("end",()=>this.emit("close"))})}),this.streamInFinished&&this.emit("finish")):Be.pipeline(this.options,(t,i,n)=>{t?this.emit("error",s.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(),Be.pipeline(this.options,(n,a,o)=>{n?i(s.nativeError(n,r)):this.options.resolveWithObject?t({data:a,info:o}):t(a)})})}):new Promise((t,i)=>{Be.pipeline(this.options,(n,a,o)=>{n?i(s.nativeError(n,r)):this.options.resolveWithObject?t({data:a,info:o}):t(a)})})}jn.exports=function(e){Object.assign(e.prototype,{toFile:ql,toBuffer:Dl,keepExif:Ol,withExif:Ul,withExifMerge:zl,keepIccProfile:Hl,withIccProfile:Gl,keepXmp:Wl,withXmp:Xl,keepMetadata:Vl,withMetadata:Ql,toFormat:Jl,jpeg:Kl,jp2:rc,png:Yl,webp:Zl,tiff:tc,avif:ic,heif:nc,jxl:ac,gif:ec,raw:sc,tile:oc,timeout:lc,_updateFormatOut:cc,_setBooleanOption:fc,_read:hc,_pipeline:uc})}});var Fn=E((gh,Bn)=>{"use strict";var dc=R("events"),pr=ir(),X=K(),{runtimePlatformArch:mc}=Mr(),B=He(),Nn=mc(),Qr=B.libvipsVersion(),me=B.format();me.heif.output.alias=["avif","heic"];me.jpeg.output.alias=["jpe","jpg"];me.tiff.output.alias=["tif"];me.jp2k.output.alias=["j2c","j2k","jp2","jpx"];var gc={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},Fe={vips:Qr.semver};if(!Qr.isGlobal)if(Qr.isWasm)try{Fe=R("@img/sharp-wasm32/versions")}catch{}else try{Fe=R(`@img/sharp-${Nn}/versions`)}catch{try{Fe=R(`@img/sharp-libvips-${Nn}/versions`)}catch{}}Fe.sharp=Fr().version;Fe.heif&&me.heif&&(me.heif.input.fileSuffix=[".avif"],me.heif.output.alias=["avif"]);function Cn(e){return X.bool(e)?e?B.cache(50,20,100):B.cache(0,0,0):X.object(e)?B.cache(e.memory,e.files,e.items):B.cache()}Cn(!0);function pc(e){return B.concurrency(X.integer(e)?e:null)}pr.familySync()===pr.GLIBC&&!B._isUsingJemalloc()?B.concurrency(1):pr.familySync()===pr.MUSL&&B.concurrency()===1024&&B.concurrency(R("os").availableParallelism());var bc=new dc.EventEmitter;function wc(){return B.counters()}function yc(e){return B.simd(X.bool(e)?e:null)}function Ec(e){if(X.object(e))if(Array.isArray(e.operation)&&e.operation.every(X.string))B.block(e.operation,!0);else throw X.invalidParameterError("operation","Array<string>",e.operation);else throw X.invalidParameterError("options","object",e)}function vc(e){if(X.object(e))if(Array.isArray(e.operation)&&e.operation.every(X.string))B.block(e.operation,!1);else throw X.invalidParameterError("operation","Array<string>",e.operation);else throw X.invalidParameterError("options","object",e)}Bn.exports=function(e){e.cache=Cn,e.concurrency=pc,e.counters=wc,e.simd=yc,e.format=me,e.interpolators=gc,e.versions=Fe,e.queue=bc,e.block=Ec,e.unblock=vc}});var Mn=E((bh,_n)=>{"use strict";var ce=Ji();Zi()(ce);sn()(ce);ln()(ce);dn()(ce);In()(ce);An()(ce);Tn()(ce);Fn()(ce);_n.exports=ce});import Yn from"http";import Zn from"https";import xe from"zlib";import bt,{PassThrough as wt,pipeline as Re}from"stream";import{Buffer as Ye}from"buffer";function Un(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,a=t[0]||"text/plain",o=a;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",h=unescape(e.substring(r+1)),u=Buffer.from(h,l);return u.type=a,u.typeFull=o,u.charset=i,u}var Zr=Un;import fe,{PassThrough as it}from"stream";import{types as nt,deprecate as vr,promisify as zn}from"util";import{Buffer as G}from"buffer";var ae=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 F=class extends ae{constructor(r,t,i){super(r,t),i&&(this.code=this.errno=i.code,this.erroredSysCall=i.syscall)}};var We=Symbol.toStringTag,yr=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[We]==="URLSearchParams",Me=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[We]),et=e=>typeof e=="object"&&(e[We]==="AbortSignal"||e[We]==="EventTarget"),rt=(e,r)=>{let t=new URL(r).hostname,i=new URL(e).hostname;return t===i||t.endsWith(`.${i}`)},tt=(e,r)=>{let t=new URL(r).protocol,i=new URL(e).protocol;return t===i};var Hn=zn(fe.pipeline),_=Symbol("Body internals"),J=class{constructor(r,{size:t=0}={}){let i=null;r===null?r=null:yr(r)?r=G.from(r.toString()):Me(r)||G.isBuffer(r)||(nt.isAnyArrayBuffer(r)?r=G.from(r):ArrayBuffer.isView(r)?r=G.from(r.buffer,r.byteOffset,r.byteLength):r instanceof fe||(r instanceof _e?(r=Yr(r),i=r.type.split("=")[1]):r=G.from(String(r))));let n=r;G.isBuffer(r)?n=fe.Readable.from(r):Me(r)&&(n=fe.Readable.from(r.stream())),this[_]={body:r,stream:n,boundary:i,disturbed:!1,error:null},this.size=t,r instanceof fe&&r.on("error",a=>{let o=a instanceof ae?a:new F(`Invalid response body while trying to fetch ${this.url}: ${a.message}`,"system",a);this[_].error=o})}get body(){return this[_].stream}get bodyUsed(){return this[_].disturbed}async arrayBuffer(){let{buffer:r,byteOffset:t,byteLength:i}=await Er(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 _e,n=new URLSearchParams(await this.text());for(let[a,o]of n)i.append(a,o);return i}let{toFormData:t}=await import("./multipart-parser-RNULNBMT.mjs");return t(this.body,r)}async blob(){let r=this.headers&&this.headers.get("content-type")||this[_].body&&this[_].body.type||"",t=await this.arrayBuffer();return new wr([t],{type:r})}async json(){let r=await this.text();return JSON.parse(r)}async text(){let r=await Er(this);return new TextDecoder().decode(r)}buffer(){return Er(this)}};J.prototype.buffer=vr(J.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(J.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:vr(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function Er(e){if(e[_].disturbed)throw new TypeError(`body used already for: ${e.url}`);if(e[_].disturbed=!0,e[_].error)throw e[_].error;let{body:r}=e;if(r===null)return G.alloc(0);if(!(r instanceof fe))return G.alloc(0);let t=[],i=0;try{for await(let n of r){if(e.size>0&&i+n.length>e.size){let a=new F(`content size at ${e.url} over limit: ${e.size}`,"max-size");throw r.destroy(a),a}i+=n.length,t.push(n)}}catch(n){throw n instanceof ae?n:new F(`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")?G.from(t.join("")):G.concat(t,i)}catch(n){throw new F(`Could not create Buffer from response body for ${e.url}: ${n.message}`,"system",n)}else throw new F(`Premature close of server response while trying to fetch ${e.url}`)}var ve=(e,r)=>{let t,i,{body:n}=e[_];if(e.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof fe&&typeof n.getBoundary!="function"&&(t=new it({highWaterMark:r}),i=new it({highWaterMark:r}),n.pipe(t),n.pipe(i),e[_].stream=t,n=i),n},Gn=vr(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"),Xe=(e,r)=>e===null?null:typeof e=="string"?"text/plain;charset=UTF-8":yr(e)?"application/x-www-form-urlencoded;charset=UTF-8":Me(e)?e.type||null:G.isBuffer(e)||nt.isAnyArrayBuffer(e)||ArrayBuffer.isView(e)?null:e instanceof _e?`multipart/form-data; boundary=${r[_].boundary}`:e&&typeof e.getBoundary=="function"?`multipart/form-data;boundary=${Gn(e)}`:e instanceof fe?null:"text/plain;charset=UTF-8",at=e=>{let{body:r}=e[_];return r===null?0:Me(r)?r.size:G.isBuffer(r)?r.length:r&&typeof r.getLengthSync=="function"&&r.hasKnownLength&&r.hasKnownLength()?r.getLengthSync():null},st=async(e,{body:r})=>{r===null?e.end():await Hn(r,e)};import{types as ot}from"util";import Qe from"http";var Ve=typeof Qe.validateHeaderName=="function"?Qe.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}},Pr=typeof Qe.validateHeaderValue=="function"?Qe.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}},O=class e extends URLSearchParams{constructor(r){let t=[];if(r instanceof e){let i=r.raw();for(let[n,a]of Object.entries(i))t.push(...a.map(o=>[n,o]))}else if(r!=null)if(typeof r=="object"&&!ot.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"||ot.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])=>(Ve(i),Pr(i,String(n)),[String(i).toLowerCase(),String(n)])):void 0,super(t),new Proxy(this,{get(i,n,a){switch(n){case"append":case"set":return(o,l)=>(Ve(o),Pr(o,String(l)),URLSearchParams.prototype[n].call(i,String(o).toLowerCase(),String(l)));case"delete":case"has":case"getAll":return o=>(Ve(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,a)}}})}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(O.prototype,["get","entries","forEach","values"].reduce((e,r)=>(e[r]={enumerable:!0},e),{}));function lt(e=[]){return new O(e.reduce((r,t,i,n)=>(i%2===0&&r.push(n.slice(i,i+2)),r),[]).filter(([r,t])=>{try{return Ve(r),Pr(r,String(t)),!0}catch{return!1}}))}var Wn=new Set([301,302,303,307,308]),Je=e=>Wn.has(e);var V=Symbol("Response internals"),W=class e extends J{constructor(r=null,t={}){super(r,t);let i=t.status!=null?t.status:200,n=new O(t.headers);if(r!==null&&!n.has("Content-Type")){let a=Xe(r,this);a&&n.append("Content-Type",a)}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(ve(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(!Je(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 O(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 Qn}from"url";import{deprecate as Jn}from"util";var ct=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 Xn}from"net";function ft(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 ht=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),ut="strict-origin-when-cross-origin";function dt(e){if(!ht.has(e))throw new TypeError(`Invalid referrerPolicy: ${e}`);return e}function Vn(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let r=e.host.replace(/(^\[)|(]$)/g,""),t=Xn(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 Pe(e){return/^about:(blank|srcdoc)$/.test(e)||e.protocol==="data:"||/^(blob|filesystem):$/.test(e.protocol)?!0:Vn(e)}function mt(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,a=ft(n),o=ft(n,!0);a.toString().length>4096&&(a=o),r&&(a=r(a)),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 a;case"strict-origin":return Pe(a)&&!Pe(l)?"no-referrer":o.toString();case"strict-origin-when-cross-origin":return a.origin===l.origin?a:Pe(a)&&!Pe(l)?"no-referrer":o;case"same-origin":return a.origin===l.origin?a:"no-referrer";case"origin-when-cross-origin":return a.origin===l.origin?a:o;case"no-referrer-when-downgrade":return Pe(a)&&!Pe(l)?"no-referrer":a;default:throw new TypeError(`Invalid referrerPolicy: ${i}`)}}function gt(e){let r=(e.get("referrer-policy")||"").split(/[,\s]+/),t="";for(let i of r)i&&ht.has(i)&&(t=i);return t}var L=Symbol("Request internals"),qe=e=>typeof e=="object"&&typeof e[L]=="object",Kn=Jn(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),ge=class e extends J{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&&Kn(),(t.body!=null||qe(r)&&r.body!==null)&&(n==="GET"||n==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let a=t.body?t.body:qe(r)&&r.body!==null?ve(r):null;super(a,{size:t.size||r.size||0});let o=new O(t.headers||r.headers||{});if(a!==null&&!o.has("Content-Type")){let u=Xe(a,this);u&&o.set("Content-Type",u)}let l=qe(r)?r.signal:null;if("signal"in t&&(l=t.signal),l!=null&&!et(l))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let h=t.referrer==null?r.referrer:t.referrer;if(h==="")h="no-referrer";else if(h){let u=new URL(h);h=/^about:(\/\/)?client$/.test(u)?"client":u}else h=void 0;this[L]={method:n,redirect:t.redirect||r.redirect||"follow",headers:o,parsedURL:i,signal:l,referrer:h},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[L].method}get url(){return Qn(this[L].parsedURL)}get headers(){return this[L].headers}get redirect(){return this[L].redirect}get signal(){return this[L].signal}get referrer(){if(this[L].referrer==="no-referrer")return"";if(this[L].referrer==="client")return"about:client";if(this[L].referrer)return this[L].referrer.toString()}get referrerPolicy(){return this[L].referrerPolicy}set referrerPolicy(r){this[L].referrerPolicy=dt(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 pt=e=>{let{parsedURL:r}=e[L],t=new O(e[L].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=at(e);typeof l=="number"&&!Number.isNaN(l)&&(i=String(l))}i&&t.set("Content-Length",i),e.referrerPolicy===""&&(e.referrerPolicy=ut),e.referrer&&e.referrer!=="no-referrer"?e[L].referrer=mt(e):e[L].referrer="no-referrer",e[L].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 a=ct(r),o={path:r.pathname+a,method:e.method,headers:t[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:e.insecureHTTPParser,agent:n};return{parsedURL:r,options:o}};var Ke=class extends ae{constructor(r,t="aborted"){super(r,t)}};var ea=new Set(["data:","http:","https:"]);async function Ze(e,r){return new Promise((t,i)=>{let n=new ge(e,r),{parsedURL:a,options:o}=pt(n);if(!ea.has(a.protocol))throw new TypeError(`node-fetch cannot load ${e}. URL scheme "${a.protocol.replace(/:$/,"")}" is not supported.`);if(a.protocol==="data:"){let v=Zr(n.url),j=new W(v,{headers:{"Content-Type":v.typeFull}});t(j);return}let l=(a.protocol==="https:"?Zn:Yn).request,{signal:h}=n,u=null,b=()=>{let v=new Ke("The operation was aborted.");i(v),n.body&&n.body instanceof bt.Readable&&n.body.destroy(v),!(!u||!u.body)&&u.body.emit("error",v)};if(h&&h.aborted){b();return}let w=()=>{b(),D()},S=l(a.toString(),o);h&&h.addEventListener("abort",w);let D=()=>{S.abort(),h&&h.removeEventListener("abort",w)};S.on("error",v=>{i(new F(`request to ${n.url} failed, reason: ${v.message}`,"system",v)),D()}),ra(S,v=>{u&&u.body&&u.body.destroy(v)}),process.version<"v14"&&S.on("socket",v=>{let j;v.prependListener("end",()=>{j=v._eventsCount}),v.prependListener("close",A=>{if(u&&j<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 j=lt(v.rawHeaders);if(Je(v.statusCode)){let T=j.get("Location"),Q=null;try{Q=T===null?null:new URL(T,n.url)}catch{if(n.redirect!=="manual"){i(new F(`uri requested responds with an invalid redirect URL: ${T}`,"invalid-redirect")),D();return}}switch(n.redirect){case"error":i(new F(`uri requested responds with a redirect, redirect mode is set to error: ${n.url}`,"no-redirect")),D();return;case"manual":break;case"follow":{if(Q===null)break;if(n.counter>=n.follow){i(new F(`maximum redirect reached at: ${n.url}`,"max-redirect")),D();return}let H={headers:new O(n.headers),follow:n.follow,counter:n.counter+1,agent:n.agent,compress:n.compress,method:n.method,body:ve(n),signal:n.signal,size:n.size,referrer:n.referrer,referrerPolicy:n.referrerPolicy};if(!rt(n.url,Q)||!tt(n.url,Q))for(let Dn of["authorization","www-authenticate","cookie","cookie2"])H.headers.delete(Dn);if(v.statusCode!==303&&n.body&&r.body instanceof bt.Readable){i(new F("Cannot follow redirect with body being a readable stream","unsupported-redirect")),D();return}(v.statusCode===303||(v.statusCode===301||v.statusCode===302)&&n.method==="POST")&&(H.method="GET",H.body=void 0,H.headers.delete("content-length"));let Kr=gt(j);Kr&&(H.referrerPolicy=Kr),t(Ze(new ge(Q,H))),D();return}default:return i(new TypeError(`Redirect option '${n.redirect}' is not a valid value of RequestRedirect`))}}h&&v.once("end",()=>{h.removeEventListener("abort",w)});let A=Re(v,new wt,T=>{T&&i(T)});process.version<"v12.10"&&v.on("aborted",w);let z={url:n.url,status:v.statusCode,statusText:v.statusMessage,headers:j,size:n.size,counter:n.counter,highWaterMark:n.highWaterMark},ne=j.get("Content-Encoding");if(!n.compress||n.method==="HEAD"||ne===null||v.statusCode===204||v.statusCode===304){u=new W(A,z),t(u);return}let qn={flush:xe.Z_SYNC_FLUSH,finishFlush:xe.Z_SYNC_FLUSH};if(ne==="gzip"||ne==="x-gzip"){A=Re(A,xe.createGunzip(qn),T=>{T&&i(T)}),u=new W(A,z),t(u);return}if(ne==="deflate"||ne==="x-deflate"){let T=Re(v,new wt,Q=>{Q&&i(Q)});T.once("data",Q=>{(Q[0]&15)===8?A=Re(A,xe.createInflate(),H=>{H&&i(H)}):A=Re(A,xe.createInflateRaw(),H=>{H&&i(H)}),u=new W(A,z),t(u)}),T.once("end",()=>{u||(u=new W(A,z),t(u))});return}if(ne==="br"){A=Re(A,xe.createBrotliDecompress(),T=>{T&&i(T)}),u=new W(A,z),t(u);return}u=new W(A,z),t(u)}),st(S,n).catch(i)})}function ra(e,r){let t=Ye.from(`0\r
1
+ import{a as R,b as E,c as On,d as br,f as Fe,g as Yr}from"./chunk-3B7PIKIS.mjs";var K=E(($f,Et)=>{"use strict";var yt=function(e){return typeof e!="undefined"&&e!==null},ta=function(e){return typeof e=="object"},ia=function(e){return Object.prototype.toString.call(e)==="[object Object]"},na=function(e){return typeof e=="function"},aa=function(e){return typeof e=="boolean"},sa=function(e){return e instanceof Buffer},oa=function(e){if(yt(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},la=function(e){return e instanceof ArrayBuffer},ca=function(e){return typeof e=="string"&&e.length>0},fa=function(e){return typeof e=="number"&&!Number.isNaN(e)},ha=function(e){return Number.isInteger(e)},ua=function(e,r,t){return e>=r&&e<=t},da=function(e,r){return r.includes(e)},ma=function(e,r,t){return new Error(`Expected ${r} for ${e} but received ${t} of type ${typeof t}`)},ga=function(e,r){return r.message=e.message,r};Et.exports={defined:yt,object:ta,plainObject:ia,fn:na,bool:aa,buffer:sa,typedArray:oa,arrayBuffer:la,string:ca,number:fa,integer:ha,inRange:ua,inArray:da,invalidParameterError:ma,nativeError:ga}});var xt=E((jf,Pt)=>{"use strict";var vt=()=>process.platform==="linux",Ze=null,pa=()=>{if(!Ze)if(vt()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,Ze=process.report.getReport(),process.report.excludeNetwork=e}else Ze={};return Ze};Pt.exports={isLinux:vt,getReport:pa}});var It=E((Tf,Rt)=>{"use strict";var Ie=R("fs"),ba="/usr/bin/ldd",wa="/proc/self/exe",er=2048,ya=e=>{let r=Ie.openSync(e,"r"),t=Buffer.alloc(er),i=Ie.readSync(r,t,0,er,0);return Ie.close(r,()=>{}),t.subarray(0,i)},Ea=e=>new Promise((r,t)=>{Ie.open(e,"r",(i,n)=>{if(i)t(i);else{let a=Buffer.alloc(er);Ie.read(n,a,0,er,0,(o,l)=>{r(a.subarray(0,l)),Ie.close(n,()=>{})})}})});Rt.exports={LDD_PATH:ba,SELF_PATH:wa,readFileSync:ya,readFile:Ea}});var At=E((Nf,St)=>{"use strict";var va=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let r=e.readUInt32LE(32),t=e.readUInt16LE(54),i=e.readUInt16LE(56);for(let n=0;n<i;n++){let a=r+n*t;if(e.readUInt32LE(a)===3){let l=e.readUInt32LE(a+8),h=e.readUInt32LE(a+32);return e.subarray(l,l+h).toString().replace(/\0.*$/g,"")}}return null};St.exports={interpreterPath:va}});var tr=E((Cf,Gt)=>{"use strict";var Lt=R("child_process"),{isLinux:Se,getReport:$t}=xt(),{LDD_PATH:rr,SELF_PATH:jt,readFile:Pr,readFileSync:xr}=It(),{interpreterPath:Tt}=At(),Y,Z,ee,Nt="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",he="",Ct=()=>he||new Promise(e=>{Lt.exec(Nt,(r,t)=>{he=r?" ":t,e(he)})}),Bt=()=>{if(!he)try{he=Lt.execSync(Nt,{encoding:"utf8"})}catch{he=" "}return he},se="glibc",Ft=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,pe="musl",Pa=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),_t=()=>{let e=$t();return e.header&&e.header.glibcVersionRuntime?se:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(Pa)?pe:null},Mt=e=>{let[r,t]=e.split(/[\r\n]+/);return r&&r.includes(se)?se:t&&t.includes(pe)?pe:null},qt=e=>{if(e){if(e.includes("/ld-musl-"))return pe;if(e.includes("/ld-linux-"))return se}return null},Dt=e=>(e=e.toString(),e.includes("musl")?pe:e.includes("GNU C Library")?se:null),xa=async()=>{if(Z!==void 0)return Z;Z=null;try{let e=await Pr(rr);Z=Dt(e)}catch{}return Z},Ra=()=>{if(Z!==void 0)return Z;Z=null;try{let e=xr(rr);Z=Dt(e)}catch{}return Z},Ia=async()=>{if(Y!==void 0)return Y;Y=null;try{let e=await Pr(jt),r=Tt(e);Y=qt(r)}catch{}return Y},Sa=()=>{if(Y!==void 0)return Y;Y=null;try{let e=xr(jt),r=Tt(e);Y=qt(r)}catch{}return Y},Ot=async()=>{let e=null;if(Se()&&(e=await Ia(),!e&&(e=await xa(),e||(e=_t()),!e))){let r=await Ct();e=Mt(r)}return e},Ut=()=>{let e=null;if(Se()&&(e=Sa(),!e&&(e=Ra(),e||(e=_t()),!e))){let r=Bt();e=Mt(r)}return e},Aa=async()=>Se()&&await Ot()!==se,ka=()=>Se()&&Ut()!==se,La=async()=>{if(ee!==void 0)return ee;ee=null;try{let r=(await Pr(rr)).match(Ft);r&&(ee=r[1])}catch{}return ee},$a=()=>{if(ee!==void 0)return ee;ee=null;try{let r=xr(rr).match(Ft);r&&(ee=r[1])}catch{}return ee},zt=()=>{let e=$t();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},kt=e=>e.trim().split(/\s+/)[1],Ht=e=>{let[r,t,i]=e.split(/[\r\n]+/);return r&&r.includes(se)?kt(r):t&&i&&t.includes(pe)?kt(i):null},ja=async()=>{let e=null;if(Se()&&(e=await La(),e||(e=zt()),!e)){let r=await Ct();e=Ht(r)}return e},Ta=()=>{let e=null;if(Se()&&(e=$a(),e||(e=zt()),!e)){let r=Bt();e=Ht(r)}return e};Gt.exports={GLIBC:se,MUSL:pe,family:Ot,familySync:Ut,isNonGlibcLinux:Aa,isNonGlibcLinuxSync:ka,version:ja,versionSync:Ta}});var qe=E((Bf,Wt)=>{"use strict";var Na=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Wt.exports=Na});var ir=E((Ff,Xt)=>{"use strict";var Ca="2.0.0",Ba=Number.MAX_SAFE_INTEGER||9007199254740991,Fa=16,_a=250,Ma=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Xt.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Fa,MAX_SAFE_BUILD_LENGTH:_a,MAX_SAFE_INTEGER:Ba,RELEASE_TYPES:Ma,SEMVER_SPEC_VERSION:Ca,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var De=E((re,Vt)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Rr,MAX_SAFE_BUILD_LENGTH:qa,MAX_LENGTH:Da}=ir(),Oa=qe();re=Vt.exports={};var Ua=re.re=[],za=re.safeRe=[],m=re.src=[],Ha=re.safeSrc=[],g=re.t={},Ga=0,Ir="[a-zA-Z0-9-]",Wa=[["\\s",1],["\\d",Da],[Ir,qa]],Xa=e=>{for(let[r,t]of Wa)e=e.split(`${r}*`).join(`${r}{0,${t}}`).split(`${r}+`).join(`${r}{1,${t}}`);return e},y=(e,r,t)=>{let i=Xa(r),n=Ga++;Oa(e,n,r),g[e]=n,m[n]=r,Ha[n]=i,Ua[n]=new RegExp(r,t?"g":void 0),za[n]=new RegExp(i,t?"g":void 0)};y("NUMERICIDENTIFIER","0|[1-9]\\d*");y("NUMERICIDENTIFIERLOOSE","\\d+");y("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Ir}*`);y("MAINVERSION",`(${m[g.NUMERICIDENTIFIER]})\\.(${m[g.NUMERICIDENTIFIER]})\\.(${m[g.NUMERICIDENTIFIER]})`);y("MAINVERSIONLOOSE",`(${m[g.NUMERICIDENTIFIERLOOSE]})\\.(${m[g.NUMERICIDENTIFIERLOOSE]})\\.(${m[g.NUMERICIDENTIFIERLOOSE]})`);y("PRERELEASEIDENTIFIER",`(?:${m[g.NONNUMERICIDENTIFIER]}|${m[g.NUMERICIDENTIFIER]})`);y("PRERELEASEIDENTIFIERLOOSE",`(?:${m[g.NONNUMERICIDENTIFIER]}|${m[g.NUMERICIDENTIFIERLOOSE]})`);y("PRERELEASE",`(?:-(${m[g.PRERELEASEIDENTIFIER]}(?:\\.${m[g.PRERELEASEIDENTIFIER]})*))`);y("PRERELEASELOOSE",`(?:-?(${m[g.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${m[g.PRERELEASEIDENTIFIERLOOSE]})*))`);y("BUILDIDENTIFIER",`${Ir}+`);y("BUILD",`(?:\\+(${m[g.BUILDIDENTIFIER]}(?:\\.${m[g.BUILDIDENTIFIER]})*))`);y("FULLPLAIN",`v?${m[g.MAINVERSION]}${m[g.PRERELEASE]}?${m[g.BUILD]}?`);y("FULL",`^${m[g.FULLPLAIN]}$`);y("LOOSEPLAIN",`[v=\\s]*${m[g.MAINVERSIONLOOSE]}${m[g.PRERELEASELOOSE]}?${m[g.BUILD]}?`);y("LOOSE",`^${m[g.LOOSEPLAIN]}$`);y("GTLT","((?:<|>)?=?)");y("XRANGEIDENTIFIERLOOSE",`${m[g.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);y("XRANGEIDENTIFIER",`${m[g.NUMERICIDENTIFIER]}|x|X|\\*`);y("XRANGEPLAIN",`[v=\\s]*(${m[g.XRANGEIDENTIFIER]})(?:\\.(${m[g.XRANGEIDENTIFIER]})(?:\\.(${m[g.XRANGEIDENTIFIER]})(?:${m[g.PRERELEASE]})?${m[g.BUILD]}?)?)?`);y("XRANGEPLAINLOOSE",`[v=\\s]*(${m[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${m[g.XRANGEIDENTIFIERLOOSE]})(?:\\.(${m[g.XRANGEIDENTIFIERLOOSE]})(?:${m[g.PRERELEASELOOSE]})?${m[g.BUILD]}?)?)?`);y("XRANGE",`^${m[g.GTLT]}\\s*${m[g.XRANGEPLAIN]}$`);y("XRANGELOOSE",`^${m[g.GTLT]}\\s*${m[g.XRANGEPLAINLOOSE]}$`);y("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Rr}})(?:\\.(\\d{1,${Rr}}))?(?:\\.(\\d{1,${Rr}}))?`);y("COERCE",`${m[g.COERCEPLAIN]}(?:$|[^\\d])`);y("COERCEFULL",m[g.COERCEPLAIN]+`(?:${m[g.PRERELEASE]})?(?:${m[g.BUILD]})?(?:$|[^\\d])`);y("COERCERTL",m[g.COERCE],!0);y("COERCERTLFULL",m[g.COERCEFULL],!0);y("LONETILDE","(?:~>?)");y("TILDETRIM",`(\\s*)${m[g.LONETILDE]}\\s+`,!0);re.tildeTrimReplace="$1~";y("TILDE",`^${m[g.LONETILDE]}${m[g.XRANGEPLAIN]}$`);y("TILDELOOSE",`^${m[g.LONETILDE]}${m[g.XRANGEPLAINLOOSE]}$`);y("LONECARET","(?:\\^)");y("CARETTRIM",`(\\s*)${m[g.LONECARET]}\\s+`,!0);re.caretTrimReplace="$1^";y("CARET",`^${m[g.LONECARET]}${m[g.XRANGEPLAIN]}$`);y("CARETLOOSE",`^${m[g.LONECARET]}${m[g.XRANGEPLAINLOOSE]}$`);y("COMPARATORLOOSE",`^${m[g.GTLT]}\\s*(${m[g.LOOSEPLAIN]})$|^$`);y("COMPARATOR",`^${m[g.GTLT]}\\s*(${m[g.FULLPLAIN]})$|^$`);y("COMPARATORTRIM",`(\\s*)${m[g.GTLT]}\\s*(${m[g.LOOSEPLAIN]}|${m[g.XRANGEPLAIN]})`,!0);re.comparatorTrimReplace="$1$2$3";y("HYPHENRANGE",`^\\s*(${m[g.XRANGEPLAIN]})\\s+-\\s+(${m[g.XRANGEPLAIN]})\\s*$`);y("HYPHENRANGELOOSE",`^\\s*(${m[g.XRANGEPLAINLOOSE]})\\s+-\\s+(${m[g.XRANGEPLAINLOOSE]})\\s*$`);y("STAR","(<|>)?=?\\s*\\*");y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var nr=E((_f,Qt)=>{"use strict";var Va=Object.freeze({loose:!0}),Qa=Object.freeze({}),Ja=e=>e?typeof e!="object"?Va:e:Qa;Qt.exports=Ja});var Zt=E((Mf,Yt)=>{"use strict";var Jt=/^[0-9]+$/,Kt=(e,r)=>{if(typeof e=="number"&&typeof r=="number")return e===r?0:e<r?-1:1;let t=Jt.test(e),i=Jt.test(r);return t&&i&&(e=+e,r=+r),e===r?0:t&&!i?-1:i&&!t?1:e<r?-1:1},Ka=(e,r)=>Kt(r,e);Yt.exports={compareIdentifiers:Kt,rcompareIdentifiers:Ka}});var Ae=E((qf,ri)=>{"use strict";var ar=qe(),{MAX_LENGTH:ei,MAX_SAFE_INTEGER:sr}=ir(),{safeRe:or,t:lr}=De(),Ya=nr(),{compareIdentifiers:Sr}=Zt(),Ar=class e{constructor(r,t){if(t=Ya(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>ei)throw new TypeError(`version is longer than ${ei} characters`);ar("SemVer",r,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let i=r.trim().match(t.loose?or[lr.LOOSE]:or[lr.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>sr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>sr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>sr||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let a=+n;if(a>=0&&a<sr)return a}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(ar("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)),this.major<r.major?-1:this.major>r.major?1:this.minor<r.minor?-1:this.minor>r.minor?1:this.patch<r.patch?-1:this.patch>r.patch?1:0}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(ar("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 Sr(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(ar("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 Sr(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=`-${t}`.match(this.options.loose?or[lr.PRERELEASELOOSE]:or[lr.PRERELEASE]);if(!n||n[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 a=this.prerelease.length;for(;--a>=0;)typeof this.prerelease[a]=="number"&&(this.prerelease[a]++,a=-2);if(a===-1){if(t===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let a=[t,n];i===!1&&(a=[t]),Sr(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=a):this.prerelease=a}break}default:throw new Error(`invalid increment argument: ${r}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};ri.exports=Ar});var ni=E((Df,ii)=>{"use strict";var ti=Ae(),Za=(e,r,t=!1)=>{if(e instanceof ti)return e;try{return new ti(e,r)}catch(i){if(!t)return null;throw i}};ii.exports=Za});var si=E((Of,ai)=>{"use strict";var es=Ae(),rs=ni(),{safeRe:cr,t:fr}=De(),ts=(e,r)=>{if(e instanceof es)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?cr[fr.COERCEFULL]:cr[fr.COERCE]);else{let h=r.includePrerelease?cr[fr.COERCERTLFULL]:cr[fr.COERCERTL],u;for(;(u=h.exec(e))&&(!t||t.index+t[0].length!==e.length);)(!t||u.index+u[0].length!==t.index+t[0].length)&&(t=u),h.lastIndex=u.index+u[1].length+u[2].length;h.lastIndex=-1}if(t===null)return null;let i=t[2],n=t[3]||"0",a=t[4]||"0",o=r.includePrerelease&&t[5]?`-${t[5]}`:"",l=r.includePrerelease&&t[6]?`+${t[6]}`:"";return rs(`${i}.${n}.${a}${o}${l}`,r)};ai.exports=ts});var be=E((Uf,li)=>{"use strict";var oi=Ae(),is=(e,r,t)=>new oi(e,t).compare(new oi(r,t));li.exports=is});var kr=E((zf,ci)=>{"use strict";var ns=be(),as=(e,r,t)=>ns(e,r,t)>=0;ci.exports=as});var hi=E((Hf,fi)=>{"use strict";var Lr=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}};fi.exports=Lr});var di=E((Gf,ui)=>{"use strict";var ss=be(),os=(e,r,t)=>ss(e,r,t)===0;ui.exports=os});var gi=E((Wf,mi)=>{"use strict";var ls=be(),cs=(e,r,t)=>ls(e,r,t)!==0;mi.exports=cs});var bi=E((Xf,pi)=>{"use strict";var fs=be(),hs=(e,r,t)=>fs(e,r,t)>0;pi.exports=hs});var yi=E((Vf,wi)=>{"use strict";var us=be(),ds=(e,r,t)=>us(e,r,t)<0;wi.exports=ds});var vi=E((Qf,Ei)=>{"use strict";var ms=be(),gs=(e,r,t)=>ms(e,r,t)<=0;Ei.exports=gs});var xi=E((Jf,Pi)=>{"use strict";var ps=di(),bs=gi(),ws=bi(),ys=kr(),Es=yi(),vs=vi(),Ps=(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 ps(e,t,i);case"!=":return bs(e,t,i);case">":return ws(e,t,i);case">=":return ys(e,t,i);case"<":return Es(e,t,i);case"<=":return vs(e,t,i);default:throw new TypeError(`Invalid operator: ${r}`)}};Pi.exports=Ps});var $i=E((Kf,Li)=>{"use strict";var Oe=Symbol("SemVer ANY"),Tr=class e{static get ANY(){return Oe}constructor(r,t){if(t=Ri(t),r instanceof e){if(r.loose===!!t.loose)return r;r=r.value}r=r.trim().split(/\s+/).join(" "),jr("comparator",r,t),this.options=t,this.loose=!!t.loose,this.parse(r),this.semver===Oe?this.value="":this.value=this.operator+this.semver.version,jr("comp",this)}parse(r){let t=this.options.loose?Ii[Si.COMPARATORLOOSE]:Ii[Si.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 Ai(i[2],this.options.loose):this.semver=Oe}toString(){return this.value}test(r){if(jr("Comparator.test",r,this.options.loose),this.semver===Oe||r===Oe)return!0;if(typeof r=="string")try{r=new Ai(r,this.options)}catch{return!1}return $r(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 ki(r.value,t).test(this.value):r.operator===""?r.value===""?!0:new ki(this.value,t).test(r.semver):(t=Ri(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("=")||$r(this.semver,"<",r.semver,t)&&this.operator.startsWith(">")&&r.operator.startsWith("<")||$r(this.semver,">",r.semver,t)&&this.operator.startsWith("<")&&r.operator.startsWith(">")))}};Li.exports=Tr;var Ri=nr(),{safeRe:Ii,t:Si}=De(),$r=xi(),jr=qe(),Ai=Ae(),ki=Nr()});var Nr=E((Yf,Ci)=>{"use strict";var xs=/\s+/g,Cr=class e{constructor(r,t){if(t=Is(t),r instanceof e)return r.loose===!!t.loose&&r.includePrerelease===!!t.includePrerelease?r:new e(r.raw,t);if(r instanceof Br)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(xs," "),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=>!Ti(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&&Ts(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&&$s)|(this.options.loose&&js))+":"+r,n=ji.get(i);if(n)return n;let a=this.options.loose,o=a?C[j.HYPHENRANGELOOSE]:C[j.HYPHENRANGE];r=r.replace(o,Us(this.options.includePrerelease)),x("hyphen replace",r),r=r.replace(C[j.COMPARATORTRIM],As),x("comparator trim",r),r=r.replace(C[j.TILDETRIM],ks),x("tilde trim",r),r=r.replace(C[j.CARETTRIM],Ls),x("caret trim",r);let l=r.split(" ").map(w=>Ns(w,this.options)).join(" ").split(/\s+/).map(w=>Os(w,this.options));a&&(l=l.filter(w=>(x("loose invalid filter",w,this.options),!!w.match(C[j.COMPARATORLOOSE])))),x("range list",l);let h=new Map,u=l.map(w=>new Br(w,this.options));for(let w of u){if(Ti(w))return[w];h.set(w.value,w)}h.size>1&&h.has("")&&h.delete("");let b=[...h.values()];return ji.set(i,b),b}intersects(r,t){if(!(r instanceof e))throw new TypeError("a Range is required");return this.set.some(i=>Ni(i,t)&&r.set.some(n=>Ni(n,t)&&i.every(a=>n.every(o=>a.intersects(o,t)))))}test(r){if(!r)return!1;if(typeof r=="string")try{r=new Ss(r,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(zs(this.set[t],r,this.options))return!0;return!1}};Ci.exports=Cr;var Rs=hi(),ji=new Rs,Is=nr(),Br=$i(),x=qe(),Ss=Ae(),{safeRe:C,t:j,comparatorTrimReplace:As,tildeTrimReplace:ks,caretTrimReplace:Ls}=De(),{FLAG_INCLUDE_PRERELEASE:$s,FLAG_LOOSE:js}=ir(),Ti=e=>e.value==="<0.0.0-0",Ts=e=>e.value==="",Ni=(e,r)=>{let t=!0,i=e.slice(),n=i.pop();for(;t&&i.length;)t=i.every(a=>n.intersects(a,r)),n=i.pop();return t},Ns=(e,r)=>(e=e.replace(C[j.BUILD],""),x("comp",e,r),e=Fs(e,r),x("caret",e),e=Cs(e,r),x("tildes",e),e=Ms(e,r),x("xrange",e),e=Ds(e,r),x("stars",e),e),B=e=>!e||e.toLowerCase()==="x"||e==="*",Cs=(e,r)=>e.trim().split(/\s+/).map(t=>Bs(t,r)).join(" "),Bs=(e,r)=>{let t=r.loose?C[j.TILDELOOSE]:C[j.TILDE];return e.replace(t,(i,n,a,o,l)=>{x("tilde",e,i,n,a,o,l);let h;return B(n)?h="":B(a)?h=`>=${n}.0.0 <${+n+1}.0.0-0`:B(o)?h=`>=${n}.${a}.0 <${n}.${+a+1}.0-0`:l?(x("replaceTilde pr",l),h=`>=${n}.${a}.${o}-${l} <${n}.${+a+1}.0-0`):h=`>=${n}.${a}.${o} <${n}.${+a+1}.0-0`,x("tilde return",h),h})},Fs=(e,r)=>e.trim().split(/\s+/).map(t=>_s(t,r)).join(" "),_s=(e,r)=>{x("caret",e,r);let t=r.loose?C[j.CARETLOOSE]:C[j.CARET],i=r.includePrerelease?"-0":"";return e.replace(t,(n,a,o,l,h)=>{x("caret",e,n,a,o,l,h);let u;return B(a)?u="":B(o)?u=`>=${a}.0.0${i} <${+a+1}.0.0-0`:B(l)?a==="0"?u=`>=${a}.${o}.0${i} <${a}.${+o+1}.0-0`:u=`>=${a}.${o}.0${i} <${+a+1}.0.0-0`:h?(x("replaceCaret pr",h),a==="0"?o==="0"?u=`>=${a}.${o}.${l}-${h} <${a}.${o}.${+l+1}-0`:u=`>=${a}.${o}.${l}-${h} <${a}.${+o+1}.0-0`:u=`>=${a}.${o}.${l}-${h} <${+a+1}.0.0-0`):(x("no pr"),a==="0"?o==="0"?u=`>=${a}.${o}.${l}${i} <${a}.${o}.${+l+1}-0`:u=`>=${a}.${o}.${l}${i} <${a}.${+o+1}.0-0`:u=`>=${a}.${o}.${l} <${+a+1}.0.0-0`),x("caret return",u),u})},Ms=(e,r)=>(x("replaceXRanges",e,r),e.split(/\s+/).map(t=>qs(t,r)).join(" ")),qs=(e,r)=>{e=e.trim();let t=r.loose?C[j.XRANGELOOSE]:C[j.XRANGE];return e.replace(t,(i,n,a,o,l,h)=>{x("xRange",e,i,n,a,o,l,h);let u=B(a),b=u||B(o),w=b||B(l),S=w;return n==="="&&S&&(n=""),h=r.includePrerelease?"-0":"",u?n===">"||n==="<"?i="<0.0.0-0":i="*":n&&S?(b&&(o=0),l=0,n===">"?(n=">=",b?(a=+a+1,o=0,l=0):(o=+o+1,l=0)):n==="<="&&(n="<",b?a=+a+1:o=+o+1),n==="<"&&(h="-0"),i=`${n+a}.${o}.${l}${h}`):b?i=`>=${a}.0.0${h} <${+a+1}.0.0-0`:w&&(i=`>=${a}.${o}.0${h} <${a}.${+o+1}.0-0`),x("xRange return",i),i})},Ds=(e,r)=>(x("replaceStars",e,r),e.trim().replace(C[j.STAR],"")),Os=(e,r)=>(x("replaceGTE0",e,r),e.trim().replace(C[r.includePrerelease?j.GTE0PRE:j.GTE0],"")),Us=e=>(r,t,i,n,a,o,l,h,u,b,w,S)=>(B(i)?t="":B(n)?t=`>=${i}.0.0${e?"-0":""}`:B(a)?t=`>=${i}.${n}.0${e?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${e?"-0":""}`,B(u)?h="":B(b)?h=`<${+u+1}.0.0-0`:B(w)?h=`<${u}.${+b+1}.0-0`:S?h=`<=${u}.${b}.${w}-${S}`:e?h=`<${u}.${b}.${+w+1}-0`:h=`<=${h}`,`${t} ${h}`.trim()),zs=(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(x(e[i].semver),e[i].semver!==Br.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 Fi=E((Zf,Bi)=>{"use strict";var Hs=Nr(),Gs=(e,r,t)=>{try{r=new Hs(r,t)}catch{return!1}return r.test(e)};Bi.exports=Gs});var Fr=E((eh,Ws)=>{Ws.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.34.4",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.js",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.js","package-release-notes":"node npm/release-notes.js","docs-build":"node docs/build.mjs","docs-serve":"cd docs && npm start","docs-publish":"cd docs && npm run build && 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:{"@img/colour":"^1.0.0","detect-libc":"^2.1.0",semver:"^7.7.2"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.34.4","@img/sharp-darwin-x64":"0.34.4","@img/sharp-libvips-darwin-arm64":"1.2.3","@img/sharp-libvips-darwin-x64":"1.2.3","@img/sharp-libvips-linux-arm":"1.2.3","@img/sharp-libvips-linux-arm64":"1.2.3","@img/sharp-libvips-linux-ppc64":"1.2.3","@img/sharp-libvips-linux-s390x":"1.2.3","@img/sharp-libvips-linux-x64":"1.2.3","@img/sharp-libvips-linuxmusl-arm64":"1.2.3","@img/sharp-libvips-linuxmusl-x64":"1.2.3","@img/sharp-linux-arm":"0.34.4","@img/sharp-linux-arm64":"0.34.4","@img/sharp-linux-ppc64":"0.34.4","@img/sharp-linux-s390x":"0.34.4","@img/sharp-linux-x64":"0.34.4","@img/sharp-linuxmusl-arm64":"0.34.4","@img/sharp-linuxmusl-x64":"0.34.4","@img/sharp-wasm32":"0.34.4","@img/sharp-win32-arm64":"0.34.4","@img/sharp-win32-ia32":"0.34.4","@img/sharp-win32-x64":"0.34.4"},devDependencies:{"@emnapi/runtime":"^1.5.0","@img/sharp-libvips-dev":"1.2.3","@img/sharp-libvips-dev-wasm32":"1.2.3","@img/sharp-libvips-win32-arm64":"1.2.3","@img/sharp-libvips-win32-ia32":"1.2.3","@img/sharp-libvips-win32-x64":"1.2.3","@types/node":"*",cc:"^3.0.1",emnapi:"^1.5.0","exif-reader":"^2.0.2","extract-zip":"^2.0.1",icc:"^3.0.0","jsdoc-to-markdown":"^9.1.2","license-checker":"^25.0.1",mocha:"^11.7.2","node-addon-api":"^8.5.0","node-gyp":"^11.4.2",nyc:"^17.1.0",semistandard:"^17.0.0","tar-fs":"^3.1.1",tsd:"^0.33.0"},license:"Apache-2.0",engines:{node:"^18.17.0 || ^20.3.0 || >=21.0.0"},config:{libvips:">=8.17.2"},funding:{url:"https://opencollective.com/libvips"},semistandard:{env:["mocha"]},cc:{linelength:"120",filter:["build/include"]},nyc:{include:["lib"]},tsd:{directory:"test/types/"}}});var Mr=E((rh,Wi)=>{"use strict";var{spawnSync:hr}=R("child_process"),{createHash:Xs}=R("crypto"),Di=si(),Vs=kr(),Qs=Fi(),_i=tr(),{config:Js,engines:Mi,optionalDependencies:Ks}=Fr(),Ys=process.env.npm_package_config_libvips||Js.libvips,Oi=Di(Ys).version,Zs=["darwin-arm64","darwin-x64","linux-arm","linux-arm64","linux-ppc64","linux-s390x","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-arm64","win32-ia32","win32-x64"],ur={encoding:"utf8",shell:!0},eo=e=>{e instanceof Error?console.error(`sharp: Installation error: ${e.message}`):console.log(`sharp: ${e}`)},Ui=()=>_i.isNonGlibcLinuxSync()?_i.familySync():"",ro=()=>`${process.platform}${Ui()}-${process.arch}`,ke=()=>{if(zi())return"wasm32";let{npm_config_arch:e,npm_config_platform:r,npm_config_libc:t}=process.env,i=typeof t=="string"?t:Ui();return`${r||process.platform}${i}-${e||process.arch}`},to=()=>{try{return R(`@img/sharp-libvips-dev-${ke()}/include`)}catch{try{return R("@img/sharp-libvips-dev/include")}catch{}}return""},io=()=>{try{return R("@img/sharp-libvips-dev/cplusplus")}catch{}return""},no=()=>{try{return R(`@img/sharp-libvips-dev-${ke()}/lib`)}catch{try{return R(`@img/sharp-libvips-${ke()}/lib`)}catch{}}return""},ao=()=>{var e;if(((e=process.release)==null?void 0:e.name)==="node"&&process.versions&&!Qs(process.versions.node,Mi.node))return{found:process.versions.node,expected:Mi.node}},zi=()=>{let{CC:e}=process.env;return!!(e&&e.endsWith("/emcc"))},so=()=>process.platform==="darwin"&&process.arch==="x64"?(hr("sysctl sysctl.proc_translated",ur).stdout||"").trim()==="sysctl.proc_translated: 1":!1,qi=e=>Xs("sha512").update(e).digest("hex"),oo=()=>{try{let e=qi(`imgsharp-libvips-${ke()}`),r=Di(Ks[`@img/sharp-libvips-${ke()}`],{includePrerelease:!0}).version;return qi(`${e}npm:${r}`).slice(0,10)}catch{}return""},lo=()=>hr(`node-gyp rebuild --directory=src ${zi()?"--nodedir=emscripten":""}`,{...ur,stdio:"inherit"}).status,Hi=()=>process.platform!=="win32"?(hr("pkg-config --modversion vips-cpp",{...ur,env:{...process.env,PKG_CONFIG_PATH:Gi()}}).stdout||"").trim():"",Gi=()=>process.platform!=="win32"?[(hr('which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',ur).stdout||"").trim(),process.env.PKG_CONFIG_PATH,"/usr/local/lib/pkgconfig","/usr/lib/pkgconfig","/usr/local/libdata/pkgconfig","/usr/libdata/pkgconfig"].filter(Boolean).join(":"):"",_r=(e,r,t)=>(t&&t(`Detected ${r}, skipping search for globally-installed libvips`),e),co=e=>{if(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)return _r(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)return _r(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(so())return _r(!1,"Rosetta",e);let r=Hi();return!!r&&Vs(r,Oi)};Wi.exports={minimumLibvipsVersion:Oi,prebuiltPlatforms:Zs,buildPlatformArch:ke,buildSharpLibvipsIncludeDir:to,buildSharpLibvipsCPlusPlusDir:io,buildSharpLibvipsLibDir:no,isUnsupportedNodeRuntime:ao,runtimePlatformArch:ro,log:eo,yarnLocator:oo,spawnRebuild:lo,globalLibvipsVersion:Hi,pkgConfigPath:Gi,useGlobalLibvips:co}});var ze=E((ih,Vi)=>{"use strict";var{familySync:fo,versionSync:ho}=tr(),{runtimePlatformArch:uo,isUnsupportedNodeRuntime:Xi,prebuiltPlatforms:mo,minimumLibvipsVersion:go}=Mr(),we=uo(),po=[`../src/build/Release/sharp-${we}.node`,"../src/build/Release/sharp-wasm32.node",`@img/sharp-${we}/sharp.node`,"@img/sharp-wasm32/sharp.node"],qr,Le,Ue=[];for(qr of po)try{Le=R(qr);break}catch(e){Ue.push(e)}if(Le&&qr.startsWith("@img/sharp-linux-x64")&&!Le._isUsingX64V2()){let e=new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");e.code="Unsupported CPU",Ue.push(e),Le=null}if(Le)Vi.exports=Le;else{let[e,r,t]=["linux","darwin","win32"].map(a=>we.startsWith(a)),i=[`Could not load the "sharp" module using the ${we} runtime`];Ue.forEach(a=>{a.code!=="MODULE_NOT_FOUND"&&i.push(`${a.code}: ${a.message}`)});let n=Ue.map(a=>a.message).join(" ");if(i.push("Possible solutions:"),Xi()){let{found:a,expected:o}=Xi();i.push("- Please upgrade Node.js:",` Found ${a}`,` Requires ${o}`)}else if(mo.includes(we)){let[a,o]=we.split("-"),l=a.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=${a.replace("musl","")}${l} --cpu=${o} sharp`)}else i.push(`- Manually install libvips >= ${go}`,"- 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:a}=R(`@img/sharp-libvips-${we}/package`),o=`${fo()} ${ho()}`,l=`${a.musl?"musl":"glibc"} ${a.musl||a.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"),Ue.some(a=>a.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 Ji=E((ah,Qi)=>{"use strict";var bo=R("util"),Dr=R("stream"),wo=K();ze();var yo=bo.debuglog("sharp"),ye=function(e,r){if(arguments.length===1&&!wo.defined(e))throw new Error("Invalid input");return this instanceof ye?(Dr.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],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!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,dilateWidth:0,erodeWidth:0,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,withXmp:"",resolveWithObject:!1,loop:-1,delay:[],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,webpSmartDeblock:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,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:[],pdfBackground:[255,255,255,255],debuglog:t=>{this.emit("warning",t),yo(t)},queueListener:function(t){ye.queue.emit("change",t)}},this.options.input=this._createInputDescriptor(e,r,{allowStream:!0}),this):new ye(e,r)};Object.setPrototypeOf(ye.prototype,Dr.Duplex.prototype);Object.setPrototypeOf(ye,Dr.Duplex);function Eo(){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(ye.prototype,{clone:Eo});Qi.exports=ye});var Zi=E((sh,Yi)=>{"use strict";var c=K(),ue=ze(),vo={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},Po=["failOn","limitInputPixels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","failOnError","openSlideLevel","pdfBackground","tiffSubifd"];function Ki(e){let r=Po.filter(t=>c.defined(e[t])).map(t=>[t,e[t]]);return r.length?Object.fromEntries(r):void 0}function xo(e,r,t){let i={autoOrient:!1,failOn:"warning",limitInputPixels:Math.pow(16383,2),ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(c.string(e))i.file=e;else if(c.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");i.buffer=e}else if(c.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");i.buffer=Buffer.from(e,0,e.byteLength)}else if(c.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(c.plainObject(e)&&!c.defined(r))r=e,Ki(r)&&(i.buffer=[]);else if(!c.defined(e)&&!c.defined(r)&&c.object(t)&&t.allowStream)i.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map(n=>this._createInputDescriptor(n));else throw new Error("Recursive join is unsupported");else throw new Error("Expected at least two images to join");else throw new Error(`Unsupported input '${e}' of type ${typeof e}${c.defined(r)?` when also providing options of type ${typeof r}`:""}`);if(c.object(r)){if(c.defined(r.failOnError))if(c.bool(r.failOnError))i.failOn=r.failOnError?"warning":"none";else throw c.invalidParameterError("failOnError","boolean",r.failOnError);if(c.defined(r.failOn))if(c.string(r.failOn)&&c.inArray(r.failOn,["none","truncated","error","warning"]))i.failOn=r.failOn;else throw c.invalidParameterError("failOn","one of: none, truncated, error, warning",r.failOn);if(c.defined(r.autoOrient))if(c.bool(r.autoOrient))i.autoOrient=r.autoOrient;else throw c.invalidParameterError("autoOrient","boolean",r.autoOrient);if(c.defined(r.density))if(c.inRange(r.density,1,1e5))i.density=r.density;else throw c.invalidParameterError("density","number between 1 and 100000",r.density);if(c.defined(r.ignoreIcc))if(c.bool(r.ignoreIcc))i.ignoreIcc=r.ignoreIcc;else throw c.invalidParameterError("ignoreIcc","boolean",r.ignoreIcc);if(c.defined(r.limitInputPixels))if(c.bool(r.limitInputPixels))i.limitInputPixels=r.limitInputPixels?Math.pow(16383,2):0;else if(c.integer(r.limitInputPixels)&&c.inRange(r.limitInputPixels,0,Number.MAX_SAFE_INTEGER))i.limitInputPixels=r.limitInputPixels;else throw c.invalidParameterError("limitInputPixels","positive integer",r.limitInputPixels);if(c.defined(r.unlimited))if(c.bool(r.unlimited))i.unlimited=r.unlimited;else throw c.invalidParameterError("unlimited","boolean",r.unlimited);if(c.defined(r.sequentialRead))if(c.bool(r.sequentialRead))i.sequentialRead=r.sequentialRead;else throw c.invalidParameterError("sequentialRead","boolean",r.sequentialRead);if(c.defined(r.raw)){if(c.object(r.raw)&&c.integer(r.raw.width)&&r.raw.width>0&&c.integer(r.raw.height)&&r.raw.height>0&&c.integer(r.raw.channels)&&c.inRange(r.raw.channels,1,4))switch(i.rawWidth=r.raw.width,i.rawHeight=r.raw.height,i.rawChannels=r.raw.channels,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(i.rawPremultiplied=!1,c.defined(r.raw.premultiplied))if(c.bool(r.raw.premultiplied))i.rawPremultiplied=r.raw.premultiplied;else throw c.invalidParameterError("raw.premultiplied","boolean",r.raw.premultiplied);if(i.rawPageHeight=0,c.defined(r.raw.pageHeight))if(c.integer(r.raw.pageHeight)&&r.raw.pageHeight>0&&r.raw.pageHeight<=r.raw.height){if(r.raw.height%r.raw.pageHeight!==0)throw new Error(`Expected raw.height ${r.raw.height} to be a multiple of raw.pageHeight ${r.raw.pageHeight}`);i.rawPageHeight=r.raw.pageHeight}else throw c.invalidParameterError("raw.pageHeight","positive integer",r.raw.pageHeight)}if(c.defined(r.animated))if(c.bool(r.animated))i.pages=r.animated?-1:1;else throw c.invalidParameterError("animated","boolean",r.animated);if(c.defined(r.pages))if(c.integer(r.pages)&&c.inRange(r.pages,-1,1e5))i.pages=r.pages;else throw c.invalidParameterError("pages","integer between -1 and 100000",r.pages);if(c.defined(r.page))if(c.integer(r.page)&&c.inRange(r.page,0,1e5))i.page=r.page;else throw c.invalidParameterError("page","integer between 0 and 100000",r.page);if(c.object(r.openSlide)&&c.defined(r.openSlide.level))if(c.integer(r.openSlide.level)&&c.inRange(r.openSlide.level,0,256))i.openSlideLevel=r.openSlide.level;else throw c.invalidParameterError("openSlide.level","integer between 0 and 256",r.openSlide.level);else if(c.defined(r.level))if(c.integer(r.level)&&c.inRange(r.level,0,256))i.openSlideLevel=r.level;else throw c.invalidParameterError("level","integer between 0 and 256",r.level);if(c.object(r.tiff)&&c.defined(r.tiff.subifd))if(c.integer(r.tiff.subifd)&&c.inRange(r.tiff.subifd,-1,1e5))i.tiffSubifd=r.tiff.subifd;else throw c.invalidParameterError("tiff.subifd","integer between -1 and 100000",r.tiff.subifd);else if(c.defined(r.subifd))if(c.integer(r.subifd)&&c.inRange(r.subifd,-1,1e5))i.tiffSubifd=r.subifd;else throw c.invalidParameterError("subifd","integer between -1 and 100000",r.subifd);if(c.object(r.svg)){if(c.defined(r.svg.stylesheet))if(c.string(r.svg.stylesheet))i.svgStylesheet=r.svg.stylesheet;else throw c.invalidParameterError("svg.stylesheet","string",r.svg.stylesheet);if(c.defined(r.svg.highBitdepth))if(c.bool(r.svg.highBitdepth))i.svgHighBitdepth=r.svg.highBitdepth;else throw c.invalidParameterError("svg.highBitdepth","boolean",r.svg.highBitdepth)}if(c.object(r.pdf)&&c.defined(r.pdf.background)?i.pdfBackground=this._getBackgroundColourOption(r.pdf.background):c.defined(r.pdfBackground)&&(i.pdfBackground=this._getBackgroundColourOption(r.pdfBackground)),c.object(r.jp2)&&c.defined(r.jp2.oneshot))if(c.bool(r.jp2.oneshot))i.jp2Oneshot=r.jp2.oneshot;else throw c.invalidParameterError("jp2.oneshot","boolean",r.jp2.oneshot);if(c.defined(r.create))if(c.object(r.create)&&c.integer(r.create.width)&&r.create.width>0&&c.integer(r.create.height)&&r.create.height>0&&c.integer(r.create.channels)){if(i.createWidth=r.create.width,i.createHeight=r.create.height,i.createChannels=r.create.channels,i.createPageHeight=0,c.defined(r.create.pageHeight))if(c.integer(r.create.pageHeight)&&r.create.pageHeight>0&&r.create.pageHeight<=r.create.height){if(r.create.height%r.create.pageHeight!==0)throw new Error(`Expected create.height ${r.create.height} to be a multiple of create.pageHeight ${r.create.pageHeight}`);i.createPageHeight=r.create.pageHeight}else throw c.invalidParameterError("create.pageHeight","positive integer",r.create.pageHeight);if(c.defined(r.create.noise)){if(!c.object(r.create.noise))throw new Error("Expected noise to be an object");if(r.create.noise.type!=="gaussian")throw new Error("Only gaussian noise is supported at the moment");if(i.createNoiseType=r.create.noise.type,!c.inRange(r.create.channels,1,4))throw c.invalidParameterError("create.channels","number between 1 and 4",r.create.channels);if(i.createNoiseMean=128,c.defined(r.create.noise.mean))if(c.number(r.create.noise.mean)&&c.inRange(r.create.noise.mean,0,1e4))i.createNoiseMean=r.create.noise.mean;else throw c.invalidParameterError("create.noise.mean","number between 0 and 10000",r.create.noise.mean);if(i.createNoiseSigma=30,c.defined(r.create.noise.sigma))if(c.number(r.create.noise.sigma)&&c.inRange(r.create.noise.sigma,0,1e4))i.createNoiseSigma=r.create.noise.sigma;else throw c.invalidParameterError("create.noise.sigma","number between 0 and 10000",r.create.noise.sigma)}else if(c.defined(r.create.background)){if(!c.inRange(r.create.channels,3,4))throw c.invalidParameterError("create.channels","number between 3 and 4",r.create.channels);i.createBackground=this._getBackgroundColourOption(r.create.background)}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(c.defined(r.text))if(c.object(r.text)&&c.string(r.text.text)){if(i.textValue=r.text.text,c.defined(r.text.height)&&c.defined(r.text.dpi))throw new Error("Expected only one of dpi or height");if(c.defined(r.text.font))if(c.string(r.text.font))i.textFont=r.text.font;else throw c.invalidParameterError("text.font","string",r.text.font);if(c.defined(r.text.fontfile))if(c.string(r.text.fontfile))i.textFontfile=r.text.fontfile;else throw c.invalidParameterError("text.fontfile","string",r.text.fontfile);if(c.defined(r.text.width))if(c.integer(r.text.width)&&r.text.width>0)i.textWidth=r.text.width;else throw c.invalidParameterError("text.width","positive integer",r.text.width);if(c.defined(r.text.height))if(c.integer(r.text.height)&&r.text.height>0)i.textHeight=r.text.height;else throw c.invalidParameterError("text.height","positive integer",r.text.height);if(c.defined(r.text.align))if(c.string(r.text.align)&&c.string(this.constructor.align[r.text.align]))i.textAlign=this.constructor.align[r.text.align];else throw c.invalidParameterError("text.align","valid alignment",r.text.align);if(c.defined(r.text.justify))if(c.bool(r.text.justify))i.textJustify=r.text.justify;else throw c.invalidParameterError("text.justify","boolean",r.text.justify);if(c.defined(r.text.dpi))if(c.integer(r.text.dpi)&&c.inRange(r.text.dpi,1,1e6))i.textDpi=r.text.dpi;else throw c.invalidParameterError("text.dpi","integer between 1 and 1000000",r.text.dpi);if(c.defined(r.text.rgba))if(c.bool(r.text.rgba))i.textRgba=r.text.rgba;else throw c.invalidParameterError("text.rgba","bool",r.text.rgba);if(c.defined(r.text.spacing))if(c.integer(r.text.spacing)&&c.inRange(r.text.spacing,-1e6,1e6))i.textSpacing=r.text.spacing;else throw c.invalidParameterError("text.spacing","integer between -1000000 and 1000000",r.text.spacing);if(c.defined(r.text.wrap))if(c.string(r.text.wrap)&&c.inArray(r.text.wrap,["word","char","word-char","none"]))i.textWrap=r.text.wrap;else throw c.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.");if(c.defined(r.join))if(c.defined(this.options.join)){if(c.defined(r.join.animated))if(c.bool(r.join.animated))i.joinAnimated=r.join.animated;else throw c.invalidParameterError("join.animated","boolean",r.join.animated);if(c.defined(r.join.across))if(c.integer(r.join.across)&&c.inRange(r.join.across,1,1e6))i.joinAcross=r.join.across;else throw c.invalidParameterError("join.across","integer between 1 and 100000",r.join.across);if(c.defined(r.join.shim))if(c.integer(r.join.shim)&&c.inRange(r.join.shim,0,1e6))i.joinShim=r.join.shim;else throw c.invalidParameterError("join.shim","integer between 0 and 100000",r.join.shim);if(c.defined(r.join.background)&&(i.joinBackground=this._getBackgroundColourOption(r.join.background)),c.defined(r.join.halign))if(c.string(r.join.halign)&&c.string(this.constructor.align[r.join.halign]))i.joinHalign=this.constructor.align[r.join.halign];else throw c.invalidParameterError("join.halign","valid alignment",r.join.halign);if(c.defined(r.join.valign))if(c.string(r.join.valign)&&c.string(this.constructor.align[r.join.valign]))i.joinValign=this.constructor.align[r.join.valign];else throw c.invalidParameterError("join.valign","valid alignment",r.join.valign)}else throw new Error("Expected input to be an array of images to join")}else if(c.defined(r))throw new Error("Invalid input options "+r);return i}function Ro(e,r,t){Array.isArray(this.options.input.buffer)?c.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 c.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),ue.metadata(this.options,(t,i)=>{t?e(c.nativeError(t,r)):e(null,i)})}):ue.metadata(this.options,(t,i)=>{t?e(c.nativeError(t,r)):e(null,i)}),this):this._isStreamInput()?new Promise((t,i)=>{let n=()=>{this._flattenBufferIn(),ue.metadata(this.options,(a,o)=>{a?i(c.nativeError(a,r)):t(o)})};this.writableFinished?n():this.once("finish",n)}):new Promise((t,i)=>{ue.metadata(this.options,(n,a)=>{n?i(c.nativeError(n,r)):t(a)})})}function ko(e){let r=Error();return c.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),ue.stats(this.options,(t,i)=>{t?e(c.nativeError(t,r)):e(null,i)})}):ue.stats(this.options,(t,i)=>{t?e(c.nativeError(t,r)):e(null,i)}),this):this._isStreamInput()?new Promise((t,i)=>{this.on("finish",function(){this._flattenBufferIn(),ue.stats(this.options,(n,a)=>{n?i(c.nativeError(n,r)):t(a)})})}):new Promise((t,i)=>{ue.stats(this.options,(n,a)=>{n?i(c.nativeError(n,r)):t(a)})})}Yi.exports=function(e){Object.assign(e.prototype,{_inputOptionsFromObject:Ki,_createInputDescriptor:xo,_write:Ro,_flattenBufferIn:Io,_isStreamInput:So,metadata:Ao,stats:ko}),e.align=vo}});var sn=E((oh,an)=>{"use strict";var p=K(),rn={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},tn={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},en={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},nn={entropy:16,attention:17},Or={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},Lo={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},$o={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"};function Ur(e){return e.angle%360!==0||e.rotationAngle!==0}function dr(e){return e.width!==-1||e.height!==-1}function jo(e,r,t){if(dr(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=$o[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:nn[t.position]||tn[t.position]||rn[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(Or[t.kernel]))this.options.kernel=Or[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 Ur(this.options)&&dr(this.options)&&(this.options.rotateBefore=!0),this}function To(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(en[e.extendWith]))this.options.extendWith=en[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=dr(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),Ur(this.options)&&!dr(this.options)&&(this.options.widthPre===-1||this.options.widthPost===-1)&&(this.options.rotateBefore=!0),this.options.input.autoOrient&&(this.options.orientBefore=!0),this}function Co(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 Ur(this.options)&&(this.options.rotateBefore=!0),this}an.exports=function(e){Object.assign(e.prototype,{resize:jo,extend:To,extract:No,trim:Co}),e.gravity=rn,e.strategy=nn,e.kernel=Or,e.fit=Lo,e.position=tn}});var ln=E((lh,on)=>{"use strict";var P=K(),zr={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 Bo(e){if(!Array.isArray(e))throw P.invalidParameterError("images to composite","array",e);return this.options.composite=e.map(r=>{if(!P.object(r))throw P.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(P.defined(r.blend))if(P.string(zr[r.blend]))i.blend=zr[r.blend];else throw P.invalidParameterError("blend","valid blend name",r.blend);if(P.defined(r.tile))if(P.bool(r.tile))i.tile=r.tile;else throw P.invalidParameterError("tile","boolean",r.tile);if(P.defined(r.left))if(P.integer(r.left))i.left=r.left;else throw P.invalidParameterError("left","integer",r.left);if(P.defined(r.top))if(P.integer(r.top))i.top=r.top;else throw P.invalidParameterError("top","integer",r.top);if(P.defined(r.top)!==P.defined(r.left))throw new Error("Expected both left and top to be set");if(i.hasOffset=P.integer(r.top)&&P.integer(r.left),P.defined(r.gravity))if(P.integer(r.gravity)&&P.inRange(r.gravity,0,8))i.gravity=r.gravity;else if(P.string(r.gravity)&&P.integer(this.constructor.gravity[r.gravity]))i.gravity=this.constructor.gravity[r.gravity];else throw P.invalidParameterError("gravity","valid gravity",r.gravity);if(P.defined(r.premultiplied))if(P.bool(r.premultiplied))i.premultiplied=r.premultiplied;else throw P.invalidParameterError("premultiplied","boolean",r.premultiplied);return i}),this}on.exports=function(e){e.prototype.composite=Bo,e.blend=zr}});var dn=E((ch,un)=>{"use strict";var f=K(),cn={integer:"integer",float:"float",approximate:"approximate"};function Fo(e,r){if(!f.defined(e))return this.autoOrient();if((this.options.angle||this.options.rotationAngle)&&(this.options.debuglog("ignoring previous rotate options"),this.options.angle=0,this.options.rotationAngle=0),f.integer(e)&&!(e%90))this.options.angle=e;else if(f.number(e))this.options.rotationAngle=e,f.object(r)&&r.background&&this._setBackgroundColourOption("rotationBackground",r.background);else throw f.invalidParameterError("angle","numeric",e);return this}function _o(){return this.options.input.autoOrient=!0,this}function Mo(e){return this.options.flip=f.bool(e)?e:!0,this}function qo(e){return this.options.flop=f.bool(e)?e:!0,this}function Do(e,r){let t=[].concat(...e);if(t.length===4&&t.every(f.number))this.options.affineMatrix=t;else throw f.invalidParameterError("matrix","1x4 or 2x2 array",e);if(f.defined(r))if(f.object(r)){if(this._setBackgroundColourOption("affineBackground",r.background),f.defined(r.idx))if(f.number(r.idx))this.options.affineIdx=r.idx;else throw f.invalidParameterError("options.idx","number",r.idx);if(f.defined(r.idy))if(f.number(r.idy))this.options.affineIdy=r.idy;else throw f.invalidParameterError("options.idy","number",r.idy);if(f.defined(r.odx))if(f.number(r.odx))this.options.affineOdx=r.odx;else throw f.invalidParameterError("options.odx","number",r.odx);if(f.defined(r.ody))if(f.number(r.ody))this.options.affineOdy=r.ody;else throw f.invalidParameterError("options.ody","number",r.ody);if(f.defined(r.interpolator))if(f.inArray(r.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=r.interpolator;else throw f.invalidParameterError("options.interpolator","valid interpolator name",r.interpolator)}else throw f.invalidParameterError("options","object",r);return this}function Oo(e,r,t){if(!f.defined(e))this.options.sharpenSigma=-1;else if(f.bool(e))this.options.sharpenSigma=e?-1:0;else if(f.number(e)&&f.inRange(e,.01,1e4)){if(this.options.sharpenSigma=e,f.defined(r))if(f.number(r)&&f.inRange(r,0,1e4))this.options.sharpenM1=r;else throw f.invalidParameterError("flat","number between 0 and 10000",r);if(f.defined(t))if(f.number(t)&&f.inRange(t,0,1e4))this.options.sharpenM2=t;else throw f.invalidParameterError("jagged","number between 0 and 10000",t)}else if(f.plainObject(e)){if(f.number(e.sigma)&&f.inRange(e.sigma,1e-6,10))this.options.sharpenSigma=e.sigma;else throw f.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(f.defined(e.m1))if(f.number(e.m1)&&f.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw f.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(f.defined(e.m2))if(f.number(e.m2)&&f.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw f.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(f.defined(e.x1))if(f.number(e.x1)&&f.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw f.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(f.defined(e.y2))if(f.number(e.y2)&&f.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw f.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(f.defined(e.y3))if(f.number(e.y3)&&f.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw f.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else throw f.invalidParameterError("sigma","number between 0.01 and 10000",e);return this}function Uo(e){if(!f.defined(e))this.options.medianSize=3;else if(f.integer(e)&&f.inRange(e,1,1e3))this.options.medianSize=e;else throw f.invalidParameterError("size","integer between 1 and 1000",e);return this}function zo(e){let r;if(f.number(e))r=e;else if(f.plainObject(e)){if(!f.number(e.sigma))throw f.invalidParameterError("options.sigma","number between 0.3 and 1000",r);if(r=e.sigma,"precision"in e)if(f.string(cn[e.precision]))this.options.precision=cn[e.precision];else throw f.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(f.number(e.minAmplitude)&&f.inRange(e.minAmplitude,.001,1))this.options.minAmpl=e.minAmplitude;else throw f.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!f.defined(e))this.options.blurSigma=-1;else if(f.bool(e))this.options.blurSigma=e?-1:0;else if(f.number(r)&&f.inRange(r,.3,1e3))this.options.blurSigma=r;else throw f.invalidParameterError("sigma","number between 0.3 and 1000",r);return this}function fn(e){if(!f.defined(e))this.options.dilateWidth=1;else if(f.integer(e)&&e>0)this.options.dilateWidth=e;else throw f.invalidParameterError("dilate","positive integer",fn);return this}function hn(e){if(!f.defined(e))this.options.erodeWidth=1;else if(f.integer(e)&&e>0)this.options.erodeWidth=e;else throw f.invalidParameterError("erode","positive integer",hn);return this}function Ho(e){return this.options.flatten=f.bool(e)?e:!0,f.object(e)&&this._setBackgroundColourOption("flattenBackground",e.background),this}function Go(){return this.options.unflatten=!0,this}function Wo(e,r){if(!f.defined(e))this.options.gamma=2.2;else if(f.number(e)&&f.inRange(e,1,3))this.options.gamma=e;else throw f.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!f.defined(r))this.options.gammaOut=this.options.gamma;else if(f.number(r)&&f.inRange(r,1,3))this.options.gammaOut=r;else throw f.invalidParameterError("gammaOut","number between 1.0 and 3.0",r);return this}function Xo(e){if(this.options.negate=f.bool(e)?e:!0,f.plainObject(e)&&"alpha"in e)if(f.bool(e.alpha))this.options.negateAlpha=e.alpha;else throw f.invalidParameterError("alpha","should be boolean value",e.alpha);return this}function Vo(e){if(f.plainObject(e)){if(f.defined(e.lower))if(f.number(e.lower)&&f.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw f.invalidParameterError("lower","number between 0 and 99",e.lower);if(f.defined(e.upper))if(f.number(e.upper)&&f.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw f.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw f.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(f.plainObject(e)){if(f.integer(e.width)&&e.width>0)this.options.claheWidth=e.width;else throw f.invalidParameterError("width","integer greater than zero",e.width);if(f.integer(e.height)&&e.height>0)this.options.claheHeight=e.height;else throw f.invalidParameterError("height","integer greater than zero",e.height);if(f.defined(e.maxSlope))if(f.integer(e.maxSlope)&&f.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw f.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw f.invalidParameterError("options","plain object",e);return this}function Ko(e){if(!f.object(e)||!Array.isArray(e.kernel)||!f.integer(e.width)||!f.integer(e.height)||!f.inRange(e.width,3,1001)||!f.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length)throw new Error("Invalid convolution kernel");return f.integer(e.scale)||(e.scale=e.kernel.reduce(function(r,t){return r+t},0)),e.scale<1&&(e.scale=1),f.integer(e.offset)||(e.offset=0),this.options.convKernel=e,this}function Yo(e,r){if(!f.defined(e))this.options.threshold=128;else if(f.bool(e))this.options.threshold=e?128:0;else if(f.integer(e)&&f.inRange(e,0,255))this.options.threshold=e;else throw f.invalidParameterError("threshold","integer between 0 and 255",e);return!f.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),f.string(r)&&f.inArray(r,["and","or","eor"]))this.options.booleanOp=r;else throw f.invalidParameterError("operator","one of: and, or, eor",r);return this}function el(e,r){if(!f.defined(e)&&f.number(r)?e=1:f.number(e)&&!f.defined(r)&&(r=0),!f.defined(e))this.options.linearA=[];else if(f.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&e.length&&e.every(f.number))this.options.linearA=e;else throw f.invalidParameterError("a","number or array of numbers",e);if(!f.defined(r))this.options.linearB=[];else if(f.number(r))this.options.linearB=[r];else if(Array.isArray(r)&&r.length&&r.every(f.number))this.options.linearB=r;else throw f.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 f.invalidParameterError("inputMatrix","array",e);if(e.length!==3&&e.length!==4)throw f.invalidParameterError("inputMatrix","3x3 or 4x4 array",e.length);let r=e.flat().map(Number);if(r.length!==9&&r.length!==16)throw f.invalidParameterError("inputMatrix","cardinality of 9 or 16",r.length);return this.options.recombMatrix=r,this}function tl(e){if(!f.plainObject(e))throw f.invalidParameterError("options","plain object",e);if("brightness"in e)if(f.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw f.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(f.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw f.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(f.integer(e.hue))this.options.hue=e.hue%360;else throw f.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(f.number(e.lightness))this.options.lightness=e.lightness;else throw f.invalidParameterError("lightness","number",e.lightness);return this}un.exports=function(e){Object.assign(e.prototype,{autoOrient:_o,rotate:Fo,flip:Mo,flop:qo,affine:Do,sharpen:Oo,erode:hn,dilate:fn,median:Uo,blur:zo,flatten:Ho,unflatten:Go,gamma:Wo,negate:Xo,normalise:Vo,normalize:Qo,clahe:Jo,convolve:Ko,threshold:Yo,boolean:Zo,linear:el,recomb:rl,modulate:tl})}});var yn=E((fh,wn)=>{"use strict";var Wr=Object.defineProperty,il=Object.getOwnPropertyDescriptor,nl=Object.getOwnPropertyNames,al=Object.prototype.hasOwnProperty,sl=(e,r)=>{for(var t in r)Wr(e,t,{get:r[t],enumerable:!0})},ol=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of nl(r))!al.call(e,n)&&n!==t&&Wr(e,n,{get:()=>r[n],enumerable:!(i=il(r,n))||i.enumerable});return e},ll=e=>ol(Wr({},"__esModule",{value:!0}),e),mn={};sl(mn,{default:()=>Pl});wn.exports=ll(mn);var te={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]},gn=Object.create(null);for(let e in te)Object.hasOwn(te,e)&&(gn[te[e]]=e);var q={to:{},get:{}};q.get=function(e){let r=e.slice(0,3).toLowerCase(),t,i;switch(r){case"hsl":{t=q.get.hsl(e),i="hsl";break}case"hwb":{t=q.get.hwb(e),i="hwb";break}default:{t=q.get.rgb(e),i="rgb";break}}return t?{model:i,value:t}:null};q.get.rgb=function(e){if(!e)return null;let r=/^#([a-f\d]{3,4})$/i,t=/^#([a-f\d]{6})([a-f\d]{2})?$/i,i=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,n=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,a=/^(\w+)$/,o=[0,0,0,1],l,h,u;if(l=e.match(t)){for(u=l[2],l=l[1],h=0;h<3;h++){let b=h*2;o[h]=Number.parseInt(l.slice(b,b+2),16)}u&&(o[3]=Number.parseInt(u,16)/255)}else if(l=e.match(r)){for(l=l[1],u=l[3],h=0;h<3;h++)o[h]=Number.parseInt(l[h]+l[h],16);u&&(o[3]=Number.parseInt(u+u,16)/255)}else if(l=e.match(i)){for(h=0;h<3;h++)o[h]=Number.parseInt(l[h+1],10);l[4]&&(o[3]=l[5]?Number.parseFloat(l[4])*.01:Number.parseFloat(l[4]))}else if(l=e.match(n)){for(h=0;h<3;h++)o[h]=Math.round(Number.parseFloat(l[h+1])*2.55);l[4]&&(o[3]=l[5]?Number.parseFloat(l[4])*.01:Number.parseFloat(l[4]))}else return(l=e.match(a))?l[1]==="transparent"?[0,0,0,0]:Object.hasOwn(te,l[1])?(o=te[l[1]],o[3]=1,o):null:null;for(h=0;h<3;h++)o[h]=de(o[h],0,255);return o[3]=de(o[3],0,1),o};q.get.hsl=function(e){if(!e)return null;let 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){let i=Number.parseFloat(t[4]),n=(Number.parseFloat(t[1])%360+360)%360,a=de(Number.parseFloat(t[2]),0,100),o=de(Number.parseFloat(t[3]),0,100),l=de(Number.isNaN(i)?1:i,0,1);return[n,a,o,l]}return null};q.get.hwb=function(e){if(!e)return null;let r=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,t=e.match(r);if(t){let i=Number.parseFloat(t[4]),n=(Number.parseFloat(t[1])%360+360)%360,a=de(Number.parseFloat(t[2]),0,100),o=de(Number.parseFloat(t[3]),0,100),l=de(Number.isNaN(i)?1:i,0,1);return[n,a,o,l]}return null};q.to.hex=function(...e){return"#"+mr(e[0])+mr(e[1])+mr(e[2])+(e[3]<1?mr(Math.round(e[3]*255)):"")};q.to.rgb=function(...e){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]+")"};q.to.rgb.percent=function(...e){let 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]+")"};q.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};q.to.hwb=function(...e){let r="";return e.length>=4&&e[3]!==1&&(r=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+r+")"};q.to.keyword=function(...e){return gn[e.slice(0,3)]};function de(e,r,t){return Math.min(Math.max(r,e),t)}function mr(e){let r=Math.round(e).toString(16).toUpperCase();return r.length<2?"0"+r:r}var $e=q,pn={};for(let e of Object.keys(te))pn[te[e]]=e;var d={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"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},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"]}},Ee=d,oe=(6/29)**3;function Te(e){let r=e>.0031308?1.055*e**.4166666666666667-.055:e*12.92;return Math.min(Math.max(0,r),1)}function Ne(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(d)){if(!("channels"in d[e]))throw new Error("missing channels property: "+e);if(!("labels"in d[e]))throw new Error("missing channel labels property: "+e);if(d[e].labels.length!==d[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:r,labels:t}=d[e];delete d[e].channels,delete d[e].labels,Object.defineProperty(d[e],"channels",{value:r}),Object.defineProperty(d[e],"labels",{value:t})}d.rgb.hsl=function(e){let r=e[0]/255,t=e[1]/255,i=e[2]/255,n=Math.min(r,t,i),a=Math.max(r,t,i),o=a-n,l,h;switch(a){case n:{l=0;break}case r:{l=(t-i)/o;break}case t:{l=2+(i-r)/o;break}case i:{l=4+(r-t)/o;break}}l=Math.min(l*60,360),l<0&&(l+=360);let u=(n+a)/2;return a===n?h=0:u<=.5?h=o/(a+n):h=o/(2-a-n),[l,h*100,u*100]};d.rgb.hsv=function(e){let r,t,i,n,a,o=e[0]/255,l=e[1]/255,h=e[2]/255,u=Math.max(o,l,h),b=u-Math.min(o,l,h),w=function(S){return(u-S)/6/b+1/2};if(b===0)n=0,a=0;else{switch(a=b/u,r=w(o),t=w(l),i=w(h),u){case o:{n=i-t;break}case l:{n=1/3+r-i;break}case h:{n=2/3+t-r;break}}n<0?n+=1:n>1&&(n-=1)}return[n*360,a*100,u*100]};d.rgb.hwb=function(e){let r=e[0],t=e[1],i=e[2],n=d.rgb.hsl(e)[0],a=1/255*Math.min(r,Math.min(t,i));return i=1-1/255*Math.max(r,Math.max(t,i)),[n,a*100,i*100]};d.rgb.oklab=function(e){let r=Ne(e[0]/255),t=Ne(e[1]/255),i=Ne(e[2]/255),n=Math.cbrt(.4122214708*r+.5363325363*t+.0514459929*i),a=Math.cbrt(.2119034982*r+.6806995451*t+.1073969566*i),o=Math.cbrt(.0883024619*r+.2817188376*t+.6299787005*i),l=.2104542553*n+.793617785*a-.0040720468*o,h=1.9779984951*n-2.428592205*a+.4505937099*o,u=.0259040371*n+.7827717662*a-.808675766*o;return[l*100,h*100,u*100]};d.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),a=(1-r-n)/(1-n)||0,o=(1-t-n)/(1-n)||0,l=(1-i-n)/(1-n)||0;return[a*100,o*100,l*100,n*100]};function cl(e,r){return(e[0]-r[0])**2+(e[1]-r[1])**2+(e[2]-r[2])**2}d.rgb.keyword=function(e){let r=pn[e];if(r)return r;let t=Number.POSITIVE_INFINITY,i;for(let n of Object.keys(te)){let a=te[n],o=cl(e,a);o<t&&(t=o,i=n)}return i};d.keyword.rgb=function(e){return te[e]};d.rgb.xyz=function(e){let r=Ne(e[0]/255),t=Ne(e[1]/255),i=Ne(e[2]/255),n=r*.4124564+t*.3575761+i*.1804375,a=r*.2126729+t*.7151522+i*.072175,o=r*.0193339+t*.119192+i*.9503041;return[n*100,a*100,o*100]};d.rgb.lab=function(e){let r=d.rgb.xyz(e),t=r[0],i=r[1],n=r[2];t/=95.047,i/=100,n/=108.883,t=t>oe?t**(1/3):7.787*t+16/116,i=i>oe?i**(1/3):7.787*i+16/116,n=n>oe?n**(1/3):7.787*n+16/116;let a=116*i-16,o=500*(t-i),l=200*(i-n);return[a,o,l]};d.hsl.rgb=function(e){let r=e[0]/360,t=e[1]/100,i=e[2]/100,n,a;if(t===0)return a=i*255,[a,a,a];let o=i<.5?i*(1+t):i+t-i*t,l=2*i-o,h=[0,0,0];for(let u=0;u<3;u++)n=r+1/3*-(u-1),n<0&&n++,n>1&&n--,6*n<1?a=l+(o-l)*6*n:2*n<1?a=o:3*n<2?a=l+(o-l)*(2/3-n)*6:a=l,h[u]=a*255;return h};d.hsl.hsv=function(e){let r=e[0],t=e[1]/100,i=e[2]/100,n=t,a=Math.max(i,.01);i*=2,t*=i<=1?i:2-i,n*=a<=1?a:2-a;let o=(i+t)/2,l=i===0?2*n/(a+n):2*t/(i+t);return[r,l*100,o*100]};d.hsv.rgb=function(e){let r=e[0]/60,t=e[1]/100,i=e[2]/100,n=Math.floor(r)%6,a=r-Math.floor(r),o=255*i*(1-t),l=255*i*(1-t*a),h=255*i*(1-t*(1-a));switch(i*=255,n){case 0:return[i,h,o];case 1:return[l,i,o];case 2:return[o,i,h];case 3:return[o,l,i];case 4:return[h,o,i];case 5:return[i,o,l]}};d.hsv.hsl=function(e){let r=e[0],t=e[1]/100,i=e[2]/100,n=Math.max(i,.01),a,o;o=(2-t)*i;let l=(2-t)*n;return a=t*n,a/=l<=1?l:2-l,a=a||0,o/=2,[r,a*100,o*100]};d.hwb.rgb=function(e){let r=e[0]/360,t=e[1]/100,i=e[2]/100,n=t+i,a;n>1&&(t/=n,i/=n);let o=Math.floor(6*r),l=1-i;a=6*r-o,(o&1)!==0&&(a=1-a);let h=t+a*(l-t),u,b,w;switch(o){default:case 6:case 0:{u=l,b=h,w=t;break}case 1:{u=h,b=l,w=t;break}case 2:{u=t,b=l,w=h;break}case 3:{u=t,b=h,w=l;break}case 4:{u=h,b=t,w=l;break}case 5:{u=l,b=t,w=h;break}}return[u*255,b*255,w*255]};d.cmyk.rgb=function(e){let r=e[0]/100,t=e[1]/100,i=e[2]/100,n=e[3]/100,a=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[a*255,o*255,l*255]};d.xyz.rgb=function(e){let r=e[0]/100,t=e[1]/100,i=e[2]/100,n,a,o;return n=r*3.2404542+t*-1.5371385+i*-.4985314,a=r*-.969266+t*1.8760108+i*.041556,o=r*.0556434+t*-.2040259+i*1.0572252,n=Te(n),a=Te(a),o=Te(o),[n*255,a*255,o*255]};d.xyz.lab=function(e){let r=e[0],t=e[1],i=e[2];r/=95.047,t/=100,i/=108.883,r=r>oe?r**(1/3):7.787*r+16/116,t=t>oe?t**(1/3):7.787*t+16/116,i=i>oe?i**(1/3):7.787*i+16/116;let n=116*t-16,a=500*(r-t),o=200*(t-i);return[n,a,o]};d.xyz.oklab=function(e){let r=e[0]/100,t=e[1]/100,i=e[2]/100,n=Math.cbrt(.8189330101*r+.3618667424*t-.1288597137*i),a=Math.cbrt(.0329845436*r+.9293118715*t+.0361456387*i),o=Math.cbrt(.0482003018*r+.2643662691*t+.633851707*i),l=.2104542553*n+.793617785*a-.0040720468*o,h=1.9779984951*n-2.428592205*a+.4505937099*o,u=.0259040371*n+.7827717662*a-.808675766*o;return[l*100,h*100,u*100]};d.oklab.oklch=function(e){return d.lab.lch(e)};d.oklab.xyz=function(e){let r=e[0]/100,t=e[1]/100,i=e[2]/100,n=(.999999998*r+.396337792*t+.215803758*i)**3,a=(1.000000008*r-.105561342*t-.063854175*i)**3,o=(1.000000055*r-.089484182*t-1.291485538*i)**3,l=1.227013851*n-.55779998*a+.281256149*o,h=-.040580178*n+1.11225687*a-.071676679*o,u=-.076381285*n-.421481978*a+1.58616322*o;return[l*100,h*100,u*100]};d.oklab.rgb=function(e){let r=e[0]/100,t=e[1]/100,i=e[2]/100,n=(r+.3963377774*t+.2158037573*i)**3,a=(r-.1055613458*t-.0638541728*i)**3,o=(r-.0894841775*t-1.291485548*i)**3,l=Te(4.0767416621*n-3.3077115913*a+.2309699292*o),h=Te(-1.2684380046*n+2.6097574011*a-.3413193965*o),u=Te(-.0041960863*n-.7034186147*a+1.707614701*o);return[l*255,h*255,u*255]};d.oklch.oklab=function(e){return d.lch.lab(e)};d.lab.xyz=function(e){let r=e[0],t=e[1],i=e[2],n,a,o;a=(r+16)/116,n=t/500+a,o=a-i/200;let l=a**3,h=n**3,u=o**3;return a=l>oe?l:(a-16/116)/7.787,n=h>oe?h:(n-16/116)/7.787,o=u>oe?u:(o-16/116)/7.787,n*=95.047,a*=100,o*=108.883,[n,a,o]};d.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]};d.lch.lab=function(e){let r=e[0],t=e[1],n=e[2]/360*2*Math.PI,a=t*Math.cos(n),o=t*Math.sin(n);return[r,a,o]};d.rgb.ansi16=function(e,r=null){let[t,i,n]=e,a=r===null?d.rgb.hsv(e)[2]:r;if(a=Math.round(a/50),a===0)return 30;let o=30+(Math.round(n/255)<<2|Math.round(i/255)<<1|Math.round(t/255));return a===2&&(o+=60),o};d.hsv.ansi16=function(e){return d.rgb.ansi16(d.hsv.rgb(e),e[2])};d.rgb.ansi256=function(e){let r=e[0],t=e[1],i=e[2];return r>>4===t>>4&&t>>4===i>>4?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)};d.ansi16.rgb=function(e){e=e[0];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=(Math.trunc(e>50)+1)*.5,i=(r&1)*t*255,n=(r>>1&1)*t*255,a=(r>>2&1)*t*255;return[i,n,a]};d.ansi256.rgb=function(e){if(e=e[0],e>=232){let a=(e-232)*10+8;return[a,a,a]}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]};d.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".slice(t.length)+t};d.hex.rgb=function(e){let r=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!r)return[0,0,0];let t=r[0];r[0].length===3&&(t=[...t].map(l=>l+l).join(""));let i=Number.parseInt(t,16),n=i>>16&255,a=i>>8&255,o=i&255;return[n,a,o]};d.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),a=Math.min(Math.min(r,t),i),o=n-a,l,h=o<1?a/(1-o):0;return o<=0?l=0:n===r?l=(t-i)/o%6:n===t?l=2+(i-r)/o:l=4+(r-t)/o,l/=6,l%=1,[l*360,o*100,h*100]};d.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]};d.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]};d.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],a=r%1*6,o=a%1,l=1-o,h=0;switch(Math.floor(a)){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 h=(1-t)*i,[(t*n[0]+h)*255,(t*n[1]+h)*255,(t*n[2]+h)*255]};d.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]};d.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]};d.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]};d.hwb.hcg=function(e){let r=e[1]/100,i=1-e[2]/100,n=i-r,a=0;return n<1&&(a=(i-n)/(1-n)),[e[0],n*100,a*100]};d.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};d.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};d.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};d.gray.hsl=function(e){return[0,0,e[0]]};d.gray.hsv=d.gray.hsl;d.gray.hwb=function(e){return[0,100,e[0]]};d.gray.cmyk=function(e){return[0,0,0,e[0]]};d.gray.lab=function(e){return[e[0],0,0]};d.gray.hex=function(e){let r=Math.round(e[0]/100*255)&255,i=((r<<16)+(r<<8)+r).toString(16).toUpperCase();return"000000".slice(i.length)+i};d.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function fl(){let e={},r=Object.keys(Ee);for(let{length:t}=r,i=0;i<t;i++)e[r[i]]={distance:-1,parent:null};return e}function hl(e){let r=fl(),t=[e];for(r[e].distance=0;t.length>0;){let i=t.pop(),n=Object.keys(Ee[i]);for(let{length:a}=n,o=0;o<a;o++){let l=n[o],h=r[l];h.distance===-1&&(h.distance=r[i].distance+1,h.parent=i,t.unshift(l))}}return r}function ul(e,r){return function(t){return r(e(t))}}function dl(e,r){let t=[r[e].parent,e],i=Ee[r[e].parent][e],n=r[e].parent;for(;r[n].parent;)t.unshift(r[n].parent),i=ul(Ee[r[n].parent][n],i),n=r[n].parent;return i.conversion=t,i}function ml(e){let r=hl(e),t={},i=Object.keys(r);for(let{length:n}=i,a=0;a<n;a++){let o=i[a];r[o].parent!==null&&(t[o]=dl(o,r))}return t}var gl=ml,je={},pl=Object.keys(Ee);function bl(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 wl(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{length:a}=n,o=0;o<a;o++)n[o]=Math.round(n[o]);return n};return"conversion"in e&&(r.conversion=e.conversion),r}for(let e of pl){je[e]={},Object.defineProperty(je[e],"channels",{value:Ee[e].channels}),Object.defineProperty(je[e],"labels",{value:Ee[e].labels});let r=gl(e),t=Object.keys(r);for(let i of t){let n=r[i];je[e][i]=wl(n),je[e][i].raw=bl(n)}}var U=je,bn=["keyword","gray","hex"],Hr={};for(let e of Object.keys(U))Hr[[...U[e].labels].sort().join("")]=e;var He={};function $(e,r){if(!(this instanceof $))return new $(e,r);if(r&&r in bn&&(r=null),r&&!(r in U))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 $)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){let n=$e.get(e);if(n===null)throw new Error("Unable to parse color from string: "+e);this.model=n.model,i=U[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=U[this.model].channels;let n=Array.prototype.slice.call(e,0,i);this.color=Gr(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 a=n.sort().join("");if(!(a in Hr))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Hr[a];let{labels:o}=U[this.model],l=[];for(t=0;t<o.length;t++)l.push(e[o[t]]);this.color=Gr(l)}if(He[this.model])for(i=U[this.model].channels,t=0;t<i;t++){let n=He[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)}$.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let r=this.model in $e.to?this:this.rgb();r=r.round(typeof e=="number"?e:1);let t=r.valpha===1?r.color:[...r.color,this.valpha];return $e.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 $e.to.rgb.percent(...t)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:r}=U[this.model],{labels:t}=U[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 $([...this.color.map(El(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new $([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:I("rgb",0,k(255)),green:I("rgb",1,k(255)),blue:I("rgb",2,k(255)),hue:I(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:I("hsl",1,k(100)),lightness:I("hsl",2,k(100)),saturationv:I("hsv",1,k(100)),value:I("hsv",2,k(100)),chroma:I("hcg",1,k(100)),gray:I("hcg",2,k(100)),white:I("hwb",1,k(100)),wblack:I("hwb",2,k(100)),cyan:I("cmyk",0,k(100)),magenta:I("cmyk",1,k(100)),yellow:I("cmyk",2,k(100)),black:I("cmyk",3,k(100)),x:I("xyz",0,k(95.047)),y:I("xyz",1,k(100)),z:I("xyz",2,k(108.833)),l:I("lab",0,k(100)),a:I("lab",1),b:I("lab",2),keyword(e){return e!==void 0?new $(e):U[this.model].keyword(this.color)},hex(e){return e!==void 0?new $(e):$e.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new $(e);let r=this.rgb().round().color,t=Math.round(this.valpha*255).toString(16).toUpperCase();return t.length===1&&(t="0"+t),$e.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 $.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,a=2*n-1,o=t.alpha()-i.alpha(),l=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,h=1-l;return $.rgb(l*t.red()+h*i.red(),l*t.green()+h*i.green(),l*t.blue()+h*i.blue(),t.alpha()*n+i.alpha()*(1-n))}};for(let e of Object.keys(U)){if(bn.includes(e))continue;let{channels:r}=U[e];$.prototype[e]=function(...t){return this.model===e?new $(this):t.length>0?new $(t,e):new $([...vl(U[this.model][e].raw(this.color)),this.valpha],e)},$[e]=function(...t){let i=t[0];return typeof i=="number"&&(i=Gr(t,r)),new $(i,e)}}function yl(e,r){return Number(e.toFixed(r))}function El(e){return function(r){return yl(r,e)}}function I(e,r,t){e=Array.isArray(e)?e:[e];for(let i of e)(He[i]||(He[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 k(e){return function(r){return Math.max(0,Math.min(e,r))}}function vl(e){return Array.isArray(e)?e:[e]}function Gr(e,r){for(let t=0;t<r;t++)typeof e[t]!="number"&&(e[t]=0);return e}var Pl=$});var vn=E((hh,En)=>{"use strict";En.exports=yn().default});var In=E((uh,Rn)=>{"use strict";var xl=vn(),le=K(),Pn={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"};function Rl(e){return this._setBackgroundColourOption("tint",e),this}function Il(e){return this.options.greyscale=le.bool(e)?e:!0,this}function Sl(e){return this.greyscale(e)}function Al(e){if(!le.string(e))throw le.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function kl(e){return this.pipelineColourspace(e)}function Ll(e){if(!le.string(e))throw le.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function $l(e){return this.toColourspace(e)}function xn(e){if(le.object(e)||le.string(e)){let r=xl(e);return[r.red(),r.green(),r.blue(),Math.round(r.alpha()*255)]}else throw le.invalidParameterError("background","object or string",e)}function jl(e,r){le.defined(r)&&(this.options[e]=xn(r))}Rn.exports=function(e){Object.assign(e.prototype,{tint:Rl,greyscale:Il,grayscale:Sl,pipelineColourspace:Al,pipelineColorspace:kl,toColourspace:Ll,toColorspace:$l,_getBackgroundColourOption:xn,_setBackgroundColourOption:jl}),e.colourspace=Pn,e.colorspace=Pn}});var An=E((dh,Sn)=>{"use strict";var ie=K(),Tl={and:"and",or:"or",eor:"eor"};function Nl(){return this.options.removeAlpha=!0,this}function Cl(e){if(ie.defined(e))if(ie.number(e)&&ie.inRange(e,0,1))this.options.ensureAlpha=e;else throw ie.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function Bl(e){let r={red:0,green:1,blue:2,alpha:3};if(Object.keys(r).includes(e)&&(e=r[e]),ie.integer(e)&&ie.inRange(e,0,4))this.options.extractChannel=e;else throw ie.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function Fl(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 _l(e){if(ie.string(e)&&ie.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw ie.invalidParameterError("boolOp","one of: and, or, eor",e);return this}Sn.exports=function(e){Object.assign(e.prototype,{removeAlpha:Nl,ensureAlpha:Cl,extractChannel:Bl,joinChannel:Fl,bandbool:_l}),e.bool=Tl}});var Tn=E((mh,jn)=>{"use strict";var Xr=R("path"),s=K(),Ce=ze(),kn=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"]]),Ml=/\.(jp[2x]|j2[kc])$/i,Ln=()=>new Error("JP2 output requires libvips with support for OpenJPEG"),$n=e=>1<<31-Math.clz32(Math.ceil(Math.log2(e)));function ql(e,r){let t;if(s.string(e)?s.string(this.options.input.file)&&Xr.resolve(this.options.input.file)===Xr.resolve(e)?t=new Error("Cannot use same file for input and output"):Ml.test(Xr.extname(e))&&!this.constructor.format.jp2k.output.file&&(t=Ln()):t=new Error("Missing output file path"),t)if(s.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 Dl(e,r){s.object(e)?this._setBooleanOption("resolveWithObject",e.resolveWithObject):this.options.resolveWithObject&&(this.options.resolveWithObject=!1),this.options.fileOut="";let t=Error();return this._pipeline(s.fn(e)?e:r,t)}function Ol(){return this.options.keepMetadata|=1,this}function Ul(e){if(s.object(e))for(let[r,t]of Object.entries(e))if(s.object(t))for(let[i,n]of Object.entries(t))if(s.string(n))this.options.withExif[`exif-${r.toLowerCase()}-${i}`]=n;else throw s.invalidParameterError(`${r}.${i}`,"string",n);else throw s.invalidParameterError(r,"object",t);else throw s.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function zl(e){return this.withExif(e),this.options.withExifMerge=!0,this}function Hl(){return this.options.keepMetadata|=8,this}function Gl(e,r){if(s.string(e))this.options.withIccProfile=e;else throw s.invalidParameterError("icc","string",e);if(this.keepIccProfile(),s.object(r)&&s.defined(r.attach))if(s.bool(r.attach))r.attach||(this.options.keepMetadata&=-9);else throw s.invalidParameterError("attach","boolean",r.attach);return this}function Wl(){return this.options.keepMetadata|=2,this}function Xl(e){if(s.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw s.invalidParameterError("xmp","non-empty string",e);return this}function Vl(){return this.options.keepMetadata=31,this}function Ql(e){if(this.keepMetadata(),this.withIccProfile("srgb"),s.object(e)){if(s.defined(e.orientation))if(s.integer(e.orientation)&&s.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw s.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(s.defined(e.density))if(s.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw s.invalidParameterError("density","positive number",e.density);s.defined(e.icc)&&this.withIccProfile(e.icc),s.defined(e.exif)&&this.withExifMerge(e.exif)}return this}function Jl(e,r){let t=kn.get((s.object(e)&&s.string(e.id)?e.id:e).toLowerCase());if(!t)throw s.invalidParameterError("format",`one of: ${[...kn.keys()].join(", ")}`,e);return this[t](r)}function Kl(e){if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.progressive)&&this._setBooleanOption("jpegProgressive",e.progressive),s.defined(e.chromaSubsampling))if(s.string(e.chromaSubsampling)&&s.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw s.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let r=s.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(s.defined(r)&&this._setBooleanOption("jpegOptimiseCoding",r),s.defined(e.mozjpeg))if(s.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 s.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let t=s.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;s.defined(t)&&this._setBooleanOption("jpegTrellisQuantisation",t),s.defined(e.overshootDeringing)&&this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let i=s.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;s.defined(i)&&(this._setBooleanOption("jpegOptimiseScans",i),i&&(this.options.jpegProgressive=!0));let n=s.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(s.defined(n))if(s.integer(n)&&s.inRange(n,0,8))this.options.jpegQuantisationTable=n;else throw s.invalidParameterError("quantisationTable","integer between 0 and 8",n)}return this._updateFormatOut("jpeg",e)}function Yl(e){if(s.object(e)){if(s.defined(e.progressive)&&this._setBooleanOption("pngProgressive",e.progressive),s.defined(e.compressionLevel))if(s.integer(e.compressionLevel)&&s.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw s.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);s.defined(e.adaptiveFiltering)&&this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let r=e.colours||e.colors;if(s.defined(r))if(s.integer(r)&&s.inRange(r,2,256))this.options.pngBitdepth=$n(r);else throw s.invalidParameterError("colours","integer between 2 and 256",r);if(s.defined(e.palette)?this._setBooleanOption("pngPalette",e.palette):[e.quality,e.effort,e.colours,e.colors,e.dither].some(s.defined)&&this._setBooleanOption("pngPalette",!0),this.options.pngPalette){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw s.invalidParameterError("quality","integer between 0 and 100",e.quality);if(s.defined(e.effort))if(s.integer(e.effort)&&s.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw s.invalidParameterError("effort","integer between 1 and 10",e.effort);if(s.defined(e.dither))if(s.number(e.dither)&&s.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw s.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function Zl(e){if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.alphaQuality))if(s.integer(e.alphaQuality)&&s.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw s.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(s.defined(e.lossless)&&this._setBooleanOption("webpLossless",e.lossless),s.defined(e.nearLossless)&&this._setBooleanOption("webpNearLossless",e.nearLossless),s.defined(e.smartSubsample)&&this._setBooleanOption("webpSmartSubsample",e.smartSubsample),s.defined(e.smartDeblock)&&this._setBooleanOption("webpSmartDeblock",e.smartDeblock),s.defined(e.preset))if(s.string(e.preset)&&s.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw s.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(s.defined(e.effort))if(s.integer(e.effort)&&s.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw s.invalidParameterError("effort","integer between 0 and 6",e.effort);s.defined(e.minSize)&&this._setBooleanOption("webpMinSize",e.minSize),s.defined(e.mixed)&&this._setBooleanOption("webpMixed",e.mixed)}return Vr(e,this.options),this._updateFormatOut("webp",e)}function ec(e){if(s.object(e)){s.defined(e.reuse)&&this._setBooleanOption("gifReuse",e.reuse),s.defined(e.progressive)&&this._setBooleanOption("gifProgressive",e.progressive);let r=e.colours||e.colors;if(s.defined(r))if(s.integer(r)&&s.inRange(r,2,256))this.options.gifBitdepth=$n(r);else throw s.invalidParameterError("colours","integer between 2 and 256",r);if(s.defined(e.effort))if(s.number(e.effort)&&s.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw s.invalidParameterError("effort","integer between 1 and 10",e.effort);if(s.defined(e.dither))if(s.number(e.dither)&&s.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw s.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(s.defined(e.interFrameMaxError))if(s.number(e.interFrameMaxError)&&s.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw s.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(s.defined(e.interPaletteMaxError))if(s.number(e.interPaletteMaxError)&&s.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw s.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(s.defined(e.keepDuplicateFrames))if(s.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw s.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return Vr(e,this.options),this._updateFormatOut("gif",e)}function rc(e){if(!this.constructor.format.jp2k.output.buffer)throw Ln();if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.lossless))if(s.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw s.invalidParameterError("lossless","boolean",e.lossless);if(s.defined(e.tileWidth))if(s.integer(e.tileWidth)&&s.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw s.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(s.defined(e.tileHeight))if(s.integer(e.tileHeight)&&s.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw s.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(s.defined(e.chromaSubsampling))if(s.string(e.chromaSubsampling)&&s.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw s.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function Vr(e,r){if(s.object(e)&&s.defined(e.loop))if(s.integer(e.loop)&&s.inRange(e.loop,0,65535))r.loop=e.loop;else throw s.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(s.object(e)&&s.defined(e.delay))if(s.integer(e.delay)&&s.inRange(e.delay,0,65535))r.delay=[e.delay];else if(Array.isArray(e.delay)&&e.delay.every(s.integer)&&e.delay.every(t=>s.inRange(t,0,65535)))r.delay=e.delay;else throw s.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function tc(e){if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.bitdepth))if(s.integer(e.bitdepth)&&s.inArray(e.bitdepth,[1,2,4,8]))this.options.tiffBitdepth=e.bitdepth;else throw s.invalidParameterError("bitdepth","1, 2, 4 or 8",e.bitdepth);if(s.defined(e.tile)&&this._setBooleanOption("tiffTile",e.tile),s.defined(e.tileWidth))if(s.integer(e.tileWidth)&&e.tileWidth>0)this.options.tiffTileWidth=e.tileWidth;else throw s.invalidParameterError("tileWidth","integer greater than zero",e.tileWidth);if(s.defined(e.tileHeight))if(s.integer(e.tileHeight)&&e.tileHeight>0)this.options.tiffTileHeight=e.tileHeight;else throw s.invalidParameterError("tileHeight","integer greater than zero",e.tileHeight);if(s.defined(e.miniswhite)&&this._setBooleanOption("tiffMiniswhite",e.miniswhite),s.defined(e.pyramid)&&this._setBooleanOption("tiffPyramid",e.pyramid),s.defined(e.xres))if(s.number(e.xres)&&e.xres>0)this.options.tiffXres=e.xres;else throw s.invalidParameterError("xres","number greater than zero",e.xres);if(s.defined(e.yres))if(s.number(e.yres)&&e.yres>0)this.options.tiffYres=e.yres;else throw s.invalidParameterError("yres","number greater than zero",e.yres);if(s.defined(e.compression))if(s.string(e.compression)&&s.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw s.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(s.defined(e.predictor))if(s.string(e.predictor)&&s.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw s.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(s.defined(e.resolutionUnit))if(s.string(e.resolutionUnit)&&s.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw s.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function ic(e){return this.heif({...e,compression:"av1"})}function nc(e){if(s.object(e)){if(s.string(e.compression)&&s.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw s.invalidParameterError("compression","one of: av1, hevc",e.compression);if(s.defined(e.quality))if(s.integer(e.quality)&&s.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw s.invalidParameterError("quality","integer between 1 and 100",e.quality);if(s.defined(e.lossless))if(s.bool(e.lossless))this.options.heifLossless=e.lossless;else throw s.invalidParameterError("lossless","boolean",e.lossless);if(s.defined(e.effort))if(s.integer(e.effort)&&s.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw s.invalidParameterError("effort","integer between 0 and 9",e.effort);if(s.defined(e.chromaSubsampling))if(s.string(e.chromaSubsampling)&&s.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw s.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(s.defined(e.bitdepth))if(s.integer(e.bitdepth)&&s.inArray(e.bitdepth,[8,10,12])){if(e.bitdepth!==8&&this.constructor.versions.heif)throw s.invalidParameterError("bitdepth when using prebuilt binaries",8,e.bitdepth);this.options.heifBitdepth=e.bitdepth}else throw s.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth)}else throw s.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function ac(e){if(s.object(e)){if(s.defined(e.quality))if(s.integer(e.quality)&&s.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 s.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(s.defined(e.distance))if(s.number(e.distance)&&s.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw s.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(s.defined(e.decodingTier))if(s.integer(e.decodingTier)&&s.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw s.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(s.defined(e.lossless))if(s.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw s.invalidParameterError("lossless","boolean",e.lossless);if(s.defined(e.effort))if(s.integer(e.effort)&&s.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw s.invalidParameterError("effort","integer between 1 and 9",e.effort)}return Vr(e,this.options),this._updateFormatOut("jxl",e)}function sc(e){if(s.object(e)&&s.defined(e.depth))if(s.string(e.depth)&&s.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw s.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth);return this._updateFormatOut("raw")}function oc(e){if(s.object(e)){if(s.defined(e.size))if(s.integer(e.size)&&s.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw s.invalidParameterError("size","integer between 1 and 8192",e.size);if(s.defined(e.overlap))if(s.integer(e.overlap)&&s.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw s.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw s.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(s.defined(e.container))if(s.string(e.container)&&s.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw s.invalidParameterError("container","one of: fs, zip",e.container);if(s.defined(e.layout))if(s.string(e.layout)&&s.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw s.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(s.defined(e.angle))if(s.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw s.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),s.defined(e.depth))if(s.string(e.depth)&&s.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw s.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(s.defined(e.skipBlanks))if(s.integer(e.skipBlanks)&&s.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw s.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else s.defined(e.layout)&&e.layout==="google"&&(this.options.tileSkipBlanks=5);let r=s.bool(e.center)?e.center:e.centre;if(s.defined(r)&&this._setBooleanOption("tileCentre",r),s.defined(e.id))if(s.string(e.id))this.options.tileId=e.id;else throw s.invalidParameterError("id","string",e.id);if(s.defined(e.basename))if(s.string(e.basename))this.options.tileBasename=e.basename;else throw s.invalidParameterError("basename","string",e.basename)}if(s.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw s.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function lc(e){if(!s.plainObject(e))throw s.invalidParameterError("options","object",e);if(s.integer(e.seconds)&&s.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw s.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function cc(e,r){return s.object(r)&&r.force===!1||(this.options.formatOut=e),this}function fc(e,r){if(s.bool(r))this.options[e]=r;else throw s.invalidParameterError(e,"boolean",r)}function hc(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function uc(e,r){return typeof e=="function"?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),Ce.pipeline(this.options,(t,i,n)=>{t?e(s.nativeError(t,r)):e(null,i,n)})}):Ce.pipeline(this.options,(t,i,n)=>{t?e(s.nativeError(t,r)):e(null,i,n)}),this):this.options.streamOut?(this._isStreamInput()?(this.once("finish",()=>{this._flattenBufferIn(),Ce.pipeline(this.options,(t,i,n)=>{t?this.emit("error",s.nativeError(t,r)):(this.emit("info",n),this.push(i)),this.push(null),this.on("end",()=>this.emit("close"))})}),this.streamInFinished&&this.emit("finish")):Ce.pipeline(this.options,(t,i,n)=>{t?this.emit("error",s.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(),Ce.pipeline(this.options,(n,a,o)=>{n?i(s.nativeError(n,r)):this.options.resolveWithObject?t({data:a,info:o}):t(a)})})}):new Promise((t,i)=>{Ce.pipeline(this.options,(n,a,o)=>{n?i(s.nativeError(n,r)):this.options.resolveWithObject?t({data:a,info:o}):t(a)})})}jn.exports=function(e){Object.assign(e.prototype,{toFile:ql,toBuffer:Dl,keepExif:Ol,withExif:Ul,withExifMerge:zl,keepIccProfile:Hl,withIccProfile:Gl,keepXmp:Wl,withXmp:Xl,keepMetadata:Vl,withMetadata:Ql,toFormat:Jl,jpeg:Kl,jp2:rc,png:Yl,webp:Zl,tiff:tc,avif:ic,heif:nc,jxl:ac,gif:ec,raw:sc,tile:oc,timeout:lc,_updateFormatOut:cc,_setBooleanOption:fc,_read:hc,_pipeline:uc})}});var Fn=E((gh,Bn)=>{"use strict";var dc=R("events"),gr=tr(),X=K(),{runtimePlatformArch:mc}=Mr(),F=ze(),Nn=mc(),Qr=F.libvipsVersion(),me=F.format();me.heif.output.alias=["avif","heic"];me.jpeg.output.alias=["jpe","jpg"];me.tiff.output.alias=["tif"];me.jp2k.output.alias=["j2c","j2k","jp2","jpx"];var gc={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},Be={vips:Qr.semver};if(!Qr.isGlobal)if(Qr.isWasm)try{Be=R("@img/sharp-wasm32/versions")}catch{}else try{Be=R(`@img/sharp-${Nn}/versions`)}catch{try{Be=R(`@img/sharp-libvips-${Nn}/versions`)}catch{}}Be.sharp=Fr().version;Be.heif&&me.heif&&(me.heif.input.fileSuffix=[".avif"],me.heif.output.alias=["avif"]);function Cn(e){return X.bool(e)?e?F.cache(50,20,100):F.cache(0,0,0):X.object(e)?F.cache(e.memory,e.files,e.items):F.cache()}Cn(!0);function pc(e){return F.concurrency(X.integer(e)?e:null)}gr.familySync()===gr.GLIBC&&!F._isUsingJemalloc()?F.concurrency(1):gr.familySync()===gr.MUSL&&F.concurrency()===1024&&F.concurrency(R("os").availableParallelism());var bc=new dc.EventEmitter;function wc(){return F.counters()}function yc(e){return F.simd(X.bool(e)?e:null)}function Ec(e){if(X.object(e))if(Array.isArray(e.operation)&&e.operation.every(X.string))F.block(e.operation,!0);else throw X.invalidParameterError("operation","Array<string>",e.operation);else throw X.invalidParameterError("options","object",e)}function vc(e){if(X.object(e))if(Array.isArray(e.operation)&&e.operation.every(X.string))F.block(e.operation,!1);else throw X.invalidParameterError("operation","Array<string>",e.operation);else throw X.invalidParameterError("options","object",e)}Bn.exports=function(e){e.cache=Cn,e.concurrency=pc,e.counters=wc,e.simd=yc,e.format=me,e.interpolators=gc,e.versions=Be,e.queue=bc,e.block=Ec,e.unblock=vc}});var Mn=E((bh,_n)=>{"use strict";var ce=Ji();Zi()(ce);sn()(ce);ln()(ce);dn()(ce);In()(ce);An()(ce);Tn()(ce);Fn()(ce);_n.exports=ce});import Yn from"http";import Zn from"https";import xe from"zlib";import bt,{PassThrough as wt,pipeline as Re}from"stream";import{Buffer as Ke}from"buffer";function Un(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,a=t[0]||"text/plain",o=a;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",h=unescape(e.substring(r+1)),u=Buffer.from(h,l);return u.type=a,u.typeFull=o,u.charset=i,u}var Zr=Un;import fe,{PassThrough as it}from"stream";import{types as nt,deprecate as Er,promisify as zn}from"util";import{Buffer as G}from"buffer";var ae=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 _=class extends ae{constructor(r,t,i){super(r,t),i&&(this.code=this.errno=i.code,this.erroredSysCall=i.syscall)}};var Ge=Symbol.toStringTag,wr=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[Ge]==="URLSearchParams",_e=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[Ge]),et=e=>typeof e=="object"&&(e[Ge]==="AbortSignal"||e[Ge]==="EventTarget"),rt=(e,r)=>{let t=new URL(r).hostname,i=new URL(e).hostname;return t===i||t.endsWith(`.${i}`)},tt=(e,r)=>{let t=new URL(r).protocol,i=new URL(e).protocol;return t===i};var Hn=zn(fe.pipeline),M=Symbol("Body internals"),J=class{constructor(r,{size:t=0}={}){let i=null;r===null?r=null:wr(r)?r=G.from(r.toString()):_e(r)||G.isBuffer(r)||(nt.isAnyArrayBuffer(r)?r=G.from(r):ArrayBuffer.isView(r)?r=G.from(r.buffer,r.byteOffset,r.byteLength):r instanceof fe||(r instanceof Fe?(r=Yr(r),i=r.type.split("=")[1]):r=G.from(String(r))));let n=r;G.isBuffer(r)?n=fe.Readable.from(r):_e(r)&&(n=fe.Readable.from(r.stream())),this[M]={body:r,stream:n,boundary:i,disturbed:!1,error:null},this.size=t,r instanceof fe&&r.on("error",a=>{let o=a instanceof ae?a:new _(`Invalid response body while trying to fetch ${this.url}: ${a.message}`,"system",a);this[M].error=o})}get body(){return this[M].stream}get bodyUsed(){return this[M].disturbed}async arrayBuffer(){let{buffer:r,byteOffset:t,byteLength:i}=await yr(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 Fe,n=new URLSearchParams(await this.text());for(let[a,o]of n)i.append(a,o);return i}let{toFormData:t}=await import("./multipart-parser-RNULNBMT.mjs");return t(this.body,r)}async blob(){let r=this.headers&&this.headers.get("content-type")||this[M].body&&this[M].body.type||"",t=await this.arrayBuffer();return new br([t],{type:r})}async json(){let r=await this.text();return JSON.parse(r)}async text(){let r=await yr(this);return new TextDecoder().decode(r)}buffer(){return yr(this)}};J.prototype.buffer=Er(J.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(J.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:Er(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function yr(e){if(e[M].disturbed)throw new TypeError(`body used already for: ${e.url}`);if(e[M].disturbed=!0,e[M].error)throw e[M].error;let{body:r}=e;if(r===null)return G.alloc(0);if(!(r instanceof fe))return G.alloc(0);let t=[],i=0;try{for await(let n of r){if(e.size>0&&i+n.length>e.size){let a=new _(`content size at ${e.url} over limit: ${e.size}`,"max-size");throw r.destroy(a),a}i+=n.length,t.push(n)}}catch(n){throw n instanceof ae?n:new _(`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")?G.from(t.join("")):G.concat(t,i)}catch(n){throw new _(`Could not create Buffer from response body for ${e.url}: ${n.message}`,"system",n)}else throw new _(`Premature close of server response while trying to fetch ${e.url}`)}var ve=(e,r)=>{let t,i,{body:n}=e[M];if(e.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof fe&&typeof n.getBoundary!="function"&&(t=new it({highWaterMark:r}),i=new it({highWaterMark:r}),n.pipe(t),n.pipe(i),e[M].stream=t,n=i),n},Gn=Er(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"),We=(e,r)=>e===null?null:typeof e=="string"?"text/plain;charset=UTF-8":wr(e)?"application/x-www-form-urlencoded;charset=UTF-8":_e(e)?e.type||null:G.isBuffer(e)||nt.isAnyArrayBuffer(e)||ArrayBuffer.isView(e)?null:e instanceof Fe?`multipart/form-data; boundary=${r[M].boundary}`:e&&typeof e.getBoundary=="function"?`multipart/form-data;boundary=${Gn(e)}`:e instanceof fe?null:"text/plain;charset=UTF-8",at=e=>{let{body:r}=e[M];return r===null?0:_e(r)?r.size:G.isBuffer(r)?r.length:r&&typeof r.getLengthSync=="function"&&r.hasKnownLength&&r.hasKnownLength()?r.getLengthSync():null},st=async(e,{body:r})=>{r===null?e.end():await Hn(r,e)};import{types as ot}from"util";import Ve from"http";var Xe=typeof Ve.validateHeaderName=="function"?Ve.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}},vr=typeof Ve.validateHeaderValue=="function"?Ve.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}},O=class e extends URLSearchParams{constructor(r){let t=[];if(r instanceof e){let i=r.raw();for(let[n,a]of Object.entries(i))t.push(...a.map(o=>[n,o]))}else if(r!=null)if(typeof r=="object"&&!ot.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"||ot.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])=>(Xe(i),vr(i,String(n)),[String(i).toLowerCase(),String(n)])):void 0,super(t),new Proxy(this,{get(i,n,a){switch(n){case"append":case"set":return(o,l)=>(Xe(o),vr(o,String(l)),URLSearchParams.prototype[n].call(i,String(o).toLowerCase(),String(l)));case"delete":case"has":case"getAll":return o=>(Xe(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,a)}}})}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(O.prototype,["get","entries","forEach","values"].reduce((e,r)=>(e[r]={enumerable:!0},e),{}));function lt(e=[]){return new O(e.reduce((r,t,i,n)=>(i%2===0&&r.push(n.slice(i,i+2)),r),[]).filter(([r,t])=>{try{return Xe(r),vr(r,String(t)),!0}catch{return!1}}))}var Wn=new Set([301,302,303,307,308]),Qe=e=>Wn.has(e);var V=Symbol("Response internals"),W=class e extends J{constructor(r=null,t={}){super(r,t);let i=t.status!=null?t.status:200,n=new O(t.headers);if(r!==null&&!n.has("Content-Type")){let a=We(r,this);a&&n.append("Content-Type",a)}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(ve(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(!Qe(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 O(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 Qn}from"url";import{deprecate as Jn}from"util";var ct=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 Xn}from"net";function ft(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 ht=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),ut="strict-origin-when-cross-origin";function dt(e){if(!ht.has(e))throw new TypeError(`Invalid referrerPolicy: ${e}`);return e}function Vn(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let r=e.host.replace(/(^\[)|(]$)/g,""),t=Xn(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 Pe(e){return/^about:(blank|srcdoc)$/.test(e)||e.protocol==="data:"||/^(blob|filesystem):$/.test(e.protocol)?!0:Vn(e)}function mt(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,a=ft(n),o=ft(n,!0);a.toString().length>4096&&(a=o),r&&(a=r(a)),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 a;case"strict-origin":return Pe(a)&&!Pe(l)?"no-referrer":o.toString();case"strict-origin-when-cross-origin":return a.origin===l.origin?a:Pe(a)&&!Pe(l)?"no-referrer":o;case"same-origin":return a.origin===l.origin?a:"no-referrer";case"origin-when-cross-origin":return a.origin===l.origin?a:o;case"no-referrer-when-downgrade":return Pe(a)&&!Pe(l)?"no-referrer":a;default:throw new TypeError(`Invalid referrerPolicy: ${i}`)}}function gt(e){let r=(e.get("referrer-policy")||"").split(/[,\s]+/),t="";for(let i of r)i&&ht.has(i)&&(t=i);return t}var L=Symbol("Request internals"),Me=e=>typeof e=="object"&&typeof e[L]=="object",Kn=Jn(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),ge=class e extends J{constructor(r,t={}){let i;if(Me(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()),!Me(t)&&"data"in t&&Kn(),(t.body!=null||Me(r)&&r.body!==null)&&(n==="GET"||n==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let a=t.body?t.body:Me(r)&&r.body!==null?ve(r):null;super(a,{size:t.size||r.size||0});let o=new O(t.headers||r.headers||{});if(a!==null&&!o.has("Content-Type")){let u=We(a,this);u&&o.set("Content-Type",u)}let l=Me(r)?r.signal:null;if("signal"in t&&(l=t.signal),l!=null&&!et(l))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let h=t.referrer==null?r.referrer:t.referrer;if(h==="")h="no-referrer";else if(h){let u=new URL(h);h=/^about:(\/\/)?client$/.test(u)?"client":u}else h=void 0;this[L]={method:n,redirect:t.redirect||r.redirect||"follow",headers:o,parsedURL:i,signal:l,referrer:h},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[L].method}get url(){return Qn(this[L].parsedURL)}get headers(){return this[L].headers}get redirect(){return this[L].redirect}get signal(){return this[L].signal}get referrer(){if(this[L].referrer==="no-referrer")return"";if(this[L].referrer==="client")return"about:client";if(this[L].referrer)return this[L].referrer.toString()}get referrerPolicy(){return this[L].referrerPolicy}set referrerPolicy(r){this[L].referrerPolicy=dt(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 pt=e=>{let{parsedURL:r}=e[L],t=new O(e[L].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=at(e);typeof l=="number"&&!Number.isNaN(l)&&(i=String(l))}i&&t.set("Content-Length",i),e.referrerPolicy===""&&(e.referrerPolicy=ut),e.referrer&&e.referrer!=="no-referrer"?e[L].referrer=mt(e):e[L].referrer="no-referrer",e[L].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 a=ct(r),o={path:r.pathname+a,method:e.method,headers:t[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:e.insecureHTTPParser,agent:n};return{parsedURL:r,options:o}};var Je=class extends ae{constructor(r,t="aborted"){super(r,t)}};var ea=new Set(["data:","http:","https:"]);async function Ye(e,r){return new Promise((t,i)=>{let n=new ge(e,r),{parsedURL:a,options:o}=pt(n);if(!ea.has(a.protocol))throw new TypeError(`node-fetch cannot load ${e}. URL scheme "${a.protocol.replace(/:$/,"")}" is not supported.`);if(a.protocol==="data:"){let v=Zr(n.url),T=new W(v,{headers:{"Content-Type":v.typeFull}});t(T);return}let l=(a.protocol==="https:"?Zn:Yn).request,{signal:h}=n,u=null,b=()=>{let v=new Je("The operation was aborted.");i(v),n.body&&n.body instanceof bt.Readable&&n.body.destroy(v),!(!u||!u.body)&&u.body.emit("error",v)};if(h&&h.aborted){b();return}let w=()=>{b(),D()},S=l(a.toString(),o);h&&h.addEventListener("abort",w);let D=()=>{S.abort(),h&&h.removeEventListener("abort",w)};S.on("error",v=>{i(new _(`request to ${n.url} failed, reason: ${v.message}`,"system",v)),D()}),ra(S,v=>{u&&u.body&&u.body.destroy(v)}),process.version<"v14"&&S.on("socket",v=>{let T;v.prependListener("end",()=>{T=v._eventsCount}),v.prependListener("close",A=>{if(u&&T<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 T=lt(v.rawHeaders);if(Qe(v.statusCode)){let N=T.get("Location"),Q=null;try{Q=N===null?null:new URL(N,n.url)}catch{if(n.redirect!=="manual"){i(new _(`uri requested responds with an invalid redirect URL: ${N}`,"invalid-redirect")),D();return}}switch(n.redirect){case"error":i(new _(`uri requested responds with a redirect, redirect mode is set to error: ${n.url}`,"no-redirect")),D();return;case"manual":break;case"follow":{if(Q===null)break;if(n.counter>=n.follow){i(new _(`maximum redirect reached at: ${n.url}`,"max-redirect")),D();return}let H={headers:new O(n.headers),follow:n.follow,counter:n.counter+1,agent:n.agent,compress:n.compress,method:n.method,body:ve(n),signal:n.signal,size:n.size,referrer:n.referrer,referrerPolicy:n.referrerPolicy};if(!rt(n.url,Q)||!tt(n.url,Q))for(let Dn of["authorization","www-authenticate","cookie","cookie2"])H.headers.delete(Dn);if(v.statusCode!==303&&n.body&&r.body instanceof bt.Readable){i(new _("Cannot follow redirect with body being a readable stream","unsupported-redirect")),D();return}(v.statusCode===303||(v.statusCode===301||v.statusCode===302)&&n.method==="POST")&&(H.method="GET",H.body=void 0,H.headers.delete("content-length"));let Kr=gt(T);Kr&&(H.referrerPolicy=Kr),t(Ye(new ge(Q,H))),D();return}default:return i(new TypeError(`Redirect option '${n.redirect}' is not a valid value of RequestRedirect`))}}h&&v.once("end",()=>{h.removeEventListener("abort",w)});let A=Re(v,new wt,N=>{N&&i(N)});process.version<"v12.10"&&v.on("aborted",w);let z={url:n.url,status:v.statusCode,statusText:v.statusMessage,headers:T,size:n.size,counter:n.counter,highWaterMark:n.highWaterMark},ne=T.get("Content-Encoding");if(!n.compress||n.method==="HEAD"||ne===null||v.statusCode===204||v.statusCode===304){u=new W(A,z),t(u);return}let qn={flush:xe.Z_SYNC_FLUSH,finishFlush:xe.Z_SYNC_FLUSH};if(ne==="gzip"||ne==="x-gzip"){A=Re(A,xe.createGunzip(qn),N=>{N&&i(N)}),u=new W(A,z),t(u);return}if(ne==="deflate"||ne==="x-deflate"){let N=Re(v,new wt,Q=>{Q&&i(Q)});N.once("data",Q=>{(Q[0]&15)===8?A=Re(A,xe.createInflate(),H=>{H&&i(H)}):A=Re(A,xe.createInflateRaw(),H=>{H&&i(H)}),u=new W(A,z),t(u)}),N.once("end",()=>{u||(u=new W(A,z),t(u))});return}if(ne==="br"){A=Re(A,xe.createBrotliDecompress(),N=>{N&&i(N)}),u=new W(A,z),t(u);return}u=new W(A,z),t(u)}),st(S,n).catch(i)})}function ra(e,r){let t=Ke.from(`0\r
3
3
  \r
4
- `),i=!1,n=!1,a;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)}},h=u=>{n=Ye.compare(u.slice(-5),t)===0,!n&&a&&(n=Ye.compare(a.slice(-3),t.slice(0,3))===0&&Ye.compare(u.slice(-2),t.slice(3))===0),a=u};o.prependListener("close",l),o.on("data",h),e.on("close",()=>{o.removeListener("close",l),o.removeListener("data",h)})})}var br=On(Mn()),Jr=["jpg","gif","png"],Pc=async(e,r)=>{var u,b,w;let t=(0,br.default)(e),i=await t.metadata(),n=(u=i.width)!=null?u:100,a=(b=i.height)!=null?b:100,o=e.split(";")[0].split("/")[1];if(Jr.includes(o))return{type:o,data:e,transformation:{width:n,height:a}};let l=(w=r==null?void 0:r.fallbackImageType)!=null?w:"png",h={data:await t.toFormat(l).toBuffer(),type:l,transformation:{width:n,height:a}};return e.includes("svg")?{...h,type:"svg",data:e,fallback:{type:l,data:h.data}}:h},xc=async(e,r)=>{var o,l,h,u,b,w,S,D;let t,i,n;if(e.startsWith("http")){let v=await Ze(e),j=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,br.default)(j);let ne=await t.metadata();if(i=(h=ne.width)!=null?h:100,n=(u=ne.height)!=null?u:100,Jr.includes(z))return{type:z,data:j,transformation:{width:i,height:n}}}else{let v=(b=r==null?void 0:r.pathPrefix)!=null?b:"";t=(0,br.default)(v+e);let j=await t.metadata();i=(w=j.width)!=null?w:100,n=(S=j.height)!=null?S:100;let A=e.split(".").pop();if(Jr.includes(A))return{type:A,data:await t.toBuffer(),transformation:{width:i,height:n}}}let a=(D=r==null?void 0:r.fallbackImageType)!=null?D:"png";return{data:await t.toFormat(a).toBuffer(),type:a,transformation:{width:i,height:n}}},Rc=async(e,r)=>{try{return e.startsWith("data:")?await Pc(e,r):await xc(e,r)}catch(t){return console.error(`Error resolving image: ${e}`,t),{type:"png",data:Buffer.from([]),transformation:{width:100,height:100}}}},yh=e=>({preprocess:async(t,i)=>{let n=[],a=o=>{var l;(l=o.children)==null||l.forEach(a),/^image/.test(o.type)&&n.push((async()=>{var b,w,S,D;let h=(w=o.url)!=null?w:i[(b=o.identifier)==null?void 0:b.toUpperCase()],u=(S=o.alt)!=null?S:h==null?void 0:h.split("/").pop();o.data={...await((D=e==null?void 0:e.imageResolver)!=null?D:Rc)(h,e),altText:{description:u,name:u,title:u},...o.data}})())};a(t)},inline:(t,i,n)=>/^(image|svg)/.test(i.type)?[new t.ImageRun({...data,...n})]:[]});export{Jr as a,yh as b};
4
+ `),i=!1,n=!1,a;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)}},h=u=>{n=Ke.compare(u.slice(-5),t)===0,!n&&a&&(n=Ke.compare(a.slice(-3),t.slice(0,3))===0&&Ke.compare(u.slice(-2),t.slice(3))===0),a=u};o.prependListener("close",l),o.on("data",h),e.on("close",()=>{o.removeListener("close",l),o.removeListener("data",h)})})}var pr=On(Mn()),Jr=["jpg","gif","png"],Pc=async(e,r)=>{var u,b,w;let t=(0,pr.default)(e),i=await t.metadata(),n=(u=i.width)!=null?u:100,a=(b=i.height)!=null?b:100,o=e.split(";")[0].split("/")[1];if(Jr.includes(o))return{type:o,data:e,transformation:{width:n,height:a}};let l=(w=r==null?void 0:r.fallbackImageType)!=null?w:"png",h={data:await t.toFormat(l).toBuffer(),type:l,transformation:{width:n,height:a}};return e.includes("svg")?{...h,type:"svg",data:e,fallback:{type:l,data:h.data}}:h},xc=async(e,r)=>{var o,l,h,u,b,w,S,D;let t,i,n;if(e.startsWith("http")){let v=await Ye(e),T=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,pr.default)(T);let ne=await t.metadata();if(i=(h=ne.width)!=null?h:100,n=(u=ne.height)!=null?u:100,Jr.includes(z))return{type:z,data:T,transformation:{width:i,height:n}}}else{let v=(b=r==null?void 0:r.pathPrefix)!=null?b:"";t=(0,pr.default)(v+e);let T=await t.metadata();i=(w=T.width)!=null?w:100,n=(S=T.height)!=null?S:100;let A=e.split(".").pop();if(Jr.includes(A))return{type:A,data:await t.toBuffer(),transformation:{width:i,height:n}}}let a=(D=r==null?void 0:r.fallbackImageType)!=null?D:"png";return{data:await t.toFormat(a).toBuffer(),type:a,transformation:{width:i,height:n}}},Rc=async(e,r)=>{try{return e.startsWith("data:")?await Pc(e,r):await xc(e,r)}catch(t){return console.error(`Error resolving image: ${e}`,t),{type:"png",data:Buffer.from([]),transformation:{width:100,height:100}}}},yh=e=>({preprocess:async(t,i)=>{let n=[],a=o=>{var l;(l=o.children)==null||l.forEach(a),/^image/.test(o.type)&&n.push((async()=>{var b,w,S,D;let h=(w=o.url)!=null?w:i[(b=o.identifier)==null?void 0:b.toUpperCase()],u=(S=o.alt)!=null?S:h==null?void 0:h.split("/").pop();o.data={...await((D=e==null?void 0:e.imageResolver)!=null?D:Rc)(h,e),altText:{description:u,name:u,title:u},...o.data}})())};a(t)},inline:(t,i,n)=>/^(image|svg)/.test(i.type)?[new t.ImageRun({...data,...n})]:[]});export{Jr as a,yh as b};