gemi 0.12.3 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/index.js +2 -2
- package/dist/app/index.js.map +1 -1
- package/dist/broadcasting/index.js +1 -1
- package/dist/{chunk-ewrksas7.js → chunk-0rtwd9ea.js} +4 -4
- package/dist/{chunk-ewrksas7.js.map → chunk-0rtwd9ea.js.map} +4 -3
- package/dist/{chunk-9c46kaww.js → chunk-1w4afpqd.js} +2 -2
- package/dist/{chunk-9c46kaww.js.map → chunk-1w4afpqd.js.map} +1 -1
- package/dist/{chunk-tx3qz6jy.js → chunk-27j91kyq.js} +2 -2
- package/dist/{chunk-tx3qz6jy.js.map → chunk-27j91kyq.js.map} +1 -1
- package/dist/{chunk-c3s0zqhy.js → chunk-2wke21e9.js} +2 -2
- package/dist/{chunk-c3s0zqhy.js.map → chunk-2wke21e9.js.map} +1 -1
- package/dist/{chunk-yw1mdgrb.js → chunk-5fcthq4e.js} +3 -3
- package/dist/{chunk-yw1mdgrb.js.map → chunk-5fcthq4e.js.map} +1 -1
- package/dist/{chunk-t178nep3.js → chunk-801pqypm.js} +3 -3
- package/dist/{chunk-t178nep3.js.map → chunk-801pqypm.js.map} +1 -1
- package/dist/{chunk-y2gtgz8c.js → chunk-82see49m.js} +2 -2
- package/dist/{chunk-y2gtgz8c.js.map → chunk-82see49m.js.map} +1 -1
- package/dist/{chunk-12nvz3n7.js → chunk-8dsam5f6.js} +3 -3
- package/dist/{chunk-12nvz3n7.js.map → chunk-8dsam5f6.js.map} +1 -1
- package/dist/{chunk-ebcx322z.js → chunk-bzp23bra.js} +2 -2
- package/dist/{chunk-ebcx322z.js.map → chunk-bzp23bra.js.map} +1 -1
- package/dist/{chunk-wd2wkvxz.js → chunk-fpftvczd.js} +2 -2
- package/dist/{chunk-wd2wkvxz.js.map → chunk-fpftvczd.js.map} +1 -1
- package/dist/{chunk-gbp46nbz.js → chunk-ft9mptg7.js} +2 -2
- package/dist/{chunk-gbp46nbz.js.map → chunk-ft9mptg7.js.map} +1 -1
- package/dist/{chunk-fda4adwp.js → chunk-fzyhqsqy.js} +2 -2
- package/dist/{chunk-fda4adwp.js.map → chunk-fzyhqsqy.js.map} +1 -1
- package/dist/{chunk-nr1djc8r.js → chunk-g0q45qwx.js} +3 -3
- package/dist/{chunk-nr1djc8r.js.map → chunk-g0q45qwx.js.map} +1 -1
- package/dist/{chunk-y5y3jm01.js → chunk-gsdcedtb.js} +2 -2
- package/dist/{chunk-y5y3jm01.js.map → chunk-gsdcedtb.js.map} +1 -1
- package/dist/{chunk-mq3c10sr.js → chunk-hz96b26e.js} +2 -2
- package/dist/{chunk-mq3c10sr.js.map → chunk-hz96b26e.js.map} +1 -1
- package/dist/{chunk-3wejx7q4.js → chunk-jj78f6qs.js} +2 -2
- package/dist/{chunk-3wejx7q4.js.map → chunk-jj78f6qs.js.map} +1 -1
- package/dist/{chunk-jvxsnvpn.js → chunk-n48d17zc.js} +2 -2
- package/dist/{chunk-jvxsnvpn.js.map → chunk-n48d17zc.js.map} +1 -1
- package/dist/{chunk-yz1h3c9p.js → chunk-nqx5t13s.js} +2 -2
- package/dist/{chunk-yz1h3c9p.js.map → chunk-nqx5t13s.js.map} +1 -1
- package/dist/{chunk-kbqv1hxk.js → chunk-rd4m9ays.js} +2 -2
- package/dist/{chunk-kbqv1hxk.js.map → chunk-rd4m9ays.js.map} +1 -1
- package/dist/{chunk-3th95jyx.js → chunk-s7axn2qm.js} +2 -2
- package/dist/{chunk-3th95jyx.js.map → chunk-s7axn2qm.js.map} +1 -1
- package/dist/{chunk-pmv5vdp8.js → chunk-svhdzdnq.js} +2 -2
- package/dist/{chunk-pmv5vdp8.js.map → chunk-svhdzdnq.js.map} +1 -1
- package/dist/{chunk-47xbr7nj.js → chunk-sy5j0q5m.js} +3 -3
- package/dist/{chunk-47xbr7nj.js.map → chunk-sy5j0q5m.js.map} +1 -1
- package/dist/{chunk-kk82vmjc.js → chunk-tgn42q8v.js} +2 -2
- package/dist/{chunk-kk82vmjc.js.map → chunk-tgn42q8v.js.map} +1 -1
- package/dist/{chunk-byvhvak7.js → chunk-ttw34nzk.js} +2 -2
- package/dist/{chunk-byvhvak7.js.map → chunk-ttw34nzk.js.map} +1 -1
- package/dist/{chunk-8ctxajfc.js → chunk-v0xf0tr8.js} +2 -2
- package/dist/{chunk-8ctxajfc.js.map → chunk-v0xf0tr8.js.map} +1 -1
- package/dist/chunk-y7vjx8c1.js +4 -0
- package/dist/{chunk-z2e36wa8.js.map → chunk-y7vjx8c1.js.map} +1 -1
- package/dist/{chunk-85nrvdny.js → chunk-yphsj8yw.js} +3 -3
- package/dist/{chunk-85nrvdny.js.map → chunk-yphsj8yw.js.map} +1 -1
- package/dist/{chunk-v6cgxnvk.js → chunk-ywq5816d.js} +3 -3
- package/dist/{chunk-v6cgxnvk.js.map → chunk-ywq5816d.js.map} +1 -1
- package/dist/{chunk-j51xzb4t.js → chunk-zd8n8m0f.js} +2 -2
- package/dist/{chunk-j51xzb4t.js.map → chunk-zd8n8m0f.js.map} +1 -1
- package/dist/client/ClientRouter.d.ts.map +1 -1
- package/dist/client/index.js +1 -3
- package/dist/client/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/index.js +3 -3
- package/dist/facades/index.js.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.js +45 -45
- package/dist/services/index.js.map +2 -2
- package/package.json +1 -1
- package/dist/chunk-z2e36wa8.js +0 -4
package/dist/email/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{y as D}from"../chunk-
|
|
2
|
+
import{y as D}from"../chunk-y7vjx8c1.js";import{yc as B}from"../chunk-fpftvczd.js";import"../chunk-bzp23bra.js";import{render as Q}from"jsx-email";import{jsx as R}from"react/jsx-runtime";class F{from="";to=[];subject="No Subject";cc=[];bcc=[];attachments=[];template;static async send(q){let k=new this,G=B.use().service.defaultLocale,{to:H=k.to,from:J=k.from,subject:w=typeof k.subject==="string"?k.subject:k.subject[q.locale||G],cc:K=k.cc,bcc:M=k.bcc,attachments:O=k.attachments,data:P}=q,z=await k.render({...P,locale:q.locale});if(process.env.EMAIL_DEBUG==="true"){let A=`${process.env.ROOT_DIR}/.debug/emails/${new Date().toISOString()}${w}.html`;await Bun.write(A,z),Bun.spawnSync(["open",A]);return}await D.use().service.driver.send({bcc:M,cc:K,from:J,subject:w,to:H,attachments:O,html:z})}async render(q){let k=this.template;return await Q(R(k,{...q}))}}export{F as Email};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=3B86AFEBF4301E8464756E2164756E21
|
package/dist/email/index.js.map
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import { ComponentType } from \"react\";\nimport { render } from \"jsx-email\";\nimport { EmailServiceContainer } from \"../services/email/EmailServiceContainer\";\nimport { SendEmailParams } from \"../services/email/drivers/types\";\nimport { I18nServiceContainer } from \"../http/I18nServiceContainer\";\n\ninterface SendEmailArgs<T> extends Partial<Omit<SendEmailParams, \"html\">> {\n data: Omit<T, \"locale\">;\n locale?: string;\n}\n\nexport class Email {\n from = \"\";\n to = [];\n subject: string | Record<string, string> = \"No Subject\";\n cc = [];\n bcc = [];\n attachments = [];\n template: ComponentType<any>;\n\n static async send<T extends Email>(\n this: new () => T,\n args: SendEmailArgs<T[\"template\"] extends (p: infer P) => any ? P : never>,\n ) {\n const instance = new this();\n\n const defaultLocale = I18nServiceContainer.use().service.defaultLocale;\n\n const {\n to = instance.to,\n from = instance.from,\n subject = typeof instance.subject === \"string\"\n ? instance.subject\n : instance.subject[args.locale || defaultLocale],\n cc = instance.cc,\n bcc = instance.bcc,\n attachments = instance.attachments,\n data,\n } = args;\n\n const html = await instance.render({\n ...(data as any),\n locale: args.locale,\n });\n\n if (process.env.EMAIL_DEBUG === \"true\") {\n const fileName = `${process.env.ROOT_DIR}/.debug/emails/${new Date().toISOString()}${subject}.html`;\n await Bun.write(fileName, html);\n Bun.spawnSync([\"open\", fileName]);\n return;\n }\n\n await EmailServiceContainer.use().service.driver.send({\n bcc,\n cc,\n from,\n subject,\n to,\n attachments,\n html,\n });\n }\n\n protected async render<T extends Record<string, any>>(props: T) {\n const Template = this.template;\n return await render(<Template {...props} />);\n }\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";0HACA,YAAS,qDAUF,MAAM,CAAM,CACjB,KAAO,GACP,GAAK,CAAC,EACN,QAA2C,aAC3C,GAAK,CAAC,EACN,IAAM,CAAC,EACP,YAAc,CAAC,EACf,qBAEa,KAAqB,CAEhC,EACA,CACA,IAAM,EAAW,IAAI,KAEf,EAAgB,EAAqB,IAAI,EAAE,QAAQ,eAGvD,KAAK,EAAS,GACd,OAAO,EAAS,KAChB,UAAU,OAAO,EAAS,UAAY,SAClC,EAAS,QACT,EAAS,QAAQ,EAAK,QAAU,GACpC,KAAK,EAAS,GACd,MAAM,EAAS,IACf,cAAc,EAAS,YACvB,QACE,EAEE,EAAO,MAAM,EAAS,OAAO,IAC7B,EACJ,OAAQ,EAAK,MACf,CAAC,EAED,GAAI,QAAQ,IAAI,cAAgB,OAAQ,CACtC,IAAM,EAAW,GAAG,QAAQ,IAAI,0BAA0B,IAAI,KAAK,EAAE,YAAY,IAAI,SACrF,MAAM,IAAI,MAAM,EAAU,CAAI,EAC9B,IAAI,UAAU,CAAC,OAAQ,CAAQ,CAAC,EAChC,OAGF,MAAM,EAAsB,IAAI,EAAE,QAAQ,OAAO,KAAK,CACpD,MACA,KACA,OACA,UACA,KACA,cACA,MACF,CAAC,OAGa,OAAqC,CAAC,EAAU,CAC9D,IAAM,EAAW,KAAK,SACtB,OAAO,MAAM,EAAO,EAAC,EAAD,IAAc,EAAO,CAAE,EAE/C",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "3B86AFEBF4301E8464756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/facades/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{fc as g5,gc as N1,hc as m5,jc as l5,kc as _2,lc as P2,mc as q}from"../http/index.js";import{pc as p5,qc as I2,rc as P1,sc as q1,tc as n,vc as v,wc as s5,xc as o,yc as C,zc as _}from"../chunk-wd2wkvxz.js";import{Bc as r6,Cc as T,Dc as P}from"../chunk-ebcx322z.js";var u=T((D9,x1)=>{var k1=function($){return typeof $!=="undefined"&&$!==null},$4=function($){return typeof $==="object"},J4=function($){return Object.prototype.toString.call($)==="[object Object]"},w4=function($){return typeof $==="function"},F4=function($){return typeof $==="boolean"},W4=function($){return $ instanceof Buffer},Z4=function($){if(k1($))switch($.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},U4=function($){return $ instanceof ArrayBuffer},B4=function($){return typeof $==="string"&&$.length>0},Y4=function($){return typeof $==="number"&&!Number.isNaN($)},Q4=function($){return Number.isInteger($)},K4=function($,J,w){return $>=J&&$<=w},H4=function($,J){return J.includes($)},G4=function($,J,w){return new Error(`Expected ${J} for ${$} but received ${w} of type ${typeof w}`)},I4=function($,J){return J.message=$.message,J};x1.exports={defined:k1,object:$4,plainObject:J4,fn:w4,bool:F4,buffer:W4,typedArray:Z4,arrayBuffer:U4,string:B4,number:Y4,integer:Q4,inRange:K4,inArray:H4,invalidParameterError:G4,nativeError:I4}});var L2=T((T9,f1)=>{var y4=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...$)=>console.error("SEMVER",...$):()=>{};f1.exports=y4});var E2=T((j9,d1)=>{var L4=Number.MAX_SAFE_INTEGER||9007199254740991,N4=["major","premajor","minor","preminor","patch","prepatch","prerelease"];d1.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:L4,RELEASE_TYPES:N4,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var N2=T((c,O1)=>{var{MAX_SAFE_COMPONENT_LENGTH:e2,MAX_SAFE_BUILD_LENGTH:X4,MAX_LENGTH:V4}=E2(),D4=L2();c=O1.exports={};var T4=c.re=[],j4=c.safeRe=[],y=c.src=[],z4=c.safeSrc=[],L=c.t={},R4=0,n2="[a-zA-Z0-9-]",P4=[["\\s",1],["\\d",V4],[n2,X4]],_4=($)=>{for(let[J,w]of P4)$=$.split(`${J}*`).join(`${J}{0,${w}}`).split(`${J}+`).join(`${J}{1,${w}}`);return $},D=($,J,w)=>{let F=_4(J),W=R4++;D4($,W,J),L[$]=W,y[W]=J,z4[W]=F,T4[W]=new RegExp(J,w?"g":void 0),j4[W]=new RegExp(F,w?"g":void 0)};D("NUMERICIDENTIFIER","0|[1-9]\\d*");D("NUMERICIDENTIFIERLOOSE","\\d+");D("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${n2}*`);D("MAINVERSION",`(${y[L.NUMERICIDENTIFIER]})\\.(${y[L.NUMERICIDENTIFIER]})\\.(${y[L.NUMERICIDENTIFIER]})`);D("MAINVERSIONLOOSE",`(${y[L.NUMERICIDENTIFIERLOOSE]})\\.(${y[L.NUMERICIDENTIFIERLOOSE]})\\.(${y[L.NUMERICIDENTIFIERLOOSE]})`);D("PRERELEASEIDENTIFIER",`(?:${y[L.NUMERICIDENTIFIER]}|${y[L.NONNUMERICIDENTIFIER]})`);D("PRERELEASEIDENTIFIERLOOSE",`(?:${y[L.NUMERICIDENTIFIERLOOSE]}|${y[L.NONNUMERICIDENTIFIER]})`);D("PRERELEASE",`(?:-(${y[L.PRERELEASEIDENTIFIER]}(?:\\.${y[L.PRERELEASEIDENTIFIER]})*))`);D("PRERELEASELOOSE",`(?:-?(${y[L.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${y[L.PRERELEASEIDENTIFIERLOOSE]})*))`);D("BUILDIDENTIFIER",`${n2}+`);D("BUILD",`(?:\\+(${y[L.BUILDIDENTIFIER]}(?:\\.${y[L.BUILDIDENTIFIER]})*))`);D("FULLPLAIN",`v?${y[L.MAINVERSION]}${y[L.PRERELEASE]}?${y[L.BUILD]}?`);D("FULL",`^${y[L.FULLPLAIN]}$`);D("LOOSEPLAIN",`[v=\\s]*${y[L.MAINVERSIONLOOSE]}${y[L.PRERELEASELOOSE]}?${y[L.BUILD]}?`);D("LOOSE",`^${y[L.LOOSEPLAIN]}$`);D("GTLT","((?:<|>)?=?)");D("XRANGEIDENTIFIERLOOSE",`${y[L.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);D("XRANGEIDENTIFIER",`${y[L.NUMERICIDENTIFIER]}|x|X|\\*`);D("XRANGEPLAIN",`[v=\\s]*(${y[L.XRANGEIDENTIFIER]})(?:\\.(${y[L.XRANGEIDENTIFIER]})(?:\\.(${y[L.XRANGEIDENTIFIER]})(?:${y[L.PRERELEASE]})?${y[L.BUILD]}?)?)?`);D("XRANGEPLAINLOOSE",`[v=\\s]*(${y[L.XRANGEIDENTIFIERLOOSE]})(?:\\.(${y[L.XRANGEIDENTIFIERLOOSE]})(?:\\.(${y[L.XRANGEIDENTIFIERLOOSE]})(?:${y[L.PRERELEASELOOSE]})?${y[L.BUILD]}?)?)?`);D("XRANGE",`^${y[L.GTLT]}\\s*${y[L.XRANGEPLAIN]}$`);D("XRANGELOOSE",`^${y[L.GTLT]}\\s*${y[L.XRANGEPLAINLOOSE]}$`);D("COERCEPLAIN",`(^|[^\\d])(\\d{1,${e2}})(?:\\.(\\d{1,${e2}}))?(?:\\.(\\d{1,${e2}}))?`);D("COERCE",`${y[L.COERCEPLAIN]}(?:$|[^\\d])`);D("COERCEFULL",y[L.COERCEPLAIN]+`(?:${y[L.PRERELEASE]})?(?:${y[L.BUILD]})?(?:$|[^\\d])`);D("COERCERTL",y[L.COERCE],!0);D("COERCERTLFULL",y[L.COERCEFULL],!0);D("LONETILDE","(?:~>?)");D("TILDETRIM",`(\\s*)${y[L.LONETILDE]}\\s+`,!0);c.tildeTrimReplace="$1~";D("TILDE",`^${y[L.LONETILDE]}${y[L.XRANGEPLAIN]}$`);D("TILDELOOSE",`^${y[L.LONETILDE]}${y[L.XRANGEPLAINLOOSE]}$`);D("LONECARET","(?:\\^)");D("CARETTRIM",`(\\s*)${y[L.LONECARET]}\\s+`,!0);c.caretTrimReplace="$1^";D("CARET",`^${y[L.LONECARET]}${y[L.XRANGEPLAIN]}$`);D("CARETLOOSE",`^${y[L.LONECARET]}${y[L.XRANGEPLAINLOOSE]}$`);D("COMPARATORLOOSE",`^${y[L.GTLT]}\\s*(${y[L.LOOSEPLAIN]})$|^$`);D("COMPARATOR",`^${y[L.GTLT]}\\s*(${y[L.FULLPLAIN]})$|^$`);D("COMPARATORTRIM",`(\\s*)${y[L.GTLT]}\\s*(${y[L.LOOSEPLAIN]}|${y[L.XRANGEPLAIN]})`,!0);c.comparatorTrimReplace="$1$2$3";D("HYPHENRANGE",`^\\s*(${y[L.XRANGEPLAIN]})\\s+-\\s+(${y[L.XRANGEPLAIN]})\\s*$`);D("HYPHENRANGELOOSE",`^\\s*(${y[L.XRANGEPLAINLOOSE]})\\s+-\\s+(${y[L.XRANGEPLAINLOOSE]})\\s*$`);D("STAR","(<|>)?=?\\s*\\*");D("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");D("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var q2=T((z9,b1)=>{var E4=Object.freeze({loose:!0}),q4=Object.freeze({}),A4=($)=>{if(!$)return q4;if(typeof $!=="object")return E4;return $};b1.exports=A4});var m1=T((R9,g1)=>{var v1=/^[0-9]+$/,h1=($,J)=>{let w=v1.test($),F=v1.test(J);if(w&&F)$=+$,J=+J;return $===J?0:w&&!F?-1:F&&!w?1:$<J?-1:1},S4=($,J)=>h1(J,$);g1.exports={compareIdentifiers:h1,rcompareIdentifiers:S4}});var B2=T((P9,a1)=>{var A2=L2(),{MAX_LENGTH:l1,MAX_SAFE_INTEGER:S2}=E2(),{safeRe:u1,safeSrc:c1,t:C2}=N2(),C4=q2(),{compareIdentifiers:U2}=m1();class m{constructor($,J){if(J=C4(J),$ instanceof m)if($.loose===!!J.loose&&$.includePrerelease===!!J.includePrerelease)return $;else $=$.version;else if(typeof $!=="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof $}".`);if($.length>l1)throw new TypeError(`version is longer than ${l1} characters`);A2("SemVer",$,J),this.options=J,this.loose=!!J.loose,this.includePrerelease=!!J.includePrerelease;let w=$.trim().match(J.loose?u1[C2.LOOSE]:u1[C2.FULL]);if(!w)throw new TypeError(`Invalid Version: ${$}`);if(this.raw=$,this.major=+w[1],this.minor=+w[2],this.patch=+w[3],this.major>S2||this.major<0)throw new TypeError("Invalid major version");if(this.minor>S2||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>S2||this.patch<0)throw new TypeError("Invalid patch version");if(!w[4])this.prerelease=[];else this.prerelease=w[4].split(".").map((F)=>{if(/^[0-9]+$/.test(F)){let W=+F;if(W>=0&&W<S2)return W}return F});this.build=w[5]?w[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare($){if(A2("SemVer.compare",this.version,this.options,$),!($ instanceof m)){if(typeof $==="string"&&$===this.version)return 0;$=new m($,this.options)}if($.version===this.version)return 0;return this.compareMain($)||this.comparePre($)}compareMain($){if(!($ instanceof m))$=new m($,this.options);return U2(this.major,$.major)||U2(this.minor,$.minor)||U2(this.patch,$.patch)}comparePre($){if(!($ instanceof m))$=new m($,this.options);if(this.prerelease.length&&!$.prerelease.length)return-1;else if(!this.prerelease.length&&$.prerelease.length)return 1;else if(!this.prerelease.length&&!$.prerelease.length)return 0;let J=0;do{let w=this.prerelease[J],F=$.prerelease[J];if(A2("prerelease compare",J,w,F),w===void 0&&F===void 0)return 0;else if(F===void 0)return 1;else if(w===void 0)return-1;else if(w===F)continue;else return U2(w,F)}while(++J)}compareBuild($){if(!($ instanceof m))$=new m($,this.options);let J=0;do{let w=this.build[J],F=$.build[J];if(A2("build compare",J,w,F),w===void 0&&F===void 0)return 0;else if(F===void 0)return 1;else if(w===void 0)return-1;else if(w===F)continue;else return U2(w,F)}while(++J)}inc($,J,w){if($.startsWith("pre")){if(!J&&w===!1)throw new Error("invalid increment argument: identifier is empty");if(J){let F=new RegExp(`^${this.options.loose?c1[C2.PRERELEASELOOSE]:c1[C2.PRERELEASE]}$`),W=`-${J}`.match(F);if(!W||W[1]!==J)throw new Error(`invalid identifier: ${J}`)}}switch($){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",J,w);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",J,w);break;case"prepatch":this.prerelease.length=0,this.inc("patch",J,w),this.inc("pre",J,w);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",J,w);this.inc("pre",J,w);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":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let F=Number(w)?1:0;if(this.prerelease.length===0)this.prerelease=[F];else{let W=this.prerelease.length;while(--W>=0)if(typeof this.prerelease[W]==="number")this.prerelease[W]++,W=-2;if(W===-1){if(J===this.prerelease.join(".")&&w===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(F)}}if(J){let W=[J,F];if(w===!1)W=[J];if(U2(this.prerelease[0],J)===0){if(isNaN(this.prerelease[1]))this.prerelease=W}else this.prerelease=W}break}default:throw new Error(`invalid increment argument: ${$}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}a1.exports=m});var n1=T((_9,e1)=>{var r1=B2(),M4=($,J,w=!1)=>{if($ instanceof r1)return $;try{return new r1($,J)}catch(F){if(!w)return null;throw F}};e1.exports=M4});var s1=T((E9,p1)=>{var k4=B2(),x4=n1(),{safeRe:M2,t:k2}=N2(),f4=($,J)=>{if($ instanceof k4)return $;if(typeof $==="number")$=String($);if(typeof $!=="string")return null;J=J||{};let w=null;if(!J.rtl)w=$.match(J.includePrerelease?M2[k2.COERCEFULL]:M2[k2.COERCE]);else{let K=J.includePrerelease?M2[k2.COERCERTLFULL]:M2[k2.COERCERTL],G;while((G=K.exec($))&&(!w||w.index+w[0].length!==$.length)){if(!w||G.index+G[0].length!==w.index+w[0].length)w=G;K.lastIndex=G.index+G[1].length+G[2].length}K.lastIndex=-1}if(w===null)return null;let F=w[2],W=w[3]||"0",Z=w[4]||"0",B=J.includePrerelease&&w[5]?`-${w[5]}`:"",Y=J.includePrerelease&&w[6]?`+${w[6]}`:"";return x4(`${F}.${W}.${Z}${B}${Y}`,J)};p1.exports=f4});var $2=T((q9,i1)=>{var t1=B2(),d4=($,J,w)=>new t1($,w).compare(new t1(J,w));i1.exports=d4});var p2=T((A9,o1)=>{var O4=$2(),b4=($,J,w)=>O4($,J,w)>=0;o1.exports=b4});var w0=T((S9,J0)=>{class $0{constructor(){this.max=1000,this.map=new Map}get($){let J=this.map.get($);if(J===void 0)return;else return this.map.delete($),this.map.set($,J),J}delete($){return this.map.delete($)}set($,J){if(!this.delete($)&&J!==void 0){if(this.map.size>=this.max){let F=this.map.keys().next().value;this.delete(F)}this.map.set($,J)}return this}}J0.exports=$0});var W0=T((C9,F0)=>{var v4=$2(),h4=($,J,w)=>v4($,J,w)===0;F0.exports=h4});var U0=T((M9,Z0)=>{var g4=$2(),m4=($,J,w)=>g4($,J,w)!==0;Z0.exports=m4});var Y0=T((k9,B0)=>{var l4=$2(),u4=($,J,w)=>l4($,J,w)>0;B0.exports=u4});var K0=T((x9,Q0)=>{var c4=$2(),a4=($,J,w)=>c4($,J,w)<0;Q0.exports=a4});var G0=T((f9,H0)=>{var r4=$2(),e4=($,J,w)=>r4($,J,w)<=0;H0.exports=e4});var y0=T((d9,I0)=>{var n4=W0(),p4=U0(),s4=Y0(),t4=p2(),i4=K0(),o4=G0(),$3=($,J,w,F)=>{switch(J){case"===":if(typeof $==="object")$=$.version;if(typeof w==="object")w=w.version;return $===w;case"!==":if(typeof $==="object")$=$.version;if(typeof w==="object")w=w.version;return $!==w;case"":case"=":case"==":return n4($,w,F);case"!=":return p4($,w,F);case">":return s4($,w,F);case">=":return t4($,w,F);case"<":return i4($,w,F);case"<=":return o4($,w,F);default:throw new TypeError(`Invalid operator: ${J}`)}};I0.exports=$3});var j0=T((O9,T0)=>{var X2=Symbol("SemVer ANY");class x2{static get ANY(){return X2}constructor($,J){if(J=L0(J),$ instanceof x2)if($.loose===!!J.loose)return $;else $=$.value;if($=$.trim().split(/\s+/).join(" "),t2("comparator",$,J),this.options=J,this.loose=!!J.loose,this.parse($),this.semver===X2)this.value="";else this.value=this.operator+this.semver.version;t2("comp",this)}parse($){let J=this.options.loose?N0[X0.COMPARATORLOOSE]:N0[X0.COMPARATOR],w=$.match(J);if(!w)throw new TypeError(`Invalid comparator: ${$}`);if(this.operator=w[1]!==void 0?w[1]:"",this.operator==="=")this.operator="";if(!w[2])this.semver=X2;else this.semver=new V0(w[2],this.options.loose)}toString(){return this.value}test($){if(t2("Comparator.test",$,this.options.loose),this.semver===X2||$===X2)return!0;if(typeof $==="string")try{$=new V0($,this.options)}catch(J){return!1}return s2($,this.operator,this.semver,this.options)}intersects($,J){if(!($ instanceof x2))throw new TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new D0($.value,J).test(this.value)}else if($.operator===""){if($.value==="")return!0;return new D0(this.value,J).test($.semver)}if(J=L0(J),J.includePrerelease&&(this.value==="<0.0.0-0"||$.value==="<0.0.0-0"))return!1;if(!J.includePrerelease&&(this.value.startsWith("<0.0.0")||$.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&$.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&$.operator.startsWith("<"))return!0;if(this.semver.version===$.semver.version&&this.operator.includes("=")&&$.operator.includes("="))return!0;if(s2(this.semver,"<",$.semver,J)&&this.operator.startsWith(">")&&$.operator.startsWith("<"))return!0;if(s2(this.semver,">",$.semver,J)&&this.operator.startsWith("<")&&$.operator.startsWith(">"))return!0;return!1}}T0.exports=x2;var L0=q2(),{safeRe:N0,t:X0}=N2(),s2=y0(),t2=L2(),V0=B2(),D0=i2()});var i2=T((b9,_0)=>{var J3=/\s+/g;class V2{constructor($,J){if(J=F3(J),$ instanceof V2)if($.loose===!!J.loose&&$.includePrerelease===!!J.includePrerelease)return $;else return new V2($.raw,J);if($ instanceof o2)return this.raw=$.value,this.set=[[$]],this.formatted=void 0,this;if(this.options=J,this.loose=!!J.loose,this.includePrerelease=!!J.includePrerelease,this.raw=$.trim().replace(J3," "),this.set=this.raw.split("||").map((w)=>this.parseRange(w.trim())).filter((w)=>w.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let w=this.set[0];if(this.set=this.set.filter((F)=>!R0(F[0])),this.set.length===0)this.set=[w];else if(this.set.length>1){for(let F of this.set)if(F.length===1&&K3(F[0])){this.set=[F];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let $=0;$<this.set.length;$++){if($>0)this.formatted+="||";let J=this.set[$];for(let w=0;w<J.length;w++){if(w>0)this.formatted+=" ";this.formatted+=J[w].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange($){let w=((this.options.includePrerelease&&Y3)|(this.options.loose&&Q3))+":"+$,F=z0.get(w);if(F)return F;let W=this.options.loose,Z=W?f[M.HYPHENRANGELOOSE]:f[M.HYPHENRANGE];$=$.replace(Z,T3(this.options.includePrerelease)),R("hyphen replace",$),$=$.replace(f[M.COMPARATORTRIM],Z3),R("comparator trim",$),$=$.replace(f[M.TILDETRIM],U3),R("tilde trim",$),$=$.replace(f[M.CARETTRIM],B3),R("caret trim",$);let B=$.split(" ").map((I)=>H3(I,this.options)).join(" ").split(/\s+/).map((I)=>D3(I,this.options));if(W)B=B.filter((I)=>{return R("loose invalid filter",I,this.options),!!I.match(f[M.COMPARATORLOOSE])});R("range list",B);let Y=new Map,K=B.map((I)=>new o2(I,this.options));for(let I of K){if(R0(I))return[I];Y.set(I.value,I)}if(Y.size>1&&Y.has(""))Y.delete("");let G=[...Y.values()];return z0.set(w,G),G}intersects($,J){if(!($ instanceof V2))throw new TypeError("a Range is required");return this.set.some((w)=>{return P0(w,J)&&$.set.some((F)=>{return P0(F,J)&&w.every((W)=>{return F.every((Z)=>{return W.intersects(Z,J)})})})})}test($){if(!$)return!1;if(typeof $==="string")try{$=new W3($,this.options)}catch(J){return!1}for(let J=0;J<this.set.length;J++)if(j3(this.set[J],$,this.options))return!0;return!1}}_0.exports=V2;var w3=w0(),z0=new w3,F3=q2(),o2=j0(),R=L2(),W3=B2(),{safeRe:f,t:M,comparatorTrimReplace:Z3,tildeTrimReplace:U3,caretTrimReplace:B3}=N2(),{FLAG_INCLUDE_PRERELEASE:Y3,FLAG_LOOSE:Q3}=E2(),R0=($)=>$.value==="<0.0.0-0",K3=($)=>$.value==="",P0=($,J)=>{let w=!0,F=$.slice(),W=F.pop();while(w&&F.length)w=F.every((Z)=>{return W.intersects(Z,J)}),W=F.pop();return w},H3=($,J)=>{return R("comp",$,J),$=y3($,J),R("caret",$),$=G3($,J),R("tildes",$),$=N3($,J),R("xrange",$),$=V3($,J),R("stars",$),$},k=($)=>!$||$.toLowerCase()==="x"||$==="*",G3=($,J)=>{return $.trim().split(/\s+/).map((w)=>I3(w,J)).join(" ")},I3=($,J)=>{let w=J.loose?f[M.TILDELOOSE]:f[M.TILDE];return $.replace(w,(F,W,Z,B,Y)=>{R("tilde",$,F,W,Z,B,Y);let K;if(k(W))K="";else if(k(Z))K=`>=${W}.0.0 <${+W+1}.0.0-0`;else if(k(B))K=`>=${W}.${Z}.0 <${W}.${+Z+1}.0-0`;else if(Y)R("replaceTilde pr",Y),K=`>=${W}.${Z}.${B}-${Y} <${W}.${+Z+1}.0-0`;else K=`>=${W}.${Z}.${B} <${W}.${+Z+1}.0-0`;return R("tilde return",K),K})},y3=($,J)=>{return $.trim().split(/\s+/).map((w)=>L3(w,J)).join(" ")},L3=($,J)=>{R("caret",$,J);let w=J.loose?f[M.CARETLOOSE]:f[M.CARET],F=J.includePrerelease?"-0":"";return $.replace(w,(W,Z,B,Y,K)=>{R("caret",$,W,Z,B,Y,K);let G;if(k(Z))G="";else if(k(B))G=`>=${Z}.0.0${F} <${+Z+1}.0.0-0`;else if(k(Y))if(Z==="0")G=`>=${Z}.${B}.0${F} <${Z}.${+B+1}.0-0`;else G=`>=${Z}.${B}.0${F} <${+Z+1}.0.0-0`;else if(K)if(R("replaceCaret pr",K),Z==="0")if(B==="0")G=`>=${Z}.${B}.${Y}-${K} <${Z}.${B}.${+Y+1}-0`;else G=`>=${Z}.${B}.${Y}-${K} <${Z}.${+B+1}.0-0`;else G=`>=${Z}.${B}.${Y}-${K} <${+Z+1}.0.0-0`;else if(R("no pr"),Z==="0")if(B==="0")G=`>=${Z}.${B}.${Y}${F} <${Z}.${B}.${+Y+1}-0`;else G=`>=${Z}.${B}.${Y}${F} <${Z}.${+B+1}.0-0`;else G=`>=${Z}.${B}.${Y} <${+Z+1}.0.0-0`;return R("caret return",G),G})},N3=($,J)=>{return R("replaceXRanges",$,J),$.split(/\s+/).map((w)=>X3(w,J)).join(" ")},X3=($,J)=>{$=$.trim();let w=J.loose?f[M.XRANGELOOSE]:f[M.XRANGE];return $.replace(w,(F,W,Z,B,Y,K)=>{R("xRange",$,F,W,Z,B,Y,K);let G=k(Z),I=G||k(B),V=I||k(Y),z=V;if(W==="="&&z)W="";if(K=J.includePrerelease?"-0":"",G)if(W===">"||W==="<")F="<0.0.0-0";else F="*";else if(W&&z){if(I)B=0;if(Y=0,W===">")if(W=">=",I)Z=+Z+1,B=0,Y=0;else B=+B+1,Y=0;else if(W==="<=")if(W="<",I)Z=+Z+1;else B=+B+1;if(W==="<")K="-0";F=`${W+Z}.${B}.${Y}${K}`}else if(I)F=`>=${Z}.0.0${K} <${+Z+1}.0.0-0`;else if(V)F=`>=${Z}.${B}.0${K} <${Z}.${+B+1}.0-0`;return R("xRange return",F),F})},V3=($,J)=>{return R("replaceStars",$,J),$.trim().replace(f[M.STAR],"")},D3=($,J)=>{return R("replaceGTE0",$,J),$.trim().replace(f[J.includePrerelease?M.GTE0PRE:M.GTE0],"")},T3=($)=>(J,w,F,W,Z,B,Y,K,G,I,V,z)=>{if(k(F))w="";else if(k(W))w=`>=${F}.0.0${$?"-0":""}`;else if(k(Z))w=`>=${F}.${W}.0${$?"-0":""}`;else if(B)w=`>=${w}`;else w=`>=${w}${$?"-0":""}`;if(k(G))K="";else if(k(I))K=`<${+G+1}.0.0-0`;else if(k(V))K=`<${G}.${+I+1}.0-0`;else if(z)K=`<=${G}.${I}.${V}-${z}`;else if($)K=`<${G}.${I}.${+V+1}-0`;else K=`<=${K}`;return`${w} ${K}`.trim()},j3=($,J,w)=>{for(let F=0;F<$.length;F++)if(!$[F].test(J))return!1;if(J.prerelease.length&&!w.includePrerelease){for(let F=0;F<$.length;F++){if(R($[F].semver),$[F].semver===o2.ANY)continue;if($[F].semver.prerelease.length>0){let W=$[F].semver;if(W.major===J.major&&W.minor===J.minor&&W.patch===J.patch)return!0}}return!1}return!0}});var q0=T((v9,E0)=>{var z3=i2(),R3=($,J,w)=>{try{J=new z3(J,w)}catch(F){return!1}return J.test($)};E0.exports=R3});var $1=T((h9,P3)=>{P3.exports={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.33.5",author:"Lovell Fuller <npm@lovell.info>",homepage:"https://sharp.pixelplumbing.com",contributors:["Pierre Inglebert <pierre.inglebert@gmail.com>","Jonathan Ong <jonathanrichardong@gmail.com>","Chanon Sajjamanochai <chanon.s@gmail.com>","Juliano Julio <julianojulio@gmail.com>","Daniel Gasienica <daniel@gasienica.ch>","Julian Walker <julian@fiftythree.com>","Amit Pitaru <pitaru.amit@gmail.com>","Brandon Aaron <hello.brandon@aaron.sh>","Andreas Lind <andreas@one.com>","Maurus Cuelenaere <mcuelenaere@gmail.com>","Linus Unneb\xE4ck <linus@folkdatorn.se>","Victor Mateevitsi <mvictoras@gmail.com>","Alaric Holloway <alaric.holloway@gmail.com>","Bernhard K. Weisshuhn <bkw@codingforce.com>","Chris Riley <criley@primedia.com>","David Carley <dacarley@gmail.com>","John Tobin <john@limelightmobileinc.com>","Kenton Gray <kentongray@gmail.com>","Felix B\xFCnemann <Felix.Buenemann@gmail.com>","Samy Al Zahrani <samyalzahrany@gmail.com>","Chintan Thakkar <lemnisk8@gmail.com>","F. Orlando Galashan <frulo@gmx.de>","Kleis Auke Wolthuizen <info@kleisauke.nl>","Matt Hirsch <mhirsch@media.mit.edu>","Matthias Thoemmes <thoemmes@gmail.com>","Patrick Paskaris <patrick@paskaris.gr>","J\xE9r\xE9my Lal <kapouer@melix.org>","Rahul Nanwani <r.nanwani@gmail.com>","Alice Monday <alice0meta@gmail.com>","Kristo Jorgenson <kristo.jorgenson@gmail.com>","YvesBos <yves_bos@outlook.com>","Guy Maliar <guy@tailorbrands.com>","Nicolas Coden <nicolas@ncoden.fr>","Matt Parrish <matt.r.parrish@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Matthew McEachen <matthew+github@mceachen.org>","Jarda Kot\u011B\u0161ovec <jarda.kotesovec@gmail.com>","Kenric D'Souza <kenric.dsouza@gmail.com>","Oleh Aleinyk <oleg.aleynik@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Andrea Bianco <andrea.bianco@unibas.ch>","Rik Heywood <rik@rik.org>","Thomas Parisot <hi@oncletom.io>","Nathan Graves <nathanrgraves+github@gmail.com>","Tom Lokhorst <tom@lokhorst.eu>","Espen Hovlandsdal <espen@hovlandsdal.com>","Sylvain Dumont <sylvain.dumont35@gmail.com>","Alun Davies <alun.owain.davies@googlemail.com>","Aidan Hoolachan <ajhoolachan21@gmail.com>","Axel Eirola <axel.eirola@iki.fi>","Freezy <freezy@xbmc.org>","Daiz <taneli.vatanen@gmail.com>","Julian Aubourg <j@ubourg.net>","Keith Belovay <keith@picthrive.com>","Michael B. Klein <mbklein@gmail.com>","Jordan Prudhomme <jordan@raboland.fr>","Ilya Ovdin <iovdin@gmail.com>","Andargor <andargor@yahoo.com>","Paul Neave <paul.neave@gmail.com>","Brendan Kennedy <brenwken@gmail.com>","Brychan Bennett-Odlum <git@brychan.io>","Edward Silverton <e.silverton@gmail.com>","Roman Malieiev <aromaleev@gmail.com>","Tomas Szabo <tomas.szabo@deftomat.com>","Robert O'Rourke <robert@o-rourke.org>","Guillermo Alfonso Varela Chouci\xF1o <guillevch@gmail.com>","Christian Flintrup <chr@gigahost.dk>","Manan Jadhav <manan@motionden.com>","Leon Radley <leon@radley.se>","alza54 <alza54@thiocod.in>","Jacob Smith <jacob@frende.me>","Michael Nutt <michael@nutt.im>","Brad Parham <baparham@gmail.com>","Taneli Vatanen <taneli.vatanen@gmail.com>","Joris Dugu\xE9 <zaruike10@gmail.com>","Chris Banks <christopher.bradley.banks@gmail.com>","Ompal Singh <ompal.hitm09@gmail.com>","Brodan <christopher.hranj@gmail.com>","Ankur Parihar <ankur.github@gmail.com>","Brahim Ait elhaj <brahima@gmail.com>","Mart Jansink <m.jansink@gmail.com>","Lachlan Newman <lachnewman007@gmail.com>","Dennis Beatty <dennis@dcbeatty.com>","Ingvar Stepanyan <me@rreverser.com>","Don Denton <don@happycollision.com>"],scripts:{install:"node install/check",clean:"rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",test:"npm run test-lint && npm run test-unit && npm run test-licensing && npm run test-types","test-lint":"semistandard && cpplint","test-unit":"nyc --reporter=lcov --reporter=text --check-coverage --branches=100 mocha","test-licensing":'license-checker --production --summary --onlyAllow="Apache-2.0;BSD;ISC;LGPL-3.0-or-later;MIT"',"test-leak":"./test/leak/leak.sh","test-types":"tsd","package-from-local-build":"node npm/from-local-build","package-from-github-release":"node npm/from-github-release","docs-build":"node docs/build && node docs/search-index/build","docs-serve":"cd docs && npx serve","docs-publish":"cd docs && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",main:"lib/index.js",types:"lib/index.d.ts",files:["install","lib","src/*.{cc,h,gyp}"],repository:{type:"git",url:"git://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{color:"^4.2.3","detect-libc":"^2.0.3",semver:"^7.6.3"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.33.5","@img/sharp-darwin-x64":"0.33.5","@img/sharp-libvips-darwin-arm64":"1.0.4","@img/sharp-libvips-darwin-x64":"1.0.4","@img/sharp-libvips-linux-arm":"1.0.5","@img/sharp-libvips-linux-arm64":"1.0.4","@img/sharp-libvips-linux-s390x":"1.0.4","@img/sharp-libvips-linux-x64":"1.0.4","@img/sharp-libvips-linuxmusl-arm64":"1.0.4","@img/sharp-libvips-linuxmusl-x64":"1.0.4","@img/sharp-linux-arm":"0.33.5","@img/sharp-linux-arm64":"0.33.5","@img/sharp-linux-s390x":"0.33.5","@img/sharp-linux-x64":"0.33.5","@img/sharp-linuxmusl-arm64":"0.33.5","@img/sharp-linuxmusl-x64":"0.33.5","@img/sharp-wasm32":"0.33.5","@img/sharp-win32-ia32":"0.33.5","@img/sharp-win32-x64":"0.33.5"},devDependencies:{"@emnapi/runtime":"^1.2.0","@img/sharp-libvips-dev":"1.0.4","@img/sharp-libvips-dev-wasm32":"1.0.5","@img/sharp-libvips-win32-ia32":"1.0.4","@img/sharp-libvips-win32-x64":"1.0.4","@types/node":"*",async:"^3.2.5",cc:"^3.0.1",emnapi:"^1.2.0","exif-reader":"^2.0.1","extract-zip":"^2.0.1",icc:"^3.0.0","jsdoc-to-markdown":"^8.0.3","license-checker":"^25.0.1",mocha:"^10.7.3","node-addon-api":"^8.1.0",nyc:"^17.0.0",prebuild:"^13.0.1",semistandard:"^17.0.0","tar-fs":"^3.0.6",tsd:"^0.31.1"},license:"Apache-2.0",engines:{node:"^18.17.0 || ^20.3.0 || >=21.0.0"},config:{libvips:">=8.15.3"},funding:{url:"https://opencollective.com/libvips"},binary:{napi_versions:[9]},semistandard:{env:["mocha"]},cc:{linelength:"120",filter:["build/include"]},nyc:{include:["lib"]},tsd:{directory:"test/types/"}}});var w1=T((g9,b0)=>{var{spawnSync:f2}=P("child_process"),{createHash:_3}=P("crypto"),M0=s1(),E3=p2(),q3=q0(),A0=P("detect-libc"),{config:A3,engines:S0,optionalDependencies:S3}=$1(),C3=process.env.npm_package_config_libvips||A3.libvips,k0=M0(C3).version,M3=["darwin-arm64","darwin-x64","linux-arm","linux-arm64","linux-s390x","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-ia32","win32-x64"],d2={encoding:"utf8",shell:!0},k3=($)=>{if($ instanceof Error)console.error(`sharp: Installation error: ${$.message}`);else console.log(`sharp: ${$}`)},x0=()=>A0.isNonGlibcLinuxSync()?A0.familySync():"",x3=()=>`${process.platform}${x0()}-${process.arch}`,Y2=()=>{if(f0())return"wasm32";let{npm_config_arch:$,npm_config_platform:J,npm_config_libc:w}=process.env,F=typeof w==="string"?w:x0();return`${J||process.platform}${F}-${$||process.arch}`},f3=()=>{try{return P(`@img/sharp-libvips-dev-${Y2()}/include`)}catch{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/include");})()}catch{}}return""},d3=()=>{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/cplusplus");})()}catch{}return""},O3=()=>{try{return P(`@img/sharp-libvips-dev-${Y2()}/lib`)}catch{try{return P(`@img/sharp-libvips-${Y2()}/lib`)}catch{}}return""},b3=()=>{if(process.release?.name==="node"&&process.versions){if(!q3(process.versions.node,S0.node))return{found:process.versions.node,expected:S0.node}}},f0=()=>{let{CC:$}=process.env;return Boolean($&&$.endsWith("/emcc"))},v3=()=>{if(process.platform==="darwin"&&process.arch==="x64")return(f2("sysctl sysctl.proc_translated",d2).stdout||"").trim()==="sysctl.proc_translated: 1";return!1},C0=($)=>_3("sha512").update($).digest("hex"),h3=()=>{try{let $=C0(`imgsharp-libvips-${Y2()}`),J=M0(S3[`@img/sharp-libvips-${Y2()}`]).version;return C0(`${$}npm:${J}`).slice(0,10)}catch{}return""},g3=()=>f2(`node-gyp rebuild --directory=src ${f0()?"--nodedir=emscripten":""}`,{...d2,stdio:"inherit"}).status,d0=()=>{if(process.platform!=="win32")return(f2("pkg-config --modversion vips-cpp",{...d2,env:{...process.env,PKG_CONFIG_PATH:O0()}}).stdout||"").trim();else return""},O0=()=>{if(process.platform!=="win32")return[(f2('which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',d2).stdout||"").trim(),process.env.PKG_CONFIG_PATH,"/usr/local/lib/pkgconfig","/usr/lib/pkgconfig","/usr/local/libdata/pkgconfig","/usr/libdata/pkgconfig"].filter(Boolean).join(":");else return""},J1=($,J,w)=>{if(w)w(`Detected ${J}, skipping search for globally-installed libvips`);return $},m3=($)=>{if(Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)===!0)return J1(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",$);if(Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)===!0)return J1(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",$);if(v3())return J1(!1,"Rosetta",$);let J=d0();return!!J&&E3(J,k0)};b0.exports={minimumLibvipsVersion:k0,prebuiltPlatforms:M3,buildPlatformArch:Y2,buildSharpLibvipsIncludeDir:f3,buildSharpLibvipsCPlusPlusDir:d3,buildSharpLibvipsLibDir:O3,isUnsupportedNodeRuntime:b3,runtimePlatformArch:x3,log:k3,yarnLocator:h3,spawnRebuild:g3,globalLibvipsVersion:d0,pkgConfigPath:O0,useGlobalLibvips:m3}});var D2=T((l9,h0)=>{var{familySync:l3,versionSync:u3}=P("detect-libc"),{runtimePlatformArch:c3,isUnsupportedNodeRuntime:v0,prebuiltPlatforms:a3,minimumLibvipsVersion:r3}=w1(),J2=c3(),e3=[`../src/build/Release/sharp-${J2}.node`,"../src/build/Release/sharp-wasm32.node",`@img/sharp-${J2}/sharp.node`,"@img/sharp-wasm32/sharp.node"],F1,O2=[];for(let $ of e3)try{F1=P($);break}catch(J){O2.push(J)}if(F1)h0.exports=F1;else{let[$,J,w]=["linux","darwin","win32"].map((Z)=>J2.startsWith(Z)),F=[`Could not load the "sharp" module using the ${J2} runtime`];O2.forEach((Z)=>{if(Z.code!=="MODULE_NOT_FOUND")F.push(`${Z.code}: ${Z.message}`)});let W=O2.map((Z)=>Z.message).join(" ");if(F.push("Possible solutions:"),v0()){let{found:Z,expected:B}=v0();F.push("- Please upgrade Node.js:",` Found ${Z}`,` Requires ${B}`)}else if(a3.includes(J2)){let[Z,B]=J2.split("-"),Y=Z.endsWith("musl")?" --libc=musl":"";F.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=${Z.replace("musl","")}${Y} --cpu=${B} sharp`)}else F.push(`- Manually install libvips >= ${r3}`,"- Add experimental WebAssembly-based dependencies:"," npm install --cpu=wasm32 sharp"," npm install @img/sharp-wasm32");if($&&/(symbol not found|CXXABI_)/i.test(W))try{let{config:Z}=P(`@img/sharp-libvips-${J2}/package`),B=`${l3()} ${u3()}`,Y=`${Z.musl?"musl":"glibc"} ${Z.musl||Z.glibc}`;F.push("- Update your OS:",` Found ${B}`,` Requires ${Y}`)}catch(Z){}if($&&/\/snap\/core[0-9]{2}/.test(W))F.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node");if(J&&/Incompatible library version/.test(W))F.push("- Update Homebrew:"," brew update && brew upgrade vips");if(O2.some((Z)=>Z.code==="ERR_DLOPEN_DISABLED"))F.push("- Run Node.js without using the --no-addons flag");if(w&&/The specified procedure could not be found/.test(W))F.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");throw F.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),new Error(F.join(`
|
|
2
|
+
import{gc as g5,hc as N1,ic as m5,kc as l5,lc as _2,mc as P2,nc as q}from"../http/index.js";import{Ac as _,qc as p5,rc as I2,sc as P1,tc as q1,uc as n,wc as v,xc as s5,yc as o,zc as C}from"../chunk-fpftvczd.js";import{Cc as r6,Dc as T,Ec as P}from"../chunk-bzp23bra.js";var u=T((D9,x1)=>{var k1=function($){return typeof $!=="undefined"&&$!==null},$4=function($){return typeof $==="object"},J4=function($){return Object.prototype.toString.call($)==="[object Object]"},w4=function($){return typeof $==="function"},F4=function($){return typeof $==="boolean"},W4=function($){return $ instanceof Buffer},Z4=function($){if(k1($))switch($.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},U4=function($){return $ instanceof ArrayBuffer},B4=function($){return typeof $==="string"&&$.length>0},Y4=function($){return typeof $==="number"&&!Number.isNaN($)},Q4=function($){return Number.isInteger($)},K4=function($,J,w){return $>=J&&$<=w},H4=function($,J){return J.includes($)},G4=function($,J,w){return new Error(`Expected ${J} for ${$} but received ${w} of type ${typeof w}`)},I4=function($,J){return J.message=$.message,J};x1.exports={defined:k1,object:$4,plainObject:J4,fn:w4,bool:F4,buffer:W4,typedArray:Z4,arrayBuffer:U4,string:B4,number:Y4,integer:Q4,inRange:K4,inArray:H4,invalidParameterError:G4,nativeError:I4}});var L2=T((T9,f1)=>{var y4=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...$)=>console.error("SEMVER",...$):()=>{};f1.exports=y4});var E2=T((j9,d1)=>{var L4=Number.MAX_SAFE_INTEGER||9007199254740991,N4=["major","premajor","minor","preminor","patch","prepatch","prerelease"];d1.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:L4,RELEASE_TYPES:N4,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var N2=T((c,O1)=>{var{MAX_SAFE_COMPONENT_LENGTH:e2,MAX_SAFE_BUILD_LENGTH:X4,MAX_LENGTH:V4}=E2(),D4=L2();c=O1.exports={};var T4=c.re=[],j4=c.safeRe=[],y=c.src=[],z4=c.safeSrc=[],L=c.t={},R4=0,n2="[a-zA-Z0-9-]",P4=[["\\s",1],["\\d",V4],[n2,X4]],_4=($)=>{for(let[J,w]of P4)$=$.split(`${J}*`).join(`${J}{0,${w}}`).split(`${J}+`).join(`${J}{1,${w}}`);return $},D=($,J,w)=>{let F=_4(J),W=R4++;D4($,W,J),L[$]=W,y[W]=J,z4[W]=F,T4[W]=new RegExp(J,w?"g":void 0),j4[W]=new RegExp(F,w?"g":void 0)};D("NUMERICIDENTIFIER","0|[1-9]\\d*");D("NUMERICIDENTIFIERLOOSE","\\d+");D("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${n2}*`);D("MAINVERSION",`(${y[L.NUMERICIDENTIFIER]})\\.(${y[L.NUMERICIDENTIFIER]})\\.(${y[L.NUMERICIDENTIFIER]})`);D("MAINVERSIONLOOSE",`(${y[L.NUMERICIDENTIFIERLOOSE]})\\.(${y[L.NUMERICIDENTIFIERLOOSE]})\\.(${y[L.NUMERICIDENTIFIERLOOSE]})`);D("PRERELEASEIDENTIFIER",`(?:${y[L.NUMERICIDENTIFIER]}|${y[L.NONNUMERICIDENTIFIER]})`);D("PRERELEASEIDENTIFIERLOOSE",`(?:${y[L.NUMERICIDENTIFIERLOOSE]}|${y[L.NONNUMERICIDENTIFIER]})`);D("PRERELEASE",`(?:-(${y[L.PRERELEASEIDENTIFIER]}(?:\\.${y[L.PRERELEASEIDENTIFIER]})*))`);D("PRERELEASELOOSE",`(?:-?(${y[L.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${y[L.PRERELEASEIDENTIFIERLOOSE]})*))`);D("BUILDIDENTIFIER",`${n2}+`);D("BUILD",`(?:\\+(${y[L.BUILDIDENTIFIER]}(?:\\.${y[L.BUILDIDENTIFIER]})*))`);D("FULLPLAIN",`v?${y[L.MAINVERSION]}${y[L.PRERELEASE]}?${y[L.BUILD]}?`);D("FULL",`^${y[L.FULLPLAIN]}$`);D("LOOSEPLAIN",`[v=\\s]*${y[L.MAINVERSIONLOOSE]}${y[L.PRERELEASELOOSE]}?${y[L.BUILD]}?`);D("LOOSE",`^${y[L.LOOSEPLAIN]}$`);D("GTLT","((?:<|>)?=?)");D("XRANGEIDENTIFIERLOOSE",`${y[L.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);D("XRANGEIDENTIFIER",`${y[L.NUMERICIDENTIFIER]}|x|X|\\*`);D("XRANGEPLAIN",`[v=\\s]*(${y[L.XRANGEIDENTIFIER]})(?:\\.(${y[L.XRANGEIDENTIFIER]})(?:\\.(${y[L.XRANGEIDENTIFIER]})(?:${y[L.PRERELEASE]})?${y[L.BUILD]}?)?)?`);D("XRANGEPLAINLOOSE",`[v=\\s]*(${y[L.XRANGEIDENTIFIERLOOSE]})(?:\\.(${y[L.XRANGEIDENTIFIERLOOSE]})(?:\\.(${y[L.XRANGEIDENTIFIERLOOSE]})(?:${y[L.PRERELEASELOOSE]})?${y[L.BUILD]}?)?)?`);D("XRANGE",`^${y[L.GTLT]}\\s*${y[L.XRANGEPLAIN]}$`);D("XRANGELOOSE",`^${y[L.GTLT]}\\s*${y[L.XRANGEPLAINLOOSE]}$`);D("COERCEPLAIN",`(^|[^\\d])(\\d{1,${e2}})(?:\\.(\\d{1,${e2}}))?(?:\\.(\\d{1,${e2}}))?`);D("COERCE",`${y[L.COERCEPLAIN]}(?:$|[^\\d])`);D("COERCEFULL",y[L.COERCEPLAIN]+`(?:${y[L.PRERELEASE]})?(?:${y[L.BUILD]})?(?:$|[^\\d])`);D("COERCERTL",y[L.COERCE],!0);D("COERCERTLFULL",y[L.COERCEFULL],!0);D("LONETILDE","(?:~>?)");D("TILDETRIM",`(\\s*)${y[L.LONETILDE]}\\s+`,!0);c.tildeTrimReplace="$1~";D("TILDE",`^${y[L.LONETILDE]}${y[L.XRANGEPLAIN]}$`);D("TILDELOOSE",`^${y[L.LONETILDE]}${y[L.XRANGEPLAINLOOSE]}$`);D("LONECARET","(?:\\^)");D("CARETTRIM",`(\\s*)${y[L.LONECARET]}\\s+`,!0);c.caretTrimReplace="$1^";D("CARET",`^${y[L.LONECARET]}${y[L.XRANGEPLAIN]}$`);D("CARETLOOSE",`^${y[L.LONECARET]}${y[L.XRANGEPLAINLOOSE]}$`);D("COMPARATORLOOSE",`^${y[L.GTLT]}\\s*(${y[L.LOOSEPLAIN]})$|^$`);D("COMPARATOR",`^${y[L.GTLT]}\\s*(${y[L.FULLPLAIN]})$|^$`);D("COMPARATORTRIM",`(\\s*)${y[L.GTLT]}\\s*(${y[L.LOOSEPLAIN]}|${y[L.XRANGEPLAIN]})`,!0);c.comparatorTrimReplace="$1$2$3";D("HYPHENRANGE",`^\\s*(${y[L.XRANGEPLAIN]})\\s+-\\s+(${y[L.XRANGEPLAIN]})\\s*$`);D("HYPHENRANGELOOSE",`^\\s*(${y[L.XRANGEPLAINLOOSE]})\\s+-\\s+(${y[L.XRANGEPLAINLOOSE]})\\s*$`);D("STAR","(<|>)?=?\\s*\\*");D("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");D("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var q2=T((z9,b1)=>{var E4=Object.freeze({loose:!0}),q4=Object.freeze({}),A4=($)=>{if(!$)return q4;if(typeof $!=="object")return E4;return $};b1.exports=A4});var m1=T((R9,g1)=>{var v1=/^[0-9]+$/,h1=($,J)=>{let w=v1.test($),F=v1.test(J);if(w&&F)$=+$,J=+J;return $===J?0:w&&!F?-1:F&&!w?1:$<J?-1:1},S4=($,J)=>h1(J,$);g1.exports={compareIdentifiers:h1,rcompareIdentifiers:S4}});var B2=T((P9,a1)=>{var A2=L2(),{MAX_LENGTH:l1,MAX_SAFE_INTEGER:S2}=E2(),{safeRe:u1,safeSrc:c1,t:C2}=N2(),C4=q2(),{compareIdentifiers:U2}=m1();class m{constructor($,J){if(J=C4(J),$ instanceof m)if($.loose===!!J.loose&&$.includePrerelease===!!J.includePrerelease)return $;else $=$.version;else if(typeof $!=="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof $}".`);if($.length>l1)throw new TypeError(`version is longer than ${l1} characters`);A2("SemVer",$,J),this.options=J,this.loose=!!J.loose,this.includePrerelease=!!J.includePrerelease;let w=$.trim().match(J.loose?u1[C2.LOOSE]:u1[C2.FULL]);if(!w)throw new TypeError(`Invalid Version: ${$}`);if(this.raw=$,this.major=+w[1],this.minor=+w[2],this.patch=+w[3],this.major>S2||this.major<0)throw new TypeError("Invalid major version");if(this.minor>S2||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>S2||this.patch<0)throw new TypeError("Invalid patch version");if(!w[4])this.prerelease=[];else this.prerelease=w[4].split(".").map((F)=>{if(/^[0-9]+$/.test(F)){let W=+F;if(W>=0&&W<S2)return W}return F});this.build=w[5]?w[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare($){if(A2("SemVer.compare",this.version,this.options,$),!($ instanceof m)){if(typeof $==="string"&&$===this.version)return 0;$=new m($,this.options)}if($.version===this.version)return 0;return this.compareMain($)||this.comparePre($)}compareMain($){if(!($ instanceof m))$=new m($,this.options);return U2(this.major,$.major)||U2(this.minor,$.minor)||U2(this.patch,$.patch)}comparePre($){if(!($ instanceof m))$=new m($,this.options);if(this.prerelease.length&&!$.prerelease.length)return-1;else if(!this.prerelease.length&&$.prerelease.length)return 1;else if(!this.prerelease.length&&!$.prerelease.length)return 0;let J=0;do{let w=this.prerelease[J],F=$.prerelease[J];if(A2("prerelease compare",J,w,F),w===void 0&&F===void 0)return 0;else if(F===void 0)return 1;else if(w===void 0)return-1;else if(w===F)continue;else return U2(w,F)}while(++J)}compareBuild($){if(!($ instanceof m))$=new m($,this.options);let J=0;do{let w=this.build[J],F=$.build[J];if(A2("build compare",J,w,F),w===void 0&&F===void 0)return 0;else if(F===void 0)return 1;else if(w===void 0)return-1;else if(w===F)continue;else return U2(w,F)}while(++J)}inc($,J,w){if($.startsWith("pre")){if(!J&&w===!1)throw new Error("invalid increment argument: identifier is empty");if(J){let F=new RegExp(`^${this.options.loose?c1[C2.PRERELEASELOOSE]:c1[C2.PRERELEASE]}$`),W=`-${J}`.match(F);if(!W||W[1]!==J)throw new Error(`invalid identifier: ${J}`)}}switch($){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",J,w);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",J,w);break;case"prepatch":this.prerelease.length=0,this.inc("patch",J,w),this.inc("pre",J,w);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",J,w);this.inc("pre",J,w);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":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let F=Number(w)?1:0;if(this.prerelease.length===0)this.prerelease=[F];else{let W=this.prerelease.length;while(--W>=0)if(typeof this.prerelease[W]==="number")this.prerelease[W]++,W=-2;if(W===-1){if(J===this.prerelease.join(".")&&w===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(F)}}if(J){let W=[J,F];if(w===!1)W=[J];if(U2(this.prerelease[0],J)===0){if(isNaN(this.prerelease[1]))this.prerelease=W}else this.prerelease=W}break}default:throw new Error(`invalid increment argument: ${$}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}a1.exports=m});var n1=T((_9,e1)=>{var r1=B2(),M4=($,J,w=!1)=>{if($ instanceof r1)return $;try{return new r1($,J)}catch(F){if(!w)return null;throw F}};e1.exports=M4});var s1=T((E9,p1)=>{var k4=B2(),x4=n1(),{safeRe:M2,t:k2}=N2(),f4=($,J)=>{if($ instanceof k4)return $;if(typeof $==="number")$=String($);if(typeof $!=="string")return null;J=J||{};let w=null;if(!J.rtl)w=$.match(J.includePrerelease?M2[k2.COERCEFULL]:M2[k2.COERCE]);else{let K=J.includePrerelease?M2[k2.COERCERTLFULL]:M2[k2.COERCERTL],G;while((G=K.exec($))&&(!w||w.index+w[0].length!==$.length)){if(!w||G.index+G[0].length!==w.index+w[0].length)w=G;K.lastIndex=G.index+G[1].length+G[2].length}K.lastIndex=-1}if(w===null)return null;let F=w[2],W=w[3]||"0",Z=w[4]||"0",B=J.includePrerelease&&w[5]?`-${w[5]}`:"",Y=J.includePrerelease&&w[6]?`+${w[6]}`:"";return x4(`${F}.${W}.${Z}${B}${Y}`,J)};p1.exports=f4});var $2=T((q9,i1)=>{var t1=B2(),d4=($,J,w)=>new t1($,w).compare(new t1(J,w));i1.exports=d4});var p2=T((A9,o1)=>{var O4=$2(),b4=($,J,w)=>O4($,J,w)>=0;o1.exports=b4});var w0=T((S9,J0)=>{class $0{constructor(){this.max=1000,this.map=new Map}get($){let J=this.map.get($);if(J===void 0)return;else return this.map.delete($),this.map.set($,J),J}delete($){return this.map.delete($)}set($,J){if(!this.delete($)&&J!==void 0){if(this.map.size>=this.max){let F=this.map.keys().next().value;this.delete(F)}this.map.set($,J)}return this}}J0.exports=$0});var W0=T((C9,F0)=>{var v4=$2(),h4=($,J,w)=>v4($,J,w)===0;F0.exports=h4});var U0=T((M9,Z0)=>{var g4=$2(),m4=($,J,w)=>g4($,J,w)!==0;Z0.exports=m4});var Y0=T((k9,B0)=>{var l4=$2(),u4=($,J,w)=>l4($,J,w)>0;B0.exports=u4});var K0=T((x9,Q0)=>{var c4=$2(),a4=($,J,w)=>c4($,J,w)<0;Q0.exports=a4});var G0=T((f9,H0)=>{var r4=$2(),e4=($,J,w)=>r4($,J,w)<=0;H0.exports=e4});var y0=T((d9,I0)=>{var n4=W0(),p4=U0(),s4=Y0(),t4=p2(),i4=K0(),o4=G0(),$3=($,J,w,F)=>{switch(J){case"===":if(typeof $==="object")$=$.version;if(typeof w==="object")w=w.version;return $===w;case"!==":if(typeof $==="object")$=$.version;if(typeof w==="object")w=w.version;return $!==w;case"":case"=":case"==":return n4($,w,F);case"!=":return p4($,w,F);case">":return s4($,w,F);case">=":return t4($,w,F);case"<":return i4($,w,F);case"<=":return o4($,w,F);default:throw new TypeError(`Invalid operator: ${J}`)}};I0.exports=$3});var j0=T((O9,T0)=>{var X2=Symbol("SemVer ANY");class x2{static get ANY(){return X2}constructor($,J){if(J=L0(J),$ instanceof x2)if($.loose===!!J.loose)return $;else $=$.value;if($=$.trim().split(/\s+/).join(" "),t2("comparator",$,J),this.options=J,this.loose=!!J.loose,this.parse($),this.semver===X2)this.value="";else this.value=this.operator+this.semver.version;t2("comp",this)}parse($){let J=this.options.loose?N0[X0.COMPARATORLOOSE]:N0[X0.COMPARATOR],w=$.match(J);if(!w)throw new TypeError(`Invalid comparator: ${$}`);if(this.operator=w[1]!==void 0?w[1]:"",this.operator==="=")this.operator="";if(!w[2])this.semver=X2;else this.semver=new V0(w[2],this.options.loose)}toString(){return this.value}test($){if(t2("Comparator.test",$,this.options.loose),this.semver===X2||$===X2)return!0;if(typeof $==="string")try{$=new V0($,this.options)}catch(J){return!1}return s2($,this.operator,this.semver,this.options)}intersects($,J){if(!($ instanceof x2))throw new TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new D0($.value,J).test(this.value)}else if($.operator===""){if($.value==="")return!0;return new D0(this.value,J).test($.semver)}if(J=L0(J),J.includePrerelease&&(this.value==="<0.0.0-0"||$.value==="<0.0.0-0"))return!1;if(!J.includePrerelease&&(this.value.startsWith("<0.0.0")||$.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&$.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&$.operator.startsWith("<"))return!0;if(this.semver.version===$.semver.version&&this.operator.includes("=")&&$.operator.includes("="))return!0;if(s2(this.semver,"<",$.semver,J)&&this.operator.startsWith(">")&&$.operator.startsWith("<"))return!0;if(s2(this.semver,">",$.semver,J)&&this.operator.startsWith("<")&&$.operator.startsWith(">"))return!0;return!1}}T0.exports=x2;var L0=q2(),{safeRe:N0,t:X0}=N2(),s2=y0(),t2=L2(),V0=B2(),D0=i2()});var i2=T((b9,_0)=>{var J3=/\s+/g;class V2{constructor($,J){if(J=F3(J),$ instanceof V2)if($.loose===!!J.loose&&$.includePrerelease===!!J.includePrerelease)return $;else return new V2($.raw,J);if($ instanceof o2)return this.raw=$.value,this.set=[[$]],this.formatted=void 0,this;if(this.options=J,this.loose=!!J.loose,this.includePrerelease=!!J.includePrerelease,this.raw=$.trim().replace(J3," "),this.set=this.raw.split("||").map((w)=>this.parseRange(w.trim())).filter((w)=>w.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let w=this.set[0];if(this.set=this.set.filter((F)=>!R0(F[0])),this.set.length===0)this.set=[w];else if(this.set.length>1){for(let F of this.set)if(F.length===1&&K3(F[0])){this.set=[F];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let $=0;$<this.set.length;$++){if($>0)this.formatted+="||";let J=this.set[$];for(let w=0;w<J.length;w++){if(w>0)this.formatted+=" ";this.formatted+=J[w].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange($){let w=((this.options.includePrerelease&&Y3)|(this.options.loose&&Q3))+":"+$,F=z0.get(w);if(F)return F;let W=this.options.loose,Z=W?f[M.HYPHENRANGELOOSE]:f[M.HYPHENRANGE];$=$.replace(Z,T3(this.options.includePrerelease)),R("hyphen replace",$),$=$.replace(f[M.COMPARATORTRIM],Z3),R("comparator trim",$),$=$.replace(f[M.TILDETRIM],U3),R("tilde trim",$),$=$.replace(f[M.CARETTRIM],B3),R("caret trim",$);let B=$.split(" ").map((I)=>H3(I,this.options)).join(" ").split(/\s+/).map((I)=>D3(I,this.options));if(W)B=B.filter((I)=>{return R("loose invalid filter",I,this.options),!!I.match(f[M.COMPARATORLOOSE])});R("range list",B);let Y=new Map,K=B.map((I)=>new o2(I,this.options));for(let I of K){if(R0(I))return[I];Y.set(I.value,I)}if(Y.size>1&&Y.has(""))Y.delete("");let G=[...Y.values()];return z0.set(w,G),G}intersects($,J){if(!($ instanceof V2))throw new TypeError("a Range is required");return this.set.some((w)=>{return P0(w,J)&&$.set.some((F)=>{return P0(F,J)&&w.every((W)=>{return F.every((Z)=>{return W.intersects(Z,J)})})})})}test($){if(!$)return!1;if(typeof $==="string")try{$=new W3($,this.options)}catch(J){return!1}for(let J=0;J<this.set.length;J++)if(j3(this.set[J],$,this.options))return!0;return!1}}_0.exports=V2;var w3=w0(),z0=new w3,F3=q2(),o2=j0(),R=L2(),W3=B2(),{safeRe:f,t:M,comparatorTrimReplace:Z3,tildeTrimReplace:U3,caretTrimReplace:B3}=N2(),{FLAG_INCLUDE_PRERELEASE:Y3,FLAG_LOOSE:Q3}=E2(),R0=($)=>$.value==="<0.0.0-0",K3=($)=>$.value==="",P0=($,J)=>{let w=!0,F=$.slice(),W=F.pop();while(w&&F.length)w=F.every((Z)=>{return W.intersects(Z,J)}),W=F.pop();return w},H3=($,J)=>{return R("comp",$,J),$=y3($,J),R("caret",$),$=G3($,J),R("tildes",$),$=N3($,J),R("xrange",$),$=V3($,J),R("stars",$),$},k=($)=>!$||$.toLowerCase()==="x"||$==="*",G3=($,J)=>{return $.trim().split(/\s+/).map((w)=>I3(w,J)).join(" ")},I3=($,J)=>{let w=J.loose?f[M.TILDELOOSE]:f[M.TILDE];return $.replace(w,(F,W,Z,B,Y)=>{R("tilde",$,F,W,Z,B,Y);let K;if(k(W))K="";else if(k(Z))K=`>=${W}.0.0 <${+W+1}.0.0-0`;else if(k(B))K=`>=${W}.${Z}.0 <${W}.${+Z+1}.0-0`;else if(Y)R("replaceTilde pr",Y),K=`>=${W}.${Z}.${B}-${Y} <${W}.${+Z+1}.0-0`;else K=`>=${W}.${Z}.${B} <${W}.${+Z+1}.0-0`;return R("tilde return",K),K})},y3=($,J)=>{return $.trim().split(/\s+/).map((w)=>L3(w,J)).join(" ")},L3=($,J)=>{R("caret",$,J);let w=J.loose?f[M.CARETLOOSE]:f[M.CARET],F=J.includePrerelease?"-0":"";return $.replace(w,(W,Z,B,Y,K)=>{R("caret",$,W,Z,B,Y,K);let G;if(k(Z))G="";else if(k(B))G=`>=${Z}.0.0${F} <${+Z+1}.0.0-0`;else if(k(Y))if(Z==="0")G=`>=${Z}.${B}.0${F} <${Z}.${+B+1}.0-0`;else G=`>=${Z}.${B}.0${F} <${+Z+1}.0.0-0`;else if(K)if(R("replaceCaret pr",K),Z==="0")if(B==="0")G=`>=${Z}.${B}.${Y}-${K} <${Z}.${B}.${+Y+1}-0`;else G=`>=${Z}.${B}.${Y}-${K} <${Z}.${+B+1}.0-0`;else G=`>=${Z}.${B}.${Y}-${K} <${+Z+1}.0.0-0`;else if(R("no pr"),Z==="0")if(B==="0")G=`>=${Z}.${B}.${Y}${F} <${Z}.${B}.${+Y+1}-0`;else G=`>=${Z}.${B}.${Y}${F} <${Z}.${+B+1}.0-0`;else G=`>=${Z}.${B}.${Y} <${+Z+1}.0.0-0`;return R("caret return",G),G})},N3=($,J)=>{return R("replaceXRanges",$,J),$.split(/\s+/).map((w)=>X3(w,J)).join(" ")},X3=($,J)=>{$=$.trim();let w=J.loose?f[M.XRANGELOOSE]:f[M.XRANGE];return $.replace(w,(F,W,Z,B,Y,K)=>{R("xRange",$,F,W,Z,B,Y,K);let G=k(Z),I=G||k(B),V=I||k(Y),z=V;if(W==="="&&z)W="";if(K=J.includePrerelease?"-0":"",G)if(W===">"||W==="<")F="<0.0.0-0";else F="*";else if(W&&z){if(I)B=0;if(Y=0,W===">")if(W=">=",I)Z=+Z+1,B=0,Y=0;else B=+B+1,Y=0;else if(W==="<=")if(W="<",I)Z=+Z+1;else B=+B+1;if(W==="<")K="-0";F=`${W+Z}.${B}.${Y}${K}`}else if(I)F=`>=${Z}.0.0${K} <${+Z+1}.0.0-0`;else if(V)F=`>=${Z}.${B}.0${K} <${Z}.${+B+1}.0-0`;return R("xRange return",F),F})},V3=($,J)=>{return R("replaceStars",$,J),$.trim().replace(f[M.STAR],"")},D3=($,J)=>{return R("replaceGTE0",$,J),$.trim().replace(f[J.includePrerelease?M.GTE0PRE:M.GTE0],"")},T3=($)=>(J,w,F,W,Z,B,Y,K,G,I,V,z)=>{if(k(F))w="";else if(k(W))w=`>=${F}.0.0${$?"-0":""}`;else if(k(Z))w=`>=${F}.${W}.0${$?"-0":""}`;else if(B)w=`>=${w}`;else w=`>=${w}${$?"-0":""}`;if(k(G))K="";else if(k(I))K=`<${+G+1}.0.0-0`;else if(k(V))K=`<${G}.${+I+1}.0-0`;else if(z)K=`<=${G}.${I}.${V}-${z}`;else if($)K=`<${G}.${I}.${+V+1}-0`;else K=`<=${K}`;return`${w} ${K}`.trim()},j3=($,J,w)=>{for(let F=0;F<$.length;F++)if(!$[F].test(J))return!1;if(J.prerelease.length&&!w.includePrerelease){for(let F=0;F<$.length;F++){if(R($[F].semver),$[F].semver===o2.ANY)continue;if($[F].semver.prerelease.length>0){let W=$[F].semver;if(W.major===J.major&&W.minor===J.minor&&W.patch===J.patch)return!0}}return!1}return!0}});var q0=T((v9,E0)=>{var z3=i2(),R3=($,J,w)=>{try{J=new z3(J,w)}catch(F){return!1}return J.test($)};E0.exports=R3});var $1=T((h9,P3)=>{P3.exports={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.33.5",author:"Lovell Fuller <npm@lovell.info>",homepage:"https://sharp.pixelplumbing.com",contributors:["Pierre Inglebert <pierre.inglebert@gmail.com>","Jonathan Ong <jonathanrichardong@gmail.com>","Chanon Sajjamanochai <chanon.s@gmail.com>","Juliano Julio <julianojulio@gmail.com>","Daniel Gasienica <daniel@gasienica.ch>","Julian Walker <julian@fiftythree.com>","Amit Pitaru <pitaru.amit@gmail.com>","Brandon Aaron <hello.brandon@aaron.sh>","Andreas Lind <andreas@one.com>","Maurus Cuelenaere <mcuelenaere@gmail.com>","Linus Unneb\xE4ck <linus@folkdatorn.se>","Victor Mateevitsi <mvictoras@gmail.com>","Alaric Holloway <alaric.holloway@gmail.com>","Bernhard K. Weisshuhn <bkw@codingforce.com>","Chris Riley <criley@primedia.com>","David Carley <dacarley@gmail.com>","John Tobin <john@limelightmobileinc.com>","Kenton Gray <kentongray@gmail.com>","Felix B\xFCnemann <Felix.Buenemann@gmail.com>","Samy Al Zahrani <samyalzahrany@gmail.com>","Chintan Thakkar <lemnisk8@gmail.com>","F. Orlando Galashan <frulo@gmx.de>","Kleis Auke Wolthuizen <info@kleisauke.nl>","Matt Hirsch <mhirsch@media.mit.edu>","Matthias Thoemmes <thoemmes@gmail.com>","Patrick Paskaris <patrick@paskaris.gr>","J\xE9r\xE9my Lal <kapouer@melix.org>","Rahul Nanwani <r.nanwani@gmail.com>","Alice Monday <alice0meta@gmail.com>","Kristo Jorgenson <kristo.jorgenson@gmail.com>","YvesBos <yves_bos@outlook.com>","Guy Maliar <guy@tailorbrands.com>","Nicolas Coden <nicolas@ncoden.fr>","Matt Parrish <matt.r.parrish@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Matthew McEachen <matthew+github@mceachen.org>","Jarda Kot\u011B\u0161ovec <jarda.kotesovec@gmail.com>","Kenric D'Souza <kenric.dsouza@gmail.com>","Oleh Aleinyk <oleg.aleynik@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Andrea Bianco <andrea.bianco@unibas.ch>","Rik Heywood <rik@rik.org>","Thomas Parisot <hi@oncletom.io>","Nathan Graves <nathanrgraves+github@gmail.com>","Tom Lokhorst <tom@lokhorst.eu>","Espen Hovlandsdal <espen@hovlandsdal.com>","Sylvain Dumont <sylvain.dumont35@gmail.com>","Alun Davies <alun.owain.davies@googlemail.com>","Aidan Hoolachan <ajhoolachan21@gmail.com>","Axel Eirola <axel.eirola@iki.fi>","Freezy <freezy@xbmc.org>","Daiz <taneli.vatanen@gmail.com>","Julian Aubourg <j@ubourg.net>","Keith Belovay <keith@picthrive.com>","Michael B. Klein <mbklein@gmail.com>","Jordan Prudhomme <jordan@raboland.fr>","Ilya Ovdin <iovdin@gmail.com>","Andargor <andargor@yahoo.com>","Paul Neave <paul.neave@gmail.com>","Brendan Kennedy <brenwken@gmail.com>","Brychan Bennett-Odlum <git@brychan.io>","Edward Silverton <e.silverton@gmail.com>","Roman Malieiev <aromaleev@gmail.com>","Tomas Szabo <tomas.szabo@deftomat.com>","Robert O'Rourke <robert@o-rourke.org>","Guillermo Alfonso Varela Chouci\xF1o <guillevch@gmail.com>","Christian Flintrup <chr@gigahost.dk>","Manan Jadhav <manan@motionden.com>","Leon Radley <leon@radley.se>","alza54 <alza54@thiocod.in>","Jacob Smith <jacob@frende.me>","Michael Nutt <michael@nutt.im>","Brad Parham <baparham@gmail.com>","Taneli Vatanen <taneli.vatanen@gmail.com>","Joris Dugu\xE9 <zaruike10@gmail.com>","Chris Banks <christopher.bradley.banks@gmail.com>","Ompal Singh <ompal.hitm09@gmail.com>","Brodan <christopher.hranj@gmail.com>","Ankur Parihar <ankur.github@gmail.com>","Brahim Ait elhaj <brahima@gmail.com>","Mart Jansink <m.jansink@gmail.com>","Lachlan Newman <lachnewman007@gmail.com>","Dennis Beatty <dennis@dcbeatty.com>","Ingvar Stepanyan <me@rreverser.com>","Don Denton <don@happycollision.com>"],scripts:{install:"node install/check",clean:"rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",test:"npm run test-lint && npm run test-unit && npm run test-licensing && npm run test-types","test-lint":"semistandard && cpplint","test-unit":"nyc --reporter=lcov --reporter=text --check-coverage --branches=100 mocha","test-licensing":'license-checker --production --summary --onlyAllow="Apache-2.0;BSD;ISC;LGPL-3.0-or-later;MIT"',"test-leak":"./test/leak/leak.sh","test-types":"tsd","package-from-local-build":"node npm/from-local-build","package-from-github-release":"node npm/from-github-release","docs-build":"node docs/build && node docs/search-index/build","docs-serve":"cd docs && npx serve","docs-publish":"cd docs && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",main:"lib/index.js",types:"lib/index.d.ts",files:["install","lib","src/*.{cc,h,gyp}"],repository:{type:"git",url:"git://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{color:"^4.2.3","detect-libc":"^2.0.3",semver:"^7.6.3"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.33.5","@img/sharp-darwin-x64":"0.33.5","@img/sharp-libvips-darwin-arm64":"1.0.4","@img/sharp-libvips-darwin-x64":"1.0.4","@img/sharp-libvips-linux-arm":"1.0.5","@img/sharp-libvips-linux-arm64":"1.0.4","@img/sharp-libvips-linux-s390x":"1.0.4","@img/sharp-libvips-linux-x64":"1.0.4","@img/sharp-libvips-linuxmusl-arm64":"1.0.4","@img/sharp-libvips-linuxmusl-x64":"1.0.4","@img/sharp-linux-arm":"0.33.5","@img/sharp-linux-arm64":"0.33.5","@img/sharp-linux-s390x":"0.33.5","@img/sharp-linux-x64":"0.33.5","@img/sharp-linuxmusl-arm64":"0.33.5","@img/sharp-linuxmusl-x64":"0.33.5","@img/sharp-wasm32":"0.33.5","@img/sharp-win32-ia32":"0.33.5","@img/sharp-win32-x64":"0.33.5"},devDependencies:{"@emnapi/runtime":"^1.2.0","@img/sharp-libvips-dev":"1.0.4","@img/sharp-libvips-dev-wasm32":"1.0.5","@img/sharp-libvips-win32-ia32":"1.0.4","@img/sharp-libvips-win32-x64":"1.0.4","@types/node":"*",async:"^3.2.5",cc:"^3.0.1",emnapi:"^1.2.0","exif-reader":"^2.0.1","extract-zip":"^2.0.1",icc:"^3.0.0","jsdoc-to-markdown":"^8.0.3","license-checker":"^25.0.1",mocha:"^10.7.3","node-addon-api":"^8.1.0",nyc:"^17.0.0",prebuild:"^13.0.1",semistandard:"^17.0.0","tar-fs":"^3.0.6",tsd:"^0.31.1"},license:"Apache-2.0",engines:{node:"^18.17.0 || ^20.3.0 || >=21.0.0"},config:{libvips:">=8.15.3"},funding:{url:"https://opencollective.com/libvips"},binary:{napi_versions:[9]},semistandard:{env:["mocha"]},cc:{linelength:"120",filter:["build/include"]},nyc:{include:["lib"]},tsd:{directory:"test/types/"}}});var w1=T((g9,b0)=>{var{spawnSync:f2}=P("child_process"),{createHash:_3}=P("crypto"),M0=s1(),E3=p2(),q3=q0(),A0=P("detect-libc"),{config:A3,engines:S0,optionalDependencies:S3}=$1(),C3=process.env.npm_package_config_libvips||A3.libvips,k0=M0(C3).version,M3=["darwin-arm64","darwin-x64","linux-arm","linux-arm64","linux-s390x","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-ia32","win32-x64"],d2={encoding:"utf8",shell:!0},k3=($)=>{if($ instanceof Error)console.error(`sharp: Installation error: ${$.message}`);else console.log(`sharp: ${$}`)},x0=()=>A0.isNonGlibcLinuxSync()?A0.familySync():"",x3=()=>`${process.platform}${x0()}-${process.arch}`,Y2=()=>{if(f0())return"wasm32";let{npm_config_arch:$,npm_config_platform:J,npm_config_libc:w}=process.env,F=typeof w==="string"?w:x0();return`${J||process.platform}${F}-${$||process.arch}`},f3=()=>{try{return P(`@img/sharp-libvips-dev-${Y2()}/include`)}catch{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/include");})()}catch{}}return""},d3=()=>{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/cplusplus");})()}catch{}return""},O3=()=>{try{return P(`@img/sharp-libvips-dev-${Y2()}/lib`)}catch{try{return P(`@img/sharp-libvips-${Y2()}/lib`)}catch{}}return""},b3=()=>{if(process.release?.name==="node"&&process.versions){if(!q3(process.versions.node,S0.node))return{found:process.versions.node,expected:S0.node}}},f0=()=>{let{CC:$}=process.env;return Boolean($&&$.endsWith("/emcc"))},v3=()=>{if(process.platform==="darwin"&&process.arch==="x64")return(f2("sysctl sysctl.proc_translated",d2).stdout||"").trim()==="sysctl.proc_translated: 1";return!1},C0=($)=>_3("sha512").update($).digest("hex"),h3=()=>{try{let $=C0(`imgsharp-libvips-${Y2()}`),J=M0(S3[`@img/sharp-libvips-${Y2()}`]).version;return C0(`${$}npm:${J}`).slice(0,10)}catch{}return""},g3=()=>f2(`node-gyp rebuild --directory=src ${f0()?"--nodedir=emscripten":""}`,{...d2,stdio:"inherit"}).status,d0=()=>{if(process.platform!=="win32")return(f2("pkg-config --modversion vips-cpp",{...d2,env:{...process.env,PKG_CONFIG_PATH:O0()}}).stdout||"").trim();else return""},O0=()=>{if(process.platform!=="win32")return[(f2('which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',d2).stdout||"").trim(),process.env.PKG_CONFIG_PATH,"/usr/local/lib/pkgconfig","/usr/lib/pkgconfig","/usr/local/libdata/pkgconfig","/usr/libdata/pkgconfig"].filter(Boolean).join(":");else return""},J1=($,J,w)=>{if(w)w(`Detected ${J}, skipping search for globally-installed libvips`);return $},m3=($)=>{if(Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)===!0)return J1(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",$);if(Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)===!0)return J1(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",$);if(v3())return J1(!1,"Rosetta",$);let J=d0();return!!J&&E3(J,k0)};b0.exports={minimumLibvipsVersion:k0,prebuiltPlatforms:M3,buildPlatformArch:Y2,buildSharpLibvipsIncludeDir:f3,buildSharpLibvipsCPlusPlusDir:d3,buildSharpLibvipsLibDir:O3,isUnsupportedNodeRuntime:b3,runtimePlatformArch:x3,log:k3,yarnLocator:h3,spawnRebuild:g3,globalLibvipsVersion:d0,pkgConfigPath:O0,useGlobalLibvips:m3}});var D2=T((l9,h0)=>{var{familySync:l3,versionSync:u3}=P("detect-libc"),{runtimePlatformArch:c3,isUnsupportedNodeRuntime:v0,prebuiltPlatforms:a3,minimumLibvipsVersion:r3}=w1(),J2=c3(),e3=[`../src/build/Release/sharp-${J2}.node`,"../src/build/Release/sharp-wasm32.node",`@img/sharp-${J2}/sharp.node`,"@img/sharp-wasm32/sharp.node"],F1,O2=[];for(let $ of e3)try{F1=P($);break}catch(J){O2.push(J)}if(F1)h0.exports=F1;else{let[$,J,w]=["linux","darwin","win32"].map((Z)=>J2.startsWith(Z)),F=[`Could not load the "sharp" module using the ${J2} runtime`];O2.forEach((Z)=>{if(Z.code!=="MODULE_NOT_FOUND")F.push(`${Z.code}: ${Z.message}`)});let W=O2.map((Z)=>Z.message).join(" ");if(F.push("Possible solutions:"),v0()){let{found:Z,expected:B}=v0();F.push("- Please upgrade Node.js:",` Found ${Z}`,` Requires ${B}`)}else if(a3.includes(J2)){let[Z,B]=J2.split("-"),Y=Z.endsWith("musl")?" --libc=musl":"";F.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=${Z.replace("musl","")}${Y} --cpu=${B} sharp`)}else F.push(`- Manually install libvips >= ${r3}`,"- Add experimental WebAssembly-based dependencies:"," npm install --cpu=wasm32 sharp"," npm install @img/sharp-wasm32");if($&&/(symbol not found|CXXABI_)/i.test(W))try{let{config:Z}=P(`@img/sharp-libvips-${J2}/package`),B=`${l3()} ${u3()}`,Y=`${Z.musl?"musl":"glibc"} ${Z.musl||Z.glibc}`;F.push("- Update your OS:",` Found ${B}`,` Requires ${Y}`)}catch(Z){}if($&&/\/snap\/core[0-9]{2}/.test(W))F.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node");if(J&&/Incompatible library version/.test(W))F.push("- Update Homebrew:"," brew update && brew upgrade vips");if(O2.some((Z)=>Z.code==="ERR_DLOPEN_DISABLED"))F.push("- Run Node.js without using the --no-addons flag");if(w&&/The specified procedure could not be found/.test(W))F.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");throw F.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),new Error(F.join(`
|
|
3
3
|
`))}});var m0=T((c9,g0)=>{var n3=P("util"),W1=P("stream"),p3=u();D2();var s3=n3.debuglog("sharp"),w2=function($,J){if(arguments.length===1&&!p3.defined($))throw new Error("Invalid input");if(!(this instanceof w2))return new w2($,J);return W1.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:"crop",position:0,resizeBackground:[0,0,0,255],useExifOrientation:!1,angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBeforePreExtract:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:"background",withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:"lanczos3",fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:"integer",minAmpl:0.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:"",joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:"srgb",colourspacePipeline:"last",composite:[],fileOut:"",formatOut:"input",streamOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:"",withExif:{},withExifMerge:!0,resolveWithObject:!1,jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:"4:2:0",jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:"4:4:4",webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:"jpeg",tiffPredictor:"horizontal",tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:8,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:"inch",heifQuality:50,heifLossless:!1,heifCompression:"av1",heifEffort:4,heifChromaSubsampling:"4:4:4",heifBitdepth:8,jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:"uchar",tileSize:256,tileOverlap:0,tileContainer:"fs",tileLayout:"dz",tileFormat:"last",tileDepth:"last",tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:"https://example.com/iiif",tileBasename:"",timeoutSeconds:0,linearA:[],linearB:[],debuglog:(w)=>{this.emit("warning",w),s3(w)},queueListener:function(w){w2.queue.emit("change",w)}},this.options.input=this._createInputDescriptor($,J,{allowStream:!0}),this};Object.setPrototypeOf(w2.prototype,W1.Duplex.prototype);Object.setPrototypeOf(w2,W1.Duplex);function t3(){let $=this.constructor.call(),{debuglog:J,queueListener:w,...F}=this.options;if($.options=structuredClone(F),$.options.debuglog=J,$.options.queueListener=w,this._isStreamInput())this.on("finish",()=>{this._flattenBufferIn(),$.options.input.buffer=this.options.input.buffer,$.emit("finish")});return $}Object.assign(w2.prototype,{clone:t3});g0.exports=w2});var Z1=T((a9,l0)=>{l0.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var c0=T((r9,u0)=>{u0.exports=function $(J){if(!J||typeof J==="string")return!1;return J instanceof Array||Array.isArray(J)||J.length>=0&&(J.splice instanceof Function||Object.getOwnPropertyDescriptor(J,J.length-1)&&J.constructor.name!=="String")}});var e0=T((e9,r0)=>{var i3=c0(),o3=Array.prototype.concat,$8=Array.prototype.slice,a0=r0.exports=function $(J){var w=[];for(var F=0,W=J.length;F<W;F++){var Z=J[F];if(i3(Z))w=o3.call(w,$8.call(Z));else w.push(Z)}return w};a0.wrap=function($){return function(){return $(a0(arguments))}}});var t0=T((n9,s0)=>{var T2=Z1(),j2=e0(),n0=Object.hasOwnProperty,p0=Object.create(null);for(b2 in T2)if(n0.call(T2,b2))p0[T2[b2]]=b2;var b2,O=s0.exports={to:{},get:{}};O.get=function($){var J=$.substring(0,3).toLowerCase(),w,F;switch(J){case"hsl":w=O.get.hsl($),F="hsl";break;case"hwb":w=O.get.hwb($),F="hwb";break;default:w=O.get.rgb($),F="rgb";break}if(!w)return null;return{model:F,value:w}};O.get.rgb=function($){if(!$)return null;var J=/^#([a-f0-9]{3,4})$/i,w=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,F=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,W=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,Z=/^(\w+)$/,B=[0,0,0,1],Y,K,G;if(Y=$.match(w)){G=Y[2],Y=Y[1];for(K=0;K<3;K++){var I=K*2;B[K]=parseInt(Y.slice(I,I+2),16)}if(G)B[3]=parseInt(G,16)/255}else if(Y=$.match(J)){Y=Y[1],G=Y[3];for(K=0;K<3;K++)B[K]=parseInt(Y[K]+Y[K],16);if(G)B[3]=parseInt(G+G,16)/255}else if(Y=$.match(F)){for(K=0;K<3;K++)B[K]=parseInt(Y[K+1],0);if(Y[4])if(Y[5])B[3]=parseFloat(Y[4])*0.01;else B[3]=parseFloat(Y[4])}else if(Y=$.match(W)){for(K=0;K<3;K++)B[K]=Math.round(parseFloat(Y[K+1])*2.55);if(Y[4])if(Y[5])B[3]=parseFloat(Y[4])*0.01;else B[3]=parseFloat(Y[4])}else if(Y=$.match(Z)){if(Y[1]==="transparent")return[0,0,0,0];if(!n0.call(T2,Y[1]))return null;return B=T2[Y[1]],B[3]=1,B}else return null;for(K=0;K<3;K++)B[K]=s(B[K],0,255);return B[3]=s(B[3],0,1),B};O.get.hsl=function($){if(!$)return null;var J=/^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*)?\)$/,w=$.match(J);if(w){var F=parseFloat(w[4]),W=(parseFloat(w[1])%360+360)%360,Z=s(parseFloat(w[2]),0,100),B=s(parseFloat(w[3]),0,100),Y=s(isNaN(F)?1:F,0,1);return[W,Z,B,Y]}return null};O.get.hwb=function($){if(!$)return null;var J=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,w=$.match(J);if(w){var F=parseFloat(w[4]),W=(parseFloat(w[1])%360+360)%360,Z=s(parseFloat(w[2]),0,100),B=s(parseFloat(w[3]),0,100),Y=s(isNaN(F)?1:F,0,1);return[W,Z,B,Y]}return null};O.to.hex=function(){var $=j2(arguments);return"#"+v2($[0])+v2($[1])+v2($[2])+($[3]<1?v2(Math.round($[3]*255)):"")};O.to.rgb=function(){var $=j2(arguments);return $.length<4||$[3]===1?"rgb("+Math.round($[0])+", "+Math.round($[1])+", "+Math.round($[2])+")":"rgba("+Math.round($[0])+", "+Math.round($[1])+", "+Math.round($[2])+", "+$[3]+")"};O.to.rgb.percent=function(){var $=j2(arguments),J=Math.round($[0]/255*100),w=Math.round($[1]/255*100),F=Math.round($[2]/255*100);return $.length<4||$[3]===1?"rgb("+J+"%, "+w+"%, "+F+"%)":"rgba("+J+"%, "+w+"%, "+F+"%, "+$[3]+")"};O.to.hsl=function(){var $=j2(arguments);return $.length<4||$[3]===1?"hsl("+$[0]+", "+$[1]+"%, "+$[2]+"%)":"hsla("+$[0]+", "+$[1]+"%, "+$[2]+"%, "+$[3]+")"};O.to.hwb=function(){var $=j2(arguments),J="";if($.length>=4&&$[3]!==1)J=", "+$[3];return"hwb("+$[0]+", "+$[1]+"%, "+$[2]+"%"+J+")"};O.to.keyword=function($){return p0[$.slice(0,3)]};function s($,J,w){return Math.min(Math.max(J,$),w)}function v2($){var J=Math.round($).toString(16).toUpperCase();return J.length<2?"0"+J:J}});var U1=T((p9,o0)=>{var z2=Z1(),i0={};for(let $ of Object.keys(z2))i0[z2[$]]=$;var N={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};o0.exports=N;for(let $ of Object.keys(N)){if(!("channels"in N[$]))throw new Error("missing channels property: "+$);if(!("labels"in N[$]))throw new Error("missing channel labels property: "+$);if(N[$].labels.length!==N[$].channels)throw new Error("channel and label counts mismatch: "+$);let{channels:J,labels:w}=N[$];delete N[$].channels,delete N[$].labels,Object.defineProperty(N[$],"channels",{value:J}),Object.defineProperty(N[$],"labels",{value:w})}N.rgb.hsl=function($){let J=$[0]/255,w=$[1]/255,F=$[2]/255,W=Math.min(J,w,F),Z=Math.max(J,w,F),B=Z-W,Y,K;if(Z===W)Y=0;else if(J===Z)Y=(w-F)/B;else if(w===Z)Y=2+(F-J)/B;else if(F===Z)Y=4+(J-w)/B;if(Y=Math.min(Y*60,360),Y<0)Y+=360;let G=(W+Z)/2;if(Z===W)K=0;else if(G<=0.5)K=B/(Z+W);else K=B/(2-Z-W);return[Y,K*100,G*100]};N.rgb.hsv=function($){let J,w,F,W,Z,B=$[0]/255,Y=$[1]/255,K=$[2]/255,G=Math.max(B,Y,K),I=G-Math.min(B,Y,K),V=function(z){return(G-z)/6/I+0.5};if(I===0)W=0,Z=0;else{if(Z=I/G,J=V(B),w=V(Y),F=V(K),B===G)W=F-w;else if(Y===G)W=0.3333333333333333+J-F;else if(K===G)W=0.6666666666666666+w-J;if(W<0)W+=1;else if(W>1)W-=1}return[W*360,Z*100,G*100]};N.rgb.hwb=function($){let J=$[0],w=$[1],F=$[2],W=N.rgb.hsl($)[0],Z=0.00392156862745098*Math.min(J,Math.min(w,F));return F=1-0.00392156862745098*Math.max(J,Math.max(w,F)),[W,Z*100,F*100]};N.rgb.cmyk=function($){let J=$[0]/255,w=$[1]/255,F=$[2]/255,W=Math.min(1-J,1-w,1-F),Z=(1-J-W)/(1-W)||0,B=(1-w-W)/(1-W)||0,Y=(1-F-W)/(1-W)||0;return[Z*100,B*100,Y*100,W*100]};function J8($,J){return($[0]-J[0])**2+($[1]-J[1])**2+($[2]-J[2])**2}N.rgb.keyword=function($){let J=i0[$];if(J)return J;let w=1/0,F;for(let W of Object.keys(z2)){let Z=z2[W],B=J8($,Z);if(B<w)w=B,F=W}return F};N.keyword.rgb=function($){return z2[$]};N.rgb.xyz=function($){let J=$[0]/255,w=$[1]/255,F=$[2]/255;J=J>0.04045?((J+0.055)/1.055)**2.4:J/12.92,w=w>0.04045?((w+0.055)/1.055)**2.4:w/12.92,F=F>0.04045?((F+0.055)/1.055)**2.4:F/12.92;let W=J*0.4124+w*0.3576+F*0.1805,Z=J*0.2126+w*0.7152+F*0.0722,B=J*0.0193+w*0.1192+F*0.9505;return[W*100,Z*100,B*100]};N.rgb.lab=function($){let J=N.rgb.xyz($),w=J[0],F=J[1],W=J[2];w/=95.047,F/=100,W/=108.883,w=w>0.008856?w**0.3333333333333333:7.787*w+0.13793103448275862,F=F>0.008856?F**0.3333333333333333:7.787*F+0.13793103448275862,W=W>0.008856?W**0.3333333333333333:7.787*W+0.13793103448275862;let Z=116*F-16,B=500*(w-F),Y=200*(F-W);return[Z,B,Y]};N.hsl.rgb=function($){let J=$[0]/360,w=$[1]/100,F=$[2]/100,W,Z,B;if(w===0)return B=F*255,[B,B,B];if(F<0.5)W=F*(1+w);else W=F+w-F*w;let Y=2*F-W,K=[0,0,0];for(let G=0;G<3;G++){if(Z=J+0.3333333333333333*-(G-1),Z<0)Z++;if(Z>1)Z--;if(6*Z<1)B=Y+(W-Y)*6*Z;else if(2*Z<1)B=W;else if(3*Z<2)B=Y+(W-Y)*(0.6666666666666666-Z)*6;else B=Y;K[G]=B*255}return K};N.hsl.hsv=function($){let J=$[0],w=$[1]/100,F=$[2]/100,W=w,Z=Math.max(F,0.01);F*=2,w*=F<=1?F:2-F,W*=Z<=1?Z:2-Z;let B=(F+w)/2,Y=F===0?2*W/(Z+W):2*w/(F+w);return[J,Y*100,B*100]};N.hsv.rgb=function($){let J=$[0]/60,w=$[1]/100,F=$[2]/100,W=Math.floor(J)%6,Z=J-Math.floor(J),B=255*F*(1-w),Y=255*F*(1-w*Z),K=255*F*(1-w*(1-Z));switch(F*=255,W){case 0:return[F,K,B];case 1:return[Y,F,B];case 2:return[B,F,K];case 3:return[B,Y,F];case 4:return[K,B,F];case 5:return[F,B,Y]}};N.hsv.hsl=function($){let J=$[0],w=$[1]/100,F=$[2]/100,W=Math.max(F,0.01),Z,B;B=(2-w)*F;let Y=(2-w)*W;return Z=w*W,Z/=Y<=1?Y:2-Y,Z=Z||0,B/=2,[J,Z*100,B*100]};N.hwb.rgb=function($){let J=$[0]/360,w=$[1]/100,F=$[2]/100,W=w+F,Z;if(W>1)w/=W,F/=W;let B=Math.floor(6*J),Y=1-F;if(Z=6*J-B,(B&1)!==0)Z=1-Z;let K=w+Z*(Y-w),G,I,V;switch(B){default:case 6:case 0:G=Y,I=K,V=w;break;case 1:G=K,I=Y,V=w;break;case 2:G=w,I=Y,V=K;break;case 3:G=w,I=K,V=Y;break;case 4:G=K,I=w,V=Y;break;case 5:G=Y,I=w,V=K;break}return[G*255,I*255,V*255]};N.cmyk.rgb=function($){let J=$[0]/100,w=$[1]/100,F=$[2]/100,W=$[3]/100,Z=1-Math.min(1,J*(1-W)+W),B=1-Math.min(1,w*(1-W)+W),Y=1-Math.min(1,F*(1-W)+W);return[Z*255,B*255,Y*255]};N.xyz.rgb=function($){let J=$[0]/100,w=$[1]/100,F=$[2]/100,W,Z,B;return W=J*3.2406+w*-1.5372+F*-0.4986,Z=J*-0.9689+w*1.8758+F*0.0415,B=J*0.0557+w*-0.204+F*1.057,W=W>0.0031308?1.055*W**0.4166666666666667-0.055:W*12.92,Z=Z>0.0031308?1.055*Z**0.4166666666666667-0.055:Z*12.92,B=B>0.0031308?1.055*B**0.4166666666666667-0.055:B*12.92,W=Math.min(Math.max(0,W),1),Z=Math.min(Math.max(0,Z),1),B=Math.min(Math.max(0,B),1),[W*255,Z*255,B*255]};N.xyz.lab=function($){let J=$[0],w=$[1],F=$[2];J/=95.047,w/=100,F/=108.883,J=J>0.008856?J**0.3333333333333333:7.787*J+0.13793103448275862,w=w>0.008856?w**0.3333333333333333:7.787*w+0.13793103448275862,F=F>0.008856?F**0.3333333333333333:7.787*F+0.13793103448275862;let W=116*w-16,Z=500*(J-w),B=200*(w-F);return[W,Z,B]};N.lab.xyz=function($){let J=$[0],w=$[1],F=$[2],W,Z,B;Z=(J+16)/116,W=w/500+Z,B=Z-F/200;let Y=Z**3,K=W**3,G=B**3;return Z=Y>0.008856?Y:(Z-0.13793103448275862)/7.787,W=K>0.008856?K:(W-0.13793103448275862)/7.787,B=G>0.008856?G:(B-0.13793103448275862)/7.787,W*=95.047,Z*=100,B*=108.883,[W,Z,B]};N.lab.lch=function($){let J=$[0],w=$[1],F=$[2],W;if(W=Math.atan2(F,w)*360/2/Math.PI,W<0)W+=360;let B=Math.sqrt(w*w+F*F);return[J,B,W]};N.lch.lab=function($){let J=$[0],w=$[1],W=$[2]/360*2*Math.PI,Z=w*Math.cos(W),B=w*Math.sin(W);return[J,Z,B]};N.rgb.ansi16=function($,J=null){let[w,F,W]=$,Z=J===null?N.rgb.hsv($)[2]:J;if(Z=Math.round(Z/50),Z===0)return 30;let B=30+(Math.round(W/255)<<2|Math.round(F/255)<<1|Math.round(w/255));if(Z===2)B+=60;return B};N.hsv.ansi16=function($){return N.rgb.ansi16(N.hsv.rgb($),$[2])};N.rgb.ansi256=function($){let J=$[0],w=$[1],F=$[2];if(J===w&&w===F){if(J<8)return 16;if(J>248)return 231;return Math.round((J-8)/247*24)+232}return 16+36*Math.round(J/255*5)+6*Math.round(w/255*5)+Math.round(F/255*5)};N.ansi16.rgb=function($){let J=$%10;if(J===0||J===7){if($>50)J+=3.5;return J=J/10.5*255,[J,J,J]}let w=(~~($>50)+1)*0.5,F=(J&1)*w*255,W=(J>>1&1)*w*255,Z=(J>>2&1)*w*255;return[F,W,Z]};N.ansi256.rgb=function($){if($>=232){let Z=($-232)*10+8;return[Z,Z,Z]}$-=16;let J,w=Math.floor($/36)/5*255,F=Math.floor((J=$%36)/6)/5*255,W=J%6/5*255;return[w,F,W]};N.rgb.hex=function($){let w=(((Math.round($[0])&255)<<16)+((Math.round($[1])&255)<<8)+(Math.round($[2])&255)).toString(16).toUpperCase();return"000000".substring(w.length)+w};N.hex.rgb=function($){let J=$.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!J)return[0,0,0];let w=J[0];if(J[0].length===3)w=w.split("").map((Y)=>{return Y+Y}).join("");let F=parseInt(w,16),W=F>>16&255,Z=F>>8&255,B=F&255;return[W,Z,B]};N.rgb.hcg=function($){let J=$[0]/255,w=$[1]/255,F=$[2]/255,W=Math.max(Math.max(J,w),F),Z=Math.min(Math.min(J,w),F),B=W-Z,Y,K;if(B<1)Y=Z/(1-B);else Y=0;if(B<=0)K=0;else if(W===J)K=(w-F)/B%6;else if(W===w)K=2+(F-J)/B;else K=4+(J-w)/B;return K/=6,K%=1,[K*360,B*100,Y*100]};N.hsl.hcg=function($){let J=$[1]/100,w=$[2]/100,F=w<0.5?2*J*w:2*J*(1-w),W=0;if(F<1)W=(w-0.5*F)/(1-F);return[$[0],F*100,W*100]};N.hsv.hcg=function($){let J=$[1]/100,w=$[2]/100,F=J*w,W=0;if(F<1)W=(w-F)/(1-F);return[$[0],F*100,W*100]};N.hcg.rgb=function($){let J=$[0]/360,w=$[1]/100,F=$[2]/100;if(w===0)return[F*255,F*255,F*255];let W=[0,0,0],Z=J%1*6,B=Z%1,Y=1-B,K=0;switch(Math.floor(Z)){case 0:W[0]=1,W[1]=B,W[2]=0;break;case 1:W[0]=Y,W[1]=1,W[2]=0;break;case 2:W[0]=0,W[1]=1,W[2]=B;break;case 3:W[0]=0,W[1]=Y,W[2]=1;break;case 4:W[0]=B,W[1]=0,W[2]=1;break;default:W[0]=1,W[1]=0,W[2]=Y}return K=(1-w)*F,[(w*W[0]+K)*255,(w*W[1]+K)*255,(w*W[2]+K)*255]};N.hcg.hsv=function($){let J=$[1]/100,w=$[2]/100,F=J+w*(1-J),W=0;if(F>0)W=J/F;return[$[0],W*100,F*100]};N.hcg.hsl=function($){let J=$[1]/100,F=$[2]/100*(1-J)+0.5*J,W=0;if(F>0&&F<0.5)W=J/(2*F);else if(F>=0.5&&F<1)W=J/(2*(1-F));return[$[0],W*100,F*100]};N.hcg.hwb=function($){let J=$[1]/100,w=$[2]/100,F=J+w*(1-J);return[$[0],(F-J)*100,(1-F)*100]};N.hwb.hcg=function($){let J=$[1]/100,F=1-$[2]/100,W=F-J,Z=0;if(W<1)Z=(F-W)/(1-W);return[$[0],W*100,Z*100]};N.apple.rgb=function($){return[$[0]/65535*255,$[1]/65535*255,$[2]/65535*255]};N.rgb.apple=function($){return[$[0]/255*65535,$[1]/255*65535,$[2]/255*65535]};N.gray.rgb=function($){return[$[0]/100*255,$[0]/100*255,$[0]/100*255]};N.gray.hsl=function($){return[0,0,$[0]]};N.gray.hsv=N.gray.hsl;N.gray.hwb=function($){return[0,100,$[0]]};N.gray.cmyk=function($){return[0,0,0,$[0]]};N.gray.lab=function($){return[$[0],0,0]};N.gray.hex=function($){let J=Math.round($[0]/100*255)&255,F=((J<<16)+(J<<8)+J).toString(16).toUpperCase();return"000000".substring(F.length)+F};N.rgb.gray=function($){return[($[0]+$[1]+$[2])/3/255*100]}});var J5=T((s9,$5)=>{var h2=U1();function w8(){let $={},J=Object.keys(h2);for(let w=J.length,F=0;F<w;F++)$[J[F]]={distance:-1,parent:null};return $}function F8($){let J=w8(),w=[$];J[$].distance=0;while(w.length){let F=w.pop(),W=Object.keys(h2[F]);for(let Z=W.length,B=0;B<Z;B++){let Y=W[B],K=J[Y];if(K.distance===-1)K.distance=J[F].distance+1,K.parent=F,w.unshift(Y)}}return J}function W8($,J){return function(w){return J($(w))}}function Z8($,J){let w=[J[$].parent,$],F=h2[J[$].parent][$],W=J[$].parent;while(J[W].parent)w.unshift(J[W].parent),F=W8(h2[J[W].parent][W],F),W=J[W].parent;return F.conversion=w,F}$5.exports=function($){let J=F8($),w={},F=Object.keys(J);for(let W=F.length,Z=0;Z<W;Z++){let B=F[Z];if(J[B].parent===null)continue;w[B]=Z8(B,J)}return w}});var F5=T((t9,w5)=>{var B1=U1(),U8=J5(),Q2={},B8=Object.keys(B1);function Y8($){let J=function(...w){let F=w[0];if(F===void 0||F===null)return F;if(F.length>1)w=F;return $(w)};if("conversion"in $)J.conversion=$.conversion;return J}function Q8($){let J=function(...w){let F=w[0];if(F===void 0||F===null)return F;if(F.length>1)w=F;let W=$(w);if(typeof W==="object")for(let Z=W.length,B=0;B<Z;B++)W[B]=Math.round(W[B]);return W};if("conversion"in $)J.conversion=$.conversion;return J}B8.forEach(($)=>{Q2[$]={},Object.defineProperty(Q2[$],"channels",{value:B1[$].channels}),Object.defineProperty(Q2[$],"labels",{value:B1[$].labels});let J=U8($);Object.keys(J).forEach((F)=>{let W=J[F];Q2[$][F]=Q8(W),Q2[$][F].raw=Y8(W)})});w5.exports=Q2});var m2=T((i9,Z5)=>{var K2=t0(),b=F5(),W5=["keyword","gray","hex"],Y1={};for(let $ of Object.keys(b))Y1[[...b[$].labels].sort().join("")]=$;var g2={};function S($,J){if(!(this instanceof S))return new S($,J);if(J&&J in W5)J=null;if(J&&!(J in b))throw new Error("Unknown model: "+J);let w,F;if($==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if($ instanceof S)this.model=$.model,this.color=[...$.color],this.valpha=$.valpha;else if(typeof $==="string"){let W=K2.get($);if(W===null)throw new Error("Unable to parse color from string: "+$);this.model=W.model,F=b[this.model].channels,this.color=W.value.slice(0,F),this.valpha=typeof W.value[F]==="number"?W.value[F]:1}else if($.length>0){this.model=J||"rgb",F=b[this.model].channels;let W=Array.prototype.slice.call($,0,F);this.color=Q1(W,F),this.valpha=typeof $[F]==="number"?$[F]:1}else if(typeof $==="number")this.model="rgb",this.color=[$>>16&255,$>>8&255,$&255],this.valpha=1;else{this.valpha=1;let W=Object.keys($);if("alpha"in $)W.splice(W.indexOf("alpha"),1),this.valpha=typeof $.alpha==="number"?$.alpha:0;let Z=W.sort().join("");if(!(Z in Y1))throw new Error("Unable to parse color from object: "+JSON.stringify($));this.model=Y1[Z];let{labels:B}=b[this.model],Y=[];for(w=0;w<B.length;w++)Y.push($[B[w]]);this.color=Q1(Y)}if(g2[this.model]){F=b[this.model].channels;for(w=0;w<F;w++){let W=g2[this.model][w];if(W)this.color[w]=W(this.color[w])}}if(this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze)Object.freeze(this)}S.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string($){let J=this.model in K2.to?this:this.rgb();J=J.round(typeof $==="number"?$:1);let w=J.valpha===1?J.color:[...J.color,this.valpha];return K2.to[J.model](w)},percentString($){let J=this.rgb().round(typeof $==="number"?$:1),w=J.valpha===1?J.color:[...J.color,this.valpha];return K2.to.rgb.percent(w)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let $={},{channels:J}=b[this.model],{labels:w}=b[this.model];for(let F=0;F<J;F++)$[w[F]]=this.color[F];if(this.valpha!==1)$.alpha=this.valpha;return $},unitArray(){let $=this.rgb().color;if($[0]/=255,$[1]/=255,$[2]/=255,this.valpha!==1)$.push(this.valpha);return $},unitObject(){let $=this.rgb().object();if($.r/=255,$.g/=255,$.b/=255,this.valpha!==1)$.alpha=this.valpha;return $},round($){return $=Math.max($||0,0),new S([...this.color.map(H8($)),this.valpha],this.model)},alpha($){if($!==void 0)return new S([...this.color,Math.max(0,Math.min(1,$))],this.model);return this.valpha},red:E("rgb",0,A(255)),green:E("rgb",1,A(255)),blue:E("rgb",2,A(255)),hue:E(["hsl","hsv","hsl","hwb","hcg"],0,($)=>($%360+360)%360),saturationl:E("hsl",1,A(100)),lightness:E("hsl",2,A(100)),saturationv:E("hsv",1,A(100)),value:E("hsv",2,A(100)),chroma:E("hcg",1,A(100)),gray:E("hcg",2,A(100)),white:E("hwb",1,A(100)),wblack:E("hwb",2,A(100)),cyan:E("cmyk",0,A(100)),magenta:E("cmyk",1,A(100)),yellow:E("cmyk",2,A(100)),black:E("cmyk",3,A(100)),x:E("xyz",0,A(95.047)),y:E("xyz",1,A(100)),z:E("xyz",2,A(108.833)),l:E("lab",0,A(100)),a:E("lab",1),b:E("lab",2),keyword($){if($!==void 0)return new S($);return b[this.model].keyword(this.color)},hex($){if($!==void 0)return new S($);return K2.to.hex(this.rgb().round().color)},hexa($){if($!==void 0)return new S($);let J=this.rgb().round().color,w=Math.round(this.valpha*255).toString(16).toUpperCase();if(w.length===1)w="0"+w;return K2.to.hex(J)+w},rgbNumber(){let $=this.rgb().color;return($[0]&255)<<16|($[1]&255)<<8|$[2]&255},luminosity(){let $=this.rgb().color,J=[];for(let[w,F]of $.entries()){let W=F/255;J[w]=W<=0.04045?W/12.92:((W+0.055)/1.055)**2.4}return 0.2126*J[0]+0.7152*J[1]+0.0722*J[2]},contrast($){let J=this.luminosity(),w=$.luminosity();if(J>w)return(J+0.05)/(w+0.05);return(w+0.05)/(J+0.05)},level($){let J=this.contrast($);if(J>=7)return"AAA";return J>=4.5?"AA":""},isDark(){let $=this.rgb().color;return($[0]*2126+$[1]*7152+$[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let $=this.rgb();for(let J=0;J<3;J++)$.color[J]=255-$.color[J];return $},lighten($){let J=this.hsl();return J.color[2]+=J.color[2]*$,J},darken($){let J=this.hsl();return J.color[2]-=J.color[2]*$,J},saturate($){let J=this.hsl();return J.color[1]+=J.color[1]*$,J},desaturate($){let J=this.hsl();return J.color[1]-=J.color[1]*$,J},whiten($){let J=this.hwb();return J.color[1]+=J.color[1]*$,J},blacken($){let J=this.hwb();return J.color[2]+=J.color[2]*$,J},grayscale(){let $=this.rgb().color,J=$[0]*0.3+$[1]*0.59+$[2]*0.11;return S.rgb(J,J,J)},fade($){return this.alpha(this.valpha-this.valpha*$)},opaquer($){return this.alpha(this.valpha+this.valpha*$)},rotate($){let J=this.hsl(),w=J.color[0];return w=(w+$)%360,w=w<0?360+w:w,J.color[0]=w,J},mix($,J){if(!$||!$.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof $);let w=$.rgb(),F=this.rgb(),W=J===void 0?0.5:J,Z=2*W-1,B=w.alpha()-F.alpha(),Y=((Z*B===-1?Z:(Z+B)/(1+Z*B))+1)/2,K=1-Y;return S.rgb(Y*w.red()+K*F.red(),Y*w.green()+K*F.green(),Y*w.blue()+K*F.blue(),w.alpha()*W+F.alpha()*(1-W))}};for(let $ of Object.keys(b)){if(W5.includes($))continue;let{channels:J}=b[$];S.prototype[$]=function(...w){if(this.model===$)return new S(this);if(w.length>0)return new S(w,$);return new S([...G8(b[this.model][$].raw(this.color)),this.valpha],$)},S[$]=function(...w){let F=w[0];if(typeof F==="number")F=Q1(w,J);return new S(F,$)}}function K8($,J){return Number($.toFixed(J))}function H8($){return function(J){return K8(J,$)}}function E($,J,w){$=Array.isArray($)?$:[$];for(let F of $)(g2[F]||(g2[F]=[]))[J]=w;return $=$[0],function(F){let W;if(F!==void 0){if(w)F=w(F);return W=this[$](),W.color[J]=F,W}if(W=this[$]().color[J],w)W=w(W);return W}}function A($){return function(J){return Math.max(0,Math.min($,J))}}function G8($){return Array.isArray($)?$:[$]}function Q1($,J){for(let w=0;w<J;w++)if(typeof $[w]!=="number")$[w]=0;return $}Z5.exports=S});var Y5=T((o9,B5)=>{var I8=m2(),H=u(),t=D2(),y8={left:"low",center:"centre",centre:"centre",right:"high"};function U5($){let{raw:J,density:w,limitInputPixels:F,ignoreIcc:W,unlimited:Z,sequentialRead:B,failOn:Y,failOnError:K,animated:G,page:I,pages:V,subifd:z}=$;return[J,w,F,W,Z,B,Y,K,G,I,V,z].some(H.defined)?{raw:J,density:w,limitInputPixels:F,ignoreIcc:W,unlimited:Z,sequentialRead:B,failOn:Y,failOnError:K,animated:G,page:I,pages:V,subifd:z}:void 0}function L8($,J,w){let F={failOn:"warning",limitInputPixels:Math.pow(16383,2),ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(H.string($))F.file=$;else if(H.buffer($)){if($.length===0)throw Error("Input Buffer is empty");F.buffer=$}else if(H.arrayBuffer($)){if($.byteLength===0)throw Error("Input bit Array is empty");F.buffer=Buffer.from($,0,$.byteLength)}else if(H.typedArray($)){if($.length===0)throw Error("Input Bit Array is empty");F.buffer=Buffer.from($.buffer,$.byteOffset,$.byteLength)}else if(H.plainObject($)&&!H.defined(J)){if(J=$,U5(J))F.buffer=[]}else if(!H.defined($)&&!H.defined(J)&&H.object(w)&&w.allowStream)F.buffer=[];else throw new Error(`Unsupported input '${$}' of type ${typeof $}${H.defined(J)?` when also providing options of type ${typeof J}`:""}`);if(H.object(J)){if(H.defined(J.failOnError))if(H.bool(J.failOnError))F.failOn=J.failOnError?"warning":"none";else throw H.invalidParameterError("failOnError","boolean",J.failOnError);if(H.defined(J.failOn))if(H.string(J.failOn)&&H.inArray(J.failOn,["none","truncated","error","warning"]))F.failOn=J.failOn;else throw H.invalidParameterError("failOn","one of: none, truncated, error, warning",J.failOn);if(H.defined(J.density))if(H.inRange(J.density,1,1e5))F.density=J.density;else throw H.invalidParameterError("density","number between 1 and 100000",J.density);if(H.defined(J.ignoreIcc))if(H.bool(J.ignoreIcc))F.ignoreIcc=J.ignoreIcc;else throw H.invalidParameterError("ignoreIcc","boolean",J.ignoreIcc);if(H.defined(J.limitInputPixels))if(H.bool(J.limitInputPixels))F.limitInputPixels=J.limitInputPixels?Math.pow(16383,2):0;else if(H.integer(J.limitInputPixels)&&H.inRange(J.limitInputPixels,0,Number.MAX_SAFE_INTEGER))F.limitInputPixels=J.limitInputPixels;else throw H.invalidParameterError("limitInputPixels","positive integer",J.limitInputPixels);if(H.defined(J.unlimited))if(H.bool(J.unlimited))F.unlimited=J.unlimited;else throw H.invalidParameterError("unlimited","boolean",J.unlimited);if(H.defined(J.sequentialRead))if(H.bool(J.sequentialRead))F.sequentialRead=J.sequentialRead;else throw H.invalidParameterError("sequentialRead","boolean",J.sequentialRead);if(H.defined(J.raw))if(H.object(J.raw)&&H.integer(J.raw.width)&&J.raw.width>0&&H.integer(J.raw.height)&&J.raw.height>0&&H.integer(J.raw.channels)&&H.inRange(J.raw.channels,1,4))switch(F.rawWidth=J.raw.width,F.rawHeight=J.raw.height,F.rawChannels=J.raw.channels,F.rawPremultiplied=!!J.raw.premultiplied,$.constructor){case Uint8Array:case Uint8ClampedArray:F.rawDepth="uchar";break;case Int8Array:F.rawDepth="char";break;case Uint16Array:F.rawDepth="ushort";break;case Int16Array:F.rawDepth="short";break;case Uint32Array:F.rawDepth="uint";break;case Int32Array:F.rawDepth="int";break;case Float32Array:F.rawDepth="float";break;case Float64Array:F.rawDepth="double";break;default:F.rawDepth="uchar";break}else throw new Error("Expected width, height and channels for raw pixel input");if(H.defined(J.animated))if(H.bool(J.animated))F.pages=J.animated?-1:1;else throw H.invalidParameterError("animated","boolean",J.animated);if(H.defined(J.pages))if(H.integer(J.pages)&&H.inRange(J.pages,-1,1e5))F.pages=J.pages;else throw H.invalidParameterError("pages","integer between -1 and 100000",J.pages);if(H.defined(J.page))if(H.integer(J.page)&&H.inRange(J.page,0,1e5))F.page=J.page;else throw H.invalidParameterError("page","integer between 0 and 100000",J.page);if(H.defined(J.level))if(H.integer(J.level)&&H.inRange(J.level,0,256))F.level=J.level;else throw H.invalidParameterError("level","integer between 0 and 256",J.level);if(H.defined(J.subifd))if(H.integer(J.subifd)&&H.inRange(J.subifd,-1,1e5))F.subifd=J.subifd;else throw H.invalidParameterError("subifd","integer between -1 and 100000",J.subifd);if(H.defined(J.create))if(H.object(J.create)&&H.integer(J.create.width)&&J.create.width>0&&H.integer(J.create.height)&&J.create.height>0&&H.integer(J.create.channels)){if(F.createWidth=J.create.width,F.createHeight=J.create.height,F.createChannels=J.create.channels,H.defined(J.create.noise)){if(!H.object(J.create.noise))throw new Error("Expected noise to be an object");if(!H.inArray(J.create.noise.type,["gaussian"]))throw new Error("Only gaussian noise is supported at the moment");if(!H.inRange(J.create.channels,1,4))throw H.invalidParameterError("create.channels","number between 1 and 4",J.create.channels);if(F.createNoiseType=J.create.noise.type,H.number(J.create.noise.mean)&&H.inRange(J.create.noise.mean,0,1e4))F.createNoiseMean=J.create.noise.mean;else throw H.invalidParameterError("create.noise.mean","number between 0 and 10000",J.create.noise.mean);if(H.number(J.create.noise.sigma)&&H.inRange(J.create.noise.sigma,0,1e4))F.createNoiseSigma=J.create.noise.sigma;else throw H.invalidParameterError("create.noise.sigma","number between 0 and 10000",J.create.noise.sigma)}else if(H.defined(J.create.background)){if(!H.inRange(J.create.channels,3,4))throw H.invalidParameterError("create.channels","number between 3 and 4",J.create.channels);let W=I8(J.create.background);F.createBackground=[W.red(),W.green(),W.blue(),Math.round(W.alpha()*255)]}else throw new Error("Expected valid noise or background to create a new input image");delete F.buffer}else throw new Error("Expected valid width, height and channels to create a new input image");if(H.defined(J.text))if(H.object(J.text)&&H.string(J.text.text)){if(F.textValue=J.text.text,H.defined(J.text.height)&&H.defined(J.text.dpi))throw new Error("Expected only one of dpi or height");if(H.defined(J.text.font))if(H.string(J.text.font))F.textFont=J.text.font;else throw H.invalidParameterError("text.font","string",J.text.font);if(H.defined(J.text.fontfile))if(H.string(J.text.fontfile))F.textFontfile=J.text.fontfile;else throw H.invalidParameterError("text.fontfile","string",J.text.fontfile);if(H.defined(J.text.width))if(H.integer(J.text.width)&&J.text.width>0)F.textWidth=J.text.width;else throw H.invalidParameterError("text.width","positive integer",J.text.width);if(H.defined(J.text.height))if(H.integer(J.text.height)&&J.text.height>0)F.textHeight=J.text.height;else throw H.invalidParameterError("text.height","positive integer",J.text.height);if(H.defined(J.text.align))if(H.string(J.text.align)&&H.string(this.constructor.align[J.text.align]))F.textAlign=this.constructor.align[J.text.align];else throw H.invalidParameterError("text.align","valid alignment",J.text.align);if(H.defined(J.text.justify))if(H.bool(J.text.justify))F.textJustify=J.text.justify;else throw H.invalidParameterError("text.justify","boolean",J.text.justify);if(H.defined(J.text.dpi))if(H.integer(J.text.dpi)&&H.inRange(J.text.dpi,1,1e6))F.textDpi=J.text.dpi;else throw H.invalidParameterError("text.dpi","integer between 1 and 1000000",J.text.dpi);if(H.defined(J.text.rgba))if(H.bool(J.text.rgba))F.textRgba=J.text.rgba;else throw H.invalidParameterError("text.rgba","bool",J.text.rgba);if(H.defined(J.text.spacing))if(H.integer(J.text.spacing)&&H.inRange(J.text.spacing,-1e6,1e6))F.textSpacing=J.text.spacing;else throw H.invalidParameterError("text.spacing","integer between -1000000 and 1000000",J.text.spacing);if(H.defined(J.text.wrap))if(H.string(J.text.wrap)&&H.inArray(J.text.wrap,["word","char","word-char","none"]))F.textWrap=J.text.wrap;else throw H.invalidParameterError("text.wrap","one of: word, char, word-char, none",J.text.wrap);delete F.buffer}else throw new Error("Expected a valid string to create an image with text.")}else if(H.defined(J))throw new Error("Invalid input options "+J);return F}function N8($,J,w){if(Array.isArray(this.options.input.buffer))if(H.buffer($)){if(this.options.input.buffer.length===0)this.on("finish",()=>{this.streamInFinished=!0});this.options.input.buffer.push($),w()}else w(new Error("Non-Buffer data on Writable Stream"));else w(new Error("Unexpected data on Writable Stream"))}function X8(){if(this._isStreamInput())this.options.input.buffer=Buffer.concat(this.options.input.buffer)}function V8(){return Array.isArray(this.options.input.buffer)}function D8($){let J=Error();if(H.fn($)){if(this._isStreamInput())this.on("finish",()=>{this._flattenBufferIn(),t.metadata(this.options,(w,F)=>{if(w)$(H.nativeError(w,J));else $(null,F)})});else t.metadata(this.options,(w,F)=>{if(w)$(H.nativeError(w,J));else $(null,F)});return this}else if(this._isStreamInput())return new Promise((w,F)=>{let W=()=>{this._flattenBufferIn(),t.metadata(this.options,(Z,B)=>{if(Z)F(H.nativeError(Z,J));else w(B)})};if(this.writableFinished)W();else this.once("finish",W)});else return new Promise((w,F)=>{t.metadata(this.options,(W,Z)=>{if(W)F(H.nativeError(W,J));else w(Z)})})}function T8($){let J=Error();if(H.fn($)){if(this._isStreamInput())this.on("finish",()=>{this._flattenBufferIn(),t.stats(this.options,(w,F)=>{if(w)$(H.nativeError(w,J));else $(null,F)})});else t.stats(this.options,(w,F)=>{if(w)$(H.nativeError(w,J));else $(null,F)});return this}else if(this._isStreamInput())return new Promise((w,F)=>{this.on("finish",function(){this._flattenBufferIn(),t.stats(this.options,(W,Z)=>{if(W)F(H.nativeError(W,J));else w(Z)})})});else return new Promise((w,F)=>{t.stats(this.options,(W,Z)=>{if(W)F(H.nativeError(W,J));else w(Z)})})}B5.exports=function($){Object.assign($.prototype,{_inputOptionsFromObject:U5,_createInputDescriptor:L8,_write:N8,_flattenBufferIn:X8,_isStreamInput:V8,metadata:D8,stats:T8}),$.align=y8}});var y5=T(($7,I5)=>{var X=u(),K5={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},H5={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},Q5={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},G5={entropy:16,attention:17},K1={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3"},j8={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},z8={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"};function H1($){return $.angle%360!==0||$.useExifOrientation===!0||$.rotationAngle!==0}function l2($){return $.width!==-1||$.height!==-1}function R8($,J,w){if(l2(this.options))this.options.debuglog("ignoring previous resize options");if(this.options.widthPost!==-1)this.options.debuglog("operation order will be: extract, resize, extract");if(X.defined($))if(X.object($)&&!X.defined(w))w=$;else if(X.integer($)&&$>0)this.options.width=$;else throw X.invalidParameterError("width","positive integer",$);else this.options.width=-1;if(X.defined(J))if(X.integer(J)&&J>0)this.options.height=J;else throw X.invalidParameterError("height","positive integer",J);else this.options.height=-1;if(X.object(w)){if(X.defined(w.width))if(X.integer(w.width)&&w.width>0)this.options.width=w.width;else throw X.invalidParameterError("width","positive integer",w.width);if(X.defined(w.height))if(X.integer(w.height)&&w.height>0)this.options.height=w.height;else throw X.invalidParameterError("height","positive integer",w.height);if(X.defined(w.fit)){let F=z8[w.fit];if(X.string(F))this.options.canvas=F;else throw X.invalidParameterError("fit","valid fit",w.fit)}if(X.defined(w.position)){let F=X.integer(w.position)?w.position:G5[w.position]||H5[w.position]||K5[w.position];if(X.integer(F)&&(X.inRange(F,0,8)||X.inRange(F,16,17)))this.options.position=F;else throw X.invalidParameterError("position","valid position/gravity/strategy",w.position)}if(this._setBackgroundColourOption("resizeBackground",w.background),X.defined(w.kernel))if(X.string(K1[w.kernel]))this.options.kernel=K1[w.kernel];else throw X.invalidParameterError("kernel","valid kernel name",w.kernel);if(X.defined(w.withoutEnlargement))this._setBooleanOption("withoutEnlargement",w.withoutEnlargement);if(X.defined(w.withoutReduction))this._setBooleanOption("withoutReduction",w.withoutReduction);if(X.defined(w.fastShrinkOnLoad))this._setBooleanOption("fastShrinkOnLoad",w.fastShrinkOnLoad)}if(H1(this.options)&&l2(this.options))this.options.rotateBeforePreExtract=!0;return this}function P8($){if(X.integer($)&&$>0)this.options.extendTop=$,this.options.extendBottom=$,this.options.extendLeft=$,this.options.extendRight=$;else if(X.object($)){if(X.defined($.top))if(X.integer($.top)&&$.top>=0)this.options.extendTop=$.top;else throw X.invalidParameterError("top","positive integer",$.top);if(X.defined($.bottom))if(X.integer($.bottom)&&$.bottom>=0)this.options.extendBottom=$.bottom;else throw X.invalidParameterError("bottom","positive integer",$.bottom);if(X.defined($.left))if(X.integer($.left)&&$.left>=0)this.options.extendLeft=$.left;else throw X.invalidParameterError("left","positive integer",$.left);if(X.defined($.right))if(X.integer($.right)&&$.right>=0)this.options.extendRight=$.right;else throw X.invalidParameterError("right","positive integer",$.right);if(this._setBackgroundColourOption("extendBackground",$.background),X.defined($.extendWith))if(X.string(Q5[$.extendWith]))this.options.extendWith=Q5[$.extendWith];else throw X.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",$.extendWith)}else throw X.invalidParameterError("extend","integer or object",$);return this}function _8($){let J=l2(this.options)||this.options.widthPre!==-1?"Post":"Pre";if(this.options[`width${J}`]!==-1)this.options.debuglog("ignoring previous extract options");if(["left","top","width","height"].forEach(function(w){let F=$[w];if(X.integer(F)&&F>=0)this.options[w+(w==="left"||w==="top"?"Offset":"")+J]=F;else throw X.invalidParameterError(w,"integer",F)},this),H1(this.options)&&!l2(this.options)){if(this.options.widthPre===-1||this.options.widthPost===-1)this.options.rotateBeforePreExtract=!0}return this}function E8($){if(this.options.trimThreshold=10,X.defined($))if(X.object($)){if(X.defined($.background))this._setBackgroundColourOption("trimBackground",$.background);if(X.defined($.threshold))if(X.number($.threshold)&&$.threshold>=0)this.options.trimThreshold=$.threshold;else throw X.invalidParameterError("threshold","positive number",$.threshold);if(X.defined($.lineArt))this._setBooleanOption("trimLineArt",$.lineArt)}else throw X.invalidParameterError("trim","object",$);if(H1(this.options))this.options.rotateBeforePreExtract=!0;return this}I5.exports=function($){Object.assign($.prototype,{resize:R8,extend:P8,extract:_8,trim:E8}),$.gravity=K5,$.strategy=G5,$.kernel=K1,$.fit=j8,$.position=H5}});var N5=T((J7,L5)=>{var j=u(),G1={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 q8($){if(!Array.isArray($))throw j.invalidParameterError("images to composite","array",$);return this.options.composite=$.map((J)=>{if(!j.object(J))throw j.invalidParameterError("image to composite","object",J);let w=this._inputOptionsFromObject(J),F={input:this._createInputDescriptor(J.input,w,{allowStream:!1}),blend:"over",tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(j.defined(J.blend))if(j.string(G1[J.blend]))F.blend=G1[J.blend];else throw j.invalidParameterError("blend","valid blend name",J.blend);if(j.defined(J.tile))if(j.bool(J.tile))F.tile=J.tile;else throw j.invalidParameterError("tile","boolean",J.tile);if(j.defined(J.left))if(j.integer(J.left))F.left=J.left;else throw j.invalidParameterError("left","integer",J.left);if(j.defined(J.top))if(j.integer(J.top))F.top=J.top;else throw j.invalidParameterError("top","integer",J.top);if(j.defined(J.top)!==j.defined(J.left))throw new Error("Expected both left and top to be set");else F.hasOffset=j.integer(J.top)&&j.integer(J.left);if(j.defined(J.gravity))if(j.integer(J.gravity)&&j.inRange(J.gravity,0,8))F.gravity=J.gravity;else if(j.string(J.gravity)&&j.integer(this.constructor.gravity[J.gravity]))F.gravity=this.constructor.gravity[J.gravity];else throw j.invalidParameterError("gravity","valid gravity",J.gravity);if(j.defined(J.premultiplied))if(j.bool(J.premultiplied))F.premultiplied=J.premultiplied;else throw j.invalidParameterError("premultiplied","boolean",J.premultiplied);return F}),this}L5.exports=function($){$.prototype.composite=q8,$.blend=G1}});var D5=T((w7,V5)=>{var A8=m2(),Q=u(),X5={integer:"integer",float:"float",approximate:"approximate"};function S8($,J){if(this.options.useExifOrientation||this.options.angle||this.options.rotationAngle)this.options.debuglog("ignoring previous rotate options");if(!Q.defined($))this.options.useExifOrientation=!0;else if(Q.integer($)&&!($%90))this.options.angle=$;else if(Q.number($)){if(this.options.rotationAngle=$,Q.object(J)&&J.background){let w=A8(J.background);this.options.rotationBackground=[w.red(),w.green(),w.blue(),Math.round(w.alpha()*255)]}}else throw Q.invalidParameterError("angle","numeric",$);return this}function C8($){return this.options.flip=Q.bool($)?$:!0,this}function M8($){return this.options.flop=Q.bool($)?$:!0,this}function k8($,J){let w=[].concat(...$);if(w.length===4&&w.every(Q.number))this.options.affineMatrix=w;else throw Q.invalidParameterError("matrix","1x4 or 2x2 array",$);if(Q.defined(J))if(Q.object(J)){if(this._setBackgroundColourOption("affineBackground",J.background),Q.defined(J.idx))if(Q.number(J.idx))this.options.affineIdx=J.idx;else throw Q.invalidParameterError("options.idx","number",J.idx);if(Q.defined(J.idy))if(Q.number(J.idy))this.options.affineIdy=J.idy;else throw Q.invalidParameterError("options.idy","number",J.idy);if(Q.defined(J.odx))if(Q.number(J.odx))this.options.affineOdx=J.odx;else throw Q.invalidParameterError("options.odx","number",J.odx);if(Q.defined(J.ody))if(Q.number(J.ody))this.options.affineOdy=J.ody;else throw Q.invalidParameterError("options.ody","number",J.ody);if(Q.defined(J.interpolator))if(Q.inArray(J.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=J.interpolator;else throw Q.invalidParameterError("options.interpolator","valid interpolator name",J.interpolator)}else throw Q.invalidParameterError("options","object",J);return this}function x8($,J,w){if(!Q.defined($))this.options.sharpenSigma=-1;else if(Q.bool($))this.options.sharpenSigma=$?-1:0;else if(Q.number($)&&Q.inRange($,0.01,1e4)){if(this.options.sharpenSigma=$,Q.defined(J))if(Q.number(J)&&Q.inRange(J,0,1e4))this.options.sharpenM1=J;else throw Q.invalidParameterError("flat","number between 0 and 10000",J);if(Q.defined(w))if(Q.number(w)&&Q.inRange(w,0,1e4))this.options.sharpenM2=w;else throw Q.invalidParameterError("jagged","number between 0 and 10000",w)}else if(Q.plainObject($)){if(Q.number($.sigma)&&Q.inRange($.sigma,0.000001,10))this.options.sharpenSigma=$.sigma;else throw Q.invalidParameterError("options.sigma","number between 0.000001 and 10",$.sigma);if(Q.defined($.m1))if(Q.number($.m1)&&Q.inRange($.m1,0,1e6))this.options.sharpenM1=$.m1;else throw Q.invalidParameterError("options.m1","number between 0 and 1000000",$.m1);if(Q.defined($.m2))if(Q.number($.m2)&&Q.inRange($.m2,0,1e6))this.options.sharpenM2=$.m2;else throw Q.invalidParameterError("options.m2","number between 0 and 1000000",$.m2);if(Q.defined($.x1))if(Q.number($.x1)&&Q.inRange($.x1,0,1e6))this.options.sharpenX1=$.x1;else throw Q.invalidParameterError("options.x1","number between 0 and 1000000",$.x1);if(Q.defined($.y2))if(Q.number($.y2)&&Q.inRange($.y2,0,1e6))this.options.sharpenY2=$.y2;else throw Q.invalidParameterError("options.y2","number between 0 and 1000000",$.y2);if(Q.defined($.y3))if(Q.number($.y3)&&Q.inRange($.y3,0,1e6))this.options.sharpenY3=$.y3;else throw Q.invalidParameterError("options.y3","number between 0 and 1000000",$.y3)}else throw Q.invalidParameterError("sigma","number between 0.01 and 10000",$);return this}function f8($){if(!Q.defined($))this.options.medianSize=3;else if(Q.integer($)&&Q.inRange($,1,1000))this.options.medianSize=$;else throw Q.invalidParameterError("size","integer between 1 and 1000",$);return this}function d8($){let J;if(Q.number($))J=$;else if(Q.plainObject($)){if(!Q.number($.sigma))throw Q.invalidParameterError("options.sigma","number between 0.3 and 1000",J);if(J=$.sigma,"precision"in $)if(Q.string(X5[$.precision]))this.options.precision=X5[$.precision];else throw Q.invalidParameterError("precision","one of: integer, float, approximate",$.precision);if("minAmplitude"in $)if(Q.number($.minAmplitude)&&Q.inRange($.minAmplitude,0.001,1))this.options.minAmpl=$.minAmplitude;else throw Q.invalidParameterError("minAmplitude","number between 0.001 and 1",$.minAmplitude)}if(!Q.defined($))this.options.blurSigma=-1;else if(Q.bool($))this.options.blurSigma=$?-1:0;else if(Q.number(J)&&Q.inRange(J,0.3,1000))this.options.blurSigma=J;else throw Q.invalidParameterError("sigma","number between 0.3 and 1000",J);return this}function O8($){if(this.options.flatten=Q.bool($)?$:!0,Q.object($))this._setBackgroundColourOption("flattenBackground",$.background);return this}function b8(){return this.options.unflatten=!0,this}function v8($,J){if(!Q.defined($))this.options.gamma=2.2;else if(Q.number($)&&Q.inRange($,1,3))this.options.gamma=$;else throw Q.invalidParameterError("gamma","number between 1.0 and 3.0",$);if(!Q.defined(J))this.options.gammaOut=this.options.gamma;else if(Q.number(J)&&Q.inRange(J,1,3))this.options.gammaOut=J;else throw Q.invalidParameterError("gammaOut","number between 1.0 and 3.0",J);return this}function h8($){if(this.options.negate=Q.bool($)?$:!0,Q.plainObject($)&&"alpha"in $)if(!Q.bool($.alpha))throw Q.invalidParameterError("alpha","should be boolean value",$.alpha);else this.options.negateAlpha=$.alpha;return this}function g8($){if(Q.plainObject($)){if(Q.defined($.lower))if(Q.number($.lower)&&Q.inRange($.lower,0,99))this.options.normaliseLower=$.lower;else throw Q.invalidParameterError("lower","number between 0 and 99",$.lower);if(Q.defined($.upper))if(Q.number($.upper)&&Q.inRange($.upper,1,100))this.options.normaliseUpper=$.upper;else throw Q.invalidParameterError("upper","number between 1 and 100",$.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw Q.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function m8($){return this.normalise($)}function l8($){if(Q.plainObject($)){if(Q.integer($.width)&&$.width>0)this.options.claheWidth=$.width;else throw Q.invalidParameterError("width","integer greater than zero",$.width);if(Q.integer($.height)&&$.height>0)this.options.claheHeight=$.height;else throw Q.invalidParameterError("height","integer greater than zero",$.height);if(Q.defined($.maxSlope))if(Q.integer($.maxSlope)&&Q.inRange($.maxSlope,0,100))this.options.claheMaxSlope=$.maxSlope;else throw Q.invalidParameterError("maxSlope","integer between 0 and 100",$.maxSlope)}else throw Q.invalidParameterError("options","plain object",$);return this}function u8($){if(!Q.object($)||!Array.isArray($.kernel)||!Q.integer($.width)||!Q.integer($.height)||!Q.inRange($.width,3,1001)||!Q.inRange($.height,3,1001)||$.height*$.width!==$.kernel.length)throw new Error("Invalid convolution kernel");if(!Q.integer($.scale))$.scale=$.kernel.reduce(function(J,w){return J+w},0);if($.scale<1)$.scale=1;if(!Q.integer($.offset))$.offset=0;return this.options.convKernel=$,this}function c8($,J){if(!Q.defined($))this.options.threshold=128;else if(Q.bool($))this.options.threshold=$?128:0;else if(Q.integer($)&&Q.inRange($,0,255))this.options.threshold=$;else throw Q.invalidParameterError("threshold","integer between 0 and 255",$);if(!Q.object(J)||J.greyscale===!0||J.grayscale===!0)this.options.thresholdGrayscale=!0;else this.options.thresholdGrayscale=!1;return this}function a8($,J,w){if(this.options.boolean=this._createInputDescriptor($,w),Q.string(J)&&Q.inArray(J,["and","or","eor"]))this.options.booleanOp=J;else throw Q.invalidParameterError("operator","one of: and, or, eor",J);return this}function r8($,J){if(!Q.defined($)&&Q.number(J))$=1;else if(Q.number($)&&!Q.defined(J))J=0;if(!Q.defined($))this.options.linearA=[];else if(Q.number($))this.options.linearA=[$];else if(Array.isArray($)&&$.length&&$.every(Q.number))this.options.linearA=$;else throw Q.invalidParameterError("a","number or array of numbers",$);if(!Q.defined(J))this.options.linearB=[];else if(Q.number(J))this.options.linearB=[J];else if(Array.isArray(J)&&J.length&&J.every(Q.number))this.options.linearB=J;else throw Q.invalidParameterError("b","number or array of numbers",J);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 e8($){if(!Array.isArray($))throw Q.invalidParameterError("inputMatrix","array",$);if($.length!==3&&$.length!==4)throw Q.invalidParameterError("inputMatrix","3x3 or 4x4 array",$.length);let J=$.flat().map(Number);if(J.length!==9&&J.length!==16)throw Q.invalidParameterError("inputMatrix","cardinality of 9 or 16",J.length);return this.options.recombMatrix=J,this}function n8($){if(!Q.plainObject($))throw Q.invalidParameterError("options","plain object",$);if("brightness"in $)if(Q.number($.brightness)&&$.brightness>=0)this.options.brightness=$.brightness;else throw Q.invalidParameterError("brightness","number above zero",$.brightness);if("saturation"in $)if(Q.number($.saturation)&&$.saturation>=0)this.options.saturation=$.saturation;else throw Q.invalidParameterError("saturation","number above zero",$.saturation);if("hue"in $)if(Q.integer($.hue))this.options.hue=$.hue%360;else throw Q.invalidParameterError("hue","number",$.hue);if("lightness"in $)if(Q.number($.lightness))this.options.lightness=$.lightness;else throw Q.invalidParameterError("lightness","number",$.lightness);return this}V5.exports=function($){Object.assign($.prototype,{rotate:S8,flip:C8,flop:M8,affine:k8,sharpen:x8,median:f8,blur:d8,flatten:O8,unflatten:b8,gamma:v8,negate:h8,normalise:g8,normalize:m8,clahe:l8,convolve:u8,threshold:c8,boolean:a8,linear:r8,recomb:e8,modulate:n8})}});var z5=T((F7,j5)=>{var p8=m2(),r=u(),T5={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"};function s8($){return this._setBackgroundColourOption("tint",$),this}function t8($){return this.options.greyscale=r.bool($)?$:!0,this}function i8($){return this.greyscale($)}function o8($){if(!r.string($))throw r.invalidParameterError("colourspace","string",$);return this.options.colourspacePipeline=$,this}function $6($){return this.pipelineColourspace($)}function J6($){if(!r.string($))throw r.invalidParameterError("colourspace","string",$);return this.options.colourspace=$,this}function w6($){return this.toColourspace($)}function F6($,J){if(r.defined(J))if(r.object(J)||r.string(J)){let w=p8(J);this.options[$]=[w.red(),w.green(),w.blue(),Math.round(w.alpha()*255)]}else throw r.invalidParameterError("background","object or string",J)}j5.exports=function($){Object.assign($.prototype,{tint:s8,greyscale:t8,grayscale:i8,pipelineColourspace:o8,pipelineColorspace:$6,toColourspace:J6,toColorspace:w6,_setBackgroundColourOption:F6}),$.colourspace=T5,$.colorspace=T5}});var P5=T((W7,R5)=>{var a=u(),W6={and:"and",or:"or",eor:"eor"};function Z6(){return this.options.removeAlpha=!0,this}function U6($){if(a.defined($))if(a.number($)&&a.inRange($,0,1))this.options.ensureAlpha=$;else throw a.invalidParameterError("alpha","number between 0 and 1",$);else this.options.ensureAlpha=1;return this}function B6($){let J={red:0,green:1,blue:2,alpha:3};if(Object.keys(J).includes($))$=J[$];if(a.integer($)&&a.inRange($,0,4))this.options.extractChannel=$;else throw a.invalidParameterError("channel","integer or one of: red, green, blue, alpha",$);return this}function Y6($,J){if(Array.isArray($))$.forEach(function(w){this.options.joinChannelIn.push(this._createInputDescriptor(w,J))},this);else this.options.joinChannelIn.push(this._createInputDescriptor($,J));return this}function Q6($){if(a.string($)&&a.inArray($,["and","or","eor"]))this.options.bandBoolOp=$;else throw a.invalidParameterError("boolOp","one of: and, or, eor",$);return this}R5.exports=function($){Object.assign($.prototype,{removeAlpha:Z6,ensureAlpha:U6,extractChannel:B6,joinChannel:Y6,bandbool:Q6}),$.bool=W6}});var C5=T((Z7,S5)=>{var I1=P("path"),U=u(),H2=D2(),_5=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"]]),K6=/\.(jp[2x]|j2[kc])$/i,E5=()=>new Error("JP2 output requires libvips with support for OpenJPEG"),q5=($)=>1<<31-Math.clz32(Math.ceil(Math.log2($)));function H6($,J){let w;if(!U.string($))w=new Error("Missing output file path");else if(U.string(this.options.input.file)&&I1.resolve(this.options.input.file)===I1.resolve($))w=new Error("Cannot use same file for input and output");else if(K6.test(I1.extname($))&&!this.constructor.format.jp2k.output.file)w=E5();if(w)if(U.fn(J))J(w);else return Promise.reject(w);else{this.options.fileOut=$;let F=Error();return this._pipeline(J,F)}return this}function G6($,J){if(U.object($))this._setBooleanOption("resolveWithObject",$.resolveWithObject);else if(this.options.resolveWithObject)this.options.resolveWithObject=!1;this.options.fileOut="";let w=Error();return this._pipeline(U.fn($)?$:J,w)}function I6(){return this.options.keepMetadata|=1,this}function y6($){if(U.object($))for(let[J,w]of Object.entries($))if(U.object(w))for(let[F,W]of Object.entries(w))if(U.string(W))this.options.withExif[`exif-${J.toLowerCase()}-${F}`]=W;else throw U.invalidParameterError(`${J}.${F}`,"string",W);else throw U.invalidParameterError(J,"object",w);else throw U.invalidParameterError("exif","object",$);return this.options.withExifMerge=!1,this.keepExif()}function L6($){return this.withExif($),this.options.withExifMerge=!0,this}function N6(){return this.options.keepMetadata|=8,this}function X6($,J){if(U.string($))this.options.withIccProfile=$;else throw U.invalidParameterError("icc","string",$);if(this.keepIccProfile(),U.object(J)){if(U.defined(J.attach))if(U.bool(J.attach)){if(!J.attach)this.options.keepMetadata&=-9}else throw U.invalidParameterError("attach","boolean",J.attach)}return this}function V6(){return this.options.keepMetadata=31,this}function D6($){if(this.keepMetadata(),this.withIccProfile("srgb"),U.object($)){if(U.defined($.orientation))if(U.integer($.orientation)&&U.inRange($.orientation,1,8))this.options.withMetadataOrientation=$.orientation;else throw U.invalidParameterError("orientation","integer between 1 and 8",$.orientation);if(U.defined($.density))if(U.number($.density)&&$.density>0)this.options.withMetadataDensity=$.density;else throw U.invalidParameterError("density","positive number",$.density);if(U.defined($.icc))this.withIccProfile($.icc);if(U.defined($.exif))this.withExifMerge($.exif)}return this}function T6($,J){let w=_5.get((U.object($)&&U.string($.id)?$.id:$).toLowerCase());if(!w)throw U.invalidParameterError("format",`one of: ${[..._5.keys()].join(", ")}`,$);return this[w](J)}function j6($){if(U.object($)){if(U.defined($.quality))if(U.integer($.quality)&&U.inRange($.quality,1,100))this.options.jpegQuality=$.quality;else throw U.invalidParameterError("quality","integer between 1 and 100",$.quality);if(U.defined($.progressive))this._setBooleanOption("jpegProgressive",$.progressive);if(U.defined($.chromaSubsampling))if(U.string($.chromaSubsampling)&&U.inArray($.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=$.chromaSubsampling;else throw U.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",$.chromaSubsampling);let J=U.bool($.optimizeCoding)?$.optimizeCoding:$.optimiseCoding;if(U.defined(J))this._setBooleanOption("jpegOptimiseCoding",J);if(U.defined($.mozjpeg))if(U.bool($.mozjpeg)){if($.mozjpeg)this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3}else throw U.invalidParameterError("mozjpeg","boolean",$.mozjpeg);let w=U.bool($.trellisQuantization)?$.trellisQuantization:$.trellisQuantisation;if(U.defined(w))this._setBooleanOption("jpegTrellisQuantisation",w);if(U.defined($.overshootDeringing))this._setBooleanOption("jpegOvershootDeringing",$.overshootDeringing);let F=U.bool($.optimizeScans)?$.optimizeScans:$.optimiseScans;if(U.defined(F)){if(this._setBooleanOption("jpegOptimiseScans",F),F)this.options.jpegProgressive=!0}let W=U.number($.quantizationTable)?$.quantizationTable:$.quantisationTable;if(U.defined(W))if(U.integer(W)&&U.inRange(W,0,8))this.options.jpegQuantisationTable=W;else throw U.invalidParameterError("quantisationTable","integer between 0 and 8",W)}return this._updateFormatOut("jpeg",$)}function z6($){if(U.object($)){if(U.defined($.progressive))this._setBooleanOption("pngProgressive",$.progressive);if(U.defined($.compressionLevel))if(U.integer($.compressionLevel)&&U.inRange($.compressionLevel,0,9))this.options.pngCompressionLevel=$.compressionLevel;else throw U.invalidParameterError("compressionLevel","integer between 0 and 9",$.compressionLevel);if(U.defined($.adaptiveFiltering))this._setBooleanOption("pngAdaptiveFiltering",$.adaptiveFiltering);let J=$.colours||$.colors;if(U.defined(J))if(U.integer(J)&&U.inRange(J,2,256))this.options.pngBitdepth=q5(J);else throw U.invalidParameterError("colours","integer between 2 and 256",J);if(U.defined($.palette))this._setBooleanOption("pngPalette",$.palette);else if([$.quality,$.effort,$.colours,$.colors,$.dither].some(U.defined))this._setBooleanOption("pngPalette",!0);if(this.options.pngPalette){if(U.defined($.quality))if(U.integer($.quality)&&U.inRange($.quality,0,100))this.options.pngQuality=$.quality;else throw U.invalidParameterError("quality","integer between 0 and 100",$.quality);if(U.defined($.effort))if(U.integer($.effort)&&U.inRange($.effort,1,10))this.options.pngEffort=$.effort;else throw U.invalidParameterError("effort","integer between 1 and 10",$.effort);if(U.defined($.dither))if(U.number($.dither)&&U.inRange($.dither,0,1))this.options.pngDither=$.dither;else throw U.invalidParameterError("dither","number between 0.0 and 1.0",$.dither)}}return this._updateFormatOut("png",$)}function R6($){if(U.object($)){if(U.defined($.quality))if(U.integer($.quality)&&U.inRange($.quality,1,100))this.options.webpQuality=$.quality;else throw U.invalidParameterError("quality","integer between 1 and 100",$.quality);if(U.defined($.alphaQuality))if(U.integer($.alphaQuality)&&U.inRange($.alphaQuality,0,100))this.options.webpAlphaQuality=$.alphaQuality;else throw U.invalidParameterError("alphaQuality","integer between 0 and 100",$.alphaQuality);if(U.defined($.lossless))this._setBooleanOption("webpLossless",$.lossless);if(U.defined($.nearLossless))this._setBooleanOption("webpNearLossless",$.nearLossless);if(U.defined($.smartSubsample))this._setBooleanOption("webpSmartSubsample",$.smartSubsample);if(U.defined($.preset))if(U.string($.preset)&&U.inArray($.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=$.preset;else throw U.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",$.preset);if(U.defined($.effort))if(U.integer($.effort)&&U.inRange($.effort,0,6))this.options.webpEffort=$.effort;else throw U.invalidParameterError("effort","integer between 0 and 6",$.effort);if(U.defined($.minSize))this._setBooleanOption("webpMinSize",$.minSize);if(U.defined($.mixed))this._setBooleanOption("webpMixed",$.mixed)}return A5($,this.options),this._updateFormatOut("webp",$)}function P6($){if(U.object($)){if(U.defined($.reuse))this._setBooleanOption("gifReuse",$.reuse);if(U.defined($.progressive))this._setBooleanOption("gifProgressive",$.progressive);let J=$.colours||$.colors;if(U.defined(J))if(U.integer(J)&&U.inRange(J,2,256))this.options.gifBitdepth=q5(J);else throw U.invalidParameterError("colours","integer between 2 and 256",J);if(U.defined($.effort))if(U.number($.effort)&&U.inRange($.effort,1,10))this.options.gifEffort=$.effort;else throw U.invalidParameterError("effort","integer between 1 and 10",$.effort);if(U.defined($.dither))if(U.number($.dither)&&U.inRange($.dither,0,1))this.options.gifDither=$.dither;else throw U.invalidParameterError("dither","number between 0.0 and 1.0",$.dither);if(U.defined($.interFrameMaxError))if(U.number($.interFrameMaxError)&&U.inRange($.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=$.interFrameMaxError;else throw U.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",$.interFrameMaxError);if(U.defined($.interPaletteMaxError))if(U.number($.interPaletteMaxError)&&U.inRange($.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=$.interPaletteMaxError;else throw U.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",$.interPaletteMaxError)}return A5($,this.options),this._updateFormatOut("gif",$)}function _6($){if(!this.constructor.format.jp2k.output.buffer)throw E5();if(U.object($)){if(U.defined($.quality))if(U.integer($.quality)&&U.inRange($.quality,1,100))this.options.jp2Quality=$.quality;else throw U.invalidParameterError("quality","integer between 1 and 100",$.quality);if(U.defined($.lossless))if(U.bool($.lossless))this.options.jp2Lossless=$.lossless;else throw U.invalidParameterError("lossless","boolean",$.lossless);if(U.defined($.tileWidth))if(U.integer($.tileWidth)&&U.inRange($.tileWidth,1,32768))this.options.jp2TileWidth=$.tileWidth;else throw U.invalidParameterError("tileWidth","integer between 1 and 32768",$.tileWidth);if(U.defined($.tileHeight))if(U.integer($.tileHeight)&&U.inRange($.tileHeight,1,32768))this.options.jp2TileHeight=$.tileHeight;else throw U.invalidParameterError("tileHeight","integer between 1 and 32768",$.tileHeight);if(U.defined($.chromaSubsampling))if(U.string($.chromaSubsampling)&&U.inArray($.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=$.chromaSubsampling;else throw U.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",$.chromaSubsampling)}return this._updateFormatOut("jp2",$)}function A5($,J){if(U.object($)&&U.defined($.loop))if(U.integer($.loop)&&U.inRange($.loop,0,65535))J.loop=$.loop;else throw U.invalidParameterError("loop","integer between 0 and 65535",$.loop);if(U.object($)&&U.defined($.delay))if(U.integer($.delay)&&U.inRange($.delay,0,65535))J.delay=[$.delay];else if(Array.isArray($.delay)&&$.delay.every(U.integer)&&$.delay.every((w)=>U.inRange(w,0,65535)))J.delay=$.delay;else throw U.invalidParameterError("delay","integer or an array of integers between 0 and 65535",$.delay)}function E6($){if(U.object($)){if(U.defined($.quality))if(U.integer($.quality)&&U.inRange($.quality,1,100))this.options.tiffQuality=$.quality;else throw U.invalidParameterError("quality","integer between 1 and 100",$.quality);if(U.defined($.bitdepth))if(U.integer($.bitdepth)&&U.inArray($.bitdepth,[1,2,4,8]))this.options.tiffBitdepth=$.bitdepth;else throw U.invalidParameterError("bitdepth","1, 2, 4 or 8",$.bitdepth);if(U.defined($.tile))this._setBooleanOption("tiffTile",$.tile);if(U.defined($.tileWidth))if(U.integer($.tileWidth)&&$.tileWidth>0)this.options.tiffTileWidth=$.tileWidth;else throw U.invalidParameterError("tileWidth","integer greater than zero",$.tileWidth);if(U.defined($.tileHeight))if(U.integer($.tileHeight)&&$.tileHeight>0)this.options.tiffTileHeight=$.tileHeight;else throw U.invalidParameterError("tileHeight","integer greater than zero",$.tileHeight);if(U.defined($.miniswhite))this._setBooleanOption("tiffMiniswhite",$.miniswhite);if(U.defined($.pyramid))this._setBooleanOption("tiffPyramid",$.pyramid);if(U.defined($.xres))if(U.number($.xres)&&$.xres>0)this.options.tiffXres=$.xres;else throw U.invalidParameterError("xres","number greater than zero",$.xres);if(U.defined($.yres))if(U.number($.yres)&&$.yres>0)this.options.tiffYres=$.yres;else throw U.invalidParameterError("yres","number greater than zero",$.yres);if(U.defined($.compression))if(U.string($.compression)&&U.inArray($.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=$.compression;else throw U.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",$.compression);if(U.defined($.predictor))if(U.string($.predictor)&&U.inArray($.predictor,["none","horizontal","float"]))this.options.tiffPredictor=$.predictor;else throw U.invalidParameterError("predictor","one of: none, horizontal, float",$.predictor);if(U.defined($.resolutionUnit))if(U.string($.resolutionUnit)&&U.inArray($.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=$.resolutionUnit;else throw U.invalidParameterError("resolutionUnit","one of: inch, cm",$.resolutionUnit)}return this._updateFormatOut("tiff",$)}function q6($){return this.heif({...$,compression:"av1"})}function A6($){if(U.object($)){if(U.string($.compression)&&U.inArray($.compression,["av1","hevc"]))this.options.heifCompression=$.compression;else throw U.invalidParameterError("compression","one of: av1, hevc",$.compression);if(U.defined($.quality))if(U.integer($.quality)&&U.inRange($.quality,1,100))this.options.heifQuality=$.quality;else throw U.invalidParameterError("quality","integer between 1 and 100",$.quality);if(U.defined($.lossless))if(U.bool($.lossless))this.options.heifLossless=$.lossless;else throw U.invalidParameterError("lossless","boolean",$.lossless);if(U.defined($.effort))if(U.integer($.effort)&&U.inRange($.effort,0,9))this.options.heifEffort=$.effort;else throw U.invalidParameterError("effort","integer between 0 and 9",$.effort);if(U.defined($.chromaSubsampling))if(U.string($.chromaSubsampling)&&U.inArray($.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=$.chromaSubsampling;else throw U.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",$.chromaSubsampling);if(U.defined($.bitdepth))if(U.integer($.bitdepth)&&U.inArray($.bitdepth,[8,10,12])){if($.bitdepth!==8&&this.constructor.versions.heif)throw U.invalidParameterError("bitdepth when using prebuilt binaries",8,$.bitdepth);this.options.heifBitdepth=$.bitdepth}else throw U.invalidParameterError("bitdepth","8, 10 or 12",$.bitdepth)}else throw U.invalidParameterError("options","Object",$);return this._updateFormatOut("heif",$)}function S6($){if(U.object($)){if(U.defined($.quality))if(U.integer($.quality)&&U.inRange($.quality,1,100))this.options.jxlDistance=$.quality>=30?0.1+(100-$.quality)*0.09:0.017666666666666667*$.quality*$.quality-1.15*$.quality+25;else throw U.invalidParameterError("quality","integer between 1 and 100",$.quality);else if(U.defined($.distance))if(U.number($.distance)&&U.inRange($.distance,0,15))this.options.jxlDistance=$.distance;else throw U.invalidParameterError("distance","number between 0.0 and 15.0",$.distance);if(U.defined($.decodingTier))if(U.integer($.decodingTier)&&U.inRange($.decodingTier,0,4))this.options.jxlDecodingTier=$.decodingTier;else throw U.invalidParameterError("decodingTier","integer between 0 and 4",$.decodingTier);if(U.defined($.lossless))if(U.bool($.lossless))this.options.jxlLossless=$.lossless;else throw U.invalidParameterError("lossless","boolean",$.lossless);if(U.defined($.effort))if(U.integer($.effort)&&U.inRange($.effort,3,9))this.options.jxlEffort=$.effort;else throw U.invalidParameterError("effort","integer between 3 and 9",$.effort)}return this._updateFormatOut("jxl",$)}function C6($){if(U.object($)){if(U.defined($.depth))if(U.string($.depth)&&U.inArray($.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=$.depth;else throw U.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",$.depth)}return this._updateFormatOut("raw")}function M6($){if(U.object($)){if(U.defined($.size))if(U.integer($.size)&&U.inRange($.size,1,8192))this.options.tileSize=$.size;else throw U.invalidParameterError("size","integer between 1 and 8192",$.size);if(U.defined($.overlap))if(U.integer($.overlap)&&U.inRange($.overlap,0,8192)){if($.overlap>this.options.tileSize)throw U.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,$.overlap);this.options.tileOverlap=$.overlap}else throw U.invalidParameterError("overlap","integer between 0 and 8192",$.overlap);if(U.defined($.container))if(U.string($.container)&&U.inArray($.container,["fs","zip"]))this.options.tileContainer=$.container;else throw U.invalidParameterError("container","one of: fs, zip",$.container);if(U.defined($.layout))if(U.string($.layout)&&U.inArray($.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=$.layout;else throw U.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",$.layout);if(U.defined($.angle))if(U.integer($.angle)&&!($.angle%90))this.options.tileAngle=$.angle;else throw U.invalidParameterError("angle","positive/negative multiple of 90",$.angle);if(this._setBackgroundColourOption("tileBackground",$.background),U.defined($.depth))if(U.string($.depth)&&U.inArray($.depth,["onepixel","onetile","one"]))this.options.tileDepth=$.depth;else throw U.invalidParameterError("depth","one of: onepixel, onetile, one",$.depth);if(U.defined($.skipBlanks))if(U.integer($.skipBlanks)&&U.inRange($.skipBlanks,-1,65535))this.options.tileSkipBlanks=$.skipBlanks;else throw U.invalidParameterError("skipBlanks","integer between -1 and 255/65535",$.skipBlanks);else if(U.defined($.layout)&&$.layout==="google")this.options.tileSkipBlanks=5;let J=U.bool($.center)?$.center:$.centre;if(U.defined(J))this._setBooleanOption("tileCentre",J);if(U.defined($.id))if(U.string($.id))this.options.tileId=$.id;else throw U.invalidParameterError("id","string",$.id);if(U.defined($.basename))if(U.string($.basename))this.options.tileBasename=$.basename;else throw U.invalidParameterError("basename","string",$.basename)}if(U.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw U.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function k6($){if(!U.plainObject($))throw U.invalidParameterError("options","object",$);if(U.integer($.seconds)&&U.inRange($.seconds,0,3600))this.options.timeoutSeconds=$.seconds;else throw U.invalidParameterError("seconds","integer between 0 and 3600",$.seconds);return this}function x6($,J){if(!(U.object(J)&&J.force===!1))this.options.formatOut=$;return this}function f6($,J){if(U.bool(J))this.options[$]=J;else throw U.invalidParameterError($,"boolean",J)}function d6(){if(!this.options.streamOut){this.options.streamOut=!0;let $=Error();this._pipeline(void 0,$)}}function O6($,J){if(typeof $==="function"){if(this._isStreamInput())this.on("finish",()=>{this._flattenBufferIn(),H2.pipeline(this.options,(w,F,W)=>{if(w)$(U.nativeError(w,J));else $(null,F,W)})});else H2.pipeline(this.options,(w,F,W)=>{if(w)$(U.nativeError(w,J));else $(null,F,W)});return this}else if(this.options.streamOut){if(this._isStreamInput()){if(this.once("finish",()=>{this._flattenBufferIn(),H2.pipeline(this.options,(w,F,W)=>{if(w)this.emit("error",U.nativeError(w,J));else this.emit("info",W),this.push(F);this.push(null),this.on("end",()=>this.emit("close"))})}),this.streamInFinished)this.emit("finish")}else H2.pipeline(this.options,(w,F,W)=>{if(w)this.emit("error",U.nativeError(w,J));else this.emit("info",W),this.push(F);this.push(null),this.on("end",()=>this.emit("close"))});return this}else if(this._isStreamInput())return new Promise((w,F)=>{this.once("finish",()=>{this._flattenBufferIn(),H2.pipeline(this.options,(W,Z,B)=>{if(W)F(U.nativeError(W,J));else if(this.options.resolveWithObject)w({data:Z,info:B});else w(Z)})})});else return new Promise((w,F)=>{H2.pipeline(this.options,(W,Z,B)=>{if(W)F(U.nativeError(W,J));else if(this.options.resolveWithObject)w({data:Z,info:B});else w(Z)})})}S5.exports=function($){Object.assign($.prototype,{toFile:H6,toBuffer:G6,keepExif:I6,withExif:y6,withExifMerge:L6,keepIccProfile:N6,withIccProfile:X6,keepMetadata:V6,withMetadata:D6,toFormat:T6,jpeg:j6,jp2:_6,png:z6,webp:R6,tiff:E6,avif:q6,heif:A6,jxl:S6,gif:P6,raw:C6,tile:M6,timeout:k6,_updateFormatOut:x6,_setBooleanOption:f6,_read:d6,_pipeline:O6})}});var f5=T((U7,x5)=>{var b6=P("events"),u2=P("detect-libc"),h=u(),{runtimePlatformArch:v6}=w1(),x=D2(),M5=v6(),y1=x.libvipsVersion(),i=x.format();i.heif.output.alias=["avif","heic"];i.jpeg.output.alias=["jpe","jpg"];i.tiff.output.alias=["tif"];i.jp2k.output.alias=["j2c","j2k","jp2","jpx"];var h6={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},G2={vips:y1.semver};if(!y1.isGlobal)if(!y1.isWasm)try{G2=P(`@img/sharp-${M5}/versions`)}catch($){try{G2=P(`@img/sharp-libvips-${M5}/versions`)}catch(J){}}else try{G2=(()=>{throw new Error("Cannot require module "+"@img/sharp-wasm32/versions");})()}catch($){}G2.sharp=$1().version;if(G2.heif&&i.heif)i.heif.input.fileSuffix=[".avif"],i.heif.output.alias=["avif"];function k5($){if(h.bool($))if($)return x.cache(50,20,100);else return x.cache(0,0,0);else if(h.object($))return x.cache($.memory,$.files,$.items);else return x.cache()}k5(!0);function g6($){return x.concurrency(h.integer($)?$:null)}if(u2.familySync()===u2.GLIBC&&!x._isUsingJemalloc())x.concurrency(1);else if(u2.familySync()===u2.MUSL&&x.concurrency()===1024)x.concurrency(P("os").availableParallelism());var m6=new b6.EventEmitter;function l6(){return x.counters()}function u6($){return x.simd(h.bool($)?$:null)}function c6($){if(h.object($))if(Array.isArray($.operation)&&$.operation.every(h.string))x.block($.operation,!0);else throw h.invalidParameterError("operation","Array<string>",$.operation);else throw h.invalidParameterError("options","object",$)}function a6($){if(h.object($))if(Array.isArray($.operation)&&$.operation.every(h.string))x.block($.operation,!1);else throw h.invalidParameterError("operation","Array<string>",$.operation);else throw h.invalidParameterError("options","object",$)}x5.exports=function($){$.cache=k5,$.concurrency=g6,$.counters=l6,$.simd=u6,$.format=i,$.interpolators=h6,$.versions=G2,$.queue=m6,$.block=c6,$.unblock=a6}});var O5=T((Y7,d5)=>{var e=m0();Y5()(e);y5()(e);N5()(e);D5()(e);z5()(e);P5()(e);C5()(e);f5()(e);d5.exports=e});import{AsyncLocalStorage as o5}from"async_hooks";class Z2 extends v{service;static _name="BroadcastingServiceContainer";publishCb;context=new o5;constructor($){super();this.service=$}onPublish($){this.publishCb=$}publish(...$){let[J,w,F]=$;this.publishCb(J,w,F)}async handleMessage($,J){let w=JSON.parse(J);if(w.type==="subscribe"){let F=Object.entries(this.service.channels).sort(([W],[Z])=>W.length-Z.length);for(let[W,Z]of F){let B=new URLPattern({pathname:W});if(B.test({pathname:w.topic})){let Y=B.exec({pathname:w.topic})?.pathname.groups,K=new Z;if(await K.subscribe.call(K,Y))$.subscribe(w.topic);break}}}if(w.type==="broadcast")$.publish(w.topic,JSON.stringify({topic:w.topic,data:w.payload}));if(w.type==="unsubscribe")$.unsubscribe(w.topic)}run($,J){let w=$.get("Cookie"),F=new Map;if(w){let W=w.split(";");for(let Z of W){let[B,Y]=Z.split("=");F.set(B.trim(),Y.trim())}}this.context.run({headers:$,cookies:F},J)}}class p{static async user(){let $=C.getStore(),J=Z2.use().context.getStore(),w="",F="";if($?.req)w=$.req.cookies.get("access_token"),F=$.req.headers.get("User-Agent");if(J?.cookies)F=J.headers.get("User-Agent"),w=J.cookies.get("access_token");let W=$?.user;if(!W)W=(await q.use().getSession(w,F))?.user,$?.setUser(W);if(W)return W;return null}static async guard($){let J=await p.user();if(!J)throw new _2;try{if(!await $(J))throw new _2}catch(w){throw new _2}}static async guardSafe($){let J=await p.user();if(!J)return!1;try{return await $(J)}catch(w){return!1}}static async authenticate($){await q.use().authenticate($)}static async createMagicLink($){return await q.use().createMagicLinkToken($)}}function l($,J){return $.replace(/:([^/]+)/g,(w,F)=>{let W=F.endsWith("?"),Z=W?F.slice(0,-1):F,B=J[Z];if(B===void 0){if(W)return"";throw new Error(`Missing parameter: ${Z}`)}return String(B)}).replace(/\/\//g,"/")}class A1 extends q1{constructor($){super("Redirect error");this.name="RedirectError",this.payload={api:{status:200,data:{},directive:{kind:"Redirect",path:$}},view:{status:307,headers:{"Cache-Control":"private, no-cache, no-store, max-age=0, must-revalidate",Location:$}}}}}class S1{static to($,...J){let[w={}]=J,{search:F={},params:W={}}={params:{},...w},Z=new URLSearchParams(F).toString();throw new A1([l($,W),Z.toString()].filter(Boolean).join("?"))}}function C1($,J){return $.replace(/{{([^}]+)}}/g,(w,F)=>{let W=J[F];if(W===void 0)throw new Error(`Missing parameter: ${F}`);return W})}class M1{static scope($){return $}static translate($,...J){let w=o.use(),F=w.detectLocale(C.getStore().req),W=w.translations.get(`${F}.server`)?.[$];if(!W)return $;return C1(W,J[0])}static locale(){return o.use().detectLocale(C.getStore().req)}static setLocale($){let J=o.use(),w=$;if(!J.supportedLocales.includes($))w=J.service.defaultLocale;C.getStore().setCookie("i18n-locale",w,{expires:new Date(Date.now()+31536000000)})}}var b5=r6(O5(),1);import{Buffer as e6}from"buffer";class R2 extends v{service;static _name="FileStorageServiceContainer";constructor($){super();this.service=$}}class v5{static async put($){return R2.use().service.driver.put($)}static async metadata($){let J=e6.from(await $.arrayBuffer());try{return await b5.default(J).metadata()}catch{return{}}}static async fetch($){return R2.use().service.driver.fetch($)}static list($){return R2.use().service.driver.list($)}static delete(){}}function h5($){return Object.fromEntries(Object.entries($).filter(([,J])=>{return J!==null&&J!==void 0}))}class F2 extends Error{constructor(){super("Adapter not found");this.name="AdapterNotFound"}}class L1{createSession(){throw new F2}deleteSession(){throw new F2}findSession(){throw new F2}findUserByEmailAddress(){throw new F2}updateSession(){throw new F2}createUser(){throw new F2}}class u5 extends _{schema={email:{required:"Email is required",string:"Invalid email",email:"Invalid email"},password:{required:"Password is required"}}}class c5 extends _{schema={name:{string:"Invalid name",required:"Name is required","min:2":"Name must be at least 3 characters"},email:{string:"Invalid email",required:"Email is required",email:"Invalid email"},password:{required:"Password is required","min:8":"Password must be at least 8 characters"}}}class a5 extends _{schema={email:{required:"Email is required",email:"Invalid email"}}}class r5 extends _{schema={password:{required:"Password is required",password:"Invalid password"}}}class d extends g5{provider=q.use()?.provider;async me(){let $=await p.user();if(!$)throw new l5;return $}async verifyEmail($=new _){let J=await $.input(),w=q.use()?.provider,F=await w.adapter.findUserByVerificationToken(J.get("token"));if(!F)return{email:null};if(await w.adapter.verifyUser(F.email),F)return{email:F.email};return{email:null}}async signInWithMagicLink($=new _){let J=q.use(),w=J.provider,F=$.search.get("token"),W=decodeURIComponent($.search.get("email")),Z=null;try{Z=await w.adapter.findUserMagicLinkToken({email:W,token:F})}catch(Y){return console.log(Y),{error:JSON.stringify(Y)}}if(!Z)return{error:"Invalid token"};await w.adapter.verifyUser(W),await w.adapter.deleteMagicLinkToken(W);let B=await J.createOrUpdateSession({email:W});return $.ctx().setCookie("access_token",B.token,{expires:B.expiresAt}),await w.onSignIn(B),{session:B}}async signInWithPin($=new _){let J=q.use(),w=J.provider,F=await $.input(),{email:W,pin:Z}=F.toJSON();if(!await w.adapter.findUserMagicLinkToken({email:W,pin:Z}))throw new n({pin:["Invalid pin"]});await w.adapter.deleteMagicLinkToken(W),await w.adapter.verifyUser(W);let Y=await J.createOrUpdateSession({email:W});return $.ctx().setCookie("access_token",Y.token,{expires:Y.expiresAt}),await w.onSignIn(Y),{session:Y}}async signIn($=new u5){let J=await $.input.call($),{email:w,password:F}=J.toJSON(),W=q.use().provider,Z=await W.adapter.findUserByEmailAddress(w,W.verifyEmail);if(!Z)throw new n({invalid_credentials:["Invalid credentials"]});if(!await W.verifyPassword(F,Z.password))throw new n({invalid_credentials:["Invalid credentials"]});let Y=await q.use().createOrUpdateSession({email:Z.email,id:Z.id});$.ctx().setCookie("access_token",Y.token,{expires:Y.expiresAt}),await W.onSignIn(Z);let{password:K,...G}=Z;return G}async signUp($=new c5){let J=await $.input(),{email:w,password:F,name:W,invitationId:Z}=J.toJSON(),B=q.use().provider;if(await B.adapter.findUserByEmailAddress(w,!1))throw new n({email:["Email address already exists"]});let K=await B.hashPassword(F),G=o.use().detectLocale($),I;if(Z){if(I=await B.adapter.findInvitation(Z,w),I)await B.adapter.deleteInvitationById(Z)}let V,z;if(I)V=await B.adapter.createUser({email:w,name:W,password:K,emailVerifiedAt:new Date,locale:G}),await B.adapter.createAccount({organizationId:I.organizationId,userId:V.id,organizationRole:I.role});else z=await B.generateEmailVerificationToken(w),V=await B.adapter.createUser({email:w,name:W,password:K,verificationToken:z,locale:G});return await B.onSignUp(V,z),V}async signOut($=new _){let J=$.cookies.get("access_token"),w=await p.user(),F=q.use().provider;return await F.adapter.deleteSession({token:J}),$.ctx().setCookie("access_token","",{expires:new Date(0)}),await F.onSignOut(w),{}}async forgotPassword($=new a5){let J=await $.input(),{email:w}=J.toJSON(),F=q.use().provider,W=await F.adapter.findUserByEmailAddress(w,F.verifyEmail);if(!W)return{};let Z=await F.generateForgotPasswordToken(W);return await F.adapter.createPasswordResetToken({user:W,token:Z}),await F.onForgotPassword(W,Z),{}}async resetPassword($=new r5){let J=q.use().provider,w=await $.input(),{password:F,token:W}=w.toJSON(),Z=await J.adapter.findPasswordResetToken({token:W});if(!Z)throw new n({token:["Invalid token"]});if(P2.Instant.from(Z.createdAt.toISOString()).add({hours:24}).until(P2.Now.instant()).sign>=0)throw new n({token:["Token expired"]});await J.adapter.deletePasswordResetToken({token:W});let Y=await J.adapter.findUserByEmailAddress(Z.user.email,J.verifyEmail);if(!Y)throw new n({email:["User not found"]});let K=await J.hashPassword(F);return await J.adapter.updateUserPassword({id:Y.id,password:K}),await J.adapter.deleteAllUserSessions(Y.id),await J.onResetPassword(Y),{}}async changePassword($=new _){let J=q.use().provider,w=await p.user(),F=await $.input(),{oldPassword:W,newPassword:Z}=F.toJSON(),{password:B}=await J.adapter.findUserByEmailAddress(w.email,J.verifyEmail);if(!await J.verifyPassword(W,B))throw new n({oldPassword:["Incorrect password"]});let K=await J.hashPassword(Z);return await J.adapter.updateUserPassword({id:w.id,password:K}),await J.adapter.deleteAllUserSessions(w.id),{}}async oauthRedirect($=new _){let{provider:J}=$.params,w=q.use().provider.oauthProviders[J];if(!w)throw new Error(`Invalid provider: ${J}`);return{url:await w.getRedirectUrl($)}}async oauthCallback($=new _){let{provider:J}=$.params,w=q.use(),F=w.provider,W=F.oauthProviders[J],{email:Z,name:B,username:Y,providerId:K}=await W.onCallback($);if(!Y&&!Z)throw new Error("Email or username is required");let G=Z??`${Y}:${J}`,I=await F.adapter.findUserByEmailAddress(G,!1),V=o.use().detectLocale($);if(!I)I=await F.adapter.createUser({email:G,name:B,locale:V,emailVerifiedAt:new Date}),await F.adapter.createSocialAccount({provider:J,userId:I.id,email:G,username:Y,providerId:K,expiresAt:new Date,accessToken:"",refreshToken:""});let z=await w.createOrUpdateSession({email:I.email,id:I.id});return $.ctx().setCookie("access_token",z.token,{expires:z.expiresAt}),await F.onSignIn(I),{session:z}}async createMagicLinkToken($=new _){let J=await $.input(),{email:w}=J.toJSON(),F=q.use(),W=F.provider,{user:Z,pin:B,token:Y}=await F.createMagicLinkToken(w);return await W.onMagicLinkCreated(Z,{email:w,pin:B,token:Y}),{email:w}}}class e5 extends N1{routes={"/:provider":this.view("__",[d,"oauthRedirect"]),"/:provider/callback":this.view("auth/OauthCallback",[d,"oauthCallback"])}}class n6 extends N1{routes={"/sign-in/magic-link":this.view("auth/MagicLinkSignIn",[d,"signInWithMagicLink"]),"/oauth":e5}}class X1 extends I2{middlewares=["cache:private"];routes={"/sign-in":this.post(d,"signIn"),"/sign-up":this.post(d,"signUp"),"/sign-out":this.post(d,"signOut"),"/forgot-password":this.post(d,"forgotPassword"),"/reset-password":this.post(d,"resetPassword"),"/change-password":this.post(d,"changePassword"),"/verify-email":this.post(d,"verifyEmail"),"/me":this.get(d,"me").middleware(["auth"]),"/magic-link":this.post(d,"createMagicLinkToken"),"/sign-in-with-pin":this.post(d,"signInWithPin")}}class p6 extends m5{basePath="/auth";verifyEmail=!0;sessionExpiresInHours=24;sessionAbsoluteExpiresInHours=672;adapter=new L1;oauthProviders={};boot(){}async verifyPassword($,J){return await Bun.password.verify($,J)}async hashPassword($){return await Bun.password.hash($)}async generateForgotPasswordToken($){let J=new Bun.CryptoHasher("sha256");return J.update(`${$.email}${Date.now()}`),J.digest("hex")}generateEmailVerificationToken($){if(!this.verifyEmail)return"";let J=new Bun.CryptoHasher("sha256");return J.update(`${$}${Date.now()}`),J.digest("hex")}generateMagicLinkToken($){let J=new Bun.CryptoHasher("sha256");return J.update(`${$}${Date.now()}`),J.digest("hex")}extendSession($){return{}}onSignUp($,J){}onSignIn($){}onSignOut($){}onForgotPassword($,J){}onResetPassword($){}onMagicLinkCreated($,J){return}}class V1 extends I2{routes={"/resize":this.file(async()=>{let $=new _,J=new URL($.rawRequest.url),w=J.searchParams.get("url"),F=Number(J.searchParams.get("w")),W=Number(J.searchParams.get("h")),Z=J.searchParams.get("fit")??"cover",B=Number(J.searchParams.get("q"));if(!w)return new Response(JSON.stringify({error:"url query parameter is required"}),{headers:{"Content-Type":"application/json"},status:404});let K=`${w.startsWith("http")?"":`http://localhost:${process.env.PORT||5173}`}${w}`,G=await fetch(K);if(!G.ok)return new Response(JSON.stringify({error:"Image not found",info:K}),{headers:{"Content-Type":"application/json"},status:404});let I=Buffer.from(await G.arrayBuffer()),V=await n5.use().service.driver.resize(I,{height:W,width:F,fit:Z,quality:B});return G.headers.delete("Content-Type"),G.headers.delete("Content-Length"),new Response(V,{headers:{"Content-Type":"image/webp","Content-Length":`${V.byteLength}`,...G.headers.toJSON()}})})}}class n5 extends v{service;static _name="ImageOptimizationServiceContainer";constructor($){super();this.service=$}}import{mkdir as D1,exists as T1,readdir as s6}from"fs/promises";class g extends v{service;static _name="LoggingServiceContainer";writer;isReady=!1;logsDirPath=`${process.env.ROOT_DIR}/storage/logs`;flushTimeout;fileSize=0;writerSize=0;isCreatingFile=!1;currentLogFilePath;constructor($){super();this.service=$;this.boot().then(()=>{this.isReady=!0})}async boot(){if(!process.env.ROOT_DIR)return;if(!await T1(`${process.env.ROOT_DIR}/storage`))await D1(`${process.env.ROOT_DIR}/storage`);if(!await T1(this.logsDirPath))await D1(this.logsDirPath);this.newLogFile()}async newLogFile(){if(!await T1(this.logsDirPath))await D1(this.logsDirPath);if(this.isCreatingFile=!0,this.currentLogFilePath){this.writer.flush(),this.writer.end(),this.writer=null;let w=new File([await Bun.file(this.currentLogFilePath).arrayBuffer()],this.currentLogFilePath.split("/").pop(),{type:"text/plain"});this.service.onLogFileClosed(w),this.fileSize=0,this.writerSize=0}let J=(await s6(this.logsDirPath)).sort().reverse()[0];if(J){let w=Bun.file(`${this.logsDirPath}/${J}`);if(w.size<this.service.maxFileSize)this.currentLogFilePath=`${this.logsDirPath}/${J}`,this.writer=w.writer(),this.writer.write(await w.text()),this.writer.write(`
|
|
4
4
|
`),this.writer.flush(),this.fileSize=w.size}if(!this.writer){let w=`${new Date(Date.now()).toISOString()}.log`.replaceAll(":","-");this.currentLogFilePath=`${this.logsDirPath}/${w}`;let F=Bun.file(`${this.logsDirPath}/${w}`);this.writer=F.writer(),this.fileSize=0,this.writerSize=0}this.isCreatingFile=!1}async log($,J,w={}){if(!this.isReady)await new Promise((Y)=>{let K=setInterval(()=>{if(this.isReady)Y({}),clearInterval(K)},100)});let F=C.getStore(),W={};if(F)W={url:F.req.rawRequest.url,method:F.req.rawRequest.method,headers:F.req.rawRequest.headers,body:F.req.rawRequest.body};let Z={timestamp:new Date(Date.now()).toISOString(),env:"production",level:$,message:J,metadata:{...W,...w}},B="";try{B=JSON.stringify(Z)}catch(Y){throw new Error("Metadata must be a valid JSON object")}this.writerSize+=B.length,this.fileSize+=B.length,this.writer.write(B),this.writer.write(`
|
|
5
|
-
`),c2.channel("/logs/live",{}).publish(JSON.stringify(Z)),this.service.onLogCreated(Z),this.tryFlush()}async tryFlush(){if(this.fileSize>this.service.maxFileSize){if(!this.isCreatingFile)await this.newLogFile()}if(this.writerSize>this.service.maxFileSize/2)await this.writer.flush(),this.writerSize=0,await this.newLogFile();else clearTimeout(this.flushTimeout),this.flushTimeout=setTimeout(async()=>{await this.writer.flush(),this.writerSize=0},100)}}class j1 extends I2{middlewares=["cache:private,0"];routes={"/live":this.get(async()=>{let $=Bun.file(g.use().currentLogFilePath);return new Response(await $.text(),{headers:{"Content-Type":"text/plain"}})})}}function t6($){let J=new Map;for(let w of $)if(typeof w==="string"){let[F,W=""]=w.split(":");if(F.startsWith("-")){if(J.has(F.replace("-","")))J.delete(F.replace("-",""))}else J.set(F,W.split(",").filter(Boolean))}else J.set(w,[]);return J}class z1 extends v{service;static _name="MiddlewareServiceContainer";constructor($){super();this.service=$}runMiddleware($){let J=new _;return Array.from(t6($).entries()).map(([w,F])=>{if(typeof w==="string"){let W=this.service.aliases[w];if(W){let Z=new W(J);return()=>Z.run.call(Z,...F)}}else{if(p5(w)){let W=new w(J);return W.run.bind(W)}return w}}).filter(Boolean).reduce((w,F)=>{return async()=>{return{...await w(),...await F()}}},()=>Promise.resolve({}))()}}function i6($){return"run"in $}function o6($){return Object.hasOwn($,"get")||Object.hasOwn($,"post")||Object.hasOwn($,"put")||Object.hasOwn($,"delete")}function $9($){return Object.hasOwn($,"first")&&Object.hasOwn($,"second")}function J9($){if("__brand"in $)return $.__brand==="ApiRouter";return!1}function R1($,J="",w=[]){let F={};function W(Z,B,Y,K){let G=Z==="/"?"":Z,I=J==="/"?"":J,V=(`${I}${G}`===""?"/":`${I}${G}`).replaceAll("//","/");if(!F[V])F[V]={};F[V][B]={exec:Y,middleware:[...w,...K]},F[V].OPTIONS={exec:()=>{let y2=new _().ctx().headers;return new Response(null,{headers:y2,status:204})},middleware:[]}}for(let[Z,B]of Object.entries($)){if(i6(B)){let Y=B,K=Y.method,G=Y.middlewares,I=Y.run.bind(Y);W(Z,K,I,G)}if(o6(B))for(let[Y,K]of Object.entries(B)){let G=K.middlewares,I=K.run.bind(K);W(Z,Y,I,G)}if(J9(B)){let Y=new B,K=R1(Y.routes,`${J}${Z}`,Y.middlewares);for(let[G,I]of Object.entries(K))F[G.replaceAll("//","/")]=I}if($9(B)){let{first:Y,second:K}=B;for(let[G,I]of Object.entries(Y)){let V=I.middlewares,z=I.run.bind(I),[y2,...r2]=Z.split("/").reverse();if(!y2.startsWith(":"))throw new Error("Resource route must end with a dynamic segment");W(r2.reverse().join("/"),G,z,V)}for(let[G,I]of Object.entries(K)){let V=I.middlewares,z=I.run.bind(I);W(Z,G,z,V)}}}return Object.fromEntries(Object.entries(F).sort(([Z],[B])=>{let Y=Z.split("/").length+Z.split(":").length,K=B.split("/").length+B.split(":").length;return Y-K}))}class _1 extends v{service;static _name="ApiRouterServiceContainer";flatRoutes={};constructor($){super();this.service=$;this.flatRoutes=R1({"/":this.service.rootRouter.bind(this.service),"/auth":X1,"/__gemi__/services/i18n":s5,"/__gemi__/services/logs":j1,"/__gemi__/services/image":V1})}getRouteHandlerAndParams($){let w=new URL($.url).pathname.replace("/api",""),F={},W;for(let[Z]of Object.entries(this.flatRoutes))try{let B=new URLPattern({pathname:Z});if(B.test({pathname:w})){W=Z,F=B.exec({pathname:w})?.pathname.groups;break}}catch(B){console.error(B)}return{params:F,path:W}}async runRouteMiddleware($,J){let F=this.flatRoutes[$][J.rawRequest.method].middleware;try{await z1.use().runMiddleware(F)}catch(W){if(W.kind===P1){if(J.rawRequest.url.includes("/api")){let{status:Z=400,data:B,headers:Y}=W.payload.api;return new Response(JSON.stringify(B),{status:Z,headers:{"Content-Type":"application/json",...Y}})}}else throw this.service.onRequestFail(J,W),console.error(W),W}}async getRouteData($){let J=this.flatRoutes[$],w=C.getStore(),F=J[w.req.rawRequest.method].exec??(()=>Promise.resolve({})),W={};try{W=await F()}catch(Z){if(Z.kind===P1){let{status:B=400,data:Y,headers:K}=Z.payload.api;return new Response(JSON.stringify(Y),{status:B,headers:{"Content-Type":"application/json",...K}})}throw this.service.onRequestFail(w.req,Z),console.error(Z),Z}return W}async handleApiRequest($){let{params:J,path:w}=this.getRouteHandlerAndParams($),F=this.flatRoutes[w];if(!F||!F[$.method])return new Response(JSON.stringify({error:{message:"Not found"}}),{status:404});let W=new _($,J,"api",w);if(!$.url.includes("/__gemi__"))this.service.onRequestStart(W);return await C.run(W,async()=>{let Z=C.getStore();Z.setRequest(W);let B=await this.runRouteMiddleware(w,W);if(B instanceof Response)return B;let Y=await this.getRouteData(w);if(Y instanceof Response)return Y;let K=Z.headers;if(K.append("Content-Type","application/json"),Z.cookies.forEach((G)=>K.append("Set-Cookie",G.toString())),Z.destroy(),!$.url.includes("/__gemi__"))this.service.onRequestEnd(W);return new Response(JSON.stringify(Y),{headers:K})})}}class a2{static prepare($,...J){let w={params:{},search:{}},[F={}]=J,{search:W,params:Z}={...w,...F},B=C.getStore();if(B.req.kind==="api")throw new Error("Query.prefetch() cannot be called from an API request");let Y=B.req.rawRequest,K=new URL(Y.url),G=new URLSearchParams(h5(W));G.delete("json"),G.sort();let I=[`${l($,Z)}`,G.toString()].filter((W2)=>W2.length>0).join("?"),V=`${K.origin}/${I}`,z=new Request(V,{headers:Y.headers}),y2=new _(z,Z),r2=(W2)=>{B.prefetchedResources.set(l($,Z),{[G.toString()]:W2})},E1=()=>{return C.run(y2,async()=>{let W2=await _1.use().getRouteData($);return r2(W2),W2})};return{instant:E1,prefetch:()=>{B.prefetchPromiseQueue.add(E1)}}}static instant($,...J){return a2.prepare($,...J).instant()}static prefetch($,...J){return a2.prepare($,...J).prefetch()}}class c2{static channel($,J){let w=Z2.use().service.channels[$];if(!w)return console.error(`Channel ${$} not found`),{publish:()=>{}};let F=new w;return{publish:(W,Z=!1)=>{let B=l($,J);Z2.use().publish(B,JSON.stringify({topic:B,data:F.publish(W)}),Z)}}}}class t5{static absolute($,...J){return`${process.env.HOST_NAME}${l(String($),J[0]??{})}`}static relative($,...J){return l(String($),J[0]??{})}}class i5{static debug($,J){g.use().log("debug",$,J)}static info($,J){g.use().log("info",$,J)}static notice($,J){g.use().log("notice",$,J)}static warning($,J){g.use().log("warning",$,J)}static error($,J){g.use().log("error",$,J)}static critical($,J){g.use().log("critical",$,J)}static alert($,J){g.use().log("alert",$,J)}static emergency($,J){g.use().log("emergency",$,J)}}export{t5 as Url,S1 as Redirect,a2 as Query,i5 as Log,M1 as I18n,v5 as FileStorage,c2 as Broadcast,p as Auth};export{Z2 as
|
|
5
|
+
`),c2.channel("/logs/live",{}).publish(JSON.stringify(Z)),this.service.onLogCreated(Z),this.tryFlush()}async tryFlush(){if(this.fileSize>this.service.maxFileSize){if(!this.isCreatingFile)await this.newLogFile()}if(this.writerSize>this.service.maxFileSize/2)await this.writer.flush(),this.writerSize=0,await this.newLogFile();else clearTimeout(this.flushTimeout),this.flushTimeout=setTimeout(async()=>{await this.writer.flush(),this.writerSize=0},100)}}class j1 extends I2{middlewares=["cache:private,0"];routes={"/live":this.get(async()=>{let $=Bun.file(g.use().currentLogFilePath);return new Response(await $.text(),{headers:{"Content-Type":"text/plain"}})})}}function t6($){let J=new Map;for(let w of $)if(typeof w==="string"){let[F,W=""]=w.split(":");if(F.startsWith("-")){if(J.has(F.replace("-","")))J.delete(F.replace("-",""))}else J.set(F,W.split(",").filter(Boolean))}else J.set(w,[]);return J}class z1 extends v{service;static _name="MiddlewareServiceContainer";constructor($){super();this.service=$}runMiddleware($){let J=new _;return Array.from(t6($).entries()).map(([w,F])=>{if(typeof w==="string"){let W=this.service.aliases[w];if(W){let Z=new W(J);return()=>Z.run.call(Z,...F)}}else{if(p5(w)){let W=new w(J);return W.run.bind(W)}return w}}).filter(Boolean).reduce((w,F)=>{return async()=>{return{...await w(),...await F()}}},()=>Promise.resolve({}))()}}function i6($){return"run"in $}function o6($){return Object.hasOwn($,"get")||Object.hasOwn($,"post")||Object.hasOwn($,"put")||Object.hasOwn($,"delete")}function $9($){return Object.hasOwn($,"first")&&Object.hasOwn($,"second")}function J9($){if("__brand"in $)return $.__brand==="ApiRouter";return!1}function R1($,J="",w=[]){let F={};function W(Z,B,Y,K){let G=Z==="/"?"":Z,I=J==="/"?"":J,V=(`${I}${G}`===""?"/":`${I}${G}`).replaceAll("//","/");if(!F[V])F[V]={};F[V][B]={exec:Y,middleware:[...w,...K]},F[V].OPTIONS={exec:()=>{let y2=new _().ctx().headers;return new Response(null,{headers:y2,status:204})},middleware:[]}}for(let[Z,B]of Object.entries($)){if(i6(B)){let Y=B,K=Y.method,G=Y.middlewares,I=Y.run.bind(Y);W(Z,K,I,G)}if(o6(B))for(let[Y,K]of Object.entries(B)){let G=K.middlewares,I=K.run.bind(K);W(Z,Y,I,G)}if(J9(B)){let Y=new B,K=R1(Y.routes,`${J}${Z}`,Y.middlewares);for(let[G,I]of Object.entries(K))F[G.replaceAll("//","/")]=I}if($9(B)){let{first:Y,second:K}=B;for(let[G,I]of Object.entries(Y)){let V=I.middlewares,z=I.run.bind(I),[y2,...r2]=Z.split("/").reverse();if(!y2.startsWith(":"))throw new Error("Resource route must end with a dynamic segment");W(r2.reverse().join("/"),G,z,V)}for(let[G,I]of Object.entries(K)){let V=I.middlewares,z=I.run.bind(I);W(Z,G,z,V)}}}return Object.fromEntries(Object.entries(F).sort(([Z],[B])=>{let Y=Z.split("/").length+Z.split(":").length,K=B.split("/").length+B.split(":").length;return Y-K}))}class _1 extends v{service;static _name="ApiRouterServiceContainer";flatRoutes={};constructor($){super();this.service=$;this.flatRoutes=R1({"/":this.service.rootRouter.bind(this.service),"/auth":X1,"/__gemi__/services/i18n":s5,"/__gemi__/services/logs":j1,"/__gemi__/services/image":V1})}getRouteHandlerAndParams($){let w=new URL($.url).pathname.replace("/api",""),F={},W;for(let[Z]of Object.entries(this.flatRoutes))try{let B=new URLPattern({pathname:Z});if(B.test({pathname:w})){W=Z,F=B.exec({pathname:w})?.pathname.groups;break}}catch(B){console.error(B)}return{params:F,path:W}}async runRouteMiddleware($,J){let F=this.flatRoutes[$][J.rawRequest.method].middleware;try{await z1.use().runMiddleware(F)}catch(W){if(W.kind===P1){if(J.rawRequest.url.includes("/api")){let{status:Z=400,data:B,headers:Y}=W.payload.api;return new Response(JSON.stringify(B),{status:Z,headers:{"Content-Type":"application/json",...Y}})}}else throw this.service.onRequestFail(J,W),console.error(W),W}}async getRouteData($){let J=this.flatRoutes[$],w=C.getStore(),F=J[w.req.rawRequest.method].exec??(()=>Promise.resolve({})),W={};try{W=await F()}catch(Z){if(Z.kind===P1){let{status:B=400,data:Y,headers:K}=Z.payload.api;return new Response(JSON.stringify(Y),{status:B,headers:{"Content-Type":"application/json",...K}})}throw this.service.onRequestFail(w.req,Z),console.error(Z),Z}return W}async handleApiRequest($){let{params:J,path:w}=this.getRouteHandlerAndParams($),F=this.flatRoutes[w];if(!F||!F[$.method])return new Response(JSON.stringify({error:{message:"Not found"}}),{status:404});let W=new _($,J,"api",w);if(!$.url.includes("/__gemi__"))this.service.onRequestStart(W);return await C.run(W,async()=>{let Z=C.getStore();Z.setRequest(W);let B=await this.runRouteMiddleware(w,W);if(B instanceof Response)return B;let Y=await this.getRouteData(w);if(Y instanceof Response)return Y;let K=Z.headers;if(K.append("Content-Type","application/json"),Z.cookies.forEach((G)=>K.append("Set-Cookie",G.toString())),Z.destroy(),!$.url.includes("/__gemi__"))this.service.onRequestEnd(W);return new Response(JSON.stringify(Y),{headers:K})})}}class a2{static prepare($,...J){let w={params:{},search:{}},[F={}]=J,{search:W,params:Z}={...w,...F},B=C.getStore();if(B.req.kind==="api")throw new Error("Query.prefetch() cannot be called from an API request");let Y=B.req.rawRequest,K=new URL(Y.url),G=new URLSearchParams(h5(W));G.delete("json"),G.sort();let I=[`${l($,Z)}`,G.toString()].filter((W2)=>W2.length>0).join("?"),V=`${K.origin}/${I}`,z=new Request(V,{headers:Y.headers}),y2=new _(z,Z),r2=(W2)=>{B.prefetchedResources.set(l($,Z),{[G.toString()]:W2})},E1=()=>{return C.run(y2,async()=>{let W2=await _1.use().getRouteData($);return r2(W2),W2})};return{instant:E1,prefetch:()=>{B.prefetchPromiseQueue.add(E1)}}}static instant($,...J){return a2.prepare($,...J).instant()}static prefetch($,...J){return a2.prepare($,...J).prefetch()}}class c2{static channel($,J){let w=Z2.use().service.channels[$];if(!w)return console.error(`Channel ${$} not found`),{publish:()=>{}};let F=new w;return{publish:(W,Z=!1)=>{let B=l($,J);Z2.use().publish(B,JSON.stringify({topic:B,data:F.publish(W)}),Z)}}}}class t5{static absolute($,...J){return`${process.env.HOST_NAME}${l(String($),J[0]??{})}`}static relative($,...J){return l(String($),J[0]??{})}}class i5{static debug($,J){g.use().log("debug",$,J)}static info($,J){g.use().log("info",$,J)}static notice($,J){g.use().log("notice",$,J)}static warning($,J){g.use().log("warning",$,J)}static error($,J){g.use().log("error",$,J)}static critical($,J){g.use().log("critical",$,J)}static alert($,J){g.use().log("alert",$,J)}static emergency($,J){g.use().log("emergency",$,J)}}export{t5 as Url,S1 as Redirect,a2 as Query,i5 as Log,M1 as I18n,v5 as FileStorage,c2 as Broadcast,p as Auth};export{Z2 as Xb,S1 as Yb,O5 as Zb,R2 as _b,g as $b,i5 as ac,n6 as bc,p6 as cc,n5 as dc,z1 as ec,_1 as fc};
|
|
6
6
|
|
|
7
|
-
//# debugId=
|
|
7
|
+
//# debugId=DA2446F70587EF9E64756E2164756E21
|