@donotdev/core 0.0.23 → 0.0.24

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/vite/index.js CHANGED
@@ -1,8 +1,8 @@
1
- var qi=Object.create;var Lr=Object.defineProperty;var Wi=Object.getOwnPropertyDescriptor;var Hi=Object.getOwnPropertyNames;var Vi=Object.getPrototypeOf,Ji=Object.prototype.hasOwnProperty;var V=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var _=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Xi=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Hi(t))!Ji.call(e,n)&&n!==r&&Lr(e,n,{get:()=>t[n],enumerable:!(s=Wi(t,n))||s.enumerable});return e};var Yi=(e,t,r)=>(r=e!=null?qi(Vi(e)):{},Xi(t||!e||!e.__esModule?Lr(r,"default",{value:e,enumerable:!0}):r,e));var Se=_((Vf,is)=>{var ns=e=>typeof e<"u"&&e!==null,yo=e=>typeof e=="object",wo=e=>Object.prototype.toString.call(e)==="[object Object]",Eo=e=>typeof e=="function",xo=e=>typeof e=="boolean",Po=e=>e instanceof Buffer,Ro=e=>{if(ns(e))switch(e.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},So=e=>e instanceof ArrayBuffer,$o=e=>typeof e=="string"&&e.length>0,ko=e=>typeof e=="number"&&!Number.isNaN(e),Ao=e=>Number.isInteger(e),_o=(e,t,r)=>e>=t&&e<=r,No=(e,t)=>t.includes(e),Io=(e,t,r)=>new Error(`Expected ${t} for ${e} but received ${r} of type ${typeof r}`),Do=(e,t)=>(t.message=e.message,t);is.exports={defined:ns,object:yo,plainObject:wo,fn:Eo,bool:xo,buffer:Po,typedArray:Ro,arrayBuffer:So,string:$o,number:ko,integer:Ao,inRange:_o,inArray:No,invalidParameterError:Io,nativeError:Do}});var ls=_((Jf,as)=>{"use strict";var os=()=>process.platform==="linux",_t=null,To=()=>{if(!_t)if(os()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,_t=process.report.getReport(),process.report.excludeNetwork=e}else _t={};return _t};as.exports={isLinux:os,getReport:To}});var us=_((Xf,cs)=>{"use strict";var st=V("fs"),Co="/usr/bin/ldd",Fo="/proc/self/exe",Nt=2048,Oo=e=>{let t=st.openSync(e,"r"),r=Buffer.alloc(Nt),s=st.readSync(t,r,0,Nt,0);return st.close(t,()=>{}),r.subarray(0,s)},jo=e=>new Promise((t,r)=>{st.open(e,"r",(s,n)=>{if(s)r(s);else{let i=Buffer.alloc(Nt);st.read(n,i,0,Nt,0,(o,a)=>{t(i.subarray(0,a)),st.close(n,()=>{})})}})});cs.exports={LDD_PATH:Co,SELF_PATH:Fo,readFileSync:Oo,readFile:jo}});var hs=_((Yf,fs)=>{"use strict";var Lo=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),s=e.readUInt16LE(56);for(let n=0;n<s;n++){let i=t+n*r;if(e.readUInt32LE(i)===3){let a=e.readUInt32LE(i+8),l=e.readUInt32LE(i+32);return e.subarray(a,a+l).toString().replace(/\0.*$/g,"")}}return null};fs.exports={interpreterPath:Lo}});var Dt=_((Kf,Ns)=>{"use strict";var gs=V("child_process"),{isLinux:nt,getReport:ps}=ls(),{LDD_PATH:It,SELF_PATH:ms,readFile:or,readFileSync:ar}=us(),{interpreterPath:bs}=hs(),$e,ke,Ae,vs="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",Ue="",ys=()=>Ue||new Promise(e=>{gs.exec(vs,(t,r)=>{Ue=t?" ":r,e(Ue)})}),ws=()=>{if(!Ue)try{Ue=gs.execSync(vs,{encoding:"utf8"})}catch{Ue=" "}return Ue},Fe="glibc",Es=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,Ye="musl",Mo=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),xs=()=>{let e=ps();return e.header&&e.header.glibcVersionRuntime?Fe:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(Mo)?Ye:null},Ps=e=>{let[t,r]=e.split(/[\r\n]+/);return t&&t.includes(Fe)?Fe:r&&r.includes(Ye)?Ye:null},Rs=e=>{if(e){if(e.includes("/ld-musl-"))return Ye;if(e.includes("/ld-linux-"))return Fe}return null},Ss=e=>(e=e.toString(),e.includes("musl")?Ye:e.includes("GNU C Library")?Fe:null),zo=async()=>{if(ke!==void 0)return ke;ke=null;try{let e=await or(It);ke=Ss(e)}catch{}return ke},Bo=()=>{if(ke!==void 0)return ke;ke=null;try{let e=ar(It);ke=Ss(e)}catch{}return ke},Uo=async()=>{if($e!==void 0)return $e;$e=null;try{let e=await or(ms),t=bs(e);$e=Rs(t)}catch{}return $e},Go=()=>{if($e!==void 0)return $e;$e=null;try{let e=ar(ms),t=bs(e);$e=Rs(t)}catch{}return $e},$s=async()=>{let e=null;if(nt()&&(e=await Uo(),!e&&(e=await zo(),e||(e=xs()),!e))){let t=await ys();e=Ps(t)}return e},ks=()=>{let e=null;if(nt()&&(e=Go(),!e&&(e=Bo(),e||(e=xs()),!e))){let t=ws();e=Ps(t)}return e},qo=async()=>nt()&&await $s()!==Fe,Wo=()=>nt()&&ks()!==Fe,Ho=async()=>{if(Ae!==void 0)return Ae;Ae=null;try{let t=(await or(It)).match(Es);t&&(Ae=t[1])}catch{}return Ae},Vo=()=>{if(Ae!==void 0)return Ae;Ae=null;try{let t=ar(It).match(Es);t&&(Ae=t[1])}catch{}return Ae},As=()=>{let e=ps();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},ds=e=>e.trim().split(/\s+/)[1],_s=e=>{let[t,r,s]=e.split(/[\r\n]+/);return t&&t.includes(Fe)?ds(t):r&&s&&r.includes(Ye)?ds(s):null},Jo=async()=>{let e=null;if(nt()&&(e=await Ho(),e||(e=As()),!e)){let t=await ys();e=_s(t)}return e},Xo=()=>{let e=null;if(nt()&&(e=Vo(),e||(e=As()),!e)){let t=ws();e=_s(t)}return e};Ns.exports={GLIBC:Fe,MUSL:Ye,family:$s,familySync:ks,isNonGlibcLinux:qo,isNonGlibcLinuxSync:Wo,version:Jo,versionSync:Xo}});var bt=_((Qf,Is)=>{"use strict";var Yo=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>{}:()=>{};Is.exports=Yo});var Tt=_((Zf,Ds)=>{"use strict";var Ko="2.0.0",Qo=Number.MAX_SAFE_INTEGER||9007199254740991,Zo=16,ea=250,ta=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Ds.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Zo,MAX_SAFE_BUILD_LENGTH:ea,MAX_SAFE_INTEGER:Qo,RELEASE_TYPES:ta,SEMVER_SPEC_VERSION:Ko,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var vt=_((_e,Ts)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:lr,MAX_SAFE_BUILD_LENGTH:ra,MAX_LENGTH:sa}=Tt(),na=bt();_e=Ts.exports={};var ia=_e.re=[],oa=_e.safeRe=[],y=_e.src=[],aa=_e.safeSrc=[],w=_e.t={},la=0,cr="[a-zA-Z0-9-]",ca=[["\\s",1],["\\d",sa],[cr,ra]],ua=e=>{for(let[t,r]of ca)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},R=(e,t,r)=>{let s=ua(t),n=la++;na(e,n,t),w[e]=n,y[n]=t,aa[n]=s,ia[n]=new RegExp(t,r?"g":void 0),oa[n]=new RegExp(s,r?"g":void 0)};R("NUMERICIDENTIFIER","0|[1-9]\\d*");R("NUMERICIDENTIFIERLOOSE","\\d+");R("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${cr}*`);R("MAINVERSION",`(${y[w.NUMERICIDENTIFIER]})\\.(${y[w.NUMERICIDENTIFIER]})\\.(${y[w.NUMERICIDENTIFIER]})`);R("MAINVERSIONLOOSE",`(${y[w.NUMERICIDENTIFIERLOOSE]})\\.(${y[w.NUMERICIDENTIFIERLOOSE]})\\.(${y[w.NUMERICIDENTIFIERLOOSE]})`);R("PRERELEASEIDENTIFIER",`(?:${y[w.NONNUMERICIDENTIFIER]}|${y[w.NUMERICIDENTIFIER]})`);R("PRERELEASEIDENTIFIERLOOSE",`(?:${y[w.NONNUMERICIDENTIFIER]}|${y[w.NUMERICIDENTIFIERLOOSE]})`);R("PRERELEASE",`(?:-(${y[w.PRERELEASEIDENTIFIER]}(?:\\.${y[w.PRERELEASEIDENTIFIER]})*))`);R("PRERELEASELOOSE",`(?:-?(${y[w.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${y[w.PRERELEASEIDENTIFIERLOOSE]})*))`);R("BUILDIDENTIFIER",`${cr}+`);R("BUILD",`(?:\\+(${y[w.BUILDIDENTIFIER]}(?:\\.${y[w.BUILDIDENTIFIER]})*))`);R("FULLPLAIN",`v?${y[w.MAINVERSION]}${y[w.PRERELEASE]}?${y[w.BUILD]}?`);R("FULL",`^${y[w.FULLPLAIN]}$`);R("LOOSEPLAIN",`[v=\\s]*${y[w.MAINVERSIONLOOSE]}${y[w.PRERELEASELOOSE]}?${y[w.BUILD]}?`);R("LOOSE",`^${y[w.LOOSEPLAIN]}$`);R("GTLT","((?:<|>)?=?)");R("XRANGEIDENTIFIERLOOSE",`${y[w.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);R("XRANGEIDENTIFIER",`${y[w.NUMERICIDENTIFIER]}|x|X|\\*`);R("XRANGEPLAIN",`[v=\\s]*(${y[w.XRANGEIDENTIFIER]})(?:\\.(${y[w.XRANGEIDENTIFIER]})(?:\\.(${y[w.XRANGEIDENTIFIER]})(?:${y[w.PRERELEASE]})?${y[w.BUILD]}?)?)?`);R("XRANGEPLAINLOOSE",`[v=\\s]*(${y[w.XRANGEIDENTIFIERLOOSE]})(?:\\.(${y[w.XRANGEIDENTIFIERLOOSE]})(?:\\.(${y[w.XRANGEIDENTIFIERLOOSE]})(?:${y[w.PRERELEASELOOSE]})?${y[w.BUILD]}?)?)?`);R("XRANGE",`^${y[w.GTLT]}\\s*${y[w.XRANGEPLAIN]}$`);R("XRANGELOOSE",`^${y[w.GTLT]}\\s*${y[w.XRANGEPLAINLOOSE]}$`);R("COERCEPLAIN",`(^|[^\\d])(\\d{1,${lr}})(?:\\.(\\d{1,${lr}}))?(?:\\.(\\d{1,${lr}}))?`);R("COERCE",`${y[w.COERCEPLAIN]}(?:$|[^\\d])`);R("COERCEFULL",y[w.COERCEPLAIN]+`(?:${y[w.PRERELEASE]})?(?:${y[w.BUILD]})?(?:$|[^\\d])`);R("COERCERTL",y[w.COERCE],!0);R("COERCERTLFULL",y[w.COERCEFULL],!0);R("LONETILDE","(?:~>?)");R("TILDETRIM",`(\\s*)${y[w.LONETILDE]}\\s+`,!0);_e.tildeTrimReplace="$1~";R("TILDE",`^${y[w.LONETILDE]}${y[w.XRANGEPLAIN]}$`);R("TILDELOOSE",`^${y[w.LONETILDE]}${y[w.XRANGEPLAINLOOSE]}$`);R("LONECARET","(?:\\^)");R("CARETTRIM",`(\\s*)${y[w.LONECARET]}\\s+`,!0);_e.caretTrimReplace="$1^";R("CARET",`^${y[w.LONECARET]}${y[w.XRANGEPLAIN]}$`);R("CARETLOOSE",`^${y[w.LONECARET]}${y[w.XRANGEPLAINLOOSE]}$`);R("COMPARATORLOOSE",`^${y[w.GTLT]}\\s*(${y[w.LOOSEPLAIN]})$|^$`);R("COMPARATOR",`^${y[w.GTLT]}\\s*(${y[w.FULLPLAIN]})$|^$`);R("COMPARATORTRIM",`(\\s*)${y[w.GTLT]}\\s*(${y[w.LOOSEPLAIN]}|${y[w.XRANGEPLAIN]})`,!0);_e.comparatorTrimReplace="$1$2$3";R("HYPHENRANGE",`^\\s*(${y[w.XRANGEPLAIN]})\\s+-\\s+(${y[w.XRANGEPLAIN]})\\s*$`);R("HYPHENRANGELOOSE",`^\\s*(${y[w.XRANGEPLAINLOOSE]})\\s+-\\s+(${y[w.XRANGEPLAINLOOSE]})\\s*$`);R("STAR","(<|>)?=?\\s*\\*");R("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");R("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Ct=_((eh,Cs)=>{"use strict";var fa=Object.freeze({loose:!0}),ha=Object.freeze({}),da=e=>e?typeof e!="object"?fa:e:ha;Cs.exports=da});var Ls=_((th,js)=>{"use strict";var Fs=/^[0-9]+$/,Os=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e<t?-1:1;let r=Fs.test(e),s=Fs.test(t);return r&&s&&(e=+e,t=+t),e===t?0:r&&!s?-1:s&&!r?1:e<t?-1:1},ga=(e,t)=>Os(t,e);js.exports={compareIdentifiers:Os,rcompareIdentifiers:ga}});var it=_((rh,zs)=>{"use strict";var Ft=bt(),{MAX_LENGTH:Ms,MAX_SAFE_INTEGER:Ot}=Tt(),{safeRe:jt,t:Lt}=vt(),pa=Ct(),{compareIdentifiers:ur}=Ls(),fr=class e{constructor(t,r){if(r=pa(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Ms)throw new TypeError(`version is longer than ${Ms} characters`);Ft("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let s=t.trim().match(r.loose?jt[Lt.LOOSE]:jt[Lt.FULL]);if(!s)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>Ot||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ot||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ot||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<Ot)return i}return n}):this.prerelease=[],this.build=s[5]?s[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Ft("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let s=this.prerelease[r],n=t.prerelease[r];if(Ft("prerelease compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return ur(s,n)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let s=this.build[r],n=t.build[r];if(Ft("build compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return ur(s,n)}while(++r)}inc(t,r,s){if(t.startsWith("pre")){if(!r&&s===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let n=`-${r}`.match(this.options.loose?jt[Lt.PRERELEASELOOSE]:jt[Lt.PRERELEASE]);if(!n||n[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,s);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,s);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,s),this.inc("pre",r,s);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,s),this.inc("pre",r,s);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let n=Number(s)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&s===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(r){let i=[r,n];s===!1&&(i=[r]),ur(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};zs.exports=fr});var Gs=_((sh,Us)=>{"use strict";var Bs=it(),ma=(e,t,r=!1)=>{if(e instanceof Bs)return e;try{return new Bs(e,t)}catch(s){if(!r)return null;throw s}};Us.exports=ma});var Ws=_((nh,qs)=>{"use strict";var ba=it(),va=Gs(),{safeRe:Mt,t:zt}=vt(),ya=(e,t)=>{if(e instanceof ba)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Mt[zt.COERCEFULL]:Mt[zt.COERCE]);else{let l=t.includePrerelease?Mt[zt.COERCERTLFULL]:Mt[zt.COERCERTL],u;for(;(u=l.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),l.lastIndex=u.index+u[1].length+u[2].length;l.lastIndex=-1}if(r===null)return null;let s=r[2],n=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return va(`${s}.${n}.${i}${o}${a}`,t)};qs.exports=ya});var Ke=_((ih,Vs)=>{"use strict";var Hs=it(),wa=(e,t,r)=>new Hs(e,r).compare(new Hs(t,r));Vs.exports=wa});var hr=_((oh,Js)=>{"use strict";var Ea=Ke(),xa=(e,t,r)=>Ea(e,t,r)>=0;Js.exports=xa});var Ys=_((ah,Xs)=>{"use strict";var dr=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(t,r)}return this}};Xs.exports=dr});var Qs=_((lh,Ks)=>{"use strict";var Pa=Ke(),Ra=(e,t,r)=>Pa(e,t,r)===0;Ks.exports=Ra});var en=_((ch,Zs)=>{"use strict";var Sa=Ke(),$a=(e,t,r)=>Sa(e,t,r)!==0;Zs.exports=$a});var rn=_((uh,tn)=>{"use strict";var ka=Ke(),Aa=(e,t,r)=>ka(e,t,r)>0;tn.exports=Aa});var nn=_((fh,sn)=>{"use strict";var _a=Ke(),Na=(e,t,r)=>_a(e,t,r)<0;sn.exports=Na});var an=_((hh,on)=>{"use strict";var Ia=Ke(),Da=(e,t,r)=>Ia(e,t,r)<=0;on.exports=Da});var cn=_((dh,ln)=>{"use strict";var Ta=Qs(),Ca=en(),Fa=rn(),Oa=hr(),ja=nn(),La=an(),Ma=(e,t,r,s)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Ta(e,r,s);case"!=":return Ca(e,r,s);case">":return Fa(e,r,s);case">=":return Oa(e,r,s);case"<":return ja(e,r,s);case"<=":return La(e,r,s);default:throw new TypeError(`Invalid operator: ${t}`)}};ln.exports=Ma});var mn=_((gh,pn)=>{"use strict";var yt=Symbol("SemVer ANY"),mr=class e{static get ANY(){return yt}constructor(t,r){if(r=un(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),pr("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===yt?this.value="":this.value=this.operator+this.semver.version,pr("comp",this)}parse(t){let r=this.options.loose?fn[hn.COMPARATORLOOSE]:fn[hn.COMPARATOR],s=t.match(r);if(!s)throw new TypeError(`Invalid comparator: ${t}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new dn(s[2],this.options.loose):this.semver=yt}toString(){return this.value}test(t){if(pr("Comparator.test",t,this.options.loose),this.semver===yt||t===yt)return!0;if(typeof t=="string")try{t=new dn(t,this.options)}catch{return!1}return gr(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new gn(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new gn(this.value,r).test(t.semver):(r=un(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||gr(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||gr(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};pn.exports=mr;var un=Ct(),{safeRe:fn,t:hn}=vt(),gr=cn(),pr=bt(),dn=it(),gn=br()});var br=_((ph,wn)=>{"use strict";var za=/\s+/g,vr=class e{constructor(t,r){if(r=Ua(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof yr)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(za," "),this.set=this.raw.split("||").map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(n=>!vn(n[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&Xa(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let s=0;s<r.length;s++)s>0&&(this.formatted+=" "),this.formatted+=r[s].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let s=((this.options.includePrerelease&&Va)|(this.options.loose&&Ja))+":"+t,n=bn.get(s);if(n)return n;let i=this.options.loose,o=i?oe[se.HYPHENRANGELOOSE]:oe[se.HYPHENRANGE];t=t.replace(o,il(this.options.includePrerelease)),G("hyphen replace",t),t=t.replace(oe[se.COMPARATORTRIM],qa),G("comparator trim",t),t=t.replace(oe[se.TILDETRIM],Wa),G("tilde trim",t),t=t.replace(oe[se.CARETTRIM],Ha),G("caret trim",t);let a=t.split(" ").map(g=>Ya(g,this.options)).join(" ").split(/\s+/).map(g=>nl(g,this.options));i&&(a=a.filter(g=>(G("loose invalid filter",g,this.options),!!g.match(oe[se.COMPARATORLOOSE])))),G("range list",a);let l=new Map,u=a.map(g=>new yr(g,this.options));for(let g of u){if(vn(g))return[g];l.set(g.value,g)}l.size>1&&l.has("")&&l.delete("");let f=[...l.values()];return bn.set(s,f),f}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(s=>yn(s,r)&&t.set.some(n=>yn(n,r)&&s.every(i=>n.every(o=>i.intersects(o,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new Ga(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(ol(this.set[r],t,this.options))return!0;return!1}};wn.exports=vr;var Ba=Ys(),bn=new Ba,Ua=Ct(),yr=mn(),G=bt(),Ga=it(),{safeRe:oe,t:se,comparatorTrimReplace:qa,tildeTrimReplace:Wa,caretTrimReplace:Ha}=vt(),{FLAG_INCLUDE_PRERELEASE:Va,FLAG_LOOSE:Ja}=Tt(),vn=e=>e.value==="<0.0.0-0",Xa=e=>e.value==="",yn=(e,t)=>{let r=!0,s=e.slice(),n=s.pop();for(;r&&s.length;)r=s.every(i=>n.intersects(i,t)),n=s.pop();return r},Ya=(e,t)=>(e=e.replace(oe[se.BUILD],""),G("comp",e,t),e=Za(e,t),G("caret",e),e=Ka(e,t),G("tildes",e),e=tl(e,t),G("xrange",e),e=sl(e,t),G("stars",e),e),ae=e=>!e||e.toLowerCase()==="x"||e==="*",Ka=(e,t)=>e.trim().split(/\s+/).map(r=>Qa(r,t)).join(" "),Qa=(e,t)=>{let r=t.loose?oe[se.TILDELOOSE]:oe[se.TILDE];return e.replace(r,(s,n,i,o,a)=>{G("tilde",e,s,n,i,o,a);let l;return ae(n)?l="":ae(i)?l=`>=${n}.0.0 <${+n+1}.0.0-0`:ae(o)?l=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(G("replaceTilde pr",a),l=`>=${n}.${i}.${o}-${a} <${n}.${+i+1}.0-0`):l=`>=${n}.${i}.${o} <${n}.${+i+1}.0-0`,G("tilde return",l),l})},Za=(e,t)=>e.trim().split(/\s+/).map(r=>el(r,t)).join(" "),el=(e,t)=>{G("caret",e,t);let r=t.loose?oe[se.CARETLOOSE]:oe[se.CARET],s=t.includePrerelease?"-0":"";return e.replace(r,(n,i,o,a,l)=>{G("caret",e,n,i,o,a,l);let u;return ae(i)?u="":ae(o)?u=`>=${i}.0.0${s} <${+i+1}.0.0-0`:ae(a)?i==="0"?u=`>=${i}.${o}.0${s} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.0${s} <${+i+1}.0.0-0`:l?(G("replaceCaret pr",l),i==="0"?o==="0"?u=`>=${i}.${o}.${a}-${l} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a}-${l} <${+i+1}.0.0-0`):(G("no pr"),i==="0"?o==="0"?u=`>=${i}.${o}.${a}${s} <${i}.${o}.${+a+1}-0`:u=`>=${i}.${o}.${a}${s} <${i}.${+o+1}.0-0`:u=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),G("caret return",u),u})},tl=(e,t)=>(G("replaceXRanges",e,t),e.split(/\s+/).map(r=>rl(r,t)).join(" ")),rl=(e,t)=>{e=e.trim();let r=t.loose?oe[se.XRANGELOOSE]:oe[se.XRANGE];return e.replace(r,(s,n,i,o,a,l)=>{G("xRange",e,s,n,i,o,a,l);let u=ae(i),f=u||ae(o),g=f||ae(a),p=g;return n==="="&&p&&(n=""),l=t.includePrerelease?"-0":"",u?n===">"||n==="<"?s="<0.0.0-0":s="*":n&&p?(f&&(o=0),a=0,n===">"?(n=">=",f?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",f?i=+i+1:o=+o+1),n==="<"&&(l="-0"),s=`${n+i}.${o}.${a}${l}`):f?s=`>=${i}.0.0${l} <${+i+1}.0.0-0`:g&&(s=`>=${i}.${o}.0${l} <${i}.${+o+1}.0-0`),G("xRange return",s),s})},sl=(e,t)=>(G("replaceStars",e,t),e.trim().replace(oe[se.STAR],"")),nl=(e,t)=>(G("replaceGTE0",e,t),e.trim().replace(oe[t.includePrerelease?se.GTE0PRE:se.GTE0],"")),il=e=>(t,r,s,n,i,o,a,l,u,f,g,p)=>(ae(s)?r="":ae(n)?r=`>=${s}.0.0${e?"-0":""}`:ae(i)?r=`>=${s}.${n}.0${e?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,ae(u)?l="":ae(f)?l=`<${+u+1}.0.0-0`:ae(g)?l=`<${u}.${+f+1}.0-0`:p?l=`<=${u}.${f}.${g}-${p}`:e?l=`<${u}.${f}.${+g+1}-0`:l=`<=${l}`,`${r} ${l}`.trim()),ol=(e,t,r)=>{for(let s=0;s<e.length;s++)if(!e[s].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let s=0;s<e.length;s++)if(G(e[s].semver),e[s].semver!==yr.ANY&&e[s].semver.prerelease.length>0){let n=e[s].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}});var xn=_((mh,En)=>{"use strict";var al=br(),ll=(e,t,r)=>{try{t=new al(t,r)}catch{return!1}return t.test(e)};En.exports=ll});var wr=_((bh,cl)=>{cl.exports={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.34.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:{build:"node install/build.js",install:"node install/check.js || npm run build",clean:"rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",test:"npm run lint && npm run test-unit",lint:"npm run lint-cpp && npm run lint-js && npm run lint-types","lint-cpp":"cpplint --quiet src/*.h src/*.cc","lint-js":"biome lint","lint-types":"tsd --files ./test/types/sharp.test-d.ts","test-leak":"./test/leak/leak.sh","test-unit":"node --experimental-test-coverage test/unit.mjs","package-from-local-build":"node npm/from-local-build.js","package-release-notes":"node npm/release-notes.js","docs-build":"node docs/build.mjs","docs-serve":"cd docs && npm start","docs-publish":"cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",main:"lib/index.js",types:"lib/index.d.ts",files:["install","lib","src/*.{cc,h,gyp}"],repository:{type:"git",url:"git://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{"@img/colour":"^1.0.0","detect-libc":"^2.1.2",semver:"^7.7.3"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.34.5","@img/sharp-darwin-x64":"0.34.5","@img/sharp-libvips-darwin-arm64":"1.2.4","@img/sharp-libvips-darwin-x64":"1.2.4","@img/sharp-libvips-linux-arm":"1.2.4","@img/sharp-libvips-linux-arm64":"1.2.4","@img/sharp-libvips-linux-ppc64":"1.2.4","@img/sharp-libvips-linux-riscv64":"1.2.4","@img/sharp-libvips-linux-s390x":"1.2.4","@img/sharp-libvips-linux-x64":"1.2.4","@img/sharp-libvips-linuxmusl-arm64":"1.2.4","@img/sharp-libvips-linuxmusl-x64":"1.2.4","@img/sharp-linux-arm":"0.34.5","@img/sharp-linux-arm64":"0.34.5","@img/sharp-linux-ppc64":"0.34.5","@img/sharp-linux-riscv64":"0.34.5","@img/sharp-linux-s390x":"0.34.5","@img/sharp-linux-x64":"0.34.5","@img/sharp-linuxmusl-arm64":"0.34.5","@img/sharp-linuxmusl-x64":"0.34.5","@img/sharp-wasm32":"0.34.5","@img/sharp-win32-arm64":"0.34.5","@img/sharp-win32-ia32":"0.34.5","@img/sharp-win32-x64":"0.34.5"},devDependencies:{"@biomejs/biome":"^2.3.4","@cpplint/cli":"^0.1.0","@emnapi/runtime":"^1.7.0","@img/sharp-libvips-dev":"1.2.4","@img/sharp-libvips-dev-wasm32":"1.2.4","@img/sharp-libvips-win32-arm64":"1.2.4","@img/sharp-libvips-win32-ia32":"1.2.4","@img/sharp-libvips-win32-x64":"1.2.4","@types/node":"*",emnapi:"^1.7.0","exif-reader":"^2.0.2","extract-zip":"^2.0.1",icc:"^3.0.0","jsdoc-to-markdown":"^9.1.3","node-addon-api":"^8.5.0","node-gyp":"^11.5.0","tar-fs":"^3.1.1",tsd:"^0.33.0"},license:"Apache-2.0",engines:{node:"^18.17.0 || ^20.3.0 || >=21.0.0"},config:{libvips:">=8.17.3"},funding:{url:"https://opencollective.com/libvips"}}});var xr=_((vh,Dn)=>{var{spawnSync:Bt}=V("node:child_process"),{createHash:ul}=V("node:crypto"),$n=Ws(),fl=hr(),hl=xn(),Pn=Dt(),{config:dl,engines:Rn,optionalDependencies:gl}=wr(),pl=process.env.npm_package_config_libvips||dl.libvips,kn=$n(pl).version,ml=["darwin-arm64","darwin-x64","linux-arm","linux-arm64","linux-ppc64","linux-riscv64","linux-s390x","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-arm64","win32-ia32","win32-x64"],Ut={encoding:"utf8",shell:!0},bl=e=>{e instanceof Error},An=()=>Pn.isNonGlibcLinuxSync()?Pn.familySync():"",vl=()=>`${process.platform}${An()}-${process.arch}`,ot=()=>{if(_n())return"wasm32";let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:r}=process.env,s=typeof r=="string"?r:An();return`${t||process.platform}${s}-${e||process.arch}`},yl=()=>{try{return V(`@img/sharp-libvips-dev-${ot()}/include`)}catch{try{return V("@img/sharp-libvips-dev/include")}catch{}}return""},wl=()=>{try{return V("@img/sharp-libvips-dev/cplusplus")}catch{}return""},El=()=>{try{return V(`@img/sharp-libvips-dev-${ot()}/lib`)}catch{try{return V(`@img/sharp-libvips-${ot()}/lib`)}catch{}}return""},xl=()=>{if(process.release?.name==="node"&&process.versions&&!hl(process.versions.node,Rn.node))return{found:process.versions.node,expected:Rn.node}},_n=()=>{let{CC:e}=process.env;return!!e?.endsWith("/emcc")},Pl=()=>process.platform==="darwin"&&process.arch==="x64"?(Bt("sysctl sysctl.proc_translated",Ut).stdout||"").trim()==="sysctl.proc_translated: 1":!1,Sn=e=>ul("sha512").update(e).digest("hex"),Rl=()=>{try{let e=Sn(`imgsharp-libvips-${ot()}`),t=$n(gl[`@img/sharp-libvips-${ot()}`],{includePrerelease:!0}).version;return Sn(`${e}npm:${t}`).slice(0,10)}catch{}return""},Sl=()=>Bt(`node-gyp rebuild --directory=src ${_n()?"--nodedir=emscripten":""}`,{...Ut,stdio:"inherit"}).status,Nn=()=>process.platform!=="win32"?(Bt("pkg-config --modversion vips-cpp",{...Ut,env:{...process.env,PKG_CONFIG_PATH:In()}}).stdout||"").trim():"",In=()=>process.platform!=="win32"?[(Bt('which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',Ut).stdout||"").trim(),process.env.PKG_CONFIG_PATH,"/usr/local/lib/pkgconfig","/usr/lib/pkgconfig","/usr/local/libdata/pkgconfig","/usr/libdata/pkgconfig"].filter(Boolean).join(":"):"",Er=(e,t,r)=>(r&&r(`Detected ${t}, skipping search for globally-installed libvips`),e),$l=e=>{if(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)return Er(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)return Er(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(Pl())return Er(!1,"Rosetta",e);let t=Nn();return!!t&&fl(t,kn)};Dn.exports={minimumLibvipsVersion:kn,prebuiltPlatforms:ml,buildPlatformArch:ot,buildSharpLibvipsIncludeDir:yl,buildSharpLibvipsCPlusPlusDir:wl,buildSharpLibvipsLibDir:El,isUnsupportedNodeRuntime:xl,runtimePlatformArch:vl,log:bl,yarnLocator:Rl,spawnRebuild:Sl,globalLibvipsVersion:Nn,pkgConfigPath:In,useGlobalLibvips:$l}});var Et=_((wh,Cn)=>{var{familySync:kl,versionSync:Al}=Dt(),{runtimePlatformArch:_l,isUnsupportedNodeRuntime:Tn,prebuiltPlatforms:Nl,minimumLibvipsVersion:Il}=xr(),Qe=_l(),Dl=[`../src/build/Release/sharp-${Qe}.node`,"../src/build/Release/sharp-wasm32.node",`@img/sharp-${Qe}/sharp.node`,"@img/sharp-wasm32/sharp.node"],Pr,at,wt=[];for(Pr of Dl)try{at=V(Pr);break}catch(e){wt.push(e)}if(at&&Pr.startsWith("@img/sharp-linux-x64")&&!at._isUsingX64V2()){let e=new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");e.code="Unsupported CPU",wt.push(e),at=null}if(at)Cn.exports=at;else{let[e,t,r]=["linux","darwin","win32"].map(i=>Qe.startsWith(i)),s=[`Could not load the "sharp" module using the ${Qe} runtime`];wt.forEach(i=>{i.code!=="MODULE_NOT_FOUND"&&s.push(`${i.code}: ${i.message}`)});let n=wt.map(i=>i.message).join(" ");if(s.push("Possible solutions:"),Tn()){let{found:i,expected:o}=Tn();s.push("- Please upgrade Node.js:",` Found ${i}`,` Requires ${o}`)}else if(Nl.includes(Qe)){let[i,o]=Qe.split("-"),a=i.endsWith("musl")?" --libc=musl":"";s.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=${i.replace("musl","")}${a} --cpu=${o} sharp`)}else s.push(`- Manually install libvips >= ${Il}`,"- Add experimental WebAssembly-based dependencies:"," npm install --cpu=wasm32 sharp"," npm install @img/sharp-wasm32");if(e&&/(symbol not found|CXXABI_)/i.test(n))try{let{config:i}=V(`@img/sharp-libvips-${Qe}/package`),o=`${kl()} ${Al()}`,a=`${i.musl?"musl":"glibc"} ${i.musl||i.glibc}`;s.push("- Update your OS:",` Found ${o}`,` Requires ${a}`)}catch{}throw e&&/\/snap\/core[0-9]{2}/.test(n)&&s.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node"),t&&/Incompatible library version/.test(n)&&s.push("- Update Homebrew:"," brew update && brew upgrade vips"),wt.some(i=>i.code==="ERR_DLOPEN_DISABLED")&&s.push("- Run Node.js without using the --no-addons flag"),r&&/The specified procedure could not be found/.test(n)&&s.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"),s.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),new Error(s.join(`
2
- `))}});var On=_((xh,Fn)=>{var Tl=V("node:util"),Rr=V("node:stream"),Cl=Se();Et();var Fl=Tl.debuglog("sharp"),Ol=e=>{Ze.queue.emit("change",e)},Ze=function(e,t){if(arguments.length===1&&!Cl.defined(e))throw new Error("Invalid input");return this instanceof Ze?(Rr.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:"crop",position:0,resizeBackground:[0,0,0,255],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:"background",withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:"lanczos3",fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:"integer",minAmpl:.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,dilateWidth:0,erodeWidth:0,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:"",joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:"srgb",colourspacePipeline:"last",composite:[],fileOut:"",formatOut:"input",streamOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:"",withExif:{},withExifMerge:!0,withXmp:"",resolveWithObject:!1,loop:-1,delay:[],jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:"4:2:0",jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:"4:4:4",webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpSmartDeblock:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:"jpeg",tiffBigtiff:!1,tiffPredictor:"horizontal",tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:8,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:"inch",heifQuality:50,heifLossless:!1,heifCompression:"av1",heifEffort:4,heifChromaSubsampling:"4:4:4",heifBitdepth:8,jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:"uchar",tileSize:256,tileOverlap:0,tileContainer:"fs",tileLayout:"dz",tileFormat:"last",tileDepth:"last",tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:"https://example.com/iiif",tileBasename:"",timeoutSeconds:0,linearA:[],linearB:[],pdfBackground:[255,255,255,255],debuglog:r=>{this.emit("warning",r),Fl(r)},queueListener:Ol},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this):new Ze(e,t)};Object.setPrototypeOf(Ze.prototype,Rr.Duplex.prototype);Object.setPrototypeOf(Ze,Rr.Duplex);function jl(){let e=this.constructor.call(),{debuglog:t,queueListener:r,...s}=this.options;return e.options=structuredClone(s),e.options.debuglog=t,e.options.queueListener=r,this._isStreamInput()&&this.on("finish",()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit("finish")}),e}Object.assign(Ze.prototype,{clone:jl});Fn.exports=Ze});var Mn=_((Ph,Ln)=>{var h=Se(),Ge=Et(),Ll={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},Ml=["failOn","limitInputPixels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","failOnError","openSlideLevel","pdfBackground","tiffSubifd"];function jn(e){let t=Ml.filter(r=>h.defined(e[r])).map(r=>[r,e[r]]);return t.length?Object.fromEntries(t):void 0}function zl(e,t,r){let s={autoOrient:!1,failOn:"warning",limitInputPixels:268402689,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(h.string(e))s.file=e;else if(h.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");s.buffer=e}else if(h.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");s.buffer=Buffer.from(e,0,e.byteLength)}else if(h.typedArray(e)){if(e.length===0)throw Error("Input Bit Array is empty");s.buffer=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(h.plainObject(e)&&!h.defined(t))t=e,jn(t)&&(s.buffer=[]);else if(!h.defined(e)&&!h.defined(t)&&h.object(r)&&r.allowStream)s.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map(n=>this._createInputDescriptor(n));else throw new Error("Recursive join is unsupported");else throw new Error("Expected at least two images to join");else throw new Error(`Unsupported input '${e}' of type ${typeof e}${h.defined(t)?` when also providing options of type ${typeof t}`:""}`);if(h.object(t)){if(h.defined(t.failOnError))if(h.bool(t.failOnError))s.failOn=t.failOnError?"warning":"none";else throw h.invalidParameterError("failOnError","boolean",t.failOnError);if(h.defined(t.failOn))if(h.string(t.failOn)&&h.inArray(t.failOn,["none","truncated","error","warning"]))s.failOn=t.failOn;else throw h.invalidParameterError("failOn","one of: none, truncated, error, warning",t.failOn);if(h.defined(t.autoOrient))if(h.bool(t.autoOrient))s.autoOrient=t.autoOrient;else throw h.invalidParameterError("autoOrient","boolean",t.autoOrient);if(h.defined(t.density))if(h.inRange(t.density,1,1e5))s.density=t.density;else throw h.invalidParameterError("density","number between 1 and 100000",t.density);if(h.defined(t.ignoreIcc))if(h.bool(t.ignoreIcc))s.ignoreIcc=t.ignoreIcc;else throw h.invalidParameterError("ignoreIcc","boolean",t.ignoreIcc);if(h.defined(t.limitInputPixels))if(h.bool(t.limitInputPixels))s.limitInputPixels=t.limitInputPixels?16383**2:0;else if(h.integer(t.limitInputPixels)&&h.inRange(t.limitInputPixels,0,Number.MAX_SAFE_INTEGER))s.limitInputPixels=t.limitInputPixels;else throw h.invalidParameterError("limitInputPixels","positive integer",t.limitInputPixels);if(h.defined(t.unlimited))if(h.bool(t.unlimited))s.unlimited=t.unlimited;else throw h.invalidParameterError("unlimited","boolean",t.unlimited);if(h.defined(t.sequentialRead))if(h.bool(t.sequentialRead))s.sequentialRead=t.sequentialRead;else throw h.invalidParameterError("sequentialRead","boolean",t.sequentialRead);if(h.defined(t.raw)){if(h.object(t.raw)&&h.integer(t.raw.width)&&t.raw.width>0&&h.integer(t.raw.height)&&t.raw.height>0&&h.integer(t.raw.channels)&&h.inRange(t.raw.channels,1,4))switch(s.rawWidth=t.raw.width,s.rawHeight=t.raw.height,s.rawChannels=t.raw.channels,e.constructor){case Uint8Array:case Uint8ClampedArray:s.rawDepth="uchar";break;case Int8Array:s.rawDepth="char";break;case Uint16Array:s.rawDepth="ushort";break;case Int16Array:s.rawDepth="short";break;case Uint32Array:s.rawDepth="uint";break;case Int32Array:s.rawDepth="int";break;case Float32Array:s.rawDepth="float";break;case Float64Array:s.rawDepth="double";break;default:s.rawDepth="uchar";break}else throw new Error("Expected width, height and channels for raw pixel input");if(s.rawPremultiplied=!1,h.defined(t.raw.premultiplied))if(h.bool(t.raw.premultiplied))s.rawPremultiplied=t.raw.premultiplied;else throw h.invalidParameterError("raw.premultiplied","boolean",t.raw.premultiplied);if(s.rawPageHeight=0,h.defined(t.raw.pageHeight))if(h.integer(t.raw.pageHeight)&&t.raw.pageHeight>0&&t.raw.pageHeight<=t.raw.height){if(t.raw.height%t.raw.pageHeight!==0)throw new Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);s.rawPageHeight=t.raw.pageHeight}else throw h.invalidParameterError("raw.pageHeight","positive integer",t.raw.pageHeight)}if(h.defined(t.animated))if(h.bool(t.animated))s.pages=t.animated?-1:1;else throw h.invalidParameterError("animated","boolean",t.animated);if(h.defined(t.pages))if(h.integer(t.pages)&&h.inRange(t.pages,-1,1e5))s.pages=t.pages;else throw h.invalidParameterError("pages","integer between -1 and 100000",t.pages);if(h.defined(t.page))if(h.integer(t.page)&&h.inRange(t.page,0,1e5))s.page=t.page;else throw h.invalidParameterError("page","integer between 0 and 100000",t.page);if(h.object(t.openSlide)&&h.defined(t.openSlide.level))if(h.integer(t.openSlide.level)&&h.inRange(t.openSlide.level,0,256))s.openSlideLevel=t.openSlide.level;else throw h.invalidParameterError("openSlide.level","integer between 0 and 256",t.openSlide.level);else if(h.defined(t.level))if(h.integer(t.level)&&h.inRange(t.level,0,256))s.openSlideLevel=t.level;else throw h.invalidParameterError("level","integer between 0 and 256",t.level);if(h.object(t.tiff)&&h.defined(t.tiff.subifd))if(h.integer(t.tiff.subifd)&&h.inRange(t.tiff.subifd,-1,1e5))s.tiffSubifd=t.tiff.subifd;else throw h.invalidParameterError("tiff.subifd","integer between -1 and 100000",t.tiff.subifd);else if(h.defined(t.subifd))if(h.integer(t.subifd)&&h.inRange(t.subifd,-1,1e5))s.tiffSubifd=t.subifd;else throw h.invalidParameterError("subifd","integer between -1 and 100000",t.subifd);if(h.object(t.svg)){if(h.defined(t.svg.stylesheet))if(h.string(t.svg.stylesheet))s.svgStylesheet=t.svg.stylesheet;else throw h.invalidParameterError("svg.stylesheet","string",t.svg.stylesheet);if(h.defined(t.svg.highBitdepth))if(h.bool(t.svg.highBitdepth))s.svgHighBitdepth=t.svg.highBitdepth;else throw h.invalidParameterError("svg.highBitdepth","boolean",t.svg.highBitdepth)}if(h.object(t.pdf)&&h.defined(t.pdf.background)?s.pdfBackground=this._getBackgroundColourOption(t.pdf.background):h.defined(t.pdfBackground)&&(s.pdfBackground=this._getBackgroundColourOption(t.pdfBackground)),h.object(t.jp2)&&h.defined(t.jp2.oneshot))if(h.bool(t.jp2.oneshot))s.jp2Oneshot=t.jp2.oneshot;else throw h.invalidParameterError("jp2.oneshot","boolean",t.jp2.oneshot);if(h.defined(t.create))if(h.object(t.create)&&h.integer(t.create.width)&&t.create.width>0&&h.integer(t.create.height)&&t.create.height>0&&h.integer(t.create.channels)){if(s.createWidth=t.create.width,s.createHeight=t.create.height,s.createChannels=t.create.channels,s.createPageHeight=0,h.defined(t.create.pageHeight))if(h.integer(t.create.pageHeight)&&t.create.pageHeight>0&&t.create.pageHeight<=t.create.height){if(t.create.height%t.create.pageHeight!==0)throw new Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);s.createPageHeight=t.create.pageHeight}else throw h.invalidParameterError("create.pageHeight","positive integer",t.create.pageHeight);if(h.defined(t.create.noise)){if(!h.object(t.create.noise))throw new Error("Expected noise to be an object");if(t.create.noise.type!=="gaussian")throw new Error("Only gaussian noise is supported at the moment");if(s.createNoiseType=t.create.noise.type,!h.inRange(t.create.channels,1,4))throw h.invalidParameterError("create.channels","number between 1 and 4",t.create.channels);if(s.createNoiseMean=128,h.defined(t.create.noise.mean))if(h.number(t.create.noise.mean)&&h.inRange(t.create.noise.mean,0,1e4))s.createNoiseMean=t.create.noise.mean;else throw h.invalidParameterError("create.noise.mean","number between 0 and 10000",t.create.noise.mean);if(s.createNoiseSigma=30,h.defined(t.create.noise.sigma))if(h.number(t.create.noise.sigma)&&h.inRange(t.create.noise.sigma,0,1e4))s.createNoiseSigma=t.create.noise.sigma;else throw h.invalidParameterError("create.noise.sigma","number between 0 and 10000",t.create.noise.sigma)}else if(h.defined(t.create.background)){if(!h.inRange(t.create.channels,3,4))throw h.invalidParameterError("create.channels","number between 3 and 4",t.create.channels);s.createBackground=this._getBackgroundColourOption(t.create.background)}else throw new Error("Expected valid noise or background to create a new input image");delete s.buffer}else throw new Error("Expected valid width, height and channels to create a new input image");if(h.defined(t.text))if(h.object(t.text)&&h.string(t.text.text)){if(s.textValue=t.text.text,h.defined(t.text.height)&&h.defined(t.text.dpi))throw new Error("Expected only one of dpi or height");if(h.defined(t.text.font))if(h.string(t.text.font))s.textFont=t.text.font;else throw h.invalidParameterError("text.font","string",t.text.font);if(h.defined(t.text.fontfile))if(h.string(t.text.fontfile))s.textFontfile=t.text.fontfile;else throw h.invalidParameterError("text.fontfile","string",t.text.fontfile);if(h.defined(t.text.width))if(h.integer(t.text.width)&&t.text.width>0)s.textWidth=t.text.width;else throw h.invalidParameterError("text.width","positive integer",t.text.width);if(h.defined(t.text.height))if(h.integer(t.text.height)&&t.text.height>0)s.textHeight=t.text.height;else throw h.invalidParameterError("text.height","positive integer",t.text.height);if(h.defined(t.text.align))if(h.string(t.text.align)&&h.string(this.constructor.align[t.text.align]))s.textAlign=this.constructor.align[t.text.align];else throw h.invalidParameterError("text.align","valid alignment",t.text.align);if(h.defined(t.text.justify))if(h.bool(t.text.justify))s.textJustify=t.text.justify;else throw h.invalidParameterError("text.justify","boolean",t.text.justify);if(h.defined(t.text.dpi))if(h.integer(t.text.dpi)&&h.inRange(t.text.dpi,1,1e6))s.textDpi=t.text.dpi;else throw h.invalidParameterError("text.dpi","integer between 1 and 1000000",t.text.dpi);if(h.defined(t.text.rgba))if(h.bool(t.text.rgba))s.textRgba=t.text.rgba;else throw h.invalidParameterError("text.rgba","bool",t.text.rgba);if(h.defined(t.text.spacing))if(h.integer(t.text.spacing)&&h.inRange(t.text.spacing,-1e6,1e6))s.textSpacing=t.text.spacing;else throw h.invalidParameterError("text.spacing","integer between -1000000 and 1000000",t.text.spacing);if(h.defined(t.text.wrap))if(h.string(t.text.wrap)&&h.inArray(t.text.wrap,["word","char","word-char","none"]))s.textWrap=t.text.wrap;else throw h.invalidParameterError("text.wrap","one of: word, char, word-char, none",t.text.wrap);delete s.buffer}else throw new Error("Expected a valid string to create an image with text.");if(h.defined(t.join))if(h.defined(this.options.join)){if(h.defined(t.join.animated))if(h.bool(t.join.animated))s.joinAnimated=t.join.animated;else throw h.invalidParameterError("join.animated","boolean",t.join.animated);if(h.defined(t.join.across))if(h.integer(t.join.across)&&h.inRange(t.join.across,1,1e6))s.joinAcross=t.join.across;else throw h.invalidParameterError("join.across","integer between 1 and 100000",t.join.across);if(h.defined(t.join.shim))if(h.integer(t.join.shim)&&h.inRange(t.join.shim,0,1e6))s.joinShim=t.join.shim;else throw h.invalidParameterError("join.shim","integer between 0 and 100000",t.join.shim);if(h.defined(t.join.background)&&(s.joinBackground=this._getBackgroundColourOption(t.join.background)),h.defined(t.join.halign))if(h.string(t.join.halign)&&h.string(this.constructor.align[t.join.halign]))s.joinHalign=this.constructor.align[t.join.halign];else throw h.invalidParameterError("join.halign","valid alignment",t.join.halign);if(h.defined(t.join.valign))if(h.string(t.join.valign)&&h.string(this.constructor.align[t.join.valign]))s.joinValign=this.constructor.align[t.join.valign];else throw h.invalidParameterError("join.valign","valid alignment",t.join.valign)}else throw new Error("Expected input to be an array of images to join")}else if(h.defined(t))throw new Error(`Invalid input options ${t}`);return s}function Bl(e,t,r){Array.isArray(this.options.input.buffer)?h.buffer(e)?(this.options.input.buffer.length===0&&this.on("finish",()=>{this.streamInFinished=!0}),this.options.input.buffer.push(e),r()):r(new Error("Non-Buffer data on Writable Stream")):r(new Error("Unexpected data on Writable Stream"))}function Ul(){this._isStreamInput()&&(this.options.input.buffer=Buffer.concat(this.options.input.buffer))}function Gl(){return Array.isArray(this.options.input.buffer)}function ql(e){let t=Error();return h.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),Ge.metadata(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)})}):Ge.metadata(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)}),this):this._isStreamInput()?new Promise((r,s)=>{let n=()=>{this._flattenBufferIn(),Ge.metadata(this.options,(i,o)=>{i?s(h.nativeError(i,t)):r(o)})};this.writableFinished?n():this.once("finish",n)}):new Promise((r,s)=>{Ge.metadata(this.options,(n,i)=>{n?s(h.nativeError(n,t)):r(i)})})}function Wl(e){let t=Error();return h.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),Ge.stats(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)})}):Ge.stats(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)}),this):this._isStreamInput()?new Promise((r,s)=>{this.on("finish",function(){this._flattenBufferIn(),Ge.stats(this.options,(n,i)=>{n?s(h.nativeError(n,t)):r(i)})})}):new Promise((r,s)=>{Ge.stats(this.options,(n,i)=>{n?s(h.nativeError(n,t)):r(i)})})}Ln.exports=e=>{Object.assign(e.prototype,{_inputOptionsFromObject:jn,_createInputDescriptor:zl,_write:Bl,_flattenBufferIn:Ul,_isStreamInput:Gl,metadata:ql,stats:Wl}),e.align=Ll}});var Wn=_((Rh,qn)=>{var x=Se(),Bn={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},Un={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},zn={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},Gn={entropy:16,attention:17},Sr={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},Hl={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},Vl={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"};function $r(e){return e.angle%360!==0||e.rotationAngle!==0}function Gt(e){return e.width!==-1||e.height!==-1}function Jl(e,t,r){if(Gt(this.options)&&this.options.debuglog("ignoring previous resize options"),this.options.widthPost!==-1&&this.options.debuglog("operation order will be: extract, resize, extract"),x.defined(e))if(x.object(e)&&!x.defined(r))r=e;else if(x.integer(e)&&e>0)this.options.width=e;else throw x.invalidParameterError("width","positive integer",e);else this.options.width=-1;if(x.defined(t))if(x.integer(t)&&t>0)this.options.height=t;else throw x.invalidParameterError("height","positive integer",t);else this.options.height=-1;if(x.object(r)){if(x.defined(r.width))if(x.integer(r.width)&&r.width>0)this.options.width=r.width;else throw x.invalidParameterError("width","positive integer",r.width);if(x.defined(r.height))if(x.integer(r.height)&&r.height>0)this.options.height=r.height;else throw x.invalidParameterError("height","positive integer",r.height);if(x.defined(r.fit)){let s=Vl[r.fit];if(x.string(s))this.options.canvas=s;else throw x.invalidParameterError("fit","valid fit",r.fit)}if(x.defined(r.position)){let s=x.integer(r.position)?r.position:Gn[r.position]||Un[r.position]||Bn[r.position];if(x.integer(s)&&(x.inRange(s,0,8)||x.inRange(s,16,17)))this.options.position=s;else throw x.invalidParameterError("position","valid position/gravity/strategy",r.position)}if(this._setBackgroundColourOption("resizeBackground",r.background),x.defined(r.kernel))if(x.string(Sr[r.kernel]))this.options.kernel=Sr[r.kernel];else throw x.invalidParameterError("kernel","valid kernel name",r.kernel);x.defined(r.withoutEnlargement)&&this._setBooleanOption("withoutEnlargement",r.withoutEnlargement),x.defined(r.withoutReduction)&&this._setBooleanOption("withoutReduction",r.withoutReduction),x.defined(r.fastShrinkOnLoad)&&this._setBooleanOption("fastShrinkOnLoad",r.fastShrinkOnLoad)}return $r(this.options)&&Gt(this.options)&&(this.options.rotateBefore=!0),this}function Xl(e){if(x.integer(e)&&e>0)this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else if(x.object(e)){if(x.defined(e.top))if(x.integer(e.top)&&e.top>=0)this.options.extendTop=e.top;else throw x.invalidParameterError("top","positive integer",e.top);if(x.defined(e.bottom))if(x.integer(e.bottom)&&e.bottom>=0)this.options.extendBottom=e.bottom;else throw x.invalidParameterError("bottom","positive integer",e.bottom);if(x.defined(e.left))if(x.integer(e.left)&&e.left>=0)this.options.extendLeft=e.left;else throw x.invalidParameterError("left","positive integer",e.left);if(x.defined(e.right))if(x.integer(e.right)&&e.right>=0)this.options.extendRight=e.right;else throw x.invalidParameterError("right","positive integer",e.right);if(this._setBackgroundColourOption("extendBackground",e.background),x.defined(e.extendWith))if(x.string(zn[e.extendWith]))this.options.extendWith=zn[e.extendWith];else throw x.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",e.extendWith)}else throw x.invalidParameterError("extend","integer or object",e);return this}function Yl(e){let t=Gt(this.options)||this.options.widthPre!==-1?"Post":"Pre";return this.options[`width${t}`]!==-1&&this.options.debuglog("ignoring previous extract options"),["left","top","width","height"].forEach(function(r){let s=e[r];if(x.integer(s)&&s>=0)this.options[r+(r==="left"||r==="top"?"Offset":"")+t]=s;else throw x.invalidParameterError(r,"integer",s)},this),$r(this.options)&&!Gt(this.options)&&(this.options.widthPre===-1||this.options.widthPost===-1)&&(this.options.rotateBefore=!0),this.options.input.autoOrient&&(this.options.orientBefore=!0),this}function Kl(e){if(this.options.trimThreshold=10,x.defined(e))if(x.object(e)){if(x.defined(e.background)&&this._setBackgroundColourOption("trimBackground",e.background),x.defined(e.threshold))if(x.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw x.invalidParameterError("threshold","positive number",e.threshold);x.defined(e.lineArt)&&this._setBooleanOption("trimLineArt",e.lineArt)}else throw x.invalidParameterError("trim","object",e);return $r(this.options)&&(this.options.rotateBefore=!0),this}qn.exports=e=>{Object.assign(e.prototype,{resize:Jl,extend:Xl,extract:Yl,trim:Kl}),e.gravity=Bn,e.strategy=Gn,e.kernel=Sr,e.fit=Hl,e.position=Un}});var Vn=_((Sh,Hn)=>{var B=Se(),kr={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 Ql(e){if(!Array.isArray(e))throw B.invalidParameterError("images to composite","array",e);return this.options.composite=e.map(t=>{if(!B.object(t))throw B.invalidParameterError("image to composite","object",t);let r=this._inputOptionsFromObject(t),s={input:this._createInputDescriptor(t.input,r,{allowStream:!1}),blend:"over",tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(B.defined(t.blend))if(B.string(kr[t.blend]))s.blend=kr[t.blend];else throw B.invalidParameterError("blend","valid blend name",t.blend);if(B.defined(t.tile))if(B.bool(t.tile))s.tile=t.tile;else throw B.invalidParameterError("tile","boolean",t.tile);if(B.defined(t.left))if(B.integer(t.left))s.left=t.left;else throw B.invalidParameterError("left","integer",t.left);if(B.defined(t.top))if(B.integer(t.top))s.top=t.top;else throw B.invalidParameterError("top","integer",t.top);if(B.defined(t.top)!==B.defined(t.left))throw new Error("Expected both left and top to be set");if(s.hasOffset=B.integer(t.top)&&B.integer(t.left),B.defined(t.gravity))if(B.integer(t.gravity)&&B.inRange(t.gravity,0,8))s.gravity=t.gravity;else if(B.string(t.gravity)&&B.integer(this.constructor.gravity[t.gravity]))s.gravity=this.constructor.gravity[t.gravity];else throw B.invalidParameterError("gravity","valid gravity",t.gravity);if(B.defined(t.premultiplied))if(B.bool(t.premultiplied))s.premultiplied=t.premultiplied;else throw B.invalidParameterError("premultiplied","boolean",t.premultiplied);return s}),this}Hn.exports=e=>{e.prototype.composite=Ql,e.blend=kr}});var Qn=_(($h,Kn)=>{var d=Se(),Jn={integer:"integer",float:"float",approximate:"approximate"};function Zl(e,t){if(!d.defined(e))return this.autoOrient();if((this.options.angle||this.options.rotationAngle)&&(this.options.debuglog("ignoring previous rotate options"),this.options.angle=0,this.options.rotationAngle=0),d.integer(e)&&!(e%90))this.options.angle=e;else if(d.number(e))this.options.rotationAngle=e,d.object(t)&&t.background&&this._setBackgroundColourOption("rotationBackground",t.background);else throw d.invalidParameterError("angle","numeric",e);return this}function ec(){return this.options.input.autoOrient=!0,this}function tc(e){return this.options.flip=d.bool(e)?e:!0,this}function rc(e){return this.options.flop=d.bool(e)?e:!0,this}function sc(e,t){let r=[].concat(...e);if(r.length===4&&r.every(d.number))this.options.affineMatrix=r;else throw d.invalidParameterError("matrix","1x4 or 2x2 array",e);if(d.defined(t))if(d.object(t)){if(this._setBackgroundColourOption("affineBackground",t.background),d.defined(t.idx))if(d.number(t.idx))this.options.affineIdx=t.idx;else throw d.invalidParameterError("options.idx","number",t.idx);if(d.defined(t.idy))if(d.number(t.idy))this.options.affineIdy=t.idy;else throw d.invalidParameterError("options.idy","number",t.idy);if(d.defined(t.odx))if(d.number(t.odx))this.options.affineOdx=t.odx;else throw d.invalidParameterError("options.odx","number",t.odx);if(d.defined(t.ody))if(d.number(t.ody))this.options.affineOdy=t.ody;else throw d.invalidParameterError("options.ody","number",t.ody);if(d.defined(t.interpolator))if(d.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw d.invalidParameterError("options.interpolator","valid interpolator name",t.interpolator)}else throw d.invalidParameterError("options","object",t);return this}function nc(e,t,r){if(!d.defined(e))this.options.sharpenSigma=-1;else if(d.bool(e))this.options.sharpenSigma=e?-1:0;else if(d.number(e)&&d.inRange(e,.01,1e4)){if(this.options.sharpenSigma=e,d.defined(t))if(d.number(t)&&d.inRange(t,0,1e4))this.options.sharpenM1=t;else throw d.invalidParameterError("flat","number between 0 and 10000",t);if(d.defined(r))if(d.number(r)&&d.inRange(r,0,1e4))this.options.sharpenM2=r;else throw d.invalidParameterError("jagged","number between 0 and 10000",r)}else if(d.plainObject(e)){if(d.number(e.sigma)&&d.inRange(e.sigma,1e-6,10))this.options.sharpenSigma=e.sigma;else throw d.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(d.defined(e.m1))if(d.number(e.m1)&&d.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw d.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(d.defined(e.m2))if(d.number(e.m2)&&d.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw d.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(d.defined(e.x1))if(d.number(e.x1)&&d.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw d.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(d.defined(e.y2))if(d.number(e.y2)&&d.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw d.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(d.defined(e.y3))if(d.number(e.y3)&&d.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw d.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else throw d.invalidParameterError("sigma","number between 0.01 and 10000",e);return this}function ic(e){if(!d.defined(e))this.options.medianSize=3;else if(d.integer(e)&&d.inRange(e,1,1e3))this.options.medianSize=e;else throw d.invalidParameterError("size","integer between 1 and 1000",e);return this}function oc(e){let t;if(d.number(e))t=e;else if(d.plainObject(e)){if(!d.number(e.sigma))throw d.invalidParameterError("options.sigma","number between 0.3 and 1000",t);if(t=e.sigma,"precision"in e)if(d.string(Jn[e.precision]))this.options.precision=Jn[e.precision];else throw d.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(d.number(e.minAmplitude)&&d.inRange(e.minAmplitude,.001,1))this.options.minAmpl=e.minAmplitude;else throw d.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!d.defined(e))this.options.blurSigma=-1;else if(d.bool(e))this.options.blurSigma=e?-1:0;else if(d.number(t)&&d.inRange(t,.3,1e3))this.options.blurSigma=t;else throw d.invalidParameterError("sigma","number between 0.3 and 1000",t);return this}function Xn(e){if(!d.defined(e))this.options.dilateWidth=1;else if(d.integer(e)&&e>0)this.options.dilateWidth=e;else throw d.invalidParameterError("dilate","positive integer",Xn);return this}function Yn(e){if(!d.defined(e))this.options.erodeWidth=1;else if(d.integer(e)&&e>0)this.options.erodeWidth=e;else throw d.invalidParameterError("erode","positive integer",Yn);return this}function ac(e){return this.options.flatten=d.bool(e)?e:!0,d.object(e)&&this._setBackgroundColourOption("flattenBackground",e.background),this}function lc(){return this.options.unflatten=!0,this}function cc(e,t){if(!d.defined(e))this.options.gamma=2.2;else if(d.number(e)&&d.inRange(e,1,3))this.options.gamma=e;else throw d.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!d.defined(t))this.options.gammaOut=this.options.gamma;else if(d.number(t)&&d.inRange(t,1,3))this.options.gammaOut=t;else throw d.invalidParameterError("gammaOut","number between 1.0 and 3.0",t);return this}function uc(e){if(this.options.negate=d.bool(e)?e:!0,d.plainObject(e)&&"alpha"in e)if(d.bool(e.alpha))this.options.negateAlpha=e.alpha;else throw d.invalidParameterError("alpha","should be boolean value",e.alpha);return this}function fc(e){if(d.plainObject(e)){if(d.defined(e.lower))if(d.number(e.lower)&&d.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw d.invalidParameterError("lower","number between 0 and 99",e.lower);if(d.defined(e.upper))if(d.number(e.upper)&&d.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw d.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw d.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function hc(e){return this.normalise(e)}function dc(e){if(d.plainObject(e)){if(d.integer(e.width)&&e.width>0)this.options.claheWidth=e.width;else throw d.invalidParameterError("width","integer greater than zero",e.width);if(d.integer(e.height)&&e.height>0)this.options.claheHeight=e.height;else throw d.invalidParameterError("height","integer greater than zero",e.height);if(d.defined(e.maxSlope))if(d.integer(e.maxSlope)&&d.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw d.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw d.invalidParameterError("options","plain object",e);return this}function gc(e){if(!d.object(e)||!Array.isArray(e.kernel)||!d.integer(e.width)||!d.integer(e.height)||!d.inRange(e.width,3,1001)||!d.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length)throw new Error("Invalid convolution kernel");return d.integer(e.scale)||(e.scale=e.kernel.reduce((t,r)=>t+r,0)),e.scale<1&&(e.scale=1),d.integer(e.offset)||(e.offset=0),this.options.convKernel=e,this}function pc(e,t){if(!d.defined(e))this.options.threshold=128;else if(d.bool(e))this.options.threshold=e?128:0;else if(d.integer(e)&&d.inRange(e,0,255))this.options.threshold=e;else throw d.invalidParameterError("threshold","integer between 0 and 255",e);return!d.object(t)||t.greyscale===!0||t.grayscale===!0?this.options.thresholdGrayscale=!0:this.options.thresholdGrayscale=!1,this}function mc(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),d.string(t)&&d.inArray(t,["and","or","eor"]))this.options.booleanOp=t;else throw d.invalidParameterError("operator","one of: and, or, eor",t);return this}function bc(e,t){if(!d.defined(e)&&d.number(t)?e=1:d.number(e)&&!d.defined(t)&&(t=0),!d.defined(e))this.options.linearA=[];else if(d.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&e.length&&e.every(d.number))this.options.linearA=e;else throw d.invalidParameterError("a","number or array of numbers",e);if(!d.defined(t))this.options.linearB=[];else if(d.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&t.length&&t.every(d.number))this.options.linearB=t;else throw d.invalidParameterError("b","number or array of numbers",t);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 vc(e){if(!Array.isArray(e))throw d.invalidParameterError("inputMatrix","array",e);if(e.length!==3&&e.length!==4)throw d.invalidParameterError("inputMatrix","3x3 or 4x4 array",e.length);let t=e.flat().map(Number);if(t.length!==9&&t.length!==16)throw d.invalidParameterError("inputMatrix","cardinality of 9 or 16",t.length);return this.options.recombMatrix=t,this}function yc(e){if(!d.plainObject(e))throw d.invalidParameterError("options","plain object",e);if("brightness"in e)if(d.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw d.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(d.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw d.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(d.integer(e.hue))this.options.hue=e.hue%360;else throw d.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(d.number(e.lightness))this.options.lightness=e.lightness;else throw d.invalidParameterError("lightness","number",e.lightness);return this}Kn.exports=e=>{Object.assign(e.prototype,{autoOrient:ec,rotate:Zl,flip:tc,flop:rc,affine:sc,sharpen:nc,erode:Yn,dilate:Xn,median:ic,blur:oc,flatten:ac,unflatten:lc,gamma:cc,negate:uc,normalise:fc,normalize:hc,clahe:dc,convolve:gc,threshold:pc,boolean:mc,linear:bc,recomb:vc,modulate:yc})}});var ni=_((kh,si)=>{var Ir=Object.defineProperty,wc=Object.getOwnPropertyDescriptor,Ec=Object.getOwnPropertyNames,xc=Object.prototype.hasOwnProperty,Pc=(e,t)=>{for(var r in t)Ir(e,r,{get:t[r],enumerable:!0})},Rc=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ec(t))!xc.call(e,n)&&n!==r&&Ir(e,n,{get:()=>t[n],enumerable:!(s=wc(t,n))||s.enumerable});return e},Sc=e=>Rc(Ir({},"__esModule",{value:!0}),e),Zn={};Pc(Zn,{default:()=>Mc});si.exports=Sc(Zn);var Ne={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]},ei=Object.create(null);for(let e in Ne)Object.hasOwn(Ne,e)&&(ei[Ne[e]]=e);var ce={to:{},get:{}};ce.get=function(e){let t=e.slice(0,3).toLowerCase(),r,s;switch(t){case"hsl":{r=ce.get.hsl(e),s="hsl";break}case"hwb":{r=ce.get.hwb(e),s="hwb";break}default:{r=ce.get.rgb(e),s="rgb";break}}return r?{model:s,value:r}:null};ce.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,r=/^#([a-f\d]{6})([a-f\d]{2})?$/i,s=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,n=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,i=/^(\w+)$/,o=[0,0,0,1],a,l,u;if(a=e.match(r)){for(u=a[2],a=a[1],l=0;l<3;l++){let f=l*2;o[l]=Number.parseInt(a.slice(f,f+2),16)}u&&(o[3]=Number.parseInt(u,16)/255)}else if(a=e.match(t)){for(a=a[1],u=a[3],l=0;l<3;l++)o[l]=Number.parseInt(a[l]+a[l],16);u&&(o[3]=Number.parseInt(u+u,16)/255)}else if(a=e.match(s)){for(l=0;l<3;l++)o[l]=Number.parseInt(a[l+1],10);a[4]&&(o[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else if(a=e.match(n)){for(l=0;l<3;l++)o[l]=Math.round(Number.parseFloat(a[l+1])*2.55);a[4]&&(o[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else return(a=e.match(i))?a[1]==="transparent"?[0,0,0,0]:Object.hasOwn(Ne,a[1])?(o=Ne[a[1]],o[3]=1,o):null:null;for(l=0;l<3;l++)o[l]=qe(o[l],0,255);return o[3]=qe(o[3],0,1),o};ce.get.hsl=function(e){if(!e)return null;let t=/^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*)?\)$/,r=e.match(t);if(r){let s=Number.parseFloat(r[4]),n=(Number.parseFloat(r[1])%360+360)%360,i=qe(Number.parseFloat(r[2]),0,100),o=qe(Number.parseFloat(r[3]),0,100),a=qe(Number.isNaN(s)?1:s,0,1);return[n,i,o,a]}return null};ce.get.hwb=function(e){if(!e)return null;let t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=e.match(t);if(r){let s=Number.parseFloat(r[4]),n=(Number.parseFloat(r[1])%360+360)%360,i=qe(Number.parseFloat(r[2]),0,100),o=qe(Number.parseFloat(r[3]),0,100),a=qe(Number.isNaN(s)?1:s,0,1);return[n,i,o,a]}return null};ce.to.hex=function(...e){return"#"+qt(e[0])+qt(e[1])+qt(e[2])+(e[3]<1?qt(Math.round(e[3]*255)):"")};ce.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};ce.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),s=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+r+"%, "+s+"%)":"rgba("+t+"%, "+r+"%, "+s+"%, "+e[3]+")"};ce.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};ce.to.hwb=function(...e){let t="";return e.length>=4&&e[3]!==1&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};ce.to.keyword=function(...e){return ei[e.slice(0,3)]};function qe(e,t,r){return Math.min(Math.max(t,e),r)}function qt(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var lt=ce,ti={};for(let e of Object.keys(Ne))ti[Ne[e]]=e;var v={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},et=v,Oe=(6/29)**3;function ut(e){let t=e>.0031308?1.055*e**.4166666666666667-.055:e*12.92;return Math.min(Math.max(0,t),1)}function ft(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(v)){if(!("channels"in v[e]))throw new Error("missing channels property: "+e);if(!("labels"in v[e]))throw new Error("missing channel labels property: "+e);if(v[e].labels.length!==v[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=v[e];delete v[e].channels,delete v[e].labels,Object.defineProperty(v[e],"channels",{value:t}),Object.defineProperty(v[e],"labels",{value:r})}v.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,s=e[2]/255,n=Math.min(t,r,s),i=Math.max(t,r,s),o=i-n,a,l;switch(i){case n:{a=0;break}case t:{a=(r-s)/o;break}case r:{a=2+(s-t)/o;break}case s:{a=4+(t-r)/o;break}}a=Math.min(a*60,360),a<0&&(a+=360);let u=(n+i)/2;return i===n?l=0:u<=.5?l=o/(i+n):l=o/(2-i-n),[a,l*100,u*100]};v.rgb.hsv=function(e){let t,r,s,n,i,o=e[0]/255,a=e[1]/255,l=e[2]/255,u=Math.max(o,a,l),f=u-Math.min(o,a,l),g=function(p){return(u-p)/6/f+1/2};if(f===0)n=0,i=0;else{switch(i=f/u,t=g(o),r=g(a),s=g(l),u){case o:{n=s-r;break}case a:{n=1/3+t-s;break}case l:{n=2/3+r-t;break}}n<0?n+=1:n>1&&(n-=1)}return[n*360,i*100,u*100]};v.rgb.hwb=function(e){let t=e[0],r=e[1],s=e[2],n=v.rgb.hsl(e)[0],i=1/255*Math.min(t,Math.min(r,s));return s=1-1/255*Math.max(t,Math.max(r,s)),[n,i*100,s*100]};v.rgb.oklab=function(e){let t=ft(e[0]/255),r=ft(e[1]/255),s=ft(e[2]/255),n=Math.cbrt(.4122214708*t+.5363325363*r+.0514459929*s),i=Math.cbrt(.2119034982*t+.6806995451*r+.1073969566*s),o=Math.cbrt(.0883024619*t+.2817188376*r+.6299787005*s),a=.2104542553*n+.793617785*i-.0040720468*o,l=1.9779984951*n-2.428592205*i+.4505937099*o,u=.0259040371*n+.7827717662*i-.808675766*o;return[a*100,l*100,u*100]};v.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,s=e[2]/255,n=Math.min(1-t,1-r,1-s),i=(1-t-n)/(1-n)||0,o=(1-r-n)/(1-n)||0,a=(1-s-n)/(1-n)||0;return[i*100,o*100,a*100,n*100]};function $c(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}v.rgb.keyword=function(e){let t=ti[e];if(t)return t;let r=Number.POSITIVE_INFINITY,s;for(let n of Object.keys(Ne)){let i=Ne[n],o=$c(e,i);o<r&&(r=o,s=n)}return s};v.keyword.rgb=function(e){return Ne[e]};v.rgb.xyz=function(e){let t=ft(e[0]/255),r=ft(e[1]/255),s=ft(e[2]/255),n=t*.4124564+r*.3575761+s*.1804375,i=t*.2126729+r*.7151522+s*.072175,o=t*.0193339+r*.119192+s*.9503041;return[n*100,i*100,o*100]};v.rgb.lab=function(e){let t=v.rgb.xyz(e),r=t[0],s=t[1],n=t[2];r/=95.047,s/=100,n/=108.883,r=r>Oe?r**(1/3):7.787*r+16/116,s=s>Oe?s**(1/3):7.787*s+16/116,n=n>Oe?n**(1/3):7.787*n+16/116;let i=116*s-16,o=500*(r-s),a=200*(s-n);return[i,o,a]};v.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,s=e[2]/100,n,i;if(r===0)return i=s*255,[i,i,i];let o=s<.5?s*(1+r):s+r-s*r,a=2*s-o,l=[0,0,0];for(let u=0;u<3;u++)n=t+1/3*-(u-1),n<0&&n++,n>1&&n--,6*n<1?i=a+(o-a)*6*n:2*n<1?i=o:3*n<2?i=a+(o-a)*(2/3-n)*6:i=a,l[u]=i*255;return l};v.hsl.hsv=function(e){let t=e[0],r=e[1]/100,s=e[2]/100,n=r,i=Math.max(s,.01);s*=2,r*=s<=1?s:2-s,n*=i<=1?i:2-i;let o=(s+r)/2,a=s===0?2*n/(i+n):2*r/(s+r);return[t,a*100,o*100]};v.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,s=e[2]/100,n=Math.floor(t)%6,i=t-Math.floor(t),o=255*s*(1-r),a=255*s*(1-r*i),l=255*s*(1-r*(1-i));switch(s*=255,n){case 0:return[s,l,o];case 1:return[a,s,o];case 2:return[o,s,l];case 3:return[o,a,s];case 4:return[l,o,s];case 5:return[s,o,a]}};v.hsv.hsl=function(e){let t=e[0],r=e[1]/100,s=e[2]/100,n=Math.max(s,.01),i,o;o=(2-r)*s;let a=(2-r)*n;return i=r*n,i/=a<=1?a:2-a,i=i||0,o/=2,[t,i*100,o*100]};v.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,s=e[2]/100,n=r+s,i;n>1&&(r/=n,s/=n);let o=Math.floor(6*t),a=1-s;i=6*t-o,(o&1)!==0&&(i=1-i);let l=r+i*(a-r),u,f,g;switch(o){default:case 6:case 0:{u=a,f=l,g=r;break}case 1:{u=l,f=a,g=r;break}case 2:{u=r,f=a,g=l;break}case 3:{u=r,f=l,g=a;break}case 4:{u=l,f=r,g=a;break}case 5:{u=a,f=r,g=l;break}}return[u*255,f*255,g*255]};v.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=e[3]/100,i=1-Math.min(1,t*(1-n)+n),o=1-Math.min(1,r*(1-n)+n),a=1-Math.min(1,s*(1-n)+n);return[i*255,o*255,a*255]};v.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n,i,o;return n=t*3.2404542+r*-1.5371385+s*-.4985314,i=t*-.969266+r*1.8760108+s*.041556,o=t*.0556434+r*-.2040259+s*1.0572252,n=ut(n),i=ut(i),o=ut(o),[n*255,i*255,o*255]};v.xyz.lab=function(e){let t=e[0],r=e[1],s=e[2];t/=95.047,r/=100,s/=108.883,t=t>Oe?t**(1/3):7.787*t+16/116,r=r>Oe?r**(1/3):7.787*r+16/116,s=s>Oe?s**(1/3):7.787*s+16/116;let n=116*r-16,i=500*(t-r),o=200*(r-s);return[n,i,o]};v.xyz.oklab=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=Math.cbrt(.8189330101*t+.3618667424*r-.1288597137*s),i=Math.cbrt(.0329845436*t+.9293118715*r+.0361456387*s),o=Math.cbrt(.0482003018*t+.2643662691*r+.633851707*s),a=.2104542553*n+.793617785*i-.0040720468*o,l=1.9779984951*n-2.428592205*i+.4505937099*o,u=.0259040371*n+.7827717662*i-.808675766*o;return[a*100,l*100,u*100]};v.oklab.oklch=function(e){return v.lab.lch(e)};v.oklab.xyz=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=(.999999998*t+.396337792*r+.215803758*s)**3,i=(1.000000008*t-.105561342*r-.063854175*s)**3,o=(1.000000055*t-.089484182*r-1.291485538*s)**3,a=1.227013851*n-.55779998*i+.281256149*o,l=-.040580178*n+1.11225687*i-.071676679*o,u=-.076381285*n-.421481978*i+1.58616322*o;return[a*100,l*100,u*100]};v.oklab.rgb=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=(t+.3963377774*r+.2158037573*s)**3,i=(t-.1055613458*r-.0638541728*s)**3,o=(t-.0894841775*r-1.291485548*s)**3,a=ut(4.0767416621*n-3.3077115913*i+.2309699292*o),l=ut(-1.2684380046*n+2.6097574011*i-.3413193965*o),u=ut(-.0041960863*n-.7034186147*i+1.707614701*o);return[a*255,l*255,u*255]};v.oklch.oklab=function(e){return v.lch.lab(e)};v.lab.xyz=function(e){let t=e[0],r=e[1],s=e[2],n,i,o;i=(t+16)/116,n=r/500+i,o=i-s/200;let a=i**3,l=n**3,u=o**3;return i=a>Oe?a:(i-16/116)/7.787,n=l>Oe?l:(n-16/116)/7.787,o=u>Oe?u:(o-16/116)/7.787,n*=95.047,i*=100,o*=108.883,[n,i,o]};v.lab.lch=function(e){let t=e[0],r=e[1],s=e[2],n;n=Math.atan2(s,r)*360/2/Math.PI,n<0&&(n+=360);let o=Math.sqrt(r*r+s*s);return[t,o,n]};v.lch.lab=function(e){let t=e[0],r=e[1],n=e[2]/360*2*Math.PI,i=r*Math.cos(n),o=r*Math.sin(n);return[t,i,o]};v.rgb.ansi16=function(e,t=null){let[r,s,n]=e,i=t===null?v.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),i===0)return 30;let o=30+(Math.round(n/255)<<2|Math.round(s/255)<<1|Math.round(r/255));return i===2&&(o+=60),o};v.hsv.ansi16=function(e){return v.rgb.ansi16(v.hsv.rgb(e),e[2])};v.rgb.ansi256=function(e){let t=e[0],r=e[1],s=e[2];return t>>4===r>>4&&r>>4===s>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(s/255*5)};v.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let r=(Math.trunc(e>50)+1)*.5,s=(t&1)*r*255,n=(t>>1&1)*r*255,i=(t>>2&1)*r*255;return[s,n,i]};v.ansi256.rgb=function(e){if(e=e[0],e>=232){let i=(e-232)*10+8;return[i,i,i]}e-=16;let t,r=Math.floor(e/36)/5*255,s=Math.floor((t=e%36)/6)/5*255,n=t%6/5*255;return[r,s,n]};v.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(r.length)+r};v.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let r=t[0];t[0].length===3&&(r=[...r].map(a=>a+a).join(""));let s=Number.parseInt(r,16),n=s>>16&255,i=s>>8&255,o=s&255;return[n,i,o]};v.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,s=e[2]/255,n=Math.max(Math.max(t,r),s),i=Math.min(Math.min(t,r),s),o=n-i,a,l=o<1?i/(1-o):0;return o<=0?a=0:n===t?a=(r-s)/o%6:n===r?a=2+(s-t)/o:a=4+(t-r)/o,a/=6,a%=1,[a*360,o*100,l*100]};v.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,s=r<.5?2*t*r:2*t*(1-r),n=0;return s<1&&(n=(r-.5*s)/(1-s)),[e[0],s*100,n*100]};v.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,s=t*r,n=0;return s<1&&(n=(r-s)/(1-s)),[e[0],s*100,n*100]};v.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,s=e[2]/100;if(r===0)return[s*255,s*255,s*255];let n=[0,0,0],i=t%1*6,o=i%1,a=1-o,l=0;switch(Math.floor(i)){case 0:{n[0]=1,n[1]=o,n[2]=0;break}case 1:{n[0]=a,n[1]=1,n[2]=0;break}case 2:{n[0]=0,n[1]=1,n[2]=o;break}case 3:{n[0]=0,n[1]=a,n[2]=1;break}case 4:{n[0]=o,n[1]=0,n[2]=1;break}default:n[0]=1,n[1]=0,n[2]=a}return l=(1-r)*s,[(r*n[0]+l)*255,(r*n[1]+l)*255,(r*n[2]+l)*255]};v.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,s=t+r*(1-t),n=0;return s>0&&(n=t/s),[e[0],n*100,s*100]};v.hcg.hsl=function(e){let t=e[1]/100,s=e[2]/100*(1-t)+.5*t,n=0;return s>0&&s<.5?n=t/(2*s):s>=.5&&s<1&&(n=t/(2*(1-s))),[e[0],n*100,s*100]};v.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,s=t+r*(1-t);return[e[0],(s-t)*100,(1-s)*100]};v.hwb.hcg=function(e){let t=e[1]/100,s=1-e[2]/100,n=s-t,i=0;return n<1&&(i=(s-n)/(1-n)),[e[0],n*100,i*100]};v.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};v.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};v.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};v.gray.hsl=function(e){return[0,0,e[0]]};v.gray.hsv=v.gray.hsl;v.gray.hwb=function(e){return[0,100,e[0]]};v.gray.cmyk=function(e){return[0,0,0,e[0]]};v.gray.lab=function(e){return[e[0],0,0]};v.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,s=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(s.length)+s};v.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function kc(){let e={},t=Object.keys(et);for(let{length:r}=t,s=0;s<r;s++)e[t[s]]={distance:-1,parent:null};return e}function Ac(e){let t=kc(),r=[e];for(t[e].distance=0;r.length>0;){let s=r.pop(),n=Object.keys(et[s]);for(let{length:i}=n,o=0;o<i;o++){let a=n[o],l=t[a];l.distance===-1&&(l.distance=t[s].distance+1,l.parent=s,r.unshift(a))}}return t}function _c(e,t){return function(r){return t(e(r))}}function Nc(e,t){let r=[t[e].parent,e],s=et[t[e].parent][e],n=t[e].parent;for(;t[n].parent;)r.unshift(t[n].parent),s=_c(et[t[n].parent][n],s),n=t[n].parent;return s.conversion=r,s}function Ic(e){let t=Ac(e),r={},s=Object.keys(t);for(let{length:n}=s,i=0;i<n;i++){let o=s[i];t[o].parent!==null&&(r[o]=Nc(o,t))}return r}var Dc=Ic,ct={},Tc=Object.keys(et);function Cc(e){let t=function(...r){let s=r[0];return s==null?s:(s.length>1&&(r=s),e(r))};return"conversion"in e&&(t.conversion=e.conversion),t}function Fc(e){let t=function(...r){let s=r[0];if(s==null)return s;s.length>1&&(r=s);let n=e(r);if(typeof n=="object")for(let{length:i}=n,o=0;o<i;o++)n[o]=Math.round(n[o]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}for(let e of Tc){ct[e]={},Object.defineProperty(ct[e],"channels",{value:et[e].channels}),Object.defineProperty(ct[e],"labels",{value:et[e].labels});let t=Dc(e),r=Object.keys(t);for(let s of r){let n=t[s];ct[e][s]=Fc(n),ct[e][s].raw=Cc(n)}}var de=ct,ri=["keyword","gray","hex"],Ar={};for(let e of Object.keys(de))Ar[[...de[e].labels].sort().join("")]=e;var _r={};function ee(e,t){if(!(this instanceof ee))return new ee(e,t);if(t&&t in ri&&(t=null),t&&!(t in de))throw new Error("Unknown model: "+t);let r,s;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof ee)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){let n=lt.get(e);if(n===null)throw new Error("Unable to parse color from string: "+e);this.model=n.model,s=de[this.model].channels,this.color=n.value.slice(0,s),this.valpha=typeof n.value[s]=="number"?n.value[s]:1}else if(e.length>0){this.model=t||"rgb",s=de[this.model].channels;let n=Array.prototype.slice.call(e,0,s);this.color=Nr(n,s),this.valpha=typeof e[s]=="number"?e[s]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let n=Object.keys(e);"alpha"in e&&(n.splice(n.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);let i=n.sort().join("");if(!(i in Ar))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Ar[i];let{labels:o}=de[this.model],a=[];for(r=0;r<o.length;r++)a.push(e[o[r]]);this.color=Nr(a)}if(_r[this.model])for(s=de[this.model].channels,r=0;r<s;r++){let n=_r[this.model][r];n&&(this.color[r]=n(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}ee.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in lt.to?this:this.rgb();t=t.round(typeof e=="number"?e:1);let r=t.valpha===1?t.color:[...t.color,this.valpha];return lt.to[t.model](...r)},percentString(e){let t=this.rgb().round(typeof e=="number"?e:1),r=t.valpha===1?t.color:[...t.color,this.valpha];return lt.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=de[this.model],{labels:r}=de[this.model];for(let s=0;s<t;s++)e[r[s]]=this.color[s];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){let e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){let e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new ee([...this.color.map(jc(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new ee([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:J("rgb",0,K(255)),green:J("rgb",1,K(255)),blue:J("rgb",2,K(255)),hue:J(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:J("hsl",1,K(100)),lightness:J("hsl",2,K(100)),saturationv:J("hsv",1,K(100)),value:J("hsv",2,K(100)),chroma:J("hcg",1,K(100)),gray:J("hcg",2,K(100)),white:J("hwb",1,K(100)),wblack:J("hwb",2,K(100)),cyan:J("cmyk",0,K(100)),magenta:J("cmyk",1,K(100)),yellow:J("cmyk",2,K(100)),black:J("cmyk",3,K(100)),x:J("xyz",0,K(95.047)),y:J("xyz",1,K(100)),z:J("xyz",2,K(108.833)),l:J("lab",0,K(100)),a:J("lab",1),b:J("lab",2),keyword(e){return e!==void 0?new ee(e):de[this.model].keyword(this.color)},hex(e){return e!==void 0?new ee(e):lt.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new ee(e);let t=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();return r.length===1&&(r="0"+r),lt.to.hex(...t)+r},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[r,s]of e.entries()){let n=s/255;t[r]=n<=.04045?n/12.92:((n+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){let t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level(e){let t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return ee.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);let r=e.rgb(),s=this.rgb(),n=t===void 0?.5:t,i=2*n-1,o=r.alpha()-s.alpha(),a=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,l=1-a;return ee.rgb(a*r.red()+l*s.red(),a*r.green()+l*s.green(),a*r.blue()+l*s.blue(),r.alpha()*n+s.alpha()*(1-n))}};for(let e of Object.keys(de)){if(ri.includes(e))continue;let{channels:t}=de[e];ee.prototype[e]=function(...r){return this.model===e?new ee(this):r.length>0?new ee(r,e):new ee([...Lc(de[this.model][e].raw(this.color)),this.valpha],e)},ee[e]=function(...r){let s=r[0];return typeof s=="number"&&(s=Nr(r,t)),new ee(s,e)}}function Oc(e,t){return Number(e.toFixed(t))}function jc(e){return function(t){return Oc(t,e)}}function J(e,t,r){e=Array.isArray(e)?e:[e];for(let s of e)(_r[s]||=[])[t]=r;return e=e[0],function(s){let n;return s!==void 0?(r&&(s=r(s)),n=this[e](),n.color[t]=s,n):(n=this[e]().color[t],r&&(n=r(n)),n)}}function K(e){return function(t){return Math.max(0,Math.min(e,t))}}function Lc(e){return Array.isArray(e)?e:[e]}function Nr(e,t){for(let r=0;r<t;r++)typeof e[r]!="number"&&(e[r]=0);return e}var Mc=ee});var oi=_((Ah,ii)=>{ii.exports=ni().default});var ui=_((_h,ci)=>{var zc=oi(),je=Se(),ai={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"};function Bc(e){return this._setBackgroundColourOption("tint",e),this}function Uc(e){return this.options.greyscale=je.bool(e)?e:!0,this}function Gc(e){return this.greyscale(e)}function qc(e){if(!je.string(e))throw je.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function Wc(e){return this.pipelineColourspace(e)}function Hc(e){if(!je.string(e))throw je.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function Vc(e){return this.toColourspace(e)}function li(e){if(je.object(e)||je.string(e)&&e.length>=3&&e.length<=200){let t=zc(e);return[t.red(),t.green(),t.blue(),Math.round(t.alpha()*255)]}else throw je.invalidParameterError("background","object or string",e)}function Jc(e,t){je.defined(t)&&(this.options[e]=li(t))}ci.exports=e=>{Object.assign(e.prototype,{tint:Bc,greyscale:Uc,grayscale:Gc,pipelineColourspace:qc,pipelineColorspace:Wc,toColourspace:Hc,toColorspace:Vc,_getBackgroundColourOption:li,_setBackgroundColourOption:Jc}),e.colourspace=ai,e.colorspace=ai}});var hi=_((Nh,fi)=>{var Ie=Se(),Xc={and:"and",or:"or",eor:"eor"};function Yc(){return this.options.removeAlpha=!0,this}function Kc(e){if(Ie.defined(e))if(Ie.number(e)&&Ie.inRange(e,0,1))this.options.ensureAlpha=e;else throw Ie.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function Qc(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e)&&(e=t[e]),Ie.integer(e)&&Ie.inRange(e,0,4))this.options.extractChannel=e;else throw Ie.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function Zc(e,t){return Array.isArray(e)?e.forEach(function(r){this.options.joinChannelIn.push(this._createInputDescriptor(r,t))},this):this.options.joinChannelIn.push(this._createInputDescriptor(e,t)),this}function eu(e){if(Ie.string(e)&&Ie.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw Ie.invalidParameterError("boolOp","one of: and, or, eor",e);return this}fi.exports=e=>{Object.assign(e.prototype,{removeAlpha:Yc,ensureAlpha:Kc,extractChannel:Qc,joinChannel:Zc,bandbool:eu}),e.bool=Xc}});var bi=_((Ih,mi)=>{var Dr=V("node:path"),c=Se(),ht=Et(),di=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"]]),tu=/\.(jp[2x]|j2[kc])$/i,gi=()=>new Error("JP2 output requires libvips with support for OpenJPEG"),pi=e=>1<<31-Math.clz32(Math.ceil(Math.log2(e)));function ru(e,t){let r;if(c.string(e)?c.string(this.options.input.file)&&Dr.resolve(this.options.input.file)===Dr.resolve(e)?r=new Error("Cannot use same file for input and output"):tu.test(Dr.extname(e))&&!this.constructor.format.jp2k.output.file&&(r=gi()):r=new Error("Missing output file path"),r)if(c.fn(t))t(r);else return Promise.reject(r);else{this.options.fileOut=e;let s=Error();return this._pipeline(t,s)}return this}function su(e,t){c.object(e)?this._setBooleanOption("resolveWithObject",e.resolveWithObject):this.options.resolveWithObject&&(this.options.resolveWithObject=!1),this.options.fileOut="";let r=Error();return this._pipeline(c.fn(e)?e:t,r)}function nu(){return this.options.keepMetadata|=1,this}function iu(e){if(c.object(e))for(let[t,r]of Object.entries(e))if(c.object(r))for(let[s,n]of Object.entries(r))if(c.string(n))this.options.withExif[`exif-${t.toLowerCase()}-${s}`]=n;else throw c.invalidParameterError(`${t}.${s}`,"string",n);else throw c.invalidParameterError(t,"object",r);else throw c.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function ou(e){return this.withExif(e),this.options.withExifMerge=!0,this}function au(){return this.options.keepMetadata|=8,this}function lu(e,t){if(c.string(e))this.options.withIccProfile=e;else throw c.invalidParameterError("icc","string",e);if(this.keepIccProfile(),c.object(t)&&c.defined(t.attach))if(c.bool(t.attach))t.attach||(this.options.keepMetadata&=-9);else throw c.invalidParameterError("attach","boolean",t.attach);return this}function cu(){return this.options.keepMetadata|=2,this}function uu(e){if(c.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw c.invalidParameterError("xmp","non-empty string",e);return this}function fu(){return this.options.keepMetadata=31,this}function hu(e){if(this.keepMetadata(),this.withIccProfile("srgb"),c.object(e)){if(c.defined(e.orientation))if(c.integer(e.orientation)&&c.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw c.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(c.defined(e.density))if(c.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw c.invalidParameterError("density","positive number",e.density);c.defined(e.icc)&&this.withIccProfile(e.icc),c.defined(e.exif)&&this.withExifMerge(e.exif)}return this}function du(e,t){let r=di.get((c.object(e)&&c.string(e.id)?e.id:e).toLowerCase());if(!r)throw c.invalidParameterError("format",`one of: ${[...di.keys()].join(", ")}`,e);return this[r](t)}function gu(e){if(c.object(e)){if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw c.invalidParameterError("quality","integer between 1 and 100",e.quality);if(c.defined(e.progressive)&&this._setBooleanOption("jpegProgressive",e.progressive),c.defined(e.chromaSubsampling))if(c.string(e.chromaSubsampling)&&c.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw c.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let t=c.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(c.defined(t)&&this._setBooleanOption("jpegOptimiseCoding",t),c.defined(e.mozjpeg))if(c.bool(e.mozjpeg))e.mozjpeg&&(this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3);else throw c.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let r=c.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;c.defined(r)&&this._setBooleanOption("jpegTrellisQuantisation",r),c.defined(e.overshootDeringing)&&this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let s=c.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;c.defined(s)&&(this._setBooleanOption("jpegOptimiseScans",s),s&&(this.options.jpegProgressive=!0));let n=c.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(c.defined(n))if(c.integer(n)&&c.inRange(n,0,8))this.options.jpegQuantisationTable=n;else throw c.invalidParameterError("quantisationTable","integer between 0 and 8",n)}return this._updateFormatOut("jpeg",e)}function pu(e){if(c.object(e)){if(c.defined(e.progressive)&&this._setBooleanOption("pngProgressive",e.progressive),c.defined(e.compressionLevel))if(c.integer(e.compressionLevel)&&c.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw c.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);c.defined(e.adaptiveFiltering)&&this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let t=e.colours||e.colors;if(c.defined(t))if(c.integer(t)&&c.inRange(t,2,256))this.options.pngBitdepth=pi(t);else throw c.invalidParameterError("colours","integer between 2 and 256",t);if(c.defined(e.palette)?this._setBooleanOption("pngPalette",e.palette):[e.quality,e.effort,e.colours,e.colors,e.dither].some(c.defined)&&this._setBooleanOption("pngPalette",!0),this.options.pngPalette){if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw c.invalidParameterError("quality","integer between 0 and 100",e.quality);if(c.defined(e.effort))if(c.integer(e.effort)&&c.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw c.invalidParameterError("effort","integer between 1 and 10",e.effort);if(c.defined(e.dither))if(c.number(e.dither)&&c.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw c.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function mu(e){if(c.object(e)){if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw c.invalidParameterError("quality","integer between 1 and 100",e.quality);if(c.defined(e.alphaQuality))if(c.integer(e.alphaQuality)&&c.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw c.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(c.defined(e.lossless)&&this._setBooleanOption("webpLossless",e.lossless),c.defined(e.nearLossless)&&this._setBooleanOption("webpNearLossless",e.nearLossless),c.defined(e.smartSubsample)&&this._setBooleanOption("webpSmartSubsample",e.smartSubsample),c.defined(e.smartDeblock)&&this._setBooleanOption("webpSmartDeblock",e.smartDeblock),c.defined(e.preset))if(c.string(e.preset)&&c.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw c.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(c.defined(e.effort))if(c.integer(e.effort)&&c.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw c.invalidParameterError("effort","integer between 0 and 6",e.effort);c.defined(e.minSize)&&this._setBooleanOption("webpMinSize",e.minSize),c.defined(e.mixed)&&this._setBooleanOption("webpMixed",e.mixed)}return Tr(e,this.options),this._updateFormatOut("webp",e)}function bu(e){if(c.object(e)){c.defined(e.reuse)&&this._setBooleanOption("gifReuse",e.reuse),c.defined(e.progressive)&&this._setBooleanOption("gifProgressive",e.progressive);let t=e.colours||e.colors;if(c.defined(t))if(c.integer(t)&&c.inRange(t,2,256))this.options.gifBitdepth=pi(t);else throw c.invalidParameterError("colours","integer between 2 and 256",t);if(c.defined(e.effort))if(c.number(e.effort)&&c.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw c.invalidParameterError("effort","integer between 1 and 10",e.effort);if(c.defined(e.dither))if(c.number(e.dither)&&c.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw c.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(c.defined(e.interFrameMaxError))if(c.number(e.interFrameMaxError)&&c.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw c.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(c.defined(e.interPaletteMaxError))if(c.number(e.interPaletteMaxError)&&c.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw c.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(c.defined(e.keepDuplicateFrames))if(c.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw c.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return Tr(e,this.options),this._updateFormatOut("gif",e)}function vu(e){if(!this.constructor.format.jp2k.output.buffer)throw gi();if(c.object(e)){if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw c.invalidParameterError("quality","integer between 1 and 100",e.quality);if(c.defined(e.lossless))if(c.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw c.invalidParameterError("lossless","boolean",e.lossless);if(c.defined(e.tileWidth))if(c.integer(e.tileWidth)&&c.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw c.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(c.defined(e.tileHeight))if(c.integer(e.tileHeight)&&c.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw c.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(c.defined(e.chromaSubsampling))if(c.string(e.chromaSubsampling)&&c.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw c.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function Tr(e,t){if(c.object(e)&&c.defined(e.loop))if(c.integer(e.loop)&&c.inRange(e.loop,0,65535))t.loop=e.loop;else throw c.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(c.object(e)&&c.defined(e.delay))if(c.integer(e.delay)&&c.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&e.delay.every(c.integer)&&e.delay.every(r=>c.inRange(r,0,65535)))t.delay=e.delay;else throw c.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function yu(e){if(c.object(e)){if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw c.invalidParameterError("quality","integer between 1 and 100",e.quality);if(c.defined(e.bitdepth))if(c.integer(e.bitdepth)&&c.inArray(e.bitdepth,[1,2,4,8]))this.options.tiffBitdepth=e.bitdepth;else throw c.invalidParameterError("bitdepth","1, 2, 4 or 8",e.bitdepth);if(c.defined(e.tile)&&this._setBooleanOption("tiffTile",e.tile),c.defined(e.tileWidth))if(c.integer(e.tileWidth)&&e.tileWidth>0)this.options.tiffTileWidth=e.tileWidth;else throw c.invalidParameterError("tileWidth","integer greater than zero",e.tileWidth);if(c.defined(e.tileHeight))if(c.integer(e.tileHeight)&&e.tileHeight>0)this.options.tiffTileHeight=e.tileHeight;else throw c.invalidParameterError("tileHeight","integer greater than zero",e.tileHeight);if(c.defined(e.miniswhite)&&this._setBooleanOption("tiffMiniswhite",e.miniswhite),c.defined(e.pyramid)&&this._setBooleanOption("tiffPyramid",e.pyramid),c.defined(e.xres))if(c.number(e.xres)&&e.xres>0)this.options.tiffXres=e.xres;else throw c.invalidParameterError("xres","number greater than zero",e.xres);if(c.defined(e.yres))if(c.number(e.yres)&&e.yres>0)this.options.tiffYres=e.yres;else throw c.invalidParameterError("yres","number greater than zero",e.yres);if(c.defined(e.compression))if(c.string(e.compression)&&c.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw c.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(c.defined(e.bigtiff)&&this._setBooleanOption("tiffBigtiff",e.bigtiff),c.defined(e.predictor))if(c.string(e.predictor)&&c.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw c.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(c.defined(e.resolutionUnit))if(c.string(e.resolutionUnit)&&c.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw c.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function wu(e){return this.heif({...e,compression:"av1"})}function Eu(e){if(c.object(e)){if(c.string(e.compression)&&c.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw c.invalidParameterError("compression","one of: av1, hevc",e.compression);if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw c.invalidParameterError("quality","integer between 1 and 100",e.quality);if(c.defined(e.lossless))if(c.bool(e.lossless))this.options.heifLossless=e.lossless;else throw c.invalidParameterError("lossless","boolean",e.lossless);if(c.defined(e.effort))if(c.integer(e.effort)&&c.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw c.invalidParameterError("effort","integer between 0 and 9",e.effort);if(c.defined(e.chromaSubsampling))if(c.string(e.chromaSubsampling)&&c.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw c.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(c.defined(e.bitdepth))if(c.integer(e.bitdepth)&&c.inArray(e.bitdepth,[8,10,12])){if(e.bitdepth!==8&&this.constructor.versions.heif)throw c.invalidParameterError("bitdepth when using prebuilt binaries",8,e.bitdepth);this.options.heifBitdepth=e.bitdepth}else throw c.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth)}else throw c.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function xu(e){if(c.object(e)){if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?.1+(100-e.quality)*.09:53/3e3*e.quality*e.quality-23/20*e.quality+25;else throw c.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(c.defined(e.distance))if(c.number(e.distance)&&c.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw c.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(c.defined(e.decodingTier))if(c.integer(e.decodingTier)&&c.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw c.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(c.defined(e.lossless))if(c.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw c.invalidParameterError("lossless","boolean",e.lossless);if(c.defined(e.effort))if(c.integer(e.effort)&&c.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw c.invalidParameterError("effort","integer between 1 and 9",e.effort)}return Tr(e,this.options),this._updateFormatOut("jxl",e)}function Pu(e){if(c.object(e)&&c.defined(e.depth))if(c.string(e.depth)&&c.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw c.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth);return this._updateFormatOut("raw")}function Ru(e){if(c.object(e)){if(c.defined(e.size))if(c.integer(e.size)&&c.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw c.invalidParameterError("size","integer between 1 and 8192",e.size);if(c.defined(e.overlap))if(c.integer(e.overlap)&&c.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw c.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw c.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(c.defined(e.container))if(c.string(e.container)&&c.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw c.invalidParameterError("container","one of: fs, zip",e.container);if(c.defined(e.layout))if(c.string(e.layout)&&c.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw c.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(c.defined(e.angle))if(c.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw c.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),c.defined(e.depth))if(c.string(e.depth)&&c.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw c.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(c.defined(e.skipBlanks))if(c.integer(e.skipBlanks)&&c.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw c.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else c.defined(e.layout)&&e.layout==="google"&&(this.options.tileSkipBlanks=5);let t=c.bool(e.center)?e.center:e.centre;if(c.defined(t)&&this._setBooleanOption("tileCentre",t),c.defined(e.id))if(c.string(e.id))this.options.tileId=e.id;else throw c.invalidParameterError("id","string",e.id);if(c.defined(e.basename))if(c.string(e.basename))this.options.tileBasename=e.basename;else throw c.invalidParameterError("basename","string",e.basename)}if(c.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw c.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function Su(e){if(!c.plainObject(e))throw c.invalidParameterError("options","object",e);if(c.integer(e.seconds)&&c.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw c.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function $u(e,t){return c.object(t)&&t.force===!1||(this.options.formatOut=e),this}function ku(e,t){if(c.bool(t))this.options[e]=t;else throw c.invalidParameterError(e,"boolean",t)}function Au(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function _u(e,t){return typeof e=="function"?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),ht.pipeline(this.options,(r,s,n)=>{r?e(c.nativeError(r,t)):e(null,s,n)})}):ht.pipeline(this.options,(r,s,n)=>{r?e(c.nativeError(r,t)):e(null,s,n)}),this):this.options.streamOut?(this._isStreamInput()?(this.once("finish",()=>{this._flattenBufferIn(),ht.pipeline(this.options,(r,s,n)=>{r?this.emit("error",c.nativeError(r,t)):(this.emit("info",n),this.push(s)),this.push(null),this.on("end",()=>this.emit("close"))})}),this.streamInFinished&&this.emit("finish")):ht.pipeline(this.options,(r,s,n)=>{r?this.emit("error",c.nativeError(r,t)):(this.emit("info",n),this.push(s)),this.push(null),this.on("end",()=>this.emit("close"))}),this):this._isStreamInput()?new Promise((r,s)=>{this.once("finish",()=>{this._flattenBufferIn(),ht.pipeline(this.options,(n,i,o)=>{n?s(c.nativeError(n,t)):this.options.resolveWithObject?r({data:i,info:o}):r(i)})})}):new Promise((r,s)=>{ht.pipeline(this.options,(n,i,o)=>{n?s(c.nativeError(n,t)):this.options.resolveWithObject?r({data:i,info:o}):r(i)})})}mi.exports=e=>{Object.assign(e.prototype,{toFile:ru,toBuffer:su,keepExif:nu,withExif:iu,withExifMerge:ou,keepIccProfile:au,withIccProfile:lu,keepXmp:cu,withXmp:uu,keepMetadata:fu,withMetadata:hu,toFormat:du,jpeg:gu,jp2:vu,png:pu,webp:mu,tiff:yu,avif:wu,heif:Eu,jxl:xu,gif:bu,raw:Pu,tile:Ru,timeout:Su,_updateFormatOut:$u,_setBooleanOption:ku,_read:Au,_pipeline:_u})}});var Ei=_((Dh,wi)=>{var Nu=V("node:events"),Wt=Dt(),ve=Se(),{runtimePlatformArch:Iu}=xr(),le=Et(),vi=Iu(),Cr=le.libvipsVersion(),We=le.format();We.heif.output.alias=["avif","heic"];We.jpeg.output.alias=["jpe","jpg"];We.tiff.output.alias=["tif"];We.jp2k.output.alias=["j2c","j2k","jp2","jpx"];var Du={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},dt={vips:Cr.semver};if(!Cr.isGlobal)if(Cr.isWasm)try{dt=V("@img/sharp-wasm32/versions")}catch{}else try{dt=V(`@img/sharp-${vi}/versions`)}catch{try{dt=V(`@img/sharp-libvips-${vi}/versions`)}catch{}}dt.sharp=wr().version;dt.heif&&We.heif&&(We.heif.input.fileSuffix=[".avif"],We.heif.output.alias=["avif"]);function yi(e){return ve.bool(e)?e?le.cache(50,20,100):le.cache(0,0,0):ve.object(e)?le.cache(e.memory,e.files,e.items):le.cache()}yi(!0);function Tu(e){return le.concurrency(ve.integer(e)?e:null)}Wt.familySync()===Wt.GLIBC&&!le._isUsingJemalloc()?le.concurrency(1):Wt.familySync()===Wt.MUSL&&le.concurrency()===1024&&le.concurrency(V("node:os").availableParallelism());var Cu=new Nu.EventEmitter;function Fu(){return le.counters()}function Ou(e){return le.simd(ve.bool(e)?e:null)}function ju(e){if(ve.object(e))if(Array.isArray(e.operation)&&e.operation.every(ve.string))le.block(e.operation,!0);else throw ve.invalidParameterError("operation","Array<string>",e.operation);else throw ve.invalidParameterError("options","object",e)}function Lu(e){if(ve.object(e))if(Array.isArray(e.operation)&&e.operation.every(ve.string))le.block(e.operation,!1);else throw ve.invalidParameterError("operation","Array<string>",e.operation);else throw ve.invalidParameterError("options","object",e)}wi.exports=e=>{e.cache=yi,e.concurrency=Tu,e.counters=Fu,e.simd=Ou,e.format=We,e.interpolators=Du,e.versions=dt,e.queue=Cu,e.block=ju,e.unblock=Lu}});var Pi=_((Ch,xi)=>{var Le=On();Mn()(Le);Wn()(Le);Vn()(Le);Qn()(Le);ui()(Le);hi()(Le);bi()(Le);Ei()(Le);xi.exports=Le});import co from"@rollup/plugin-strip";import{visualizer as uo}from"rollup-plugin-visualizer";var er=["/react/","/react-dom/","/scheduler/","/react-router","/@radix-ui/","/react-day-picker/","/react-hook-form/","/react-i18next/","/clsx/","/class-variance-authority/"],Ki={valibot:["/valibot/"],firebase:["/firebase/","/@firebase/"],lucide:["/lucide-react/","/lucide/"],i18n:["/i18next/","/i18next-browser-languagedetector/","/i18next-http-backend/","/@donotdev/i18n/"],zustand:["/zustand/"],"tanstack-query":["/@tanstack/react-query/","/@tanstack/query-core/"]};function Qi(e){let t=e.match(/(?:^|\0)virtual:([^?]+)/);if(t)return t[1]}function zr(e){let t=e.replace(/\\/g,"/");if(t.includes("/node_modules/"))return t.split("?")[0]}function Br(e,t=er){return t.some(r=>e.includes(r))}function Zi(e){for(let[t,r]of Object.entries(Ki))if(r.some(s=>e.includes(s)))return t}function eo(e){let t=Qi(e);if(t)return t==="i18n-mapping"?"virtual-i18n-mapping":"virtual-modules";let r=zr(e);if(!r)return;if(Br(r))return"react-core";let s=Zi(r);if(s)return s}function to(e=[]){let t=e.filter(s=>!er.includes(s)),r=[...er,...t];return function(s){let n=zr(s);if(n&&Br(n,r))return"react-core"}}var Mr={development:{manualChunks:void 0},production:{manualChunks:eo}};function Ur(e,t={}){let r=Mr[e]||Mr.production,s=t.reactCore||[];return s.length>0?{manualChunks:to(s)}:r}import*as he from"@clack/prompts";import*as T from"node:fs";import"node:fs";import{createRequire as so}from"node:module";import{resolve as kt,join as Ce,dirname as ze,relative as Hr,normalize as no,sep as Vr,extname as io}from"node:path";import{fileURLToPath as oo}from"node:url";import ao from"fast-glob";var tr={HOMEPAGE_FILE:"HomePage.tsx",HOMEPAGE_PATH:"/",HOMEPAGE_COMPONENT:"HomePage"};var U={routes:"virtual:routes",themes:"virtual:themes",i18n:"virtual:i18n-mapping",assets:"virtual:assets",env:"virtual:env"},ne={routes:"routes",themes:"themes",i18n:"i18n",assets:"assets",env:"env"},Q={next:{middleware:"middleware.ts",routeManifest:"public/route-manifest.json",assetManifest:"public/asset-manifest.json",utilities:"src/styles/utilities.generated.css",appPages:"src/app",appLayout:"src/app/layout.tsx",configRoute:"src/config/dndev-config-route.js",configTheme:"src/config/dndev-config-theme.js",configI18n:"src/config/dndev-config-i18n.js",configPwa:"src/config/dndev-config-pwa.js",configAsset:"src/config/dndev-config-asset.js",configSeo:"src/config/dndev-config-seo.js",configServer:"src/config/dndev-config-server.js"},vite:{routeInspection:"src/routes.generated.log",themeInspection:"src/themes.generated.log",i18nInspection:"src/i18n.generated.log",assetInspection:"src/assets.generated.log",envInspection:"src/env.generated.log"},manifests:{route:"route-manifest.json",theme:"theme-manifest.json",i18n:"i18n-manifest.json",asset:"asset-manifest.json",feature:"feature-manifest.json",env:"env-manifest.json"}},rr={package:"@donotdev/ui",assetsPath:"packages/ui/assets",browserTargets:["> 1%","last 2 versions","Firefox ESR","not dead","not op_mini all"]},Te={public:"public",fonts:"fonts",nodeModules:"node_modules",packages:"packages",core:"core",ui:"ui"},St={SOURCE_ROOT:"packages/core/i18n",SOURCE_LOCALES:"packages/core/i18n/locales",SOURCE_EAGER:"packages/core/i18n/locales/eager",SOURCE_LAZY:"packages/core/i18n/locales/lazy",PUBLISHED_ROOT:"i18n",PUBLISHED_LOCALES:"i18n/locales",PUBLISHED_EAGER:"i18n/locales/eager",PUBLISHED_LAZY:"i18n/locales/lazy"},pe={routes:{consumer:["src/**/*Page.tsx","src/pages/**/*Page.tsx"],exclude:["**/node_modules/**","**/dist/**","**/build/**","**/*.test.tsx","**/*.stories.tsx"],extensions:[".tsx"]},css:{consumer:["src/**/*.css"],themes:["src/**/*.css"],extensions:[".css",".scss",".sass"],framework:["packages/ui/src/**/*.css","packages/core/components/src/**/*.css","packages/core/templates/src/**/*.css"]},i18n:{eager:["src/locales/*_*.json"],lazy:["src/**/locales/*_*.json","!src/locales/*_*.json","../../entities/locales/*_*.json"],additional:[],framework:{eager:[`${St.SOURCE_EAGER}/*_*.json`],lazy:[`${St.SOURCE_LAZY}/*_*.json`]},extensions:[".json"]},assets:{consumer:["public/**/*"],fallback:["manifest.json"],modern:["logo.svg","favicon.svg","apple-touch-icon.png","android-chrome-192x192.png","android-chrome-512x512.png"],patterns:["favicon.svg","favicon.ico","favicon-*.png","logo.svg","logo.png","logo.webp","logo.avif","apple-touch-icon*.png","android-chrome-*.png","manifest.json"],fonts:["fonts/**/*.woff2","fonts/**/*.woff","fonts/**/*.ttf"],framework:["packages/ui/assets/**/*"]},pwa:{consumer:["public/manifest.json","public/service-worker.js","public/sw.js","public/icon-192x192.png","public/icon-512x512.png","public/favicon.ico","public/favicon.svg","public/apple-touch-icon.png","public/logo.svg"],exclude:["**/node_modules/**","**/dist/**","**/build/**"],extensions:[".json",".js",".png",".svg",".ico"],framework:["packages/ui/assets/**/*"]},globalIgnore:["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/coverage/**","**/test/**"]},Xe={mandatoryIncludes:["react","react-dom","react-router-dom","zustand","lucide-react","valibot","i18next","i18next-browser-languagedetector","i18next-http-backend","react-i18next","@tanstack/react-query","react-helmet-async","@donotdev/core","@donotdev/components","@donotdev/ui","@donotdev/templates","@donotdev/firebase"],optionalFeatures:["@donotdev/adv-comps","@donotdev/auth","@donotdev/billing","@donotdev/crud","@donotdev/oauth","shiki","@tiptap/react","@tiptap/starter-kit","@tiptap/extension-placeholder"],coreBundled:["@donotdev/types","@donotdev/utils","@donotdev/stores","@donotdev/schemas","@donotdev/hooks","@donotdev/i18n","@donotdev/config"],componentsBundled:["class-variance-authority","clsx","lucide-react","react-day-picker"],radixUIPattern:"@radix-ui/",buildTools:["esbuild","@esbuild/win32-x64","@esbuild/darwin-x64","@esbuild/linux-x64","@esbuild/darwin-arm64","@esbuild/linux-arm64","vite","rollup","rollup-plugin-visualizer","@vitejs/plugin-react","vite-tsconfig-paths","vite-plugin-pwa","vite-plugin-compression2","vite-plugin-node-polyfills","fsevents","postcss","postcss-import","postcss-nesting","autoprefixer"],buildTimePackages:[],largeOptional:["@sentry/react","framer-motion","stripe","@tanstack/react-query","shiki","@tiptap/react","@tiptap/starter-kit","@tiptap/extension-placeholder","sharp","semver","file-type"]},qr=["firebase-admin","gcp-metadata","google-logging-utils","payload","undici","@fastify/busboy","image-size","@donotdev/tooling","fs","path","crypto","net","tls","http","https","child_process","os","util","stream","buffer","events","querystring","url","zlib","assert","constants","domain","punycode","string_decoder","timers","tty","vm","worker_threads","cluster","dgram","dns","http2","inspector","module","perf_hooks","process","readline","repl","trace_events","v8","wasi"],sr=["@donotdev/core/functions","@donotdev/core/server"],nr={selectors:{class:/\.([a-zA-Z0-9-]+)/g,variable:/--[a-zA-Z0-9-]+/g,keyframe:/@keyframes\s+([a-zA-Z0-9-]+)/g},themes:{themeClass:/(?::root\.|\.)([a-z][a-z0-9-]+)\s*\{([\s\S]*?)\}/gim,themeLabel:/--theme-label\s*:\s*['"]([^'"]+)['"]/,themeIcon:/--theme-icon\s*:\s*['"]([^'"]+)['"]/,themeIsDark:/--theme-is-dark\s*:\s*(0|1)/}},ir=[{name:"light",displayName:"Light",icon:"Sun",isDark:!1}],Gr={base:{absolute:!0,onlyFiles:!0,ignore:pe.globalIgnore},css:{absolute:!0,onlyFiles:!0,ignore:[...pe.globalIgnore,"**/*.test.css"]},routes:{absolute:!0,onlyFiles:!0,ignore:[...pe.globalIgnore,"**/*.test.tsx","**/*.stories.tsx"]},i18n:{absolute:!0,onlyFiles:!0,ignore:pe.globalIgnore},assets:{absolute:!0,onlyFiles:!0,ignore:pe.globalIgnore}};function Wr(e,t=null){let r=pe[e];if(!r)throw new Error(`Unknown pattern type: ${e}`);return t&&r.framework?{...r,framework:r.framework.map(s=>`${t}/${s}`)}:r}function $t(e){return Gr[e]||Gr.base}var rt={getGlobOptionsFor:$t||void 0,SCAN_PATTERNS:pe||void 0,getPatternsFor:Wr||void 0,I18N_PATHS:St||void 0},Z={error:(e,t)=>{},warn:(e,t)=>{},info:e=>{}};function Jr(e,t){return e().catch(r=>{throw new Error(`${t}: ${r instanceof Error?r.message:String(r)}`)})}var Xr={CLI:"packages/cli",COMPONENTS:"packages/core/components",CONFIG:"packages/core/config",CORE:"packages/core",CRUD:"packages/core/crud",FEATURES:"packages/features",HOOKS:"packages/core/hooks",I18N:"packages/core/i18n",SCHEMAS:"packages/core/schemas",STORES:"packages/core/stores",TEMPLATES:"packages/templates",TOOLING:"packages/tooling",TYPES:"packages/core/types",UI:"packages/ui",UTILS:"packages/core/utils",AUTH:"packages/features/auth",BILLING:"packages/features/billing",OAUTH:"packages/features/oauth",FIREBASE:"packages/providers/firebase",FUNCTIONS:"packages/functions"},W=class e{static _instance=null;options;_repoRoot;_appRoot=null;static getInstance(t={}){return e._instance||(e._instance=new e(t)),e._instance}static _reset(){e._instance=null}constructor(t={}){if(e._instance)return e._instance;this.options={maxLevels:t.maxLevels??10,customMarkers:t.customMarkers||[],cache:t.cache??!1,debug:t.debug??!1};try{let r=process.cwd();if(!r)throw new Error("PathResolver: process.cwd() returned undefined. This should never happen.");this._repoRoot=this._findRepoRoot(r)}catch(r){throw new Error(`PathResolver constructor failed: ${r instanceof Error?r.message:String(r)}. cwd: ${process.cwd()}`)}this._appRoot=null,e._instance=this}normalizePath(t){if(!t)return"";try{return no(t).split(Vr).join("/")}catch{return String(t).split(Vr).join("/")}}getRelativePath(t){let r=this.getAppRoot(),s=Hr(r,t);return this.normalizePath(s)}getBasename(t){if(!t)return"";let s=this.normalizePath(t).split("/");return s[s.length-1]||""}getDirname(t){return t?this.normalizePath(ze(t)):""}resolvePackage(t,r=null){try{let s=r||this.getAppRoot(),i=so(Ce(s,"package.json")).resolve(t);return this.normalizePath(i)}catch{return null}}resolveFrameworkPackage(t,r=null){let s=this.resolvePackage(`${t}/package.json`,r);if(s)return this.getDirname(s);if(this.isMonorepo()&&t.startsWith("@donotdev/")){let o=t.replace("@donotdev/",""),a=this.resolveRepoPath(`packages/${o}`);if(this.pathExists(a))return a;if(["auth","billing","crud","oauth"].includes(o)){let l=this.resolveRepoPath(`packages/features/${o}`);if(this.pathExists(l))return l}if(o==="firebase"){let l=this.resolveRepoPath(`packages/providers/${o}`);if(this.pathExists(l))return l}}let n=this.resolveAppPath(`node_modules/${t}`);if(this.pathExists(n))return n;let i=this.resolveRepoPath(`node_modules/${t}`);return this.pathExists(i)?i:null}resolvePackageAsset(t,r=null){return this.resolvePackage(t,r)}resolveAppPath(t){let r=this.getAppRoot(),s=kt(r,t);return this.normalizePath(s)}resolveRepoPath(t){let r=this.getRepoRoot(),s=this.normalizePath(t),n=kt(r,s);return this.normalizePath(n)}resolvePath(t,r){let s=this.normalizePath(r),n=this.normalizePath(t),i=kt(s,n);return this.normalizePath(i)}createImportPath(t){return"./"+this.getRelativePath(t)}getFileInfo(t){try{let r=T.statSync(t);return{absolutePath:this.normalizePath(t),relativePath:this.getRelativePath(t),importPath:this.createImportPath(t),size:r.size,isFile:r.isFile(),isDirectory:r.isDirectory()}}catch{return null}}_detectFormat(t,r){return r&&r!=="auto"?r:io(t).toLowerCase()===".json"?"json":"text"}async read(t,r={}){let{format:s="auto",encoding:n="utf8"}=r,i=this._detectFormat(t,s);try{if(i==="buffer")return await T.promises.readFile(t);let o=await T.promises.readFile(t,n),a=this.stripBom(o);return i==="json"?JSON.parse(a):a}catch(o){return this.options.debug&&Z.warn(`Failed to read file: ${t}`,o),null}}readSync(t,r={}){let{format:s="auto",encoding:n="utf8"}=r,i=this._detectFormat(t,s);try{if(i==="buffer")return T.readFileSync(t);let o=T.readFileSync(t,n),a=this.stripBom(o);return i==="json"?JSON.parse(a):a}catch(o){return this.options.debug&&Z.warn(`Failed to read file: ${t}`,o),null}}async write(t,r,s={}){let{format:n="auto",overwrite:i=!1,dryRun:o=!1,verbose:a=!1}=s,l=this.normalizePath(t),u=this.normalizePath(ze(l)),f=this.pathExists(l);if(f&&!i)return a&&Z.info(`Skipping existing file: ${l}`),!1;if(o)return Z.info(`[DRY RUN] Would write file: ${l}`),!0;try{await T.promises.mkdir(u,{recursive:!0})}catch(m){if(m?.code!=="EEXIST")throw m}let g=this._detectFormat(t,n),p;Buffer.isBuffer(r)?p=r:g==="json"&&typeof r=="object"?p=JSON.stringify(r,null,2):p=String(r);try{return await Jr(async()=>(Buffer.isBuffer(p)?await T.promises.writeFile(l,p):await T.promises.writeFile(l,p,"utf8"),a&&Z.info(`${f?"Updated":"Created"} file: ${l}`),!0),`Failed to write file: ${l}`)}catch{return!1}}writeSync(t,r,s={}){let{format:n="auto",overwrite:i=!1,dryRun:o=!1,verbose:a=!1}=s,l=this.normalizePath(t),u=this.normalizePath(ze(l)),f=this.pathExists(l);if(f&&!i)return a&&Z.info(`Skipping existing file: ${l}`),!1;if(o)return Z.info(`[DRY RUN] Would write file: ${l}`),!0;try{T.mkdirSync(u,{recursive:!0})}catch(m){if(m?.code!=="EEXIST")throw m}let g=this._detectFormat(t,n),p;Buffer.isBuffer(r)?p=r:g==="json"&&typeof r=="object"?p=JSON.stringify(r,null,2):p=String(r);try{return Buffer.isBuffer(p)?T.writeFileSync(l,p):T.writeFileSync(l,p,"utf8"),a&&Z.info(`${f?"Updated":"Created"} file: ${l}`),!0}catch(m){throw new Error(`Failed to write file: ${l}: ${m instanceof Error?m.message:String(m)}`)}}async copy(t,r,s={}){let{overwrite:n=!1,dryRun:i=!1,verbose:o=!1}=s,a=this.normalizePath(r),l=this.pathExists(a);if(l&&!n)return o&&Z.info(`Skipping existing file: ${a}`),!1;if(i)return Z.info(`[DRY RUN] Would copy file: ${a}`),!0;let u=this.normalizePath(ze(a));try{await T.promises.mkdir(u,{recursive:!0})}catch(f){if(f?.code!=="EEXIST")throw f}try{return await Jr(async()=>(await T.promises.copyFile(t,a),o&&Z.info(`${l?"Updated":"Created"} file: ${a}`),!0),`Failed to copy file from ${t} to ${a}`)}catch{return!1}}copySync(t,r,s={}){let{overwrite:n=!1,dryRun:i=!1,verbose:o=!1}=s,a=this.normalizePath(r),l=this.pathExists(a);if(l&&!n)return o&&Z.info(`Skipping existing file: ${a}`),!1;if(i)return Z.info(`[DRY RUN] Would copy file: ${a}`),!0;let u=this.normalizePath(ze(a));try{T.mkdirSync(u,{recursive:!0})}catch(f){if(f?.code!=="EEXIST")throw f}try{return T.copyFileSync(t,a),o&&Z.info(`${l?"Updated":"Created"} file: ${a}`),!0}catch{return!1}}pathExists(t,r=!1){try{return T.existsSync(t)}catch(s){return r||Z.error(`Error checking path existence: ${t}`,s),!1}}mkdir(t){try{let r=t.startsWith("/")||t.match(/^[A-Z]:/)?this.normalizePath(t):this.resolveAppPath(t);return T.existsSync(r)||T.mkdirSync(r,{recursive:!0}),!0}catch{return!1}}readdirSync(t,r){try{return T.readdirSync(t,r)}catch(s){return this.options.debug&&Z.warn(`Failed to read directory: ${t}`,s),r&&typeof r=="object"&&"withFileTypes"in r&&r.withFileTypes?[]:[]}}statSync(t){try{return T.statSync(t)}catch(r){return this.options.debug&&Z.warn(`Failed to stat file: ${t}`,r),null}}lstatSync(t){try{return T.lstatSync(t)}catch(r){return this.options.debug&&Z.warn(`Failed to lstat file: ${t}`,r),null}}async ensureDir(t){try{await T.promises.mkdir(t,{recursive:!0})}catch(r){if(r?.code!=="EEXIST")throw r}}ensureDirSync(t){try{T.mkdirSync(t,{recursive:!0})}catch(r){if(r?.code!=="EEXIST")throw r}}async remove(t){await T.promises.rm(t,{recursive:!0,force:!0})}removeSync(t){T.rmSync(t,{recursive:!0,force:!0})}async readdir(t,r){return T.promises.readdir(t,r)}stripBom(t){return t.charCodeAt(0)===65279?t.slice(1):t}getRepoRoot(){return this._repoRoot||process.cwd()}getAppRoot(){return this._appRoot?this._appRoot:this._repoRoot}setAppRoot(t){if(!t)throw new Error("PathResolver.setAppRoot: root cannot be undefined or null");this._appRoot=this.normalizePath(t)}isMonorepo(){let t=Ce(this._repoRoot,"packages");return this.pathExists(t)}isWithinApp(t){let r=this.normalizePath(kt(t)),s=this.getAppRoot(),n=Hr(s,r),i=this.normalizePath(n);return!i.startsWith("../")&&!i.startsWith("/")}async findFiles(t,r,s={}){let n=this.normalizePath(Ce(t,r)),i=this.getAppRoot(),o=this.normalizePath(i),a=n.startsWith(o)?n.slice(o.length+1):n,l={absolute:!0,onlyFiles:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:i,ignore:rt.SCAN_PATTERNS?.globalIgnore||["**/node_modules/**","**/dist/**","**/build/**","**/.git/**"]};return await this._globWithNormalization([a],{...l,...s})}clearCache(){}async _resolveFrameworkI18nPattern(t){let r=rt.I18N_PATHS;if(!r)return null;let s=t.replace(r.SOURCE_ROOT+"/",""),n=this.resolveFrameworkPackage("@donotdev/core");if(!n)return null;let i=this.normalizePath(Ce(n,r.PUBLISHED_ROOT,s)),o=i.replace(/\/[^/]*\*.*$/,"");return this.pathExists(o),i}async _globWithNormalization(t,r){return(await ao(t,r)).map(n=>{let i=typeof n=="string"?n:n.path;return this.normalizePath(i)})}async resolveFiles(t,r="css"){if(!t||typeof t!="object")return{frameworkFiles:[],consumerFiles:[]};if(r==="i18n")return{frameworkFiles:[],consumerFiles:[]};if(Array.isArray(t.framework)||(t.framework=[]),!Array.isArray(t.consumer))return{frameworkFiles:[],consumerFiles:[]};let s=[...t.framework,...t.consumer];for(let f of s)if(typeof f!="string"||f.trim()==="")return{frameworkFiles:[],consumerFiles:[]};let n=this.getAppRoot(),i=rt.getGlobOptionsFor?rt.getGlobOptionsFor(r):{ignore:["**/node_modules/**","**/dist/**","**/build/**"]},o=this.normalizePath(n),a=t.framework.map(f=>{let g=this.normalizePath(f);return g.startsWith(o)?g.slice(o.length+1):g}),l=t.consumer.map(f=>{let g=this.normalizePath(f);return g.startsWith(o)?g.slice(o.length+1):g}),u={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:n};try{let f=a.length>0?await this._globWithNormalization(a,u):[],g=await this._globWithNormalization(l,u);return{frameworkFiles:f,consumerFiles:g}}catch{return this.options.debug,{frameworkFiles:[],consumerFiles:[]}}}async resolvePatterns(t){if(!rt.getPatternsFor)return{framework:[],consumer:[],all:[]};let r=this.getAppRoot(),s=this.getRepoRoot();if(t==="i18n"&&(!r||r===s))throw new Error(`Cannot resolve i18n patterns: appRoot not set (appRoot: ${r}, repoRoot: ${s}). Ensure configResolved hook has run before discovery.`);let n=rt.getPatternsFor(t),i=this.isMonorepo();if(t==="i18n"){let l=n,u={eager:l.eager.map(f=>f.startsWith("!")?"!"+this.resolveAppPath(f.slice(1)):this.resolveAppPath(f)),lazy:l.lazy.map(f=>f.startsWith("!")?"!"+this.resolveAppPath(f.slice(1)):this.resolveAppPath(f)),framework:{eager:i?(l.framework?.eager||[]).map(f=>this.resolveRepoPath(f)).filter(Boolean):await Promise.all((l.framework?.eager||[]).map(f=>this._resolveFrameworkI18nPattern(f))).then(f=>f.filter(Boolean)),lazy:i?(l.framework?.lazy||[]).map(f=>this.resolveRepoPath(f)).filter(Boolean):await Promise.all((l.framework?.lazy||[]).map(f=>this._resolveFrameworkI18nPattern(f))).then(f=>f.filter(Boolean))},all:[]};return u.all=[...u.eager,...u.lazy,...u.framework.eager,...u.framework.lazy],u}let o=n,a={framework:i?(o.framework||[]).map(l=>this.resolveRepoPath(l)).filter(Boolean):[],consumer:(o.consumer||[]).map(l=>this.resolveAppPath(l)),all:[]};return a.all=[...a.consumer,...a.framework],a}getEmptyModulePath(t=!1){if(t)return"@donotdev/core/empty";let r=this.resolvePackage("@donotdev/core/empty");if(r)return r;let s=ze(oo(import.meta.url));return this.normalizePath(Ce(s,"../empty.js"))}_findRepoRoot(t){let r=this.normalizePath(t),s=0,n=this.options.maxLevels;for(;s<n;){let i=this.normalizePath(Ce(r,Xr.TOOLING)),o=this.normalizePath(Ce(r,Xr.CORE));if(this.pathExists(i)&&this.pathExists(o))return r;let a=Ce(r,"apps");if(this.pathExists(a)&&this.statSync(a)?.isDirectory())return this.normalizePath(r);let l=this.normalizePath(Ce(r,"package.json"));if(this.pathExists(l)&&this.normalizePath(ze(r))===r)return r;let u=this.normalizePath(ze(r));if(u===r)break;r=u,s++}return this.normalizePath(t)}};var Ee={reset:"\x1B[0m",green:"\x1B[32m",brightGreen:"\x1B[92m",red:"\x1B[31m",brightRed:"\x1B[91m",yellow:"\x1B[33m",brightYellow:"\x1B[93m",blue:"\x1B[34m",cyan:"\x1B[36m",brightCyan:"\x1B[96m",gray:"\x1B[90m",white:"\x1B[37m"};function lo(){return process.env.NO_COLOR?!1:process.platform==="win32"?!0:process.stdout.isTTY===!0}function Pe(e,t){return lo()?`${t}${e}${Ee.reset}`:e}function z(e,t,r,s={}){let{logDir:n=".dndev-logs",fileLogging:i=!1}=s,o=W.getInstance(),a=null;if(i){let f=o.resolveAppPath(n);o.pathExists(f)||o.mkdir(f),a=o.resolveAppPath(`${n}/${e.replace(/[^a-zA-Z0-9]/g,"-")}.log`);let g=`=== ${e} Log Started at ${new Date().toISOString()} ===
3
- `;o.writeSync(a,g)}let l=(f,g,p)=>{if(a){let m=new Date().toISOString(),I=p.length>0?" "+p.map(H=>typeof H=="object"?JSON.stringify(H,null,2):String(H)).join(" "):"",q=`${m} [${f}] ${g}${I}
4
- `;o.appendFile(a,q)}},u=(f,g)=>{if(g.length===0)return f;let p=g.map(m=>typeof m=="object"?JSON.stringify(m,null,2):String(m)).join(" ");return`${f} ${p}`};return{debug:(f,...g)=>{t&&(i?l("DEBUG",f,g):he.log.message(Pe(u(f,g),Ee.gray)))},verbose:(f,...g)=>{r&&(i?l("VERBOSE",f,g):he.log.message(u(f,g)))},info:(f,...g)=>{i?l("INFO",f,g):he.log.info(Pe(u(f,g),Ee.brightCyan))},warn:(f,...g)=>{t&&i?l("WARN",f,g):he.log.warn(Pe(u(f,g),Ee.brightYellow))},error:(f,...g)=>{t&&i?l("ERROR",f,g):he.log.error(Pe(u(f,g),Ee.brightRed))},success:(f,...g)=>{t&&i?l("SUCCESS",f,g):he.log.success(Pe(u(f,g),Ee.brightGreen))},when:(f,g="debug")=>(p,...m)=>{if(f){let I=u(p,m);switch(g){case"verbose":r&&(he.log.message(I),l("VERBOSE",p,m));break;case"info":he.log.info(Pe(I,Ee.brightCyan)),l("INFO",p,m);break;case"warn":he.log.warn(Pe(I,Ee.brightYellow)),l("WARN",p,m);break;case"error":he.log.error(Pe(I,Ee.brightRed)),l("ERROR",p,m);break;case"success":he.log.success(Pe(I,Ee.brightGreen)),l("SUCCESS",p,m);break;default:t&&(he.log.message(Pe(I,Ee.gray)),l("DEBUG",p,m))}}},getLogFilePath:()=>a}}function Yr(e={}){let{mode:t="development",chunkingOptions:r={},debug:s,verbose:n=!0,isDev:i,isDebug:o,shouldAnalyze:a,build:l={}}=e,u=z("build",s,n),f=Ur(t,r);return u.debug("\u{1F41B} DEBUG MODE ENABLED:"),u.debug(" - Minification: DISABLED"),u.debug(" - Sourcemaps: ENABLED"),u.debug(" - Console logs: PRESERVED"),u.debug(" - Debugger statements: PRESERVED"),a&&(u.info("\u{1F4CA} Bundle analysis enabled"),u.info(` Visual treemap will open after build (stats.html)
5
- `)),{outDir:"dist",sourcemap:i||o,cacheDir:"node_modules/.vite",target:"baseline-widely-available",minify:o?!1:"esbuild",reportCompressedSize:!1,chunkSizeWarningLimit:2048,assetsInlineLimit:0,esbuild:{format:"esm",drop:o?[]:["console","debugger"],legalComments:"none"},cssMinify:o?!1:"esbuild",cssCodeSplit:!0,rollupOptions:{external:fo(),output:{format:"es",entryFileNames:"assets/[name].[hash].js",chunkFileNames:"assets/[name].[hash].js",assetFileNames:"assets/[name].[hash][extname]",...f.manualChunks&&{manualChunks:f.manualChunks},compact:!0},onwarn(p,m){p.code!=="MODULE_LEVEL_DIRECTIVE"&&m(p)},plugins:[...o?[]:[co({include:["**/*.js","**/*.ts","**/*.tsx","**/*.jsx"],functions:["console.*","debugger"],labels:["debug"]})],...a?[(()=>{let p=W.getInstance(),m=p.getAppRoot(),I="dist",q=p.resolveAppPath(`${I}/stats.html`),H=()=>{try{let k=p.resolveAppPath(I);p.pathExists(k)||p.mkdir(k)}catch{}},$=uo({filename:q,open:!0,gzipSize:!0,brotliSize:!0,template:"treemap",sourcemap:i||o,projectRoot:m});if($.buildStart){let k=$.buildStart.bind($);$.buildStart=function(...D){H();let N=k.apply(this,D);return N&&typeof N.then=="function"?N.catch(E=>{}):N}}else $.buildStart=function(){H()};let C=["generateBundle","writeBundle","closeBundle"];for(let k of C)if($[k]){let D=$[k];$[k]=function(...N){try{H();let E=D.apply(this,N);return E&&typeof E.then=="function"?E.catch(M=>{let L=M?.message||M?.toString()||String(M)||"Unknown error";u.warn(`Bundle visualizer warning in ${k}: ${L}`),k==="closeBundle"&&u.warn(`You can manually open ${q} to view the bundle analysis`)}):E}catch(E){let M=E?.message||E?.toString()||String(E)||"Unknown error";buildLogger.warn(`Bundle visualizer warning in ${k}: ${M}`),k==="closeBundle"&&buildLogger.warn(` You can manually open ${q} to view the bundle analysis`)}}}return $})()]:[]]}}}function fo(e){return e?["firebase-admin","gcp-metadata","google-logging-utils","@google-cloud/firestore",/\.node$/,"esbuild",/@esbuild\/.*/]:["gcp-metadata","google-logging-utils","payload","file-type","firebase-admin","firebase-admin/app","firebase-admin/auth","firebase-admin/firestore","firebase-admin/functions","firebase-admin/credential","@google-cloud/firestore","google-auth-library","google-gax","googleapis-common"]}function ho(){let e=!1,t=W.getInstance();if((t.pathExists("/.dockerenv")||t.pathExists("/run/.containerenv"))&&(e=!0),!e&&(process.env.DOCKER_CONTAINER==="true"||process.env.IS_DOCKER==="true"||process.env.DOCKER_BUILDKIT==="1"||process.env.CI==="true"&&process.env.DOCKER==="true")&&(e=!0),!e&&process.env.DOCKER_HOST&&process.env.DOCKER_HOST.includes("docker")&&(e=!0),!e&&process.platform==="linux"&&t.pathExists("/proc/self/cgroup"))try{let n=t.readSync("/proc/self/cgroup");n&&(n.includes("docker")||n.includes("containerd"))&&(e=!0)}catch{}let r=!1;if((process.env.WSL_DISTRO_NAME||process.env.WSLENV)&&(r=!0),!r&&process.platform==="linux"&&t.pathExists("/proc/version"))try{let n=(t.readSync("/proc/version")||"").toLowerCase();r=n.includes("microsoft")||n.includes("wsl")}catch{}if(!r&&process.platform==="linux"&&t.pathExists("/proc/sys/kernel/osrelease"))try{let n=(t.readSync("/proc/sys/kernel/osrelease")||"").toLowerCase()||"";(n.includes("microsoft")||n.includes("wsl"))&&(r=!0)}catch{}if(!r&&process.platform==="win32"){let n=process.cwd();n&&(n.includes("\\wsl$")||n.includes("\\wsl.localhost"))&&(r=!0)}let s=typeof process.versions?.bun=="string";return{isDocker:e,isWSL2:r,isBun:s}}function go(e,t){if(e!==void 0)return e;let{isDocker:r,isWSL2:s,isBun:n}=ho();if(r||s||n){let i=r?"Docker":s?"WSL2":"Bun";return t.info(`Detected ${i} environment - enabling polling mode for file watching`),!0}}function Kr(e,t={},r){let s=W.getInstance(),n=s.getRepoRoot(),{watch:i,hmr:o,host:a,...l}=t||{},u=o||{},f=a===!0?"localhost":a||"localhost",g={...u.port&&{port:u.port},...u.clientPort&&{clientPort:u.clientPort},host:u.host??f,...u.protocol&&{protocol:u.protocol},overlay:u.overlay??!0,timeout:u.timeout??5e3},p=a!==void 0?a:!0,m=l.https===!0;return{port:e,host:p,open:t.open!==void 0?t.open:!0,https:m,fs:{allow:[n,s.resolveRepoPath("packages"),s.resolveRepoPath("node_modules")],strict:!1},watch:{usePolling:go(t?.watch?.usePolling,r),interval:t?.watch?.interval??2e3,...t?.watch||{}},hmr:{...g,...u},headers:{"Cross-Origin-Opener-Policy":"same-origin-allow-popups","Cross-Origin-Embedder-Policy":"unsafe-none"},middlewareMode:!1,...l}}function Qr(e={}){let t=e.https===!0;return{...e,https:t}}var me={CONCATENATE_DEDUPE:"CONCATENATE_DEDUPE",SHALLOW_MERGE:"SHALLOW_MERGE",DEEP_MERGE:"DEEP_MERGE",REPLACE:"REPLACE"};function Be(e,t,r,s={}){let{protectedKeys:n=[],onConflict:i}=s;if(t==null)return e;switch(r){case me.CONCATENATE_DEDUPE:{if(!Array.isArray(e)||!Array.isArray(t))return t;let o=[...e,...t];return[...new Set(o)]}case me.SHALLOW_MERGE:return typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)||Array.isArray(t)?t:{...e,...t};case me.DEEP_MERGE:{if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)||Array.isArray(t))return t;let o={...e};for(let a in t){if(n.includes(a)){i&&i(a,e[a],t[a]);continue}typeof o[a]=="object"&&typeof t[a]=="object"&&o[a]!==null&&t[a]!==null&&!Array.isArray(o[a])&&!Array.isArray(t[a])?o[a]=Be(o[a],t[a],me.DEEP_MERGE,{protectedKeys:n,onConflict:i}):o[a]=t[a]}return o}case me.REPLACE:default:return t}}function Zr(e,t,r=[],s){let n=[...e,...t||[]],i=[...new Set(n)];return[...new Set([...i,...r])]}var At={base:"/",mode:process.env.NODE_ENV==="production"?"production":"development",debug:!1,verbose:process.env.CI!=="true",server:{port:3e3,strictPort:!0,host:!0,open:!0,cors:!0,https:!0,hmr:{overlay:!0,timeout:5e3,usePolling:void 0,interval:2e3},watch:{usePolling:void 0,interval:2e3}},build:{sourcemap:!0,target:"es2020",minify:"esbuild",cssMinify:"esbuild",analyze:!0},preview:{port:4173,strictPort:!0,host:!0,open:!1,cors:!0,https:!0},routes:{hmr:!0},themes:{},i18n:{},assets:{copyFonts:!0},features:{},pwa:{enabled:!1},seo:{disabled:!1,generateRobotsTxt:!0,generateSitemap:!0,crawlDelay:1},serverShim:{enabled:!0},chunking:{reactCore:[]},discovery:{verbose:!0,cacheTimeout:6e4,fileLogging:!1,logDir:".dndev-logs"},pluginFactory:{verbose:!0,disableHmr:!1,hmrSmartDetection:!0,hmrDebounceMs:500,hmrCacheTimeout:3e4},resolve:{alias:{"@":"/src"},preserveSymlinks:!1},define:{__DEV__:JSON.stringify(process.env.NODE_ENV==="development"),__PROD__:JSON.stringify(process.env.NODE_ENV==="production")},optimizeDeps:{include:[...Xe.mandatoryIncludes],exclude:[...Xe.buildTools,...Object.values(U)],esbuildOptions:{format:"esm",target:"es2020",platform:"browser",define:{"process.env.NODE_ENV":JSON.stringify(process.env.NODE_ENV||"development")},external:["next","next/*"]}},plugins:[],css:{},envDir:void 0};function es(e={},t={}){let{onConflict:r}=t,s={...At},n=[],i=(o,a,l,u)=>{n.push({key:o,frameworkValue:a,userValue:l,reason:u}),r&&r(o,a,l,u)};return Object.keys(e).forEach(o=>{let a=e[o],l=s[o];if(o==="optimizeDeps"&&typeof a=="object"&&a!==null){let u=l?.include||[],f=l?.exclude||[],g=a.include||[],p=a.exclude||[],m=u.filter(C=>!C.startsWith("@donotdev/")),I=p.filter(C=>m.includes(C));if(I.length>0)for(let C of I)i("optimizeDeps.exclude",C,"excluded",`Framework requires ${C} to be included. It will be included despite your exclusion.`);let q=Zr(u,g,m),H=Be(f,p,me.CONCATENATE_DEDUPE),$=Be(l?.esbuildOptions||{},a.esbuildOptions||{},me.DEEP_MERGE,{protectedKeys:["external"],onConflict:C=>i(`optimizeDeps.esbuildOptions.${C}`,l?.esbuildOptions?.[C],a.esbuildOptions?.[C],`Framework requires ${C} to remain as configured.`)});s[o]={...l,include:q,exclude:H,esbuildOptions:$,...Object.fromEntries(Object.entries(a).filter(([C])=>!["include","exclude","esbuildOptions"].includes(C)))};return}if(o==="css"&&typeof a=="object"&&a!==null){s[o]=Be(l||{},a,me.DEEP_MERGE,{protectedKeys:["postcss"],onConflict:()=>i("css.postcss","framework PostCSS config",a.postcss,"Framework PostCSS config is required and cannot be overridden. Your postcss config is ignored.")});return}if(o==="define"&&typeof a=="object"&&a!==null){s[o]=Be(l||{},a,me.DEEP_MERGE,{protectedKeys:["__DEV__","__PROD__"],onConflict:u=>i(`define.${u}`,l?.[u],a[u],`Framework requires ${u} to remain as configured.`)});return}if(Array.isArray(a)){Array.isArray(l)?s[o]=Be(l,a,me.CONCATENATE_DEDUPE):s[o]=a;return}if(typeof a=="object"&&a!==null&&typeof l=="object"&&l!==null&&!Array.isArray(l)){s[o]=Be(l,a,me.SHALLOW_MERGE);return}s[o]=a}),s}function ts(e){let{server:t={},preview:r={},mode:s,build:n={},resolve:i={},routes:o={},themes:a={},i18n:l={},assets:u={},features:f={},seo:g={},pwa:p={},serverShim:m={},chunking:I={},discovery:q={},pluginFactory:H={},debug:$,verbose:C,base:k,define:D={},optimizeDeps:N={},plugins:E=[],css:M={},envDir:L,...ue}=e,S=s!=="production",A=$||S,te=s==="production"&&(n.analyze??At.build.analyze);return{mode:s,debug:$,verbose:C,isDev:S,isDebug:A,shouldAnalyze:te,serverOptions:t,previewOptions:r,buildOverrides:n,resolveOptions:i,routeOptions:o,themeOptions:a,i18nOptions:l,assetOptions:u,featureOptions:f,seoOptions:g,pwaOptions:p,serverShimOptions:m,chunkingOptions:I,discoveryOptions:q,pluginFactoryOptions:H,base:k,defineOptions:D,optimizeDepsOptions:N,pluginsOptions:E,cssOptions:M,envDir:L,restOptions:ue}}import{resolve as po}from"node:path";import mo from"autoprefixer";import bo from"postcss-import";import vo from"postcss-nesting";function rs({postcssImport:e,postcssNesting:t,autoprefixer:r,resolve:s}){return{plugins:[s?e({resolve:s}):e,t,r({overrideBrowserslist:["> 1%","last 2 versions","Firefox ESR","not dead","not op_mini all"],grid:"autoplace"})]}}function ss(e={}){return e.postcss?e.postcss:async()=>{let t=W.getInstance();return rs({postcssImport:bo,postcssNesting:vo,autoprefixer:mo,resolve:(s,n)=>{let i=t.resolvePackage(s,n);if(i)return i;if(s.startsWith("@donotdev/")){let o=s.split("/")[0]+"/"+s.split("/")[1],a=s.split("/").slice(2).join("/"),l=t.resolveFrameworkPackage(o,n);if(l&&a){let u=t.resolvePath(a,l);if(t.pathExists(u))return u}}return po(n,s)}})}}import tf from"@vitejs/plugin-basic-ssl";import rf from"@vitejs/plugin-react";import sf from"vite-tsconfig-paths";var ie=class{static generateVirtualModule(t,r,s=!1,n=void 0,i=void 0){return r.isEmpty(t)?r.generateEmpty(t,s,n,i):r.generateModule(t,s,i)}static generateInspection(t,r,s,n){return r.generateInspection.length>=3?r.generateInspection(t,s,n):r.generateInspection(t,s)}static wrapVirtualModule(t,r){return`// Virtual module: ${t}
1
+ var Xi=Object.create;var Br=Object.defineProperty;var Yi=Object.getOwnPropertyDescriptor;var Ki=Object.getOwnPropertyNames;var Qi=Object.getPrototypeOf,Zi=Object.prototype.hasOwnProperty;var V=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var N=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var eo=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ki(t))!Zi.call(e,n)&&n!==r&&Br(e,n,{get:()=>t[n],enumerable:!(s=Yi(t,n))||s.enumerable});return e};var to=(e,t,r)=>(r=e!=null?Xi(Qi(e)):{},eo(t||!e||!e.__esModule?Br(r,"default",{value:e,enumerable:!0}):r,e));var Re=N((eh,ls)=>{var as=e=>typeof e<"u"&&e!==null,So=e=>typeof e=="object",Ro=e=>Object.prototype.toString.call(e)==="[object Object]",$o=e=>typeof e=="function",ko=e=>typeof e=="boolean",Ao=e=>e instanceof Buffer,_o=e=>{if(as(e))switch(e.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},No=e=>e instanceof ArrayBuffer,Io=e=>typeof e=="string"&&e.length>0,Do=e=>typeof e=="number"&&!Number.isNaN(e),To=e=>Number.isInteger(e),Co=(e,t,r)=>e>=t&&e<=r,Fo=(e,t)=>t.includes(e),Oo=(e,t,r)=>new Error(`Expected ${t} for ${e} but received ${r} of type ${typeof r}`),jo=(e,t)=>(t.message=e.message,t);ls.exports={defined:as,object:So,plainObject:Ro,fn:$o,bool:ko,buffer:Ao,typedArray:_o,arrayBuffer:No,string:Io,number:Do,integer:To,inRange:Co,inArray:Fo,invalidParameterError:Oo,nativeError:jo}});var fs=N((th,us)=>{"use strict";var cs=()=>process.platform==="linux",Nt=null,Lo=()=>{if(!Nt)if(cs()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,Nt=process.report.getReport(),process.report.excludeNetwork=e}else Nt={};return Nt};us.exports={isLinux:cs,getReport:Lo}});var ds=N((rh,hs)=>{"use strict";var st=V("fs"),Mo="/usr/bin/ldd",zo="/proc/self/exe",It=2048,Bo=e=>{let t=st.openSync(e,"r"),r=Buffer.alloc(It),s=st.readSync(t,r,0,It,0);return st.close(t,()=>{}),r.subarray(0,s)},Uo=e=>new Promise((t,r)=>{st.open(e,"r",(s,n)=>{if(s)r(s);else{let i=Buffer.alloc(It);st.read(n,i,0,It,0,(o,a)=>{t(i.subarray(0,a)),st.close(n,()=>{})})}})});hs.exports={LDD_PATH:Mo,SELF_PATH:zo,readFileSync:Bo,readFile:Uo}});var ps=N((sh,gs)=>{"use strict";var Go=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),s=e.readUInt16LE(56);for(let n=0;n<s;n++){let i=t+n*r;if(e.readUInt32LE(i)===3){let a=e.readUInt32LE(i+8),l=e.readUInt32LE(i+32);return e.subarray(a,a+l).toString().replace(/\0.*$/g,"")}}return null};gs.exports={interpreterPath:Go}});var Tt=N((nh,Ts)=>{"use strict";var bs=V("child_process"),{isLinux:nt,getReport:vs}=fs(),{LDD_PATH:Dt,SELF_PATH:ys,readFile:ar,readFileSync:lr}=ds(),{interpreterPath:ws}=ps(),$e,ke,Ae,Es="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",Be="",xs=()=>Be||new Promise(e=>{bs.exec(Es,(t,r)=>{Be=t?" ":r,e(Be)})}),Ps=()=>{if(!Be)try{Be=bs.execSync(Es,{encoding:"utf8"})}catch{Be=" "}return Be},Ce="glibc",Ss=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,Ye="musl",qo=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),Rs=()=>{let e=vs();return e.header&&e.header.glibcVersionRuntime?Ce:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(qo)?Ye:null},$s=e=>{let[t,r]=e.split(/[\r\n]+/);return t&&t.includes(Ce)?Ce:r&&r.includes(Ye)?Ye:null},ks=e=>{if(e){if(e.includes("/ld-musl-"))return Ye;if(e.includes("/ld-linux-"))return Ce}return null},As=e=>(e=e.toString(),e.includes("musl")?Ye:e.includes("GNU C Library")?Ce:null),Wo=async()=>{if(ke!==void 0)return ke;ke=null;try{let e=await ar(Dt);ke=As(e)}catch{}return ke},Ho=()=>{if(ke!==void 0)return ke;ke=null;try{let e=lr(Dt);ke=As(e)}catch{}return ke},Vo=async()=>{if($e!==void 0)return $e;$e=null;try{let e=await ar(ys),t=ws(e);$e=ks(t)}catch{}return $e},Jo=()=>{if($e!==void 0)return $e;$e=null;try{let e=lr(ys),t=ws(e);$e=ks(t)}catch{}return $e},_s=async()=>{let e=null;if(nt()&&(e=await Vo(),!e&&(e=await Wo(),e||(e=Rs()),!e))){let t=await xs();e=$s(t)}return e},Ns=()=>{let e=null;if(nt()&&(e=Jo(),!e&&(e=Ho(),e||(e=Rs()),!e))){let t=Ps();e=$s(t)}return e},Xo=async()=>nt()&&await _s()!==Ce,Yo=()=>nt()&&Ns()!==Ce,Ko=async()=>{if(Ae!==void 0)return Ae;Ae=null;try{let t=(await ar(Dt)).match(Ss);t&&(Ae=t[1])}catch{}return Ae},Qo=()=>{if(Ae!==void 0)return Ae;Ae=null;try{let t=lr(Dt).match(Ss);t&&(Ae=t[1])}catch{}return Ae},Is=()=>{let e=vs();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},ms=e=>e.trim().split(/\s+/)[1],Ds=e=>{let[t,r,s]=e.split(/[\r\n]+/);return t&&t.includes(Ce)?ms(t):r&&s&&r.includes(Ye)?ms(s):null},Zo=async()=>{let e=null;if(nt()&&(e=await Ko(),e||(e=Is()),!e)){let t=await xs();e=Ds(t)}return e},ea=()=>{let e=null;if(nt()&&(e=Qo(),e||(e=Is()),!e)){let t=Ps();e=Ds(t)}return e};Ts.exports={GLIBC:Ce,MUSL:Ye,family:_s,familySync:Ns,isNonGlibcLinux:Xo,isNonGlibcLinuxSync:Yo,version:Zo,versionSync:ea}});var vt=N((ih,Cs)=>{"use strict";var ta=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>{}:()=>{};Cs.exports=ta});var Ct=N((oh,Fs)=>{"use strict";var ra="2.0.0",sa=Number.MAX_SAFE_INTEGER||9007199254740991,na=16,ia=250,oa=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Fs.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:na,MAX_SAFE_BUILD_LENGTH:ia,MAX_SAFE_INTEGER:sa,RELEASE_TYPES:oa,SEMVER_SPEC_VERSION:ra,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var yt=N((_e,Os)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:cr,MAX_SAFE_BUILD_LENGTH:aa,MAX_LENGTH:la}=Ct(),ca=vt();_e=Os.exports={};var ua=_e.re=[],fa=_e.safeRe=[],y=_e.src=[],ha=_e.safeSrc=[],w=_e.t={},da=0,ur="[a-zA-Z0-9-]",ga=[["\\s",1],["\\d",la],[ur,aa]],pa=e=>{for(let[t,r]of ga)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},R=(e,t,r)=>{let s=pa(t),n=da++;ca(e,n,t),w[e]=n,y[n]=t,ha[n]=s,ua[n]=new RegExp(t,r?"g":void 0),fa[n]=new RegExp(s,r?"g":void 0)};R("NUMERICIDENTIFIER","0|[1-9]\\d*");R("NUMERICIDENTIFIERLOOSE","\\d+");R("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${ur}*`);R("MAINVERSION",`(${y[w.NUMERICIDENTIFIER]})\\.(${y[w.NUMERICIDENTIFIER]})\\.(${y[w.NUMERICIDENTIFIER]})`);R("MAINVERSIONLOOSE",`(${y[w.NUMERICIDENTIFIERLOOSE]})\\.(${y[w.NUMERICIDENTIFIERLOOSE]})\\.(${y[w.NUMERICIDENTIFIERLOOSE]})`);R("PRERELEASEIDENTIFIER",`(?:${y[w.NONNUMERICIDENTIFIER]}|${y[w.NUMERICIDENTIFIER]})`);R("PRERELEASEIDENTIFIERLOOSE",`(?:${y[w.NONNUMERICIDENTIFIER]}|${y[w.NUMERICIDENTIFIERLOOSE]})`);R("PRERELEASE",`(?:-(${y[w.PRERELEASEIDENTIFIER]}(?:\\.${y[w.PRERELEASEIDENTIFIER]})*))`);R("PRERELEASELOOSE",`(?:-?(${y[w.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${y[w.PRERELEASEIDENTIFIERLOOSE]})*))`);R("BUILDIDENTIFIER",`${ur}+`);R("BUILD",`(?:\\+(${y[w.BUILDIDENTIFIER]}(?:\\.${y[w.BUILDIDENTIFIER]})*))`);R("FULLPLAIN",`v?${y[w.MAINVERSION]}${y[w.PRERELEASE]}?${y[w.BUILD]}?`);R("FULL",`^${y[w.FULLPLAIN]}$`);R("LOOSEPLAIN",`[v=\\s]*${y[w.MAINVERSIONLOOSE]}${y[w.PRERELEASELOOSE]}?${y[w.BUILD]}?`);R("LOOSE",`^${y[w.LOOSEPLAIN]}$`);R("GTLT","((?:<|>)?=?)");R("XRANGEIDENTIFIERLOOSE",`${y[w.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);R("XRANGEIDENTIFIER",`${y[w.NUMERICIDENTIFIER]}|x|X|\\*`);R("XRANGEPLAIN",`[v=\\s]*(${y[w.XRANGEIDENTIFIER]})(?:\\.(${y[w.XRANGEIDENTIFIER]})(?:\\.(${y[w.XRANGEIDENTIFIER]})(?:${y[w.PRERELEASE]})?${y[w.BUILD]}?)?)?`);R("XRANGEPLAINLOOSE",`[v=\\s]*(${y[w.XRANGEIDENTIFIERLOOSE]})(?:\\.(${y[w.XRANGEIDENTIFIERLOOSE]})(?:\\.(${y[w.XRANGEIDENTIFIERLOOSE]})(?:${y[w.PRERELEASELOOSE]})?${y[w.BUILD]}?)?)?`);R("XRANGE",`^${y[w.GTLT]}\\s*${y[w.XRANGEPLAIN]}$`);R("XRANGELOOSE",`^${y[w.GTLT]}\\s*${y[w.XRANGEPLAINLOOSE]}$`);R("COERCEPLAIN",`(^|[^\\d])(\\d{1,${cr}})(?:\\.(\\d{1,${cr}}))?(?:\\.(\\d{1,${cr}}))?`);R("COERCE",`${y[w.COERCEPLAIN]}(?:$|[^\\d])`);R("COERCEFULL",y[w.COERCEPLAIN]+`(?:${y[w.PRERELEASE]})?(?:${y[w.BUILD]})?(?:$|[^\\d])`);R("COERCERTL",y[w.COERCE],!0);R("COERCERTLFULL",y[w.COERCEFULL],!0);R("LONETILDE","(?:~>?)");R("TILDETRIM",`(\\s*)${y[w.LONETILDE]}\\s+`,!0);_e.tildeTrimReplace="$1~";R("TILDE",`^${y[w.LONETILDE]}${y[w.XRANGEPLAIN]}$`);R("TILDELOOSE",`^${y[w.LONETILDE]}${y[w.XRANGEPLAINLOOSE]}$`);R("LONECARET","(?:\\^)");R("CARETTRIM",`(\\s*)${y[w.LONECARET]}\\s+`,!0);_e.caretTrimReplace="$1^";R("CARET",`^${y[w.LONECARET]}${y[w.XRANGEPLAIN]}$`);R("CARETLOOSE",`^${y[w.LONECARET]}${y[w.XRANGEPLAINLOOSE]}$`);R("COMPARATORLOOSE",`^${y[w.GTLT]}\\s*(${y[w.LOOSEPLAIN]})$|^$`);R("COMPARATOR",`^${y[w.GTLT]}\\s*(${y[w.FULLPLAIN]})$|^$`);R("COMPARATORTRIM",`(\\s*)${y[w.GTLT]}\\s*(${y[w.LOOSEPLAIN]}|${y[w.XRANGEPLAIN]})`,!0);_e.comparatorTrimReplace="$1$2$3";R("HYPHENRANGE",`^\\s*(${y[w.XRANGEPLAIN]})\\s+-\\s+(${y[w.XRANGEPLAIN]})\\s*$`);R("HYPHENRANGELOOSE",`^\\s*(${y[w.XRANGEPLAINLOOSE]})\\s+-\\s+(${y[w.XRANGEPLAINLOOSE]})\\s*$`);R("STAR","(<|>)?=?\\s*\\*");R("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");R("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Ft=N((ah,js)=>{"use strict";var ma=Object.freeze({loose:!0}),ba=Object.freeze({}),va=e=>e?typeof e!="object"?ma:e:ba;js.exports=va});var Bs=N((lh,zs)=>{"use strict";var Ls=/^[0-9]+$/,Ms=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e===t?0:e<t?-1:1;let r=Ls.test(e),s=Ls.test(t);return r&&s&&(e=+e,t=+t),e===t?0:r&&!s?-1:s&&!r?1:e<t?-1:1},ya=(e,t)=>Ms(t,e);zs.exports={compareIdentifiers:Ms,rcompareIdentifiers:ya}});var it=N((ch,Gs)=>{"use strict";var Ot=vt(),{MAX_LENGTH:Us,MAX_SAFE_INTEGER:jt}=Ct(),{safeRe:Lt,t:Mt}=yt(),wa=Ft(),{compareIdentifiers:fr}=Bs(),hr=class e{constructor(t,r){if(r=wa(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Us)throw new TypeError(`version is longer than ${Us} characters`);Ot("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let s=t.trim().match(r.loose?Lt[Mt.LOOSE]:Lt[Mt.FULL]);if(!s)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>jt||this.major<0)throw new TypeError("Invalid major version");if(this.minor>jt||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>jt||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<jt)return i}return n}):this.prerelease=[],this.build=s[5]?s[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(Ot("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let s=this.prerelease[r],n=t.prerelease[r];if(Ot("prerelease compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return fr(s,n)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let s=this.build[r],n=t.build[r];if(Ot("build compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return fr(s,n)}while(++r)}inc(t,r,s){if(t.startsWith("pre")){if(!r&&s===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let n=`-${r}`.match(this.options.loose?Lt[Mt.PRERELEASELOOSE]:Lt[Mt.PRERELEASE]);if(!n||n[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,s);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,s);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,s),this.inc("pre",r,s);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,s),this.inc("pre",r,s);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let n=Number(s)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&s===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(r){let i=[r,n];s===!1&&(i=[r]),fr(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Gs.exports=hr});var Hs=N((uh,Ws)=>{"use strict";var qs=it(),Ea=(e,t,r=!1)=>{if(e instanceof qs)return e;try{return new qs(e,t)}catch(s){if(!r)return null;throw s}};Ws.exports=Ea});var Js=N((fh,Vs)=>{"use strict";var xa=it(),Pa=Hs(),{safeRe:zt,t:Bt}=yt(),Sa=(e,t)=>{if(e instanceof xa)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?zt[Bt.COERCEFULL]:zt[Bt.COERCE]);else{let l=t.includePrerelease?zt[Bt.COERCERTLFULL]:zt[Bt.COERCERTL],f;for(;(f=l.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||f.index+f[0].length!==r.index+r[0].length)&&(r=f),l.lastIndex=f.index+f[1].length+f[2].length;l.lastIndex=-1}if(r===null)return null;let s=r[2],n=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Pa(`${s}.${n}.${i}${o}${a}`,t)};Vs.exports=Sa});var Ke=N((hh,Ys)=>{"use strict";var Xs=it(),Ra=(e,t,r)=>new Xs(e,r).compare(new Xs(t,r));Ys.exports=Ra});var dr=N((dh,Ks)=>{"use strict";var $a=Ke(),ka=(e,t,r)=>$a(e,t,r)>=0;Ks.exports=ka});var Zs=N((gh,Qs)=>{"use strict";var gr=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(t,r)}return this}};Qs.exports=gr});var tn=N((ph,en)=>{"use strict";var Aa=Ke(),_a=(e,t,r)=>Aa(e,t,r)===0;en.exports=_a});var sn=N((mh,rn)=>{"use strict";var Na=Ke(),Ia=(e,t,r)=>Na(e,t,r)!==0;rn.exports=Ia});var on=N((bh,nn)=>{"use strict";var Da=Ke(),Ta=(e,t,r)=>Da(e,t,r)>0;nn.exports=Ta});var ln=N((vh,an)=>{"use strict";var Ca=Ke(),Fa=(e,t,r)=>Ca(e,t,r)<0;an.exports=Fa});var un=N((yh,cn)=>{"use strict";var Oa=Ke(),ja=(e,t,r)=>Oa(e,t,r)<=0;cn.exports=ja});var hn=N((wh,fn)=>{"use strict";var La=tn(),Ma=sn(),za=on(),Ba=dr(),Ua=ln(),Ga=un(),qa=(e,t,r,s)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return La(e,r,s);case"!=":return Ma(e,r,s);case">":return za(e,r,s);case">=":return Ba(e,r,s);case"<":return Ua(e,r,s);case"<=":return Ga(e,r,s);default:throw new TypeError(`Invalid operator: ${t}`)}};fn.exports=qa});var yn=N((Eh,vn)=>{"use strict";var wt=Symbol("SemVer ANY"),br=class e{static get ANY(){return wt}constructor(t,r){if(r=dn(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),mr("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===wt?this.value="":this.value=this.operator+this.semver.version,mr("comp",this)}parse(t){let r=this.options.loose?gn[pn.COMPARATORLOOSE]:gn[pn.COMPARATOR],s=t.match(r);if(!s)throw new TypeError(`Invalid comparator: ${t}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new mn(s[2],this.options.loose):this.semver=wt}toString(){return this.value}test(t){if(mr("Comparator.test",t,this.options.loose),this.semver===wt||t===wt)return!0;if(typeof t=="string")try{t=new mn(t,this.options)}catch{return!1}return pr(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new bn(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new bn(this.value,r).test(t.semver):(r=dn(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||pr(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||pr(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};vn.exports=br;var dn=Ft(),{safeRe:gn,t:pn}=yt(),pr=hn(),mr=vt(),mn=it(),bn=vr()});var vr=N((xh,Pn)=>{"use strict";var Wa=/\s+/g,yr=class e{constructor(t,r){if(r=Va(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof wr)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(Wa," "),this.set=this.raw.split("||").map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(n=>!En(n[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&el(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let s=0;s<r.length;s++)s>0&&(this.formatted+=" "),this.formatted+=r[s].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let s=((this.options.includePrerelease&&Qa)|(this.options.loose&&Za))+":"+t,n=wn.get(s);if(n)return n;let i=this.options.loose,o=i?oe[se.HYPHENRANGELOOSE]:oe[se.HYPHENRANGE];t=t.replace(o,ul(this.options.includePrerelease)),H("hyphen replace",t),t=t.replace(oe[se.COMPARATORTRIM],Xa),H("comparator trim",t),t=t.replace(oe[se.TILDETRIM],Ya),H("tilde trim",t),t=t.replace(oe[se.CARETTRIM],Ka),H("caret trim",t);let a=t.split(" ").map(g=>tl(g,this.options)).join(" ").split(/\s+/).map(g=>cl(g,this.options));i&&(a=a.filter(g=>(H("loose invalid filter",g,this.options),!!g.match(oe[se.COMPARATORLOOSE])))),H("range list",a);let l=new Map,f=a.map(g=>new wr(g,this.options));for(let g of f){if(En(g))return[g];l.set(g.value,g)}l.size>1&&l.has("")&&l.delete("");let u=[...l.values()];return wn.set(s,u),u}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(s=>xn(s,r)&&t.set.some(n=>xn(n,r)&&s.every(i=>n.every(o=>i.intersects(o,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new Ja(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(fl(this.set[r],t,this.options))return!0;return!1}};Pn.exports=yr;var Ha=Zs(),wn=new Ha,Va=Ft(),wr=yn(),H=vt(),Ja=it(),{safeRe:oe,t:se,comparatorTrimReplace:Xa,tildeTrimReplace:Ya,caretTrimReplace:Ka}=yt(),{FLAG_INCLUDE_PRERELEASE:Qa,FLAG_LOOSE:Za}=Ct(),En=e=>e.value==="<0.0.0-0",el=e=>e.value==="",xn=(e,t)=>{let r=!0,s=e.slice(),n=s.pop();for(;r&&s.length;)r=s.every(i=>n.intersects(i,t)),n=s.pop();return r},tl=(e,t)=>(e=e.replace(oe[se.BUILD],""),H("comp",e,t),e=nl(e,t),H("caret",e),e=rl(e,t),H("tildes",e),e=ol(e,t),H("xrange",e),e=ll(e,t),H("stars",e),e),ae=e=>!e||e.toLowerCase()==="x"||e==="*",rl=(e,t)=>e.trim().split(/\s+/).map(r=>sl(r,t)).join(" "),sl=(e,t)=>{let r=t.loose?oe[se.TILDELOOSE]:oe[se.TILDE];return e.replace(r,(s,n,i,o,a)=>{H("tilde",e,s,n,i,o,a);let l;return ae(n)?l="":ae(i)?l=`>=${n}.0.0 <${+n+1}.0.0-0`:ae(o)?l=`>=${n}.${i}.0 <${n}.${+i+1}.0-0`:a?(H("replaceTilde pr",a),l=`>=${n}.${i}.${o}-${a} <${n}.${+i+1}.0-0`):l=`>=${n}.${i}.${o} <${n}.${+i+1}.0-0`,H("tilde return",l),l})},nl=(e,t)=>e.trim().split(/\s+/).map(r=>il(r,t)).join(" "),il=(e,t)=>{H("caret",e,t);let r=t.loose?oe[se.CARETLOOSE]:oe[se.CARET],s=t.includePrerelease?"-0":"";return e.replace(r,(n,i,o,a,l)=>{H("caret",e,n,i,o,a,l);let f;return ae(i)?f="":ae(o)?f=`>=${i}.0.0${s} <${+i+1}.0.0-0`:ae(a)?i==="0"?f=`>=${i}.${o}.0${s} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.0${s} <${+i+1}.0.0-0`:l?(H("replaceCaret pr",l),i==="0"?o==="0"?f=`>=${i}.${o}.${a}-${l} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a}-${l} <${+i+1}.0.0-0`):(H("no pr"),i==="0"?o==="0"?f=`>=${i}.${o}.${a}${s} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}${s} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),H("caret return",f),f})},ol=(e,t)=>(H("replaceXRanges",e,t),e.split(/\s+/).map(r=>al(r,t)).join(" ")),al=(e,t)=>{e=e.trim();let r=t.loose?oe[se.XRANGELOOSE]:oe[se.XRANGE];return e.replace(r,(s,n,i,o,a,l)=>{H("xRange",e,s,n,i,o,a,l);let f=ae(i),u=f||ae(o),g=u||ae(a),p=g;return n==="="&&p&&(n=""),l=t.includePrerelease?"-0":"",f?n===">"||n==="<"?s="<0.0.0-0":s="*":n&&p?(u&&(o=0),a=0,n===">"?(n=">=",u?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",u?i=+i+1:o=+o+1),n==="<"&&(l="-0"),s=`${n+i}.${o}.${a}${l}`):u?s=`>=${i}.0.0${l} <${+i+1}.0.0-0`:g&&(s=`>=${i}.${o}.0${l} <${i}.${+o+1}.0-0`),H("xRange return",s),s})},ll=(e,t)=>(H("replaceStars",e,t),e.trim().replace(oe[se.STAR],"")),cl=(e,t)=>(H("replaceGTE0",e,t),e.trim().replace(oe[t.includePrerelease?se.GTE0PRE:se.GTE0],"")),ul=e=>(t,r,s,n,i,o,a,l,f,u,g,p)=>(ae(s)?r="":ae(n)?r=`>=${s}.0.0${e?"-0":""}`:ae(i)?r=`>=${s}.${n}.0${e?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,ae(f)?l="":ae(u)?l=`<${+f+1}.0.0-0`:ae(g)?l=`<${f}.${+u+1}.0-0`:p?l=`<=${f}.${u}.${g}-${p}`:e?l=`<${f}.${u}.${+g+1}-0`:l=`<=${l}`,`${r} ${l}`.trim()),fl=(e,t,r)=>{for(let s=0;s<e.length;s++)if(!e[s].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let s=0;s<e.length;s++)if(H(e[s].semver),e[s].semver!==wr.ANY&&e[s].semver.prerelease.length>0){let n=e[s].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}});var Rn=N((Ph,Sn)=>{"use strict";var hl=vr(),dl=(e,t,r)=>{try{t=new hl(t,r)}catch{return!1}return t.test(e)};Sn.exports=dl});var Er=N((Sh,gl)=>{gl.exports={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.34.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:{build:"node install/build.js",install:"node install/check.js || npm run build",clean:"rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",test:"npm run lint && npm run test-unit",lint:"npm run lint-cpp && npm run lint-js && npm run lint-types","lint-cpp":"cpplint --quiet src/*.h src/*.cc","lint-js":"biome lint","lint-types":"tsd --files ./test/types/sharp.test-d.ts","test-leak":"./test/leak/leak.sh","test-unit":"node --experimental-test-coverage test/unit.mjs","package-from-local-build":"node npm/from-local-build.js","package-release-notes":"node npm/release-notes.js","docs-build":"node docs/build.mjs","docs-serve":"cd docs && npm start","docs-publish":"cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",main:"lib/index.js",types:"lib/index.d.ts",files:["install","lib","src/*.{cc,h,gyp}"],repository:{type:"git",url:"git://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{"@img/colour":"^1.0.0","detect-libc":"^2.1.2",semver:"^7.7.3"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.34.5","@img/sharp-darwin-x64":"0.34.5","@img/sharp-libvips-darwin-arm64":"1.2.4","@img/sharp-libvips-darwin-x64":"1.2.4","@img/sharp-libvips-linux-arm":"1.2.4","@img/sharp-libvips-linux-arm64":"1.2.4","@img/sharp-libvips-linux-ppc64":"1.2.4","@img/sharp-libvips-linux-riscv64":"1.2.4","@img/sharp-libvips-linux-s390x":"1.2.4","@img/sharp-libvips-linux-x64":"1.2.4","@img/sharp-libvips-linuxmusl-arm64":"1.2.4","@img/sharp-libvips-linuxmusl-x64":"1.2.4","@img/sharp-linux-arm":"0.34.5","@img/sharp-linux-arm64":"0.34.5","@img/sharp-linux-ppc64":"0.34.5","@img/sharp-linux-riscv64":"0.34.5","@img/sharp-linux-s390x":"0.34.5","@img/sharp-linux-x64":"0.34.5","@img/sharp-linuxmusl-arm64":"0.34.5","@img/sharp-linuxmusl-x64":"0.34.5","@img/sharp-wasm32":"0.34.5","@img/sharp-win32-arm64":"0.34.5","@img/sharp-win32-ia32":"0.34.5","@img/sharp-win32-x64":"0.34.5"},devDependencies:{"@biomejs/biome":"^2.3.4","@cpplint/cli":"^0.1.0","@emnapi/runtime":"^1.7.0","@img/sharp-libvips-dev":"1.2.4","@img/sharp-libvips-dev-wasm32":"1.2.4","@img/sharp-libvips-win32-arm64":"1.2.4","@img/sharp-libvips-win32-ia32":"1.2.4","@img/sharp-libvips-win32-x64":"1.2.4","@types/node":"*",emnapi:"^1.7.0","exif-reader":"^2.0.2","extract-zip":"^2.0.1",icc:"^3.0.0","jsdoc-to-markdown":"^9.1.3","node-addon-api":"^8.5.0","node-gyp":"^11.5.0","tar-fs":"^3.1.1",tsd:"^0.33.0"},license:"Apache-2.0",engines:{node:"^18.17.0 || ^20.3.0 || >=21.0.0"},config:{libvips:">=8.17.3"},funding:{url:"https://opencollective.com/libvips"}}});var Pr=N((Rh,Fn)=>{var{spawnSync:Ut}=V("node:child_process"),{createHash:pl}=V("node:crypto"),_n=Js(),ml=dr(),bl=Rn(),$n=Tt(),{config:vl,engines:kn,optionalDependencies:yl}=Er(),wl=process.env.npm_package_config_libvips||vl.libvips,Nn=_n(wl).version,El=["darwin-arm64","darwin-x64","linux-arm","linux-arm64","linux-ppc64","linux-riscv64","linux-s390x","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-arm64","win32-ia32","win32-x64"],Gt={encoding:"utf8",shell:!0},xl=e=>{e instanceof Error},In=()=>$n.isNonGlibcLinuxSync()?$n.familySync():"",Pl=()=>`${process.platform}${In()}-${process.arch}`,ot=()=>{if(Dn())return"wasm32";let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:r}=process.env,s=typeof r=="string"?r:In();return`${t||process.platform}${s}-${e||process.arch}`},Sl=()=>{try{return V(`@img/sharp-libvips-dev-${ot()}/include`)}catch{try{return V("@img/sharp-libvips-dev/include")}catch{}}return""},Rl=()=>{try{return V("@img/sharp-libvips-dev/cplusplus")}catch{}return""},$l=()=>{try{return V(`@img/sharp-libvips-dev-${ot()}/lib`)}catch{try{return V(`@img/sharp-libvips-${ot()}/lib`)}catch{}}return""},kl=()=>{if(process.release?.name==="node"&&process.versions&&!bl(process.versions.node,kn.node))return{found:process.versions.node,expected:kn.node}},Dn=()=>{let{CC:e}=process.env;return!!e?.endsWith("/emcc")},Al=()=>process.platform==="darwin"&&process.arch==="x64"?(Ut("sysctl sysctl.proc_translated",Gt).stdout||"").trim()==="sysctl.proc_translated: 1":!1,An=e=>pl("sha512").update(e).digest("hex"),_l=()=>{try{let e=An(`imgsharp-libvips-${ot()}`),t=_n(yl[`@img/sharp-libvips-${ot()}`],{includePrerelease:!0}).version;return An(`${e}npm:${t}`).slice(0,10)}catch{}return""},Nl=()=>Ut(`node-gyp rebuild --directory=src ${Dn()?"--nodedir=emscripten":""}`,{...Gt,stdio:"inherit"}).status,Tn=()=>process.platform!=="win32"?(Ut("pkg-config --modversion vips-cpp",{...Gt,env:{...process.env,PKG_CONFIG_PATH:Cn()}}).stdout||"").trim():"",Cn=()=>process.platform!=="win32"?[(Ut('which brew >/dev/null 2>&1 && brew environment --plain | grep PKG_CONFIG_LIBDIR | cut -d" " -f2',Gt).stdout||"").trim(),process.env.PKG_CONFIG_PATH,"/usr/local/lib/pkgconfig","/usr/lib/pkgconfig","/usr/local/libdata/pkgconfig","/usr/libdata/pkgconfig"].filter(Boolean).join(":"):"",xr=(e,t,r)=>(r&&r(`Detected ${t}, skipping search for globally-installed libvips`),e),Il=e=>{if(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)return xr(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)return xr(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(Al())return xr(!1,"Rosetta",e);let t=Tn();return!!t&&ml(t,Nn)};Fn.exports={minimumLibvipsVersion:Nn,prebuiltPlatforms:El,buildPlatformArch:ot,buildSharpLibvipsIncludeDir:Sl,buildSharpLibvipsCPlusPlusDir:Rl,buildSharpLibvipsLibDir:$l,isUnsupportedNodeRuntime:kl,runtimePlatformArch:Pl,log:xl,yarnLocator:_l,spawnRebuild:Nl,globalLibvipsVersion:Tn,pkgConfigPath:Cn,useGlobalLibvips:Il}});var xt=N((kh,jn)=>{var{familySync:Dl,versionSync:Tl}=Tt(),{runtimePlatformArch:Cl,isUnsupportedNodeRuntime:On,prebuiltPlatforms:Fl,minimumLibvipsVersion:Ol}=Pr(),Qe=Cl(),jl=[`../src/build/Release/sharp-${Qe}.node`,"../src/build/Release/sharp-wasm32.node",`@img/sharp-${Qe}/sharp.node`,"@img/sharp-wasm32/sharp.node"],Sr,at,Et=[];for(Sr of jl)try{at=V(Sr);break}catch(e){Et.push(e)}if(at&&Sr.startsWith("@img/sharp-linux-x64")&&!at._isUsingX64V2()){let e=new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");e.code="Unsupported CPU",Et.push(e),at=null}if(at)jn.exports=at;else{let[e,t,r]=["linux","darwin","win32"].map(i=>Qe.startsWith(i)),s=[`Could not load the "sharp" module using the ${Qe} runtime`];Et.forEach(i=>{i.code!=="MODULE_NOT_FOUND"&&s.push(`${i.code}: ${i.message}`)});let n=Et.map(i=>i.message).join(" ");if(s.push("Possible solutions:"),On()){let{found:i,expected:o}=On();s.push("- Please upgrade Node.js:",` Found ${i}`,` Requires ${o}`)}else if(Fl.includes(Qe)){let[i,o]=Qe.split("-"),a=i.endsWith("musl")?" --libc=musl":"";s.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=${i.replace("musl","")}${a} --cpu=${o} sharp`)}else s.push(`- Manually install libvips >= ${Ol}`,"- Add experimental WebAssembly-based dependencies:"," npm install --cpu=wasm32 sharp"," npm install @img/sharp-wasm32");if(e&&/(symbol not found|CXXABI_)/i.test(n))try{let{config:i}=V(`@img/sharp-libvips-${Qe}/package`),o=`${Dl()} ${Tl()}`,a=`${i.musl?"musl":"glibc"} ${i.musl||i.glibc}`;s.push("- Update your OS:",` Found ${o}`,` Requires ${a}`)}catch{}throw e&&/\/snap\/core[0-9]{2}/.test(n)&&s.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node"),t&&/Incompatible library version/.test(n)&&s.push("- Update Homebrew:"," brew update && brew upgrade vips"),Et.some(i=>i.code==="ERR_DLOPEN_DISABLED")&&s.push("- Run Node.js without using the --no-addons flag"),r&&/The specified procedure could not be found/.test(n)&&s.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"),s.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),new Error(s.join(`
2
+ `))}});var Mn=N((_h,Ln)=>{var Ll=V("node:util"),Rr=V("node:stream"),Ml=Re();xt();var zl=Ll.debuglog("sharp"),Bl=e=>{Ze.queue.emit("change",e)},Ze=function(e,t){if(arguments.length===1&&!Ml.defined(e))throw new Error("Invalid input");return this instanceof Ze?(Rr.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:"crop",position:0,resizeBackground:[0,0,0,255],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:"background",withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:"lanczos3",fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:"integer",minAmpl:.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,dilateWidth:0,erodeWidth:0,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:"",joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:"srgb",colourspacePipeline:"last",composite:[],fileOut:"",formatOut:"input",streamOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:"",withExif:{},withExifMerge:!0,withXmp:"",resolveWithObject:!1,loop:-1,delay:[],jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:"4:2:0",jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:"4:4:4",webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpSmartDeblock:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:"jpeg",tiffBigtiff:!1,tiffPredictor:"horizontal",tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:8,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:"inch",heifQuality:50,heifLossless:!1,heifCompression:"av1",heifEffort:4,heifChromaSubsampling:"4:4:4",heifBitdepth:8,jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:"uchar",tileSize:256,tileOverlap:0,tileContainer:"fs",tileLayout:"dz",tileFormat:"last",tileDepth:"last",tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:"https://example.com/iiif",tileBasename:"",timeoutSeconds:0,linearA:[],linearB:[],pdfBackground:[255,255,255,255],debuglog:r=>{this.emit("warning",r),zl(r)},queueListener:Bl},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this):new Ze(e,t)};Object.setPrototypeOf(Ze.prototype,Rr.Duplex.prototype);Object.setPrototypeOf(Ze,Rr.Duplex);function Ul(){let e=this.constructor.call(),{debuglog:t,queueListener:r,...s}=this.options;return e.options=structuredClone(s),e.options.debuglog=t,e.options.queueListener=r,this._isStreamInput()&&this.on("finish",()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit("finish")}),e}Object.assign(Ze.prototype,{clone:Ul});Ln.exports=Ze});var Un=N((Nh,Bn)=>{var h=Re(),Ue=xt(),Gl={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},ql=["failOn","limitInputPixels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","failOnError","openSlideLevel","pdfBackground","tiffSubifd"];function zn(e){let t=ql.filter(r=>h.defined(e[r])).map(r=>[r,e[r]]);return t.length?Object.fromEntries(t):void 0}function Wl(e,t,r){let s={autoOrient:!1,failOn:"warning",limitInputPixels:268402689,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(h.string(e))s.file=e;else if(h.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");s.buffer=e}else if(h.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");s.buffer=Buffer.from(e,0,e.byteLength)}else if(h.typedArray(e)){if(e.length===0)throw Error("Input Bit Array is empty");s.buffer=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(h.plainObject(e)&&!h.defined(t))t=e,zn(t)&&(s.buffer=[]);else if(!h.defined(e)&&!h.defined(t)&&h.object(r)&&r.allowStream)s.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map(n=>this._createInputDescriptor(n));else throw new Error("Recursive join is unsupported");else throw new Error("Expected at least two images to join");else throw new Error(`Unsupported input '${e}' of type ${typeof e}${h.defined(t)?` when also providing options of type ${typeof t}`:""}`);if(h.object(t)){if(h.defined(t.failOnError))if(h.bool(t.failOnError))s.failOn=t.failOnError?"warning":"none";else throw h.invalidParameterError("failOnError","boolean",t.failOnError);if(h.defined(t.failOn))if(h.string(t.failOn)&&h.inArray(t.failOn,["none","truncated","error","warning"]))s.failOn=t.failOn;else throw h.invalidParameterError("failOn","one of: none, truncated, error, warning",t.failOn);if(h.defined(t.autoOrient))if(h.bool(t.autoOrient))s.autoOrient=t.autoOrient;else throw h.invalidParameterError("autoOrient","boolean",t.autoOrient);if(h.defined(t.density))if(h.inRange(t.density,1,1e5))s.density=t.density;else throw h.invalidParameterError("density","number between 1 and 100000",t.density);if(h.defined(t.ignoreIcc))if(h.bool(t.ignoreIcc))s.ignoreIcc=t.ignoreIcc;else throw h.invalidParameterError("ignoreIcc","boolean",t.ignoreIcc);if(h.defined(t.limitInputPixels))if(h.bool(t.limitInputPixels))s.limitInputPixels=t.limitInputPixels?16383**2:0;else if(h.integer(t.limitInputPixels)&&h.inRange(t.limitInputPixels,0,Number.MAX_SAFE_INTEGER))s.limitInputPixels=t.limitInputPixels;else throw h.invalidParameterError("limitInputPixels","positive integer",t.limitInputPixels);if(h.defined(t.unlimited))if(h.bool(t.unlimited))s.unlimited=t.unlimited;else throw h.invalidParameterError("unlimited","boolean",t.unlimited);if(h.defined(t.sequentialRead))if(h.bool(t.sequentialRead))s.sequentialRead=t.sequentialRead;else throw h.invalidParameterError("sequentialRead","boolean",t.sequentialRead);if(h.defined(t.raw)){if(h.object(t.raw)&&h.integer(t.raw.width)&&t.raw.width>0&&h.integer(t.raw.height)&&t.raw.height>0&&h.integer(t.raw.channels)&&h.inRange(t.raw.channels,1,4))switch(s.rawWidth=t.raw.width,s.rawHeight=t.raw.height,s.rawChannels=t.raw.channels,e.constructor){case Uint8Array:case Uint8ClampedArray:s.rawDepth="uchar";break;case Int8Array:s.rawDepth="char";break;case Uint16Array:s.rawDepth="ushort";break;case Int16Array:s.rawDepth="short";break;case Uint32Array:s.rawDepth="uint";break;case Int32Array:s.rawDepth="int";break;case Float32Array:s.rawDepth="float";break;case Float64Array:s.rawDepth="double";break;default:s.rawDepth="uchar";break}else throw new Error("Expected width, height and channels for raw pixel input");if(s.rawPremultiplied=!1,h.defined(t.raw.premultiplied))if(h.bool(t.raw.premultiplied))s.rawPremultiplied=t.raw.premultiplied;else throw h.invalidParameterError("raw.premultiplied","boolean",t.raw.premultiplied);if(s.rawPageHeight=0,h.defined(t.raw.pageHeight))if(h.integer(t.raw.pageHeight)&&t.raw.pageHeight>0&&t.raw.pageHeight<=t.raw.height){if(t.raw.height%t.raw.pageHeight!==0)throw new Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);s.rawPageHeight=t.raw.pageHeight}else throw h.invalidParameterError("raw.pageHeight","positive integer",t.raw.pageHeight)}if(h.defined(t.animated))if(h.bool(t.animated))s.pages=t.animated?-1:1;else throw h.invalidParameterError("animated","boolean",t.animated);if(h.defined(t.pages))if(h.integer(t.pages)&&h.inRange(t.pages,-1,1e5))s.pages=t.pages;else throw h.invalidParameterError("pages","integer between -1 and 100000",t.pages);if(h.defined(t.page))if(h.integer(t.page)&&h.inRange(t.page,0,1e5))s.page=t.page;else throw h.invalidParameterError("page","integer between 0 and 100000",t.page);if(h.object(t.openSlide)&&h.defined(t.openSlide.level))if(h.integer(t.openSlide.level)&&h.inRange(t.openSlide.level,0,256))s.openSlideLevel=t.openSlide.level;else throw h.invalidParameterError("openSlide.level","integer between 0 and 256",t.openSlide.level);else if(h.defined(t.level))if(h.integer(t.level)&&h.inRange(t.level,0,256))s.openSlideLevel=t.level;else throw h.invalidParameterError("level","integer between 0 and 256",t.level);if(h.object(t.tiff)&&h.defined(t.tiff.subifd))if(h.integer(t.tiff.subifd)&&h.inRange(t.tiff.subifd,-1,1e5))s.tiffSubifd=t.tiff.subifd;else throw h.invalidParameterError("tiff.subifd","integer between -1 and 100000",t.tiff.subifd);else if(h.defined(t.subifd))if(h.integer(t.subifd)&&h.inRange(t.subifd,-1,1e5))s.tiffSubifd=t.subifd;else throw h.invalidParameterError("subifd","integer between -1 and 100000",t.subifd);if(h.object(t.svg)){if(h.defined(t.svg.stylesheet))if(h.string(t.svg.stylesheet))s.svgStylesheet=t.svg.stylesheet;else throw h.invalidParameterError("svg.stylesheet","string",t.svg.stylesheet);if(h.defined(t.svg.highBitdepth))if(h.bool(t.svg.highBitdepth))s.svgHighBitdepth=t.svg.highBitdepth;else throw h.invalidParameterError("svg.highBitdepth","boolean",t.svg.highBitdepth)}if(h.object(t.pdf)&&h.defined(t.pdf.background)?s.pdfBackground=this._getBackgroundColourOption(t.pdf.background):h.defined(t.pdfBackground)&&(s.pdfBackground=this._getBackgroundColourOption(t.pdfBackground)),h.object(t.jp2)&&h.defined(t.jp2.oneshot))if(h.bool(t.jp2.oneshot))s.jp2Oneshot=t.jp2.oneshot;else throw h.invalidParameterError("jp2.oneshot","boolean",t.jp2.oneshot);if(h.defined(t.create))if(h.object(t.create)&&h.integer(t.create.width)&&t.create.width>0&&h.integer(t.create.height)&&t.create.height>0&&h.integer(t.create.channels)){if(s.createWidth=t.create.width,s.createHeight=t.create.height,s.createChannels=t.create.channels,s.createPageHeight=0,h.defined(t.create.pageHeight))if(h.integer(t.create.pageHeight)&&t.create.pageHeight>0&&t.create.pageHeight<=t.create.height){if(t.create.height%t.create.pageHeight!==0)throw new Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);s.createPageHeight=t.create.pageHeight}else throw h.invalidParameterError("create.pageHeight","positive integer",t.create.pageHeight);if(h.defined(t.create.noise)){if(!h.object(t.create.noise))throw new Error("Expected noise to be an object");if(t.create.noise.type!=="gaussian")throw new Error("Only gaussian noise is supported at the moment");if(s.createNoiseType=t.create.noise.type,!h.inRange(t.create.channels,1,4))throw h.invalidParameterError("create.channels","number between 1 and 4",t.create.channels);if(s.createNoiseMean=128,h.defined(t.create.noise.mean))if(h.number(t.create.noise.mean)&&h.inRange(t.create.noise.mean,0,1e4))s.createNoiseMean=t.create.noise.mean;else throw h.invalidParameterError("create.noise.mean","number between 0 and 10000",t.create.noise.mean);if(s.createNoiseSigma=30,h.defined(t.create.noise.sigma))if(h.number(t.create.noise.sigma)&&h.inRange(t.create.noise.sigma,0,1e4))s.createNoiseSigma=t.create.noise.sigma;else throw h.invalidParameterError("create.noise.sigma","number between 0 and 10000",t.create.noise.sigma)}else if(h.defined(t.create.background)){if(!h.inRange(t.create.channels,3,4))throw h.invalidParameterError("create.channels","number between 3 and 4",t.create.channels);s.createBackground=this._getBackgroundColourOption(t.create.background)}else throw new Error("Expected valid noise or background to create a new input image");delete s.buffer}else throw new Error("Expected valid width, height and channels to create a new input image");if(h.defined(t.text))if(h.object(t.text)&&h.string(t.text.text)){if(s.textValue=t.text.text,h.defined(t.text.height)&&h.defined(t.text.dpi))throw new Error("Expected only one of dpi or height");if(h.defined(t.text.font))if(h.string(t.text.font))s.textFont=t.text.font;else throw h.invalidParameterError("text.font","string",t.text.font);if(h.defined(t.text.fontfile))if(h.string(t.text.fontfile))s.textFontfile=t.text.fontfile;else throw h.invalidParameterError("text.fontfile","string",t.text.fontfile);if(h.defined(t.text.width))if(h.integer(t.text.width)&&t.text.width>0)s.textWidth=t.text.width;else throw h.invalidParameterError("text.width","positive integer",t.text.width);if(h.defined(t.text.height))if(h.integer(t.text.height)&&t.text.height>0)s.textHeight=t.text.height;else throw h.invalidParameterError("text.height","positive integer",t.text.height);if(h.defined(t.text.align))if(h.string(t.text.align)&&h.string(this.constructor.align[t.text.align]))s.textAlign=this.constructor.align[t.text.align];else throw h.invalidParameterError("text.align","valid alignment",t.text.align);if(h.defined(t.text.justify))if(h.bool(t.text.justify))s.textJustify=t.text.justify;else throw h.invalidParameterError("text.justify","boolean",t.text.justify);if(h.defined(t.text.dpi))if(h.integer(t.text.dpi)&&h.inRange(t.text.dpi,1,1e6))s.textDpi=t.text.dpi;else throw h.invalidParameterError("text.dpi","integer between 1 and 1000000",t.text.dpi);if(h.defined(t.text.rgba))if(h.bool(t.text.rgba))s.textRgba=t.text.rgba;else throw h.invalidParameterError("text.rgba","bool",t.text.rgba);if(h.defined(t.text.spacing))if(h.integer(t.text.spacing)&&h.inRange(t.text.spacing,-1e6,1e6))s.textSpacing=t.text.spacing;else throw h.invalidParameterError("text.spacing","integer between -1000000 and 1000000",t.text.spacing);if(h.defined(t.text.wrap))if(h.string(t.text.wrap)&&h.inArray(t.text.wrap,["word","char","word-char","none"]))s.textWrap=t.text.wrap;else throw h.invalidParameterError("text.wrap","one of: word, char, word-char, none",t.text.wrap);delete s.buffer}else throw new Error("Expected a valid string to create an image with text.");if(h.defined(t.join))if(h.defined(this.options.join)){if(h.defined(t.join.animated))if(h.bool(t.join.animated))s.joinAnimated=t.join.animated;else throw h.invalidParameterError("join.animated","boolean",t.join.animated);if(h.defined(t.join.across))if(h.integer(t.join.across)&&h.inRange(t.join.across,1,1e6))s.joinAcross=t.join.across;else throw h.invalidParameterError("join.across","integer between 1 and 100000",t.join.across);if(h.defined(t.join.shim))if(h.integer(t.join.shim)&&h.inRange(t.join.shim,0,1e6))s.joinShim=t.join.shim;else throw h.invalidParameterError("join.shim","integer between 0 and 100000",t.join.shim);if(h.defined(t.join.background)&&(s.joinBackground=this._getBackgroundColourOption(t.join.background)),h.defined(t.join.halign))if(h.string(t.join.halign)&&h.string(this.constructor.align[t.join.halign]))s.joinHalign=this.constructor.align[t.join.halign];else throw h.invalidParameterError("join.halign","valid alignment",t.join.halign);if(h.defined(t.join.valign))if(h.string(t.join.valign)&&h.string(this.constructor.align[t.join.valign]))s.joinValign=this.constructor.align[t.join.valign];else throw h.invalidParameterError("join.valign","valid alignment",t.join.valign)}else throw new Error("Expected input to be an array of images to join")}else if(h.defined(t))throw new Error(`Invalid input options ${t}`);return s}function Hl(e,t,r){Array.isArray(this.options.input.buffer)?h.buffer(e)?(this.options.input.buffer.length===0&&this.on("finish",()=>{this.streamInFinished=!0}),this.options.input.buffer.push(e),r()):r(new Error("Non-Buffer data on Writable Stream")):r(new Error("Unexpected data on Writable Stream"))}function Vl(){this._isStreamInput()&&(this.options.input.buffer=Buffer.concat(this.options.input.buffer))}function Jl(){return Array.isArray(this.options.input.buffer)}function Xl(e){let t=Error();return h.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),Ue.metadata(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)})}):Ue.metadata(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)}),this):this._isStreamInput()?new Promise((r,s)=>{let n=()=>{this._flattenBufferIn(),Ue.metadata(this.options,(i,o)=>{i?s(h.nativeError(i,t)):r(o)})};this.writableFinished?n():this.once("finish",n)}):new Promise((r,s)=>{Ue.metadata(this.options,(n,i)=>{n?s(h.nativeError(n,t)):r(i)})})}function Yl(e){let t=Error();return h.fn(e)?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),Ue.stats(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)})}):Ue.stats(this.options,(r,s)=>{r?e(h.nativeError(r,t)):e(null,s)}),this):this._isStreamInput()?new Promise((r,s)=>{this.on("finish",function(){this._flattenBufferIn(),Ue.stats(this.options,(n,i)=>{n?s(h.nativeError(n,t)):r(i)})})}):new Promise((r,s)=>{Ue.stats(this.options,(n,i)=>{n?s(h.nativeError(n,t)):r(i)})})}Bn.exports=e=>{Object.assign(e.prototype,{_inputOptionsFromObject:zn,_createInputDescriptor:Wl,_write:Hl,_flattenBufferIn:Vl,_isStreamInput:Jl,metadata:Xl,stats:Yl}),e.align=Gl}});var Jn=N((Ih,Vn)=>{var x=Re(),qn={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},Wn={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},Gn={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},Hn={entropy:16,attention:17},$r={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},Kl={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},Ql={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"};function kr(e){return e.angle%360!==0||e.rotationAngle!==0}function qt(e){return e.width!==-1||e.height!==-1}function Zl(e,t,r){if(qt(this.options)&&this.options.debuglog("ignoring previous resize options"),this.options.widthPost!==-1&&this.options.debuglog("operation order will be: extract, resize, extract"),x.defined(e))if(x.object(e)&&!x.defined(r))r=e;else if(x.integer(e)&&e>0)this.options.width=e;else throw x.invalidParameterError("width","positive integer",e);else this.options.width=-1;if(x.defined(t))if(x.integer(t)&&t>0)this.options.height=t;else throw x.invalidParameterError("height","positive integer",t);else this.options.height=-1;if(x.object(r)){if(x.defined(r.width))if(x.integer(r.width)&&r.width>0)this.options.width=r.width;else throw x.invalidParameterError("width","positive integer",r.width);if(x.defined(r.height))if(x.integer(r.height)&&r.height>0)this.options.height=r.height;else throw x.invalidParameterError("height","positive integer",r.height);if(x.defined(r.fit)){let s=Ql[r.fit];if(x.string(s))this.options.canvas=s;else throw x.invalidParameterError("fit","valid fit",r.fit)}if(x.defined(r.position)){let s=x.integer(r.position)?r.position:Hn[r.position]||Wn[r.position]||qn[r.position];if(x.integer(s)&&(x.inRange(s,0,8)||x.inRange(s,16,17)))this.options.position=s;else throw x.invalidParameterError("position","valid position/gravity/strategy",r.position)}if(this._setBackgroundColourOption("resizeBackground",r.background),x.defined(r.kernel))if(x.string($r[r.kernel]))this.options.kernel=$r[r.kernel];else throw x.invalidParameterError("kernel","valid kernel name",r.kernel);x.defined(r.withoutEnlargement)&&this._setBooleanOption("withoutEnlargement",r.withoutEnlargement),x.defined(r.withoutReduction)&&this._setBooleanOption("withoutReduction",r.withoutReduction),x.defined(r.fastShrinkOnLoad)&&this._setBooleanOption("fastShrinkOnLoad",r.fastShrinkOnLoad)}return kr(this.options)&&qt(this.options)&&(this.options.rotateBefore=!0),this}function ec(e){if(x.integer(e)&&e>0)this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else if(x.object(e)){if(x.defined(e.top))if(x.integer(e.top)&&e.top>=0)this.options.extendTop=e.top;else throw x.invalidParameterError("top","positive integer",e.top);if(x.defined(e.bottom))if(x.integer(e.bottom)&&e.bottom>=0)this.options.extendBottom=e.bottom;else throw x.invalidParameterError("bottom","positive integer",e.bottom);if(x.defined(e.left))if(x.integer(e.left)&&e.left>=0)this.options.extendLeft=e.left;else throw x.invalidParameterError("left","positive integer",e.left);if(x.defined(e.right))if(x.integer(e.right)&&e.right>=0)this.options.extendRight=e.right;else throw x.invalidParameterError("right","positive integer",e.right);if(this._setBackgroundColourOption("extendBackground",e.background),x.defined(e.extendWith))if(x.string(Gn[e.extendWith]))this.options.extendWith=Gn[e.extendWith];else throw x.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",e.extendWith)}else throw x.invalidParameterError("extend","integer or object",e);return this}function tc(e){let t=qt(this.options)||this.options.widthPre!==-1?"Post":"Pre";return this.options[`width${t}`]!==-1&&this.options.debuglog("ignoring previous extract options"),["left","top","width","height"].forEach(function(r){let s=e[r];if(x.integer(s)&&s>=0)this.options[r+(r==="left"||r==="top"?"Offset":"")+t]=s;else throw x.invalidParameterError(r,"integer",s)},this),kr(this.options)&&!qt(this.options)&&(this.options.widthPre===-1||this.options.widthPost===-1)&&(this.options.rotateBefore=!0),this.options.input.autoOrient&&(this.options.orientBefore=!0),this}function rc(e){if(this.options.trimThreshold=10,x.defined(e))if(x.object(e)){if(x.defined(e.background)&&this._setBackgroundColourOption("trimBackground",e.background),x.defined(e.threshold))if(x.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw x.invalidParameterError("threshold","positive number",e.threshold);x.defined(e.lineArt)&&this._setBooleanOption("trimLineArt",e.lineArt)}else throw x.invalidParameterError("trim","object",e);return kr(this.options)&&(this.options.rotateBefore=!0),this}Vn.exports=e=>{Object.assign(e.prototype,{resize:Zl,extend:ec,extract:tc,trim:rc}),e.gravity=qn,e.strategy=Hn,e.kernel=$r,e.fit=Kl,e.position=Wn}});var Yn=N((Dh,Xn)=>{var U=Re(),Ar={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 sc(e){if(!Array.isArray(e))throw U.invalidParameterError("images to composite","array",e);return this.options.composite=e.map(t=>{if(!U.object(t))throw U.invalidParameterError("image to composite","object",t);let r=this._inputOptionsFromObject(t),s={input:this._createInputDescriptor(t.input,r,{allowStream:!1}),blend:"over",tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(U.defined(t.blend))if(U.string(Ar[t.blend]))s.blend=Ar[t.blend];else throw U.invalidParameterError("blend","valid blend name",t.blend);if(U.defined(t.tile))if(U.bool(t.tile))s.tile=t.tile;else throw U.invalidParameterError("tile","boolean",t.tile);if(U.defined(t.left))if(U.integer(t.left))s.left=t.left;else throw U.invalidParameterError("left","integer",t.left);if(U.defined(t.top))if(U.integer(t.top))s.top=t.top;else throw U.invalidParameterError("top","integer",t.top);if(U.defined(t.top)!==U.defined(t.left))throw new Error("Expected both left and top to be set");if(s.hasOffset=U.integer(t.top)&&U.integer(t.left),U.defined(t.gravity))if(U.integer(t.gravity)&&U.inRange(t.gravity,0,8))s.gravity=t.gravity;else if(U.string(t.gravity)&&U.integer(this.constructor.gravity[t.gravity]))s.gravity=this.constructor.gravity[t.gravity];else throw U.invalidParameterError("gravity","valid gravity",t.gravity);if(U.defined(t.premultiplied))if(U.bool(t.premultiplied))s.premultiplied=t.premultiplied;else throw U.invalidParameterError("premultiplied","boolean",t.premultiplied);return s}),this}Xn.exports=e=>{e.prototype.composite=sc,e.blend=Ar}});var ti=N((Th,ei)=>{var d=Re(),Kn={integer:"integer",float:"float",approximate:"approximate"};function nc(e,t){if(!d.defined(e))return this.autoOrient();if((this.options.angle||this.options.rotationAngle)&&(this.options.debuglog("ignoring previous rotate options"),this.options.angle=0,this.options.rotationAngle=0),d.integer(e)&&!(e%90))this.options.angle=e;else if(d.number(e))this.options.rotationAngle=e,d.object(t)&&t.background&&this._setBackgroundColourOption("rotationBackground",t.background);else throw d.invalidParameterError("angle","numeric",e);return this}function ic(){return this.options.input.autoOrient=!0,this}function oc(e){return this.options.flip=d.bool(e)?e:!0,this}function ac(e){return this.options.flop=d.bool(e)?e:!0,this}function lc(e,t){let r=[].concat(...e);if(r.length===4&&r.every(d.number))this.options.affineMatrix=r;else throw d.invalidParameterError("matrix","1x4 or 2x2 array",e);if(d.defined(t))if(d.object(t)){if(this._setBackgroundColourOption("affineBackground",t.background),d.defined(t.idx))if(d.number(t.idx))this.options.affineIdx=t.idx;else throw d.invalidParameterError("options.idx","number",t.idx);if(d.defined(t.idy))if(d.number(t.idy))this.options.affineIdy=t.idy;else throw d.invalidParameterError("options.idy","number",t.idy);if(d.defined(t.odx))if(d.number(t.odx))this.options.affineOdx=t.odx;else throw d.invalidParameterError("options.odx","number",t.odx);if(d.defined(t.ody))if(d.number(t.ody))this.options.affineOdy=t.ody;else throw d.invalidParameterError("options.ody","number",t.ody);if(d.defined(t.interpolator))if(d.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw d.invalidParameterError("options.interpolator","valid interpolator name",t.interpolator)}else throw d.invalidParameterError("options","object",t);return this}function cc(e,t,r){if(!d.defined(e))this.options.sharpenSigma=-1;else if(d.bool(e))this.options.sharpenSigma=e?-1:0;else if(d.number(e)&&d.inRange(e,.01,1e4)){if(this.options.sharpenSigma=e,d.defined(t))if(d.number(t)&&d.inRange(t,0,1e4))this.options.sharpenM1=t;else throw d.invalidParameterError("flat","number between 0 and 10000",t);if(d.defined(r))if(d.number(r)&&d.inRange(r,0,1e4))this.options.sharpenM2=r;else throw d.invalidParameterError("jagged","number between 0 and 10000",r)}else if(d.plainObject(e)){if(d.number(e.sigma)&&d.inRange(e.sigma,1e-6,10))this.options.sharpenSigma=e.sigma;else throw d.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(d.defined(e.m1))if(d.number(e.m1)&&d.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw d.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(d.defined(e.m2))if(d.number(e.m2)&&d.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw d.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(d.defined(e.x1))if(d.number(e.x1)&&d.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw d.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(d.defined(e.y2))if(d.number(e.y2)&&d.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw d.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(d.defined(e.y3))if(d.number(e.y3)&&d.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw d.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else throw d.invalidParameterError("sigma","number between 0.01 and 10000",e);return this}function uc(e){if(!d.defined(e))this.options.medianSize=3;else if(d.integer(e)&&d.inRange(e,1,1e3))this.options.medianSize=e;else throw d.invalidParameterError("size","integer between 1 and 1000",e);return this}function fc(e){let t;if(d.number(e))t=e;else if(d.plainObject(e)){if(!d.number(e.sigma))throw d.invalidParameterError("options.sigma","number between 0.3 and 1000",t);if(t=e.sigma,"precision"in e)if(d.string(Kn[e.precision]))this.options.precision=Kn[e.precision];else throw d.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(d.number(e.minAmplitude)&&d.inRange(e.minAmplitude,.001,1))this.options.minAmpl=e.minAmplitude;else throw d.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!d.defined(e))this.options.blurSigma=-1;else if(d.bool(e))this.options.blurSigma=e?-1:0;else if(d.number(t)&&d.inRange(t,.3,1e3))this.options.blurSigma=t;else throw d.invalidParameterError("sigma","number between 0.3 and 1000",t);return this}function Qn(e){if(!d.defined(e))this.options.dilateWidth=1;else if(d.integer(e)&&e>0)this.options.dilateWidth=e;else throw d.invalidParameterError("dilate","positive integer",Qn);return this}function Zn(e){if(!d.defined(e))this.options.erodeWidth=1;else if(d.integer(e)&&e>0)this.options.erodeWidth=e;else throw d.invalidParameterError("erode","positive integer",Zn);return this}function hc(e){return this.options.flatten=d.bool(e)?e:!0,d.object(e)&&this._setBackgroundColourOption("flattenBackground",e.background),this}function dc(){return this.options.unflatten=!0,this}function gc(e,t){if(!d.defined(e))this.options.gamma=2.2;else if(d.number(e)&&d.inRange(e,1,3))this.options.gamma=e;else throw d.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!d.defined(t))this.options.gammaOut=this.options.gamma;else if(d.number(t)&&d.inRange(t,1,3))this.options.gammaOut=t;else throw d.invalidParameterError("gammaOut","number between 1.0 and 3.0",t);return this}function pc(e){if(this.options.negate=d.bool(e)?e:!0,d.plainObject(e)&&"alpha"in e)if(d.bool(e.alpha))this.options.negateAlpha=e.alpha;else throw d.invalidParameterError("alpha","should be boolean value",e.alpha);return this}function mc(e){if(d.plainObject(e)){if(d.defined(e.lower))if(d.number(e.lower)&&d.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw d.invalidParameterError("lower","number between 0 and 99",e.lower);if(d.defined(e.upper))if(d.number(e.upper)&&d.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw d.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw d.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function bc(e){return this.normalise(e)}function vc(e){if(d.plainObject(e)){if(d.integer(e.width)&&e.width>0)this.options.claheWidth=e.width;else throw d.invalidParameterError("width","integer greater than zero",e.width);if(d.integer(e.height)&&e.height>0)this.options.claheHeight=e.height;else throw d.invalidParameterError("height","integer greater than zero",e.height);if(d.defined(e.maxSlope))if(d.integer(e.maxSlope)&&d.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw d.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw d.invalidParameterError("options","plain object",e);return this}function yc(e){if(!d.object(e)||!Array.isArray(e.kernel)||!d.integer(e.width)||!d.integer(e.height)||!d.inRange(e.width,3,1001)||!d.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length)throw new Error("Invalid convolution kernel");return d.integer(e.scale)||(e.scale=e.kernel.reduce((t,r)=>t+r,0)),e.scale<1&&(e.scale=1),d.integer(e.offset)||(e.offset=0),this.options.convKernel=e,this}function wc(e,t){if(!d.defined(e))this.options.threshold=128;else if(d.bool(e))this.options.threshold=e?128:0;else if(d.integer(e)&&d.inRange(e,0,255))this.options.threshold=e;else throw d.invalidParameterError("threshold","integer between 0 and 255",e);return!d.object(t)||t.greyscale===!0||t.grayscale===!0?this.options.thresholdGrayscale=!0:this.options.thresholdGrayscale=!1,this}function Ec(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),d.string(t)&&d.inArray(t,["and","or","eor"]))this.options.booleanOp=t;else throw d.invalidParameterError("operator","one of: and, or, eor",t);return this}function xc(e,t){if(!d.defined(e)&&d.number(t)?e=1:d.number(e)&&!d.defined(t)&&(t=0),!d.defined(e))this.options.linearA=[];else if(d.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&e.length&&e.every(d.number))this.options.linearA=e;else throw d.invalidParameterError("a","number or array of numbers",e);if(!d.defined(t))this.options.linearB=[];else if(d.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&t.length&&t.every(d.number))this.options.linearB=t;else throw d.invalidParameterError("b","number or array of numbers",t);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 Pc(e){if(!Array.isArray(e))throw d.invalidParameterError("inputMatrix","array",e);if(e.length!==3&&e.length!==4)throw d.invalidParameterError("inputMatrix","3x3 or 4x4 array",e.length);let t=e.flat().map(Number);if(t.length!==9&&t.length!==16)throw d.invalidParameterError("inputMatrix","cardinality of 9 or 16",t.length);return this.options.recombMatrix=t,this}function Sc(e){if(!d.plainObject(e))throw d.invalidParameterError("options","plain object",e);if("brightness"in e)if(d.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw d.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(d.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw d.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(d.integer(e.hue))this.options.hue=e.hue%360;else throw d.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(d.number(e.lightness))this.options.lightness=e.lightness;else throw d.invalidParameterError("lightness","number",e.lightness);return this}ei.exports=e=>{Object.assign(e.prototype,{autoOrient:ic,rotate:nc,flip:oc,flop:ac,affine:lc,sharpen:cc,erode:Zn,dilate:Qn,median:uc,blur:fc,flatten:hc,unflatten:dc,gamma:gc,negate:pc,normalise:mc,normalize:bc,clahe:vc,convolve:yc,threshold:wc,boolean:Ec,linear:xc,recomb:Pc,modulate:Sc})}});var ai=N((Ch,oi)=>{var Dr=Object.defineProperty,Rc=Object.getOwnPropertyDescriptor,$c=Object.getOwnPropertyNames,kc=Object.prototype.hasOwnProperty,Ac=(e,t)=>{for(var r in t)Dr(e,r,{get:t[r],enumerable:!0})},_c=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of $c(t))!kc.call(e,n)&&n!==r&&Dr(e,n,{get:()=>t[n],enumerable:!(s=Rc(t,n))||s.enumerable});return e},Nc=e=>_c(Dr({},"__esModule",{value:!0}),e),ri={};Ac(ri,{default:()=>qc});oi.exports=Nc(ri);var Ne={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]},si=Object.create(null);for(let e in Ne)Object.hasOwn(Ne,e)&&(si[Ne[e]]=e);var ce={to:{},get:{}};ce.get=function(e){let t=e.slice(0,3).toLowerCase(),r,s;switch(t){case"hsl":{r=ce.get.hsl(e),s="hsl";break}case"hwb":{r=ce.get.hwb(e),s="hwb";break}default:{r=ce.get.rgb(e),s="rgb";break}}return r?{model:s,value:r}:null};ce.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,r=/^#([a-f\d]{6})([a-f\d]{2})?$/i,s=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,n=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,i=/^(\w+)$/,o=[0,0,0,1],a,l,f;if(a=e.match(r)){for(f=a[2],a=a[1],l=0;l<3;l++){let u=l*2;o[l]=Number.parseInt(a.slice(u,u+2),16)}f&&(o[3]=Number.parseInt(f,16)/255)}else if(a=e.match(t)){for(a=a[1],f=a[3],l=0;l<3;l++)o[l]=Number.parseInt(a[l]+a[l],16);f&&(o[3]=Number.parseInt(f+f,16)/255)}else if(a=e.match(s)){for(l=0;l<3;l++)o[l]=Number.parseInt(a[l+1],10);a[4]&&(o[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else if(a=e.match(n)){for(l=0;l<3;l++)o[l]=Math.round(Number.parseFloat(a[l+1])*2.55);a[4]&&(o[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else return(a=e.match(i))?a[1]==="transparent"?[0,0,0,0]:Object.hasOwn(Ne,a[1])?(o=Ne[a[1]],o[3]=1,o):null:null;for(l=0;l<3;l++)o[l]=Ge(o[l],0,255);return o[3]=Ge(o[3],0,1),o};ce.get.hsl=function(e){if(!e)return null;let t=/^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*)?\)$/,r=e.match(t);if(r){let s=Number.parseFloat(r[4]),n=(Number.parseFloat(r[1])%360+360)%360,i=Ge(Number.parseFloat(r[2]),0,100),o=Ge(Number.parseFloat(r[3]),0,100),a=Ge(Number.isNaN(s)?1:s,0,1);return[n,i,o,a]}return null};ce.get.hwb=function(e){if(!e)return null;let t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,r=e.match(t);if(r){let s=Number.parseFloat(r[4]),n=(Number.parseFloat(r[1])%360+360)%360,i=Ge(Number.parseFloat(r[2]),0,100),o=Ge(Number.parseFloat(r[3]),0,100),a=Ge(Number.isNaN(s)?1:s,0,1);return[n,i,o,a]}return null};ce.to.hex=function(...e){return"#"+Wt(e[0])+Wt(e[1])+Wt(e[2])+(e[3]<1?Wt(Math.round(e[3]*255)):"")};ce.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};ce.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),s=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+r+"%, "+s+"%)":"rgba("+t+"%, "+r+"%, "+s+"%, "+e[3]+")"};ce.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};ce.to.hwb=function(...e){let t="";return e.length>=4&&e[3]!==1&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};ce.to.keyword=function(...e){return si[e.slice(0,3)]};function Ge(e,t,r){return Math.min(Math.max(t,e),r)}function Wt(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var lt=ce,ni={};for(let e of Object.keys(Ne))ni[Ne[e]]=e;var v={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},et=v,Fe=(6/29)**3;function ut(e){let t=e>.0031308?1.055*e**.4166666666666667-.055:e*12.92;return Math.min(Math.max(0,t),1)}function ft(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(v)){if(!("channels"in v[e]))throw new Error("missing channels property: "+e);if(!("labels"in v[e]))throw new Error("missing channel labels property: "+e);if(v[e].labels.length!==v[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=v[e];delete v[e].channels,delete v[e].labels,Object.defineProperty(v[e],"channels",{value:t}),Object.defineProperty(v[e],"labels",{value:r})}v.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,s=e[2]/255,n=Math.min(t,r,s),i=Math.max(t,r,s),o=i-n,a,l;switch(i){case n:{a=0;break}case t:{a=(r-s)/o;break}case r:{a=2+(s-t)/o;break}case s:{a=4+(t-r)/o;break}}a=Math.min(a*60,360),a<0&&(a+=360);let f=(n+i)/2;return i===n?l=0:f<=.5?l=o/(i+n):l=o/(2-i-n),[a,l*100,f*100]};v.rgb.hsv=function(e){let t,r,s,n,i,o=e[0]/255,a=e[1]/255,l=e[2]/255,f=Math.max(o,a,l),u=f-Math.min(o,a,l),g=function(p){return(f-p)/6/u+1/2};if(u===0)n=0,i=0;else{switch(i=u/f,t=g(o),r=g(a),s=g(l),f){case o:{n=s-r;break}case a:{n=1/3+t-s;break}case l:{n=2/3+r-t;break}}n<0?n+=1:n>1&&(n-=1)}return[n*360,i*100,f*100]};v.rgb.hwb=function(e){let t=e[0],r=e[1],s=e[2],n=v.rgb.hsl(e)[0],i=1/255*Math.min(t,Math.min(r,s));return s=1-1/255*Math.max(t,Math.max(r,s)),[n,i*100,s*100]};v.rgb.oklab=function(e){let t=ft(e[0]/255),r=ft(e[1]/255),s=ft(e[2]/255),n=Math.cbrt(.4122214708*t+.5363325363*r+.0514459929*s),i=Math.cbrt(.2119034982*t+.6806995451*r+.1073969566*s),o=Math.cbrt(.0883024619*t+.2817188376*r+.6299787005*s),a=.2104542553*n+.793617785*i-.0040720468*o,l=1.9779984951*n-2.428592205*i+.4505937099*o,f=.0259040371*n+.7827717662*i-.808675766*o;return[a*100,l*100,f*100]};v.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,s=e[2]/255,n=Math.min(1-t,1-r,1-s),i=(1-t-n)/(1-n)||0,o=(1-r-n)/(1-n)||0,a=(1-s-n)/(1-n)||0;return[i*100,o*100,a*100,n*100]};function Ic(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}v.rgb.keyword=function(e){let t=ni[e];if(t)return t;let r=Number.POSITIVE_INFINITY,s;for(let n of Object.keys(Ne)){let i=Ne[n],o=Ic(e,i);o<r&&(r=o,s=n)}return s};v.keyword.rgb=function(e){return Ne[e]};v.rgb.xyz=function(e){let t=ft(e[0]/255),r=ft(e[1]/255),s=ft(e[2]/255),n=t*.4124564+r*.3575761+s*.1804375,i=t*.2126729+r*.7151522+s*.072175,o=t*.0193339+r*.119192+s*.9503041;return[n*100,i*100,o*100]};v.rgb.lab=function(e){let t=v.rgb.xyz(e),r=t[0],s=t[1],n=t[2];r/=95.047,s/=100,n/=108.883,r=r>Fe?r**(1/3):7.787*r+16/116,s=s>Fe?s**(1/3):7.787*s+16/116,n=n>Fe?n**(1/3):7.787*n+16/116;let i=116*s-16,o=500*(r-s),a=200*(s-n);return[i,o,a]};v.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,s=e[2]/100,n,i;if(r===0)return i=s*255,[i,i,i];let o=s<.5?s*(1+r):s+r-s*r,a=2*s-o,l=[0,0,0];for(let f=0;f<3;f++)n=t+1/3*-(f-1),n<0&&n++,n>1&&n--,6*n<1?i=a+(o-a)*6*n:2*n<1?i=o:3*n<2?i=a+(o-a)*(2/3-n)*6:i=a,l[f]=i*255;return l};v.hsl.hsv=function(e){let t=e[0],r=e[1]/100,s=e[2]/100,n=r,i=Math.max(s,.01);s*=2,r*=s<=1?s:2-s,n*=i<=1?i:2-i;let o=(s+r)/2,a=s===0?2*n/(i+n):2*r/(s+r);return[t,a*100,o*100]};v.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,s=e[2]/100,n=Math.floor(t)%6,i=t-Math.floor(t),o=255*s*(1-r),a=255*s*(1-r*i),l=255*s*(1-r*(1-i));switch(s*=255,n){case 0:return[s,l,o];case 1:return[a,s,o];case 2:return[o,s,l];case 3:return[o,a,s];case 4:return[l,o,s];case 5:return[s,o,a]}};v.hsv.hsl=function(e){let t=e[0],r=e[1]/100,s=e[2]/100,n=Math.max(s,.01),i,o;o=(2-r)*s;let a=(2-r)*n;return i=r*n,i/=a<=1?a:2-a,i=i||0,o/=2,[t,i*100,o*100]};v.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,s=e[2]/100,n=r+s,i;n>1&&(r/=n,s/=n);let o=Math.floor(6*t),a=1-s;i=6*t-o,(o&1)!==0&&(i=1-i);let l=r+i*(a-r),f,u,g;switch(o){default:case 6:case 0:{f=a,u=l,g=r;break}case 1:{f=l,u=a,g=r;break}case 2:{f=r,u=a,g=l;break}case 3:{f=r,u=l,g=a;break}case 4:{f=l,u=r,g=a;break}case 5:{f=a,u=r,g=l;break}}return[f*255,u*255,g*255]};v.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=e[3]/100,i=1-Math.min(1,t*(1-n)+n),o=1-Math.min(1,r*(1-n)+n),a=1-Math.min(1,s*(1-n)+n);return[i*255,o*255,a*255]};v.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n,i,o;return n=t*3.2404542+r*-1.5371385+s*-.4985314,i=t*-.969266+r*1.8760108+s*.041556,o=t*.0556434+r*-.2040259+s*1.0572252,n=ut(n),i=ut(i),o=ut(o),[n*255,i*255,o*255]};v.xyz.lab=function(e){let t=e[0],r=e[1],s=e[2];t/=95.047,r/=100,s/=108.883,t=t>Fe?t**(1/3):7.787*t+16/116,r=r>Fe?r**(1/3):7.787*r+16/116,s=s>Fe?s**(1/3):7.787*s+16/116;let n=116*r-16,i=500*(t-r),o=200*(r-s);return[n,i,o]};v.xyz.oklab=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=Math.cbrt(.8189330101*t+.3618667424*r-.1288597137*s),i=Math.cbrt(.0329845436*t+.9293118715*r+.0361456387*s),o=Math.cbrt(.0482003018*t+.2643662691*r+.633851707*s),a=.2104542553*n+.793617785*i-.0040720468*o,l=1.9779984951*n-2.428592205*i+.4505937099*o,f=.0259040371*n+.7827717662*i-.808675766*o;return[a*100,l*100,f*100]};v.oklab.oklch=function(e){return v.lab.lch(e)};v.oklab.xyz=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=(.999999998*t+.396337792*r+.215803758*s)**3,i=(1.000000008*t-.105561342*r-.063854175*s)**3,o=(1.000000055*t-.089484182*r-1.291485538*s)**3,a=1.227013851*n-.55779998*i+.281256149*o,l=-.040580178*n+1.11225687*i-.071676679*o,f=-.076381285*n-.421481978*i+1.58616322*o;return[a*100,l*100,f*100]};v.oklab.rgb=function(e){let t=e[0]/100,r=e[1]/100,s=e[2]/100,n=(t+.3963377774*r+.2158037573*s)**3,i=(t-.1055613458*r-.0638541728*s)**3,o=(t-.0894841775*r-1.291485548*s)**3,a=ut(4.0767416621*n-3.3077115913*i+.2309699292*o),l=ut(-1.2684380046*n+2.6097574011*i-.3413193965*o),f=ut(-.0041960863*n-.7034186147*i+1.707614701*o);return[a*255,l*255,f*255]};v.oklch.oklab=function(e){return v.lch.lab(e)};v.lab.xyz=function(e){let t=e[0],r=e[1],s=e[2],n,i,o;i=(t+16)/116,n=r/500+i,o=i-s/200;let a=i**3,l=n**3,f=o**3;return i=a>Fe?a:(i-16/116)/7.787,n=l>Fe?l:(n-16/116)/7.787,o=f>Fe?f:(o-16/116)/7.787,n*=95.047,i*=100,o*=108.883,[n,i,o]};v.lab.lch=function(e){let t=e[0],r=e[1],s=e[2],n;n=Math.atan2(s,r)*360/2/Math.PI,n<0&&(n+=360);let o=Math.sqrt(r*r+s*s);return[t,o,n]};v.lch.lab=function(e){let t=e[0],r=e[1],n=e[2]/360*2*Math.PI,i=r*Math.cos(n),o=r*Math.sin(n);return[t,i,o]};v.rgb.ansi16=function(e,t=null){let[r,s,n]=e,i=t===null?v.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),i===0)return 30;let o=30+(Math.round(n/255)<<2|Math.round(s/255)<<1|Math.round(r/255));return i===2&&(o+=60),o};v.hsv.ansi16=function(e){return v.rgb.ansi16(v.hsv.rgb(e),e[2])};v.rgb.ansi256=function(e){let t=e[0],r=e[1],s=e[2];return t>>4===r>>4&&r>>4===s>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(s/255*5)};v.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let r=(Math.trunc(e>50)+1)*.5,s=(t&1)*r*255,n=(t>>1&1)*r*255,i=(t>>2&1)*r*255;return[s,n,i]};v.ansi256.rgb=function(e){if(e=e[0],e>=232){let i=(e-232)*10+8;return[i,i,i]}e-=16;let t,r=Math.floor(e/36)/5*255,s=Math.floor((t=e%36)/6)/5*255,n=t%6/5*255;return[r,s,n]};v.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(r.length)+r};v.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let r=t[0];t[0].length===3&&(r=[...r].map(a=>a+a).join(""));let s=Number.parseInt(r,16),n=s>>16&255,i=s>>8&255,o=s&255;return[n,i,o]};v.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,s=e[2]/255,n=Math.max(Math.max(t,r),s),i=Math.min(Math.min(t,r),s),o=n-i,a,l=o<1?i/(1-o):0;return o<=0?a=0:n===t?a=(r-s)/o%6:n===r?a=2+(s-t)/o:a=4+(t-r)/o,a/=6,a%=1,[a*360,o*100,l*100]};v.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,s=r<.5?2*t*r:2*t*(1-r),n=0;return s<1&&(n=(r-.5*s)/(1-s)),[e[0],s*100,n*100]};v.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,s=t*r,n=0;return s<1&&(n=(r-s)/(1-s)),[e[0],s*100,n*100]};v.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,s=e[2]/100;if(r===0)return[s*255,s*255,s*255];let n=[0,0,0],i=t%1*6,o=i%1,a=1-o,l=0;switch(Math.floor(i)){case 0:{n[0]=1,n[1]=o,n[2]=0;break}case 1:{n[0]=a,n[1]=1,n[2]=0;break}case 2:{n[0]=0,n[1]=1,n[2]=o;break}case 3:{n[0]=0,n[1]=a,n[2]=1;break}case 4:{n[0]=o,n[1]=0,n[2]=1;break}default:n[0]=1,n[1]=0,n[2]=a}return l=(1-r)*s,[(r*n[0]+l)*255,(r*n[1]+l)*255,(r*n[2]+l)*255]};v.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,s=t+r*(1-t),n=0;return s>0&&(n=t/s),[e[0],n*100,s*100]};v.hcg.hsl=function(e){let t=e[1]/100,s=e[2]/100*(1-t)+.5*t,n=0;return s>0&&s<.5?n=t/(2*s):s>=.5&&s<1&&(n=t/(2*(1-s))),[e[0],n*100,s*100]};v.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,s=t+r*(1-t);return[e[0],(s-t)*100,(1-s)*100]};v.hwb.hcg=function(e){let t=e[1]/100,s=1-e[2]/100,n=s-t,i=0;return n<1&&(i=(s-n)/(1-n)),[e[0],n*100,i*100]};v.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};v.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};v.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};v.gray.hsl=function(e){return[0,0,e[0]]};v.gray.hsv=v.gray.hsl;v.gray.hwb=function(e){return[0,100,e[0]]};v.gray.cmyk=function(e){return[0,0,0,e[0]]};v.gray.lab=function(e){return[e[0],0,0]};v.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,s=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(s.length)+s};v.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function Dc(){let e={},t=Object.keys(et);for(let{length:r}=t,s=0;s<r;s++)e[t[s]]={distance:-1,parent:null};return e}function Tc(e){let t=Dc(),r=[e];for(t[e].distance=0;r.length>0;){let s=r.pop(),n=Object.keys(et[s]);for(let{length:i}=n,o=0;o<i;o++){let a=n[o],l=t[a];l.distance===-1&&(l.distance=t[s].distance+1,l.parent=s,r.unshift(a))}}return t}function Cc(e,t){return function(r){return t(e(r))}}function Fc(e,t){let r=[t[e].parent,e],s=et[t[e].parent][e],n=t[e].parent;for(;t[n].parent;)r.unshift(t[n].parent),s=Cc(et[t[n].parent][n],s),n=t[n].parent;return s.conversion=r,s}function Oc(e){let t=Tc(e),r={},s=Object.keys(t);for(let{length:n}=s,i=0;i<n;i++){let o=s[i];t[o].parent!==null&&(r[o]=Fc(o,t))}return r}var jc=Oc,ct={},Lc=Object.keys(et);function Mc(e){let t=function(...r){let s=r[0];return s==null?s:(s.length>1&&(r=s),e(r))};return"conversion"in e&&(t.conversion=e.conversion),t}function zc(e){let t=function(...r){let s=r[0];if(s==null)return s;s.length>1&&(r=s);let n=e(r);if(typeof n=="object")for(let{length:i}=n,o=0;o<i;o++)n[o]=Math.round(n[o]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}for(let e of Lc){ct[e]={},Object.defineProperty(ct[e],"channels",{value:et[e].channels}),Object.defineProperty(ct[e],"labels",{value:et[e].labels});let t=jc(e),r=Object.keys(t);for(let s of r){let n=t[s];ct[e][s]=zc(n),ct[e][s].raw=Mc(n)}}var de=ct,ii=["keyword","gray","hex"],_r={};for(let e of Object.keys(de))_r[[...de[e].labels].sort().join("")]=e;var Nr={};function ee(e,t){if(!(this instanceof ee))return new ee(e,t);if(t&&t in ii&&(t=null),t&&!(t in de))throw new Error("Unknown model: "+t);let r,s;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof ee)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){let n=lt.get(e);if(n===null)throw new Error("Unable to parse color from string: "+e);this.model=n.model,s=de[this.model].channels,this.color=n.value.slice(0,s),this.valpha=typeof n.value[s]=="number"?n.value[s]:1}else if(e.length>0){this.model=t||"rgb",s=de[this.model].channels;let n=Array.prototype.slice.call(e,0,s);this.color=Ir(n,s),this.valpha=typeof e[s]=="number"?e[s]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let n=Object.keys(e);"alpha"in e&&(n.splice(n.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);let i=n.sort().join("");if(!(i in _r))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=_r[i];let{labels:o}=de[this.model],a=[];for(r=0;r<o.length;r++)a.push(e[o[r]]);this.color=Ir(a)}if(Nr[this.model])for(s=de[this.model].channels,r=0;r<s;r++){let n=Nr[this.model][r];n&&(this.color[r]=n(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}ee.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in lt.to?this:this.rgb();t=t.round(typeof e=="number"?e:1);let r=t.valpha===1?t.color:[...t.color,this.valpha];return lt.to[t.model](...r)},percentString(e){let t=this.rgb().round(typeof e=="number"?e:1),r=t.valpha===1?t.color:[...t.color,this.valpha];return lt.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=de[this.model],{labels:r}=de[this.model];for(let s=0;s<t;s++)e[r[s]]=this.color[s];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){let e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){let e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new ee([...this.color.map(Uc(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new ee([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:J("rgb",0,K(255)),green:J("rgb",1,K(255)),blue:J("rgb",2,K(255)),hue:J(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:J("hsl",1,K(100)),lightness:J("hsl",2,K(100)),saturationv:J("hsv",1,K(100)),value:J("hsv",2,K(100)),chroma:J("hcg",1,K(100)),gray:J("hcg",2,K(100)),white:J("hwb",1,K(100)),wblack:J("hwb",2,K(100)),cyan:J("cmyk",0,K(100)),magenta:J("cmyk",1,K(100)),yellow:J("cmyk",2,K(100)),black:J("cmyk",3,K(100)),x:J("xyz",0,K(95.047)),y:J("xyz",1,K(100)),z:J("xyz",2,K(108.833)),l:J("lab",0,K(100)),a:J("lab",1),b:J("lab",2),keyword(e){return e!==void 0?new ee(e):de[this.model].keyword(this.color)},hex(e){return e!==void 0?new ee(e):lt.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new ee(e);let t=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();return r.length===1&&(r="0"+r),lt.to.hex(...t)+r},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[r,s]of e.entries()){let n=s/255;t[r]=n<=.04045?n/12.92:((n+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){let t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level(e){let t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return ee.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);let r=e.rgb(),s=this.rgb(),n=t===void 0?.5:t,i=2*n-1,o=r.alpha()-s.alpha(),a=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,l=1-a;return ee.rgb(a*r.red()+l*s.red(),a*r.green()+l*s.green(),a*r.blue()+l*s.blue(),r.alpha()*n+s.alpha()*(1-n))}};for(let e of Object.keys(de)){if(ii.includes(e))continue;let{channels:t}=de[e];ee.prototype[e]=function(...r){return this.model===e?new ee(this):r.length>0?new ee(r,e):new ee([...Gc(de[this.model][e].raw(this.color)),this.valpha],e)},ee[e]=function(...r){let s=r[0];return typeof s=="number"&&(s=Ir(r,t)),new ee(s,e)}}function Bc(e,t){return Number(e.toFixed(t))}function Uc(e){return function(t){return Bc(t,e)}}function J(e,t,r){e=Array.isArray(e)?e:[e];for(let s of e)(Nr[s]||=[])[t]=r;return e=e[0],function(s){let n;return s!==void 0?(r&&(s=r(s)),n=this[e](),n.color[t]=s,n):(n=this[e]().color[t],r&&(n=r(n)),n)}}function K(e){return function(t){return Math.max(0,Math.min(e,t))}}function Gc(e){return Array.isArray(e)?e:[e]}function Ir(e,t){for(let r=0;r<t;r++)typeof e[r]!="number"&&(e[r]=0);return e}var qc=ee});var ci=N((Fh,li)=>{li.exports=ai().default});var di=N((Oh,hi)=>{var Wc=ci(),Oe=Re(),ui={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"};function Hc(e){return this._setBackgroundColourOption("tint",e),this}function Vc(e){return this.options.greyscale=Oe.bool(e)?e:!0,this}function Jc(e){return this.greyscale(e)}function Xc(e){if(!Oe.string(e))throw Oe.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function Yc(e){return this.pipelineColourspace(e)}function Kc(e){if(!Oe.string(e))throw Oe.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function Qc(e){return this.toColourspace(e)}function fi(e){if(Oe.object(e)||Oe.string(e)&&e.length>=3&&e.length<=200){let t=Wc(e);return[t.red(),t.green(),t.blue(),Math.round(t.alpha()*255)]}else throw Oe.invalidParameterError("background","object or string",e)}function Zc(e,t){Oe.defined(t)&&(this.options[e]=fi(t))}hi.exports=e=>{Object.assign(e.prototype,{tint:Hc,greyscale:Vc,grayscale:Jc,pipelineColourspace:Xc,pipelineColorspace:Yc,toColourspace:Kc,toColorspace:Qc,_getBackgroundColourOption:fi,_setBackgroundColourOption:Zc}),e.colourspace=ui,e.colorspace=ui}});var pi=N((jh,gi)=>{var Ie=Re(),eu={and:"and",or:"or",eor:"eor"};function tu(){return this.options.removeAlpha=!0,this}function ru(e){if(Ie.defined(e))if(Ie.number(e)&&Ie.inRange(e,0,1))this.options.ensureAlpha=e;else throw Ie.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function su(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e)&&(e=t[e]),Ie.integer(e)&&Ie.inRange(e,0,4))this.options.extractChannel=e;else throw Ie.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function nu(e,t){return Array.isArray(e)?e.forEach(function(r){this.options.joinChannelIn.push(this._createInputDescriptor(r,t))},this):this.options.joinChannelIn.push(this._createInputDescriptor(e,t)),this}function iu(e){if(Ie.string(e)&&Ie.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw Ie.invalidParameterError("boolOp","one of: and, or, eor",e);return this}gi.exports=e=>{Object.assign(e.prototype,{removeAlpha:tu,ensureAlpha:ru,extractChannel:su,joinChannel:nu,bandbool:iu}),e.bool=eu}});var wi=N((Lh,yi)=>{var Tr=V("node:path"),c=Re(),ht=xt(),mi=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"]]),ou=/\.(jp[2x]|j2[kc])$/i,bi=()=>new Error("JP2 output requires libvips with support for OpenJPEG"),vi=e=>1<<31-Math.clz32(Math.ceil(Math.log2(e)));function au(e,t){let r;if(c.string(e)?c.string(this.options.input.file)&&Tr.resolve(this.options.input.file)===Tr.resolve(e)?r=new Error("Cannot use same file for input and output"):ou.test(Tr.extname(e))&&!this.constructor.format.jp2k.output.file&&(r=bi()):r=new Error("Missing output file path"),r)if(c.fn(t))t(r);else return Promise.reject(r);else{this.options.fileOut=e;let s=Error();return this._pipeline(t,s)}return this}function lu(e,t){c.object(e)?this._setBooleanOption("resolveWithObject",e.resolveWithObject):this.options.resolveWithObject&&(this.options.resolveWithObject=!1),this.options.fileOut="";let r=Error();return this._pipeline(c.fn(e)?e:t,r)}function cu(){return this.options.keepMetadata|=1,this}function uu(e){if(c.object(e))for(let[t,r]of Object.entries(e))if(c.object(r))for(let[s,n]of Object.entries(r))if(c.string(n))this.options.withExif[`exif-${t.toLowerCase()}-${s}`]=n;else throw c.invalidParameterError(`${t}.${s}`,"string",n);else throw c.invalidParameterError(t,"object",r);else throw c.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function fu(e){return this.withExif(e),this.options.withExifMerge=!0,this}function hu(){return this.options.keepMetadata|=8,this}function du(e,t){if(c.string(e))this.options.withIccProfile=e;else throw c.invalidParameterError("icc","string",e);if(this.keepIccProfile(),c.object(t)&&c.defined(t.attach))if(c.bool(t.attach))t.attach||(this.options.keepMetadata&=-9);else throw c.invalidParameterError("attach","boolean",t.attach);return this}function gu(){return this.options.keepMetadata|=2,this}function pu(e){if(c.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw c.invalidParameterError("xmp","non-empty string",e);return this}function mu(){return this.options.keepMetadata=31,this}function bu(e){if(this.keepMetadata(),this.withIccProfile("srgb"),c.object(e)){if(c.defined(e.orientation))if(c.integer(e.orientation)&&c.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw c.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(c.defined(e.density))if(c.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw c.invalidParameterError("density","positive number",e.density);c.defined(e.icc)&&this.withIccProfile(e.icc),c.defined(e.exif)&&this.withExifMerge(e.exif)}return this}function vu(e,t){let r=mi.get((c.object(e)&&c.string(e.id)?e.id:e).toLowerCase());if(!r)throw c.invalidParameterError("format",`one of: ${[...mi.keys()].join(", ")}`,e);return this[r](t)}function yu(e){if(c.object(e)){if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw c.invalidParameterError("quality","integer between 1 and 100",e.quality);if(c.defined(e.progressive)&&this._setBooleanOption("jpegProgressive",e.progressive),c.defined(e.chromaSubsampling))if(c.string(e.chromaSubsampling)&&c.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw c.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let t=c.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(c.defined(t)&&this._setBooleanOption("jpegOptimiseCoding",t),c.defined(e.mozjpeg))if(c.bool(e.mozjpeg))e.mozjpeg&&(this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3);else throw c.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let r=c.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;c.defined(r)&&this._setBooleanOption("jpegTrellisQuantisation",r),c.defined(e.overshootDeringing)&&this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let s=c.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;c.defined(s)&&(this._setBooleanOption("jpegOptimiseScans",s),s&&(this.options.jpegProgressive=!0));let n=c.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(c.defined(n))if(c.integer(n)&&c.inRange(n,0,8))this.options.jpegQuantisationTable=n;else throw c.invalidParameterError("quantisationTable","integer between 0 and 8",n)}return this._updateFormatOut("jpeg",e)}function wu(e){if(c.object(e)){if(c.defined(e.progressive)&&this._setBooleanOption("pngProgressive",e.progressive),c.defined(e.compressionLevel))if(c.integer(e.compressionLevel)&&c.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw c.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);c.defined(e.adaptiveFiltering)&&this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let t=e.colours||e.colors;if(c.defined(t))if(c.integer(t)&&c.inRange(t,2,256))this.options.pngBitdepth=vi(t);else throw c.invalidParameterError("colours","integer between 2 and 256",t);if(c.defined(e.palette)?this._setBooleanOption("pngPalette",e.palette):[e.quality,e.effort,e.colours,e.colors,e.dither].some(c.defined)&&this._setBooleanOption("pngPalette",!0),this.options.pngPalette){if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw c.invalidParameterError("quality","integer between 0 and 100",e.quality);if(c.defined(e.effort))if(c.integer(e.effort)&&c.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw c.invalidParameterError("effort","integer between 1 and 10",e.effort);if(c.defined(e.dither))if(c.number(e.dither)&&c.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw c.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function Eu(e){if(c.object(e)){if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw c.invalidParameterError("quality","integer between 1 and 100",e.quality);if(c.defined(e.alphaQuality))if(c.integer(e.alphaQuality)&&c.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw c.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(c.defined(e.lossless)&&this._setBooleanOption("webpLossless",e.lossless),c.defined(e.nearLossless)&&this._setBooleanOption("webpNearLossless",e.nearLossless),c.defined(e.smartSubsample)&&this._setBooleanOption("webpSmartSubsample",e.smartSubsample),c.defined(e.smartDeblock)&&this._setBooleanOption("webpSmartDeblock",e.smartDeblock),c.defined(e.preset))if(c.string(e.preset)&&c.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw c.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(c.defined(e.effort))if(c.integer(e.effort)&&c.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw c.invalidParameterError("effort","integer between 0 and 6",e.effort);c.defined(e.minSize)&&this._setBooleanOption("webpMinSize",e.minSize),c.defined(e.mixed)&&this._setBooleanOption("webpMixed",e.mixed)}return Cr(e,this.options),this._updateFormatOut("webp",e)}function xu(e){if(c.object(e)){c.defined(e.reuse)&&this._setBooleanOption("gifReuse",e.reuse),c.defined(e.progressive)&&this._setBooleanOption("gifProgressive",e.progressive);let t=e.colours||e.colors;if(c.defined(t))if(c.integer(t)&&c.inRange(t,2,256))this.options.gifBitdepth=vi(t);else throw c.invalidParameterError("colours","integer between 2 and 256",t);if(c.defined(e.effort))if(c.number(e.effort)&&c.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw c.invalidParameterError("effort","integer between 1 and 10",e.effort);if(c.defined(e.dither))if(c.number(e.dither)&&c.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw c.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(c.defined(e.interFrameMaxError))if(c.number(e.interFrameMaxError)&&c.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw c.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(c.defined(e.interPaletteMaxError))if(c.number(e.interPaletteMaxError)&&c.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw c.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(c.defined(e.keepDuplicateFrames))if(c.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw c.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return Cr(e,this.options),this._updateFormatOut("gif",e)}function Pu(e){if(!this.constructor.format.jp2k.output.buffer)throw bi();if(c.object(e)){if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw c.invalidParameterError("quality","integer between 1 and 100",e.quality);if(c.defined(e.lossless))if(c.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw c.invalidParameterError("lossless","boolean",e.lossless);if(c.defined(e.tileWidth))if(c.integer(e.tileWidth)&&c.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw c.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(c.defined(e.tileHeight))if(c.integer(e.tileHeight)&&c.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw c.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(c.defined(e.chromaSubsampling))if(c.string(e.chromaSubsampling)&&c.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw c.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function Cr(e,t){if(c.object(e)&&c.defined(e.loop))if(c.integer(e.loop)&&c.inRange(e.loop,0,65535))t.loop=e.loop;else throw c.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(c.object(e)&&c.defined(e.delay))if(c.integer(e.delay)&&c.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&e.delay.every(c.integer)&&e.delay.every(r=>c.inRange(r,0,65535)))t.delay=e.delay;else throw c.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function Su(e){if(c.object(e)){if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw c.invalidParameterError("quality","integer between 1 and 100",e.quality);if(c.defined(e.bitdepth))if(c.integer(e.bitdepth)&&c.inArray(e.bitdepth,[1,2,4,8]))this.options.tiffBitdepth=e.bitdepth;else throw c.invalidParameterError("bitdepth","1, 2, 4 or 8",e.bitdepth);if(c.defined(e.tile)&&this._setBooleanOption("tiffTile",e.tile),c.defined(e.tileWidth))if(c.integer(e.tileWidth)&&e.tileWidth>0)this.options.tiffTileWidth=e.tileWidth;else throw c.invalidParameterError("tileWidth","integer greater than zero",e.tileWidth);if(c.defined(e.tileHeight))if(c.integer(e.tileHeight)&&e.tileHeight>0)this.options.tiffTileHeight=e.tileHeight;else throw c.invalidParameterError("tileHeight","integer greater than zero",e.tileHeight);if(c.defined(e.miniswhite)&&this._setBooleanOption("tiffMiniswhite",e.miniswhite),c.defined(e.pyramid)&&this._setBooleanOption("tiffPyramid",e.pyramid),c.defined(e.xres))if(c.number(e.xres)&&e.xres>0)this.options.tiffXres=e.xres;else throw c.invalidParameterError("xres","number greater than zero",e.xres);if(c.defined(e.yres))if(c.number(e.yres)&&e.yres>0)this.options.tiffYres=e.yres;else throw c.invalidParameterError("yres","number greater than zero",e.yres);if(c.defined(e.compression))if(c.string(e.compression)&&c.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw c.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(c.defined(e.bigtiff)&&this._setBooleanOption("tiffBigtiff",e.bigtiff),c.defined(e.predictor))if(c.string(e.predictor)&&c.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw c.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(c.defined(e.resolutionUnit))if(c.string(e.resolutionUnit)&&c.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw c.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function Ru(e){return this.heif({...e,compression:"av1"})}function $u(e){if(c.object(e)){if(c.string(e.compression)&&c.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw c.invalidParameterError("compression","one of: av1, hevc",e.compression);if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw c.invalidParameterError("quality","integer between 1 and 100",e.quality);if(c.defined(e.lossless))if(c.bool(e.lossless))this.options.heifLossless=e.lossless;else throw c.invalidParameterError("lossless","boolean",e.lossless);if(c.defined(e.effort))if(c.integer(e.effort)&&c.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw c.invalidParameterError("effort","integer between 0 and 9",e.effort);if(c.defined(e.chromaSubsampling))if(c.string(e.chromaSubsampling)&&c.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw c.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(c.defined(e.bitdepth))if(c.integer(e.bitdepth)&&c.inArray(e.bitdepth,[8,10,12])){if(e.bitdepth!==8&&this.constructor.versions.heif)throw c.invalidParameterError("bitdepth when using prebuilt binaries",8,e.bitdepth);this.options.heifBitdepth=e.bitdepth}else throw c.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth)}else throw c.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function ku(e){if(c.object(e)){if(c.defined(e.quality))if(c.integer(e.quality)&&c.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?.1+(100-e.quality)*.09:53/3e3*e.quality*e.quality-23/20*e.quality+25;else throw c.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(c.defined(e.distance))if(c.number(e.distance)&&c.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw c.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(c.defined(e.decodingTier))if(c.integer(e.decodingTier)&&c.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw c.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(c.defined(e.lossless))if(c.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw c.invalidParameterError("lossless","boolean",e.lossless);if(c.defined(e.effort))if(c.integer(e.effort)&&c.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw c.invalidParameterError("effort","integer between 1 and 9",e.effort)}return Cr(e,this.options),this._updateFormatOut("jxl",e)}function Au(e){if(c.object(e)&&c.defined(e.depth))if(c.string(e.depth)&&c.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw c.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth);return this._updateFormatOut("raw")}function _u(e){if(c.object(e)){if(c.defined(e.size))if(c.integer(e.size)&&c.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw c.invalidParameterError("size","integer between 1 and 8192",e.size);if(c.defined(e.overlap))if(c.integer(e.overlap)&&c.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw c.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw c.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(c.defined(e.container))if(c.string(e.container)&&c.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw c.invalidParameterError("container","one of: fs, zip",e.container);if(c.defined(e.layout))if(c.string(e.layout)&&c.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw c.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(c.defined(e.angle))if(c.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw c.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),c.defined(e.depth))if(c.string(e.depth)&&c.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw c.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(c.defined(e.skipBlanks))if(c.integer(e.skipBlanks)&&c.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw c.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else c.defined(e.layout)&&e.layout==="google"&&(this.options.tileSkipBlanks=5);let t=c.bool(e.center)?e.center:e.centre;if(c.defined(t)&&this._setBooleanOption("tileCentre",t),c.defined(e.id))if(c.string(e.id))this.options.tileId=e.id;else throw c.invalidParameterError("id","string",e.id);if(c.defined(e.basename))if(c.string(e.basename))this.options.tileBasename=e.basename;else throw c.invalidParameterError("basename","string",e.basename)}if(c.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw c.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function Nu(e){if(!c.plainObject(e))throw c.invalidParameterError("options","object",e);if(c.integer(e.seconds)&&c.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw c.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function Iu(e,t){return c.object(t)&&t.force===!1||(this.options.formatOut=e),this}function Du(e,t){if(c.bool(t))this.options[e]=t;else throw c.invalidParameterError(e,"boolean",t)}function Tu(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function Cu(e,t){return typeof e=="function"?(this._isStreamInput()?this.on("finish",()=>{this._flattenBufferIn(),ht.pipeline(this.options,(r,s,n)=>{r?e(c.nativeError(r,t)):e(null,s,n)})}):ht.pipeline(this.options,(r,s,n)=>{r?e(c.nativeError(r,t)):e(null,s,n)}),this):this.options.streamOut?(this._isStreamInput()?(this.once("finish",()=>{this._flattenBufferIn(),ht.pipeline(this.options,(r,s,n)=>{r?this.emit("error",c.nativeError(r,t)):(this.emit("info",n),this.push(s)),this.push(null),this.on("end",()=>this.emit("close"))})}),this.streamInFinished&&this.emit("finish")):ht.pipeline(this.options,(r,s,n)=>{r?this.emit("error",c.nativeError(r,t)):(this.emit("info",n),this.push(s)),this.push(null),this.on("end",()=>this.emit("close"))}),this):this._isStreamInput()?new Promise((r,s)=>{this.once("finish",()=>{this._flattenBufferIn(),ht.pipeline(this.options,(n,i,o)=>{n?s(c.nativeError(n,t)):this.options.resolveWithObject?r({data:i,info:o}):r(i)})})}):new Promise((r,s)=>{ht.pipeline(this.options,(n,i,o)=>{n?s(c.nativeError(n,t)):this.options.resolveWithObject?r({data:i,info:o}):r(i)})})}yi.exports=e=>{Object.assign(e.prototype,{toFile:au,toBuffer:lu,keepExif:cu,withExif:uu,withExifMerge:fu,keepIccProfile:hu,withIccProfile:du,keepXmp:gu,withXmp:pu,keepMetadata:mu,withMetadata:bu,toFormat:vu,jpeg:yu,jp2:Pu,png:wu,webp:Eu,tiff:Su,avif:Ru,heif:$u,jxl:ku,gif:xu,raw:Au,tile:_u,timeout:Nu,_updateFormatOut:Iu,_setBooleanOption:Du,_read:Tu,_pipeline:Cu})}});var Si=N((Mh,Pi)=>{var Fu=V("node:events"),Ht=Tt(),ve=Re(),{runtimePlatformArch:Ou}=Pr(),le=xt(),Ei=Ou(),Fr=le.libvipsVersion(),qe=le.format();qe.heif.output.alias=["avif","heic"];qe.jpeg.output.alias=["jpe","jpg"];qe.tiff.output.alias=["tif"];qe.jp2k.output.alias=["j2c","j2k","jp2","jpx"];var ju={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},dt={vips:Fr.semver};if(!Fr.isGlobal)if(Fr.isWasm)try{dt=V("@img/sharp-wasm32/versions")}catch{}else try{dt=V(`@img/sharp-${Ei}/versions`)}catch{try{dt=V(`@img/sharp-libvips-${Ei}/versions`)}catch{}}dt.sharp=Er().version;dt.heif&&qe.heif&&(qe.heif.input.fileSuffix=[".avif"],qe.heif.output.alias=["avif"]);function xi(e){return ve.bool(e)?e?le.cache(50,20,100):le.cache(0,0,0):ve.object(e)?le.cache(e.memory,e.files,e.items):le.cache()}xi(!0);function Lu(e){return le.concurrency(ve.integer(e)?e:null)}Ht.familySync()===Ht.GLIBC&&!le._isUsingJemalloc()?le.concurrency(1):Ht.familySync()===Ht.MUSL&&le.concurrency()===1024&&le.concurrency(V("node:os").availableParallelism());var Mu=new Fu.EventEmitter;function zu(){return le.counters()}function Bu(e){return le.simd(ve.bool(e)?e:null)}function Uu(e){if(ve.object(e))if(Array.isArray(e.operation)&&e.operation.every(ve.string))le.block(e.operation,!0);else throw ve.invalidParameterError("operation","Array<string>",e.operation);else throw ve.invalidParameterError("options","object",e)}function Gu(e){if(ve.object(e))if(Array.isArray(e.operation)&&e.operation.every(ve.string))le.block(e.operation,!1);else throw ve.invalidParameterError("operation","Array<string>",e.operation);else throw ve.invalidParameterError("options","object",e)}Pi.exports=e=>{e.cache=xi,e.concurrency=Lu,e.counters=zu,e.simd=Bu,e.format=qe,e.interpolators=ju,e.versions=dt,e.queue=Mu,e.block=Uu,e.unblock=Gu}});var $i=N((Bh,Ri)=>{var je=Mn();Un()(je);Jn()(je);Yn()(je);ti()(je);di()(je);pi()(je);wi()(je);Si()(je);Ri.exports=je});import po from"@rollup/plugin-strip";import{visualizer as mo}from"rollup-plugin-visualizer";var tr=["/react/","/react-dom/","/scheduler/","/react-router","/@radix-ui/","/react-day-picker/","/react-hook-form/","/react-i18next/","/clsx/","/class-variance-authority/"],ro={valibot:["/valibot/"],firebase:["/firebase/","/@firebase/"],lucide:["/lucide-react/","/lucide/"],i18n:["/i18next/","/i18next-browser-languagedetector/","/i18next-http-backend/","/@donotdev/i18n/"],zustand:["/zustand/"],"tanstack-query":["/@tanstack/react-query/","/@tanstack/query-core/"]};function so(e){let t=e.match(/(?:^|\0)virtual:([^?]+)/);if(t)return t[1]}function Gr(e){let t=e.replace(/\\/g,"/");if(t.includes("/node_modules/"))return t.split("?")[0]}function qr(e,t=tr){return t.some(r=>e.includes(r))}function no(e){for(let[t,r]of Object.entries(ro))if(r.some(s=>e.includes(s)))return t}function io(e){let t=so(e);if(t)return t==="i18n-mapping"?"virtual-i18n-mapping":"virtual-modules";let r=Gr(e);if(!r)return;if(qr(r))return"react-core";let s=no(r);if(s)return s}function oo(e=[]){let t=e.filter(s=>!tr.includes(s)),r=[...tr,...t];return function(s){let n=Gr(s);if(n&&qr(n,r))return"react-core"}}var Ur={development:{manualChunks:void 0},production:{manualChunks:io}};function Wr(e,t={}){let r=Ur[e]||Ur.production,s=t.reactCore||[];return s.length>0?{manualChunks:oo(s)}:r}import*as he from"@clack/prompts";import*as T from"node:fs";import"node:fs";import{createRequire as lo}from"node:module";import{resolve as At,join as Te,dirname as Me,relative as Xr,normalize as co,sep as Yr,extname as uo}from"node:path";import{fileURLToPath as fo}from"node:url";import ho from"fast-glob";var rr={HOMEPAGE_FILE:"HomePage.tsx",HOMEPAGE_PATH:"/",HOMEPAGE_COMPONENT:"HomePage"};var W={routes:"virtual:routes",themes:"virtual:themes",i18n:"virtual:i18n-mapping",assets:"virtual:assets",env:"virtual:env"},ne={routes:"routes",themes:"themes",i18n:"i18n",assets:"assets",env:"env"},Q={next:{middleware:"middleware.ts",routeManifest:"public/route-manifest.json",assetManifest:"public/asset-manifest.json",utilities:"src/styles/utilities.generated.css",appPages:"src/app",appLayout:"src/app/layout.tsx",configRoute:"src/config/dndev-config-route.js",configTheme:"src/config/dndev-config-theme.js",configI18n:"src/config/dndev-config-i18n.js",configPwa:"src/config/dndev-config-pwa.js",configAsset:"src/config/dndev-config-asset.js",configSeo:"src/config/dndev-config-seo.js",configServer:"src/config/dndev-config-server.js"},vite:{routeInspection:"src/routes.generated.log",themeInspection:"src/themes.generated.log",i18nInspection:"src/i18n.generated.log",assetInspection:"src/assets.generated.log",envInspection:"src/env.generated.log"},manifests:{route:"route-manifest.json",theme:"theme-manifest.json",i18n:"i18n-manifest.json",asset:"asset-manifest.json",feature:"feature-manifest.json",env:"env-manifest.json"}},sr={package:"@donotdev/ui",assetsPath:"packages/ui/assets",browserTargets:["> 1%","last 2 versions","Firefox ESR","not dead","not op_mini all"]},mt={public:"public",fonts:"fonts",nodeModules:"node_modules",packages:"packages",core:"core",ui:"ui"},$t={SOURCE_ROOT:"packages/core/i18n",SOURCE_LOCALES:"packages/core/i18n/locales",SOURCE_EAGER:"packages/core/i18n/locales/eager",SOURCE_LAZY:"packages/core/i18n/locales/lazy",PUBLISHED_ROOT:"i18n",PUBLISHED_LOCALES:"i18n/locales",PUBLISHED_EAGER:"i18n/locales/eager",PUBLISHED_LAZY:"i18n/locales/lazy"},pe={routes:{consumer:["src/**/*Page.tsx","src/pages/**/*Page.tsx"],exclude:["**/node_modules/**","**/dist/**","**/build/**","**/*.test.tsx","**/*.stories.tsx"],extensions:[".tsx"]},css:{consumer:["src/**/*.css"],themes:["src/**/*.css"],extensions:[".css",".scss",".sass"],framework:["packages/ui/src/**/*.css","packages/core/components/src/**/*.css","packages/core/templates/src/**/*.css"]},i18n:{eager:["src/locales/*_*.json"],lazy:["src/**/locales/*_*.json","!src/locales/*_*.json","../../entities/locales/*_*.json"],additional:[],framework:{eager:[`${$t.SOURCE_EAGER}/*_*.json`],lazy:[`${$t.SOURCE_LAZY}/*_*.json`]},extensions:[".json"]},assets:{consumer:["public/**/*"],fallback:["manifest.json"],modern:["logo.svg","favicon.svg","apple-touch-icon.png","android-chrome-192x192.png","android-chrome-512x512.png"],patterns:["favicon.svg","favicon.ico","favicon-*.png","logo.svg","logo.png","logo.webp","logo.avif","apple-touch-icon*.png","android-chrome-*.png","manifest.json"],fonts:["fonts/**/*.woff2","fonts/**/*.woff","fonts/**/*.ttf"],framework:["packages/ui/assets/**/*"]},pwa:{consumer:["public/manifest.json","public/service-worker.js","public/sw.js","public/icon-192x192.png","public/icon-512x512.png","public/favicon.ico","public/favicon.svg","public/apple-touch-icon.png","public/logo.svg"],exclude:["**/node_modules/**","**/dist/**","**/build/**"],extensions:[".json",".js",".png",".svg",".ico"],framework:["packages/ui/assets/**/*"]},globalIgnore:["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/coverage/**","**/test/**"]},Xe={mandatoryIncludes:["react","react-dom","react-router-dom","zustand","lucide-react","valibot","i18next","i18next-browser-languagedetector","i18next-http-backend","react-i18next","@tanstack/react-query","react-helmet-async","@donotdev/core","@donotdev/components","@donotdev/ui","@donotdev/templates","@donotdev/firebase"],optionalFeatures:["@donotdev/adv-comps","@donotdev/auth","@donotdev/billing","@donotdev/crud","@donotdev/oauth","shiki","@tiptap/react","@tiptap/starter-kit","@tiptap/extension-placeholder"],coreBundled:["@donotdev/types","@donotdev/utils","@donotdev/stores","@donotdev/schemas","@donotdev/hooks","@donotdev/i18n","@donotdev/config"],componentsBundled:["class-variance-authority","clsx","lucide-react","react-day-picker"],radixUIPattern:"@radix-ui/",buildTools:["esbuild","@esbuild/win32-x64","@esbuild/darwin-x64","@esbuild/linux-x64","@esbuild/darwin-arm64","@esbuild/linux-arm64","vite","rollup","rollup-plugin-visualizer","@vitejs/plugin-react","vite-tsconfig-paths","vite-plugin-pwa","vite-plugin-compression2","vite-plugin-node-polyfills","fsevents","postcss","postcss-import","postcss-nesting","autoprefixer"],buildTimePackages:[],largeOptional:["@sentry/react","framer-motion","stripe","@tanstack/react-query","shiki","@tiptap/react","@tiptap/starter-kit","@tiptap/extension-placeholder","sharp","semver","file-type"]},Vr=["firebase-admin","gcp-metadata","google-logging-utils","payload","undici","@fastify/busboy","image-size","@donotdev/tooling","fs","path","crypto","net","tls","http","https","child_process","os","util","stream","buffer","events","querystring","url","zlib","assert","constants","domain","punycode","string_decoder","timers","tty","vm","worker_threads","cluster","dgram","dns","http2","inspector","module","perf_hooks","process","readline","repl","trace_events","v8","wasi"],nr=["@donotdev/core/functions","@donotdev/core/server"],ir={selectors:{class:/\.([a-zA-Z0-9-]+)/g,variable:/--[a-zA-Z0-9-]+/g,keyframe:/@keyframes\s+([a-zA-Z0-9-]+)/g},themes:{themeClass:/(?::root\.|\.)([a-z][a-z0-9-]+)\s*\{([\s\S]*?)\}/gim,themeLabel:/--theme-label\s*:\s*['"]([^'"]+)['"]/,themeIcon:/--theme-icon\s*:\s*['"]([^'"]+)['"]/,themeIsDark:/--theme-is-dark\s*:\s*(0|1)/}},bt={Inter:"inter-latin","Space Grotesk":"space-grotesk-latin","Playfair Display":"playfair-display-latin",Roboto:"roboto-latin"},or=[{name:"light",displayName:"Light",icon:"Sun",isDark:!1}],Hr={base:{absolute:!0,onlyFiles:!0,ignore:pe.globalIgnore},css:{absolute:!0,onlyFiles:!0,ignore:[...pe.globalIgnore,"**/*.test.css"]},routes:{absolute:!0,onlyFiles:!0,ignore:[...pe.globalIgnore,"**/*.test.tsx","**/*.stories.tsx"]},i18n:{absolute:!0,onlyFiles:!0,ignore:pe.globalIgnore},assets:{absolute:!0,onlyFiles:!0,ignore:pe.globalIgnore}};function Jr(e,t=null){let r=pe[e];if(!r)throw new Error(`Unknown pattern type: ${e}`);return t&&r.framework?{...r,framework:r.framework.map(s=>`${t}/${s}`)}:r}function kt(e){return Hr[e]||Hr.base}var rt={getGlobOptionsFor:kt||void 0,SCAN_PATTERNS:pe||void 0,getPatternsFor:Jr||void 0,I18N_PATHS:$t||void 0},Z={error:(e,t)=>{},warn:(e,t)=>{},info:e=>{}};function Kr(e,t){return e().catch(r=>{throw new Error(`${t}: ${r instanceof Error?r.message:String(r)}`)})}var Qr={CLI:"packages/cli",COMPONENTS:"packages/core/components",CONFIG:"packages/core/config",CORE:"packages/core",CRUD:"packages/core/crud",FEATURES:"packages/features",HOOKS:"packages/core/hooks",I18N:"packages/core/i18n",SCHEMAS:"packages/core/schemas",STORES:"packages/core/stores",TEMPLATES:"packages/templates",TOOLING:"packages/tooling",TYPES:"packages/core/types",UI:"packages/ui",UTILS:"packages/core/utils",AUTH:"packages/features/auth",BILLING:"packages/features/billing",OAUTH:"packages/features/oauth",FIREBASE:"packages/providers/firebase",FUNCTIONS:"packages/functions"},G=class e{static _instance=null;options;_repoRoot;_appRoot=null;static getInstance(t={}){return e._instance||(e._instance=new e(t)),e._instance}static _reset(){e._instance=null}constructor(t={}){if(e._instance)return e._instance;this.options={maxLevels:t.maxLevels??10,customMarkers:t.customMarkers||[],cache:t.cache??!1,debug:t.debug??!1};try{let r=process.cwd();if(!r)throw new Error("PathResolver: process.cwd() returned undefined. This should never happen.");this._repoRoot=this._findRepoRoot(r)}catch(r){throw new Error(`PathResolver constructor failed: ${r instanceof Error?r.message:String(r)}. cwd: ${process.cwd()}`)}this._appRoot=null,e._instance=this}normalizePath(t){if(!t)return"";try{return co(t).split(Yr).join("/")}catch{return String(t).split(Yr).join("/")}}getRelativePath(t){let r=this.getAppRoot(),s=Xr(r,t);return this.normalizePath(s)}getBasename(t){if(!t)return"";let s=this.normalizePath(t).split("/");return s[s.length-1]||""}getDirname(t){return t?this.normalizePath(Me(t)):""}resolvePackage(t,r=null){try{let s=r||this.getAppRoot(),i=lo(Te(s,"package.json")).resolve(t);return this.normalizePath(i)}catch{return null}}resolveFrameworkPackage(t,r=null){let s=this.resolvePackage(`${t}/package.json`,r);if(s)return this.getDirname(s);if(this.isMonorepo()&&t.startsWith("@donotdev/")){let o=t.replace("@donotdev/",""),a=this.resolveRepoPath(`packages/${o}`);if(this.pathExists(a))return a;if(["auth","billing","crud","oauth"].includes(o)){let l=this.resolveRepoPath(`packages/features/${o}`);if(this.pathExists(l))return l}if(o==="firebase"){let l=this.resolveRepoPath(`packages/providers/${o}`);if(this.pathExists(l))return l}}let n=this.resolveAppPath(`node_modules/${t}`);if(this.pathExists(n))return n;let i=this.resolveRepoPath(`node_modules/${t}`);return this.pathExists(i)?i:null}resolvePackageAsset(t,r=null){return this.resolvePackage(t,r)}resolveAppPath(t){let r=this.getAppRoot(),s=At(r,t);return this.normalizePath(s)}resolveRepoPath(t){let r=this.getRepoRoot(),s=this.normalizePath(t),n=At(r,s);return this.normalizePath(n)}resolvePath(t,r){let s=this.normalizePath(r),n=this.normalizePath(t),i=At(s,n);return this.normalizePath(i)}createImportPath(t){return"./"+this.getRelativePath(t)}getFileInfo(t){try{let r=T.statSync(t);return{absolutePath:this.normalizePath(t),relativePath:this.getRelativePath(t),importPath:this.createImportPath(t),size:r.size,isFile:r.isFile(),isDirectory:r.isDirectory()}}catch{return null}}_detectFormat(t,r){return r&&r!=="auto"?r:uo(t).toLowerCase()===".json"?"json":"text"}async read(t,r={}){let{format:s="auto",encoding:n="utf8"}=r,i=this._detectFormat(t,s);try{if(i==="buffer")return await T.promises.readFile(t);let o=await T.promises.readFile(t,n),a=this.stripBom(o);return i==="json"?JSON.parse(a):a}catch(o){return this.options.debug&&Z.warn(`Failed to read file: ${t}`,o),null}}readSync(t,r={}){let{format:s="auto",encoding:n="utf8"}=r,i=this._detectFormat(t,s);try{if(i==="buffer")return T.readFileSync(t);let o=T.readFileSync(t,n),a=this.stripBom(o);return i==="json"?JSON.parse(a):a}catch(o){return this.options.debug&&Z.warn(`Failed to read file: ${t}`,o),null}}async write(t,r,s={}){let{format:n="auto",overwrite:i=!1,dryRun:o=!1,verbose:a=!1}=s,l=this.normalizePath(t),f=this.normalizePath(Me(l)),u=this.pathExists(l);if(u&&!i)return a&&Z.info(`Skipping existing file: ${l}`),!1;if(o)return Z.info(`[DRY RUN] Would write file: ${l}`),!0;try{await T.promises.mkdir(f,{recursive:!0})}catch(m){if(m?.code!=="EEXIST")throw m}let g=this._detectFormat(t,n),p;Buffer.isBuffer(r)?p=r:g==="json"&&typeof r=="object"?p=JSON.stringify(r,null,2):p=String(r);try{return await Kr(async()=>(Buffer.isBuffer(p)?await T.promises.writeFile(l,p):await T.promises.writeFile(l,p,"utf8"),a&&Z.info(`${u?"Updated":"Created"} file: ${l}`),!0),`Failed to write file: ${l}`)}catch{return!1}}writeSync(t,r,s={}){let{format:n="auto",overwrite:i=!1,dryRun:o=!1,verbose:a=!1}=s,l=this.normalizePath(t),f=this.normalizePath(Me(l)),u=this.pathExists(l);if(u&&!i)return a&&Z.info(`Skipping existing file: ${l}`),!1;if(o)return Z.info(`[DRY RUN] Would write file: ${l}`),!0;try{T.mkdirSync(f,{recursive:!0})}catch(m){if(m?.code!=="EEXIST")throw m}let g=this._detectFormat(t,n),p;Buffer.isBuffer(r)?p=r:g==="json"&&typeof r=="object"?p=JSON.stringify(r,null,2):p=String(r);try{return Buffer.isBuffer(p)?T.writeFileSync(l,p):T.writeFileSync(l,p,"utf8"),a&&Z.info(`${u?"Updated":"Created"} file: ${l}`),!0}catch(m){throw new Error(`Failed to write file: ${l}: ${m instanceof Error?m.message:String(m)}`)}}async copy(t,r,s={}){let{overwrite:n=!1,dryRun:i=!1,verbose:o=!1}=s,a=this.normalizePath(r),l=this.pathExists(a);if(l&&!n)return o&&Z.info(`Skipping existing file: ${a}`),!1;if(i)return Z.info(`[DRY RUN] Would copy file: ${a}`),!0;let f=this.normalizePath(Me(a));try{await T.promises.mkdir(f,{recursive:!0})}catch(u){if(u?.code!=="EEXIST")throw u}try{return await Kr(async()=>(await T.promises.copyFile(t,a),o&&Z.info(`${l?"Updated":"Created"} file: ${a}`),!0),`Failed to copy file from ${t} to ${a}`)}catch{return!1}}copySync(t,r,s={}){let{overwrite:n=!1,dryRun:i=!1,verbose:o=!1}=s,a=this.normalizePath(r),l=this.pathExists(a);if(l&&!n)return o&&Z.info(`Skipping existing file: ${a}`),!1;if(i)return Z.info(`[DRY RUN] Would copy file: ${a}`),!0;let f=this.normalizePath(Me(a));try{T.mkdirSync(f,{recursive:!0})}catch(u){if(u?.code!=="EEXIST")throw u}try{return T.copyFileSync(t,a),o&&Z.info(`${l?"Updated":"Created"} file: ${a}`),!0}catch{return!1}}pathExists(t,r=!1){try{return T.existsSync(t)}catch(s){return r||Z.error(`Error checking path existence: ${t}`,s),!1}}mkdir(t){try{let r=t.startsWith("/")||t.match(/^[A-Z]:/)?this.normalizePath(t):this.resolveAppPath(t);return T.existsSync(r)||T.mkdirSync(r,{recursive:!0}),!0}catch{return!1}}readdirSync(t,r){try{return T.readdirSync(t,r)}catch(s){return this.options.debug&&Z.warn(`Failed to read directory: ${t}`,s),r&&typeof r=="object"&&"withFileTypes"in r&&r.withFileTypes?[]:[]}}statSync(t){try{return T.statSync(t)}catch(r){return this.options.debug&&Z.warn(`Failed to stat file: ${t}`,r),null}}lstatSync(t){try{return T.lstatSync(t)}catch(r){return this.options.debug&&Z.warn(`Failed to lstat file: ${t}`,r),null}}async ensureDir(t){try{await T.promises.mkdir(t,{recursive:!0})}catch(r){if(r?.code!=="EEXIST")throw r}}ensureDirSync(t){try{T.mkdirSync(t,{recursive:!0})}catch(r){if(r?.code!=="EEXIST")throw r}}async remove(t){await T.promises.rm(t,{recursive:!0,force:!0})}removeSync(t){T.rmSync(t,{recursive:!0,force:!0})}async readdir(t,r){return T.promises.readdir(t,r)}stripBom(t){return t.charCodeAt(0)===65279?t.slice(1):t}getRepoRoot(){return this._repoRoot||process.cwd()}getAppRoot(){return this._appRoot?this._appRoot:this._repoRoot}setAppRoot(t){if(!t)throw new Error("PathResolver.setAppRoot: root cannot be undefined or null");this._appRoot=this.normalizePath(t)}isMonorepo(){let t=Te(this._repoRoot,"packages");return this.pathExists(t)}isWithinApp(t){let r=this.normalizePath(At(t)),s=this.getAppRoot(),n=Xr(s,r),i=this.normalizePath(n);return!i.startsWith("../")&&!i.startsWith("/")}async findFiles(t,r,s={}){let n=this.normalizePath(Te(t,r)),i=this.getAppRoot(),o=this.normalizePath(i),a=n.startsWith(o)?n.slice(o.length+1):n,l={absolute:!0,onlyFiles:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:i,ignore:rt.SCAN_PATTERNS?.globalIgnore||["**/node_modules/**","**/dist/**","**/build/**","**/.git/**"]};return await this._globWithNormalization([a],{...l,...s})}clearCache(){}async _resolveFrameworkI18nPattern(t){let r=rt.I18N_PATHS;if(!r)return null;let s=t.replace(r.SOURCE_ROOT+"/",""),n=this.resolveFrameworkPackage("@donotdev/core");if(!n)return null;let i=this.normalizePath(Te(n,r.PUBLISHED_ROOT,s)),o=i.replace(/\/[^/]*\*.*$/,"");return this.pathExists(o),i}async _globWithNormalization(t,r){return(await ho(t,r)).map(n=>{let i=typeof n=="string"?n:n.path;return this.normalizePath(i)})}async resolveFiles(t,r="css"){if(!t||typeof t!="object")return{frameworkFiles:[],consumerFiles:[]};if(r==="i18n")return{frameworkFiles:[],consumerFiles:[]};if(Array.isArray(t.framework)||(t.framework=[]),!Array.isArray(t.consumer))return{frameworkFiles:[],consumerFiles:[]};let s=[...t.framework,...t.consumer];for(let u of s)if(typeof u!="string"||u.trim()==="")return{frameworkFiles:[],consumerFiles:[]};let n=this.getAppRoot(),i=rt.getGlobOptionsFor?rt.getGlobOptionsFor(r):{ignore:["**/node_modules/**","**/dist/**","**/build/**"]},o=this.normalizePath(n),a=t.framework.map(u=>{let g=this.normalizePath(u);return g.startsWith(o)?g.slice(o.length+1):g}),l=t.consumer.map(u=>{let g=this.normalizePath(u);return g.startsWith(o)?g.slice(o.length+1):g}),f={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:n};try{let u=a.length>0?await this._globWithNormalization(a,f):[],g=await this._globWithNormalization(l,f);return{frameworkFiles:u,consumerFiles:g}}catch{return this.options.debug,{frameworkFiles:[],consumerFiles:[]}}}async resolvePatterns(t){if(!rt.getPatternsFor)return{framework:[],consumer:[],all:[]};let r=this.getAppRoot(),s=this.getRepoRoot();if(t==="i18n"&&(!r||r===s))throw new Error(`Cannot resolve i18n patterns: appRoot not set (appRoot: ${r}, repoRoot: ${s}). Ensure configResolved hook has run before discovery.`);let n=rt.getPatternsFor(t),i=this.isMonorepo();if(t==="i18n"){let l=n,f={eager:l.eager.map(u=>u.startsWith("!")?"!"+this.resolveAppPath(u.slice(1)):this.resolveAppPath(u)),lazy:l.lazy.map(u=>u.startsWith("!")?"!"+this.resolveAppPath(u.slice(1)):this.resolveAppPath(u)),framework:{eager:i?(l.framework?.eager||[]).map(u=>this.resolveRepoPath(u)).filter(Boolean):await Promise.all((l.framework?.eager||[]).map(u=>this._resolveFrameworkI18nPattern(u))).then(u=>u.filter(Boolean)),lazy:i?(l.framework?.lazy||[]).map(u=>this.resolveRepoPath(u)).filter(Boolean):await Promise.all((l.framework?.lazy||[]).map(u=>this._resolveFrameworkI18nPattern(u))).then(u=>u.filter(Boolean))},all:[]};return f.all=[...f.eager,...f.lazy,...f.framework.eager,...f.framework.lazy],f}let o=n,a={framework:i?(o.framework||[]).map(l=>this.resolveRepoPath(l)).filter(Boolean):[],consumer:(o.consumer||[]).map(l=>this.resolveAppPath(l)),all:[]};return a.all=[...a.consumer,...a.framework],a}getEmptyModulePath(t=!1){if(t)return"@donotdev/core/empty";let r=this.resolvePackage("@donotdev/core/empty");if(r)return r;let s=Me(fo(import.meta.url));return this.normalizePath(Te(s,"../empty.js"))}_findRepoRoot(t){let r=this.normalizePath(t),s=0,n=this.options.maxLevels;for(;s<n;){let i=this.normalizePath(Te(r,Qr.TOOLING)),o=this.normalizePath(Te(r,Qr.CORE));if(this.pathExists(i)&&this.pathExists(o))return r;let a=Te(r,"apps");if(this.pathExists(a)&&this.statSync(a)?.isDirectory())return this.normalizePath(r);let l=this.normalizePath(Te(r,"package.json"));if(this.pathExists(l)&&this.normalizePath(Me(r))===r)return r;let f=this.normalizePath(Me(r));if(f===r)break;r=f,s++}return this.normalizePath(t)}};var Ee={reset:"\x1B[0m",green:"\x1B[32m",brightGreen:"\x1B[92m",red:"\x1B[31m",brightRed:"\x1B[91m",yellow:"\x1B[33m",brightYellow:"\x1B[93m",blue:"\x1B[34m",cyan:"\x1B[36m",brightCyan:"\x1B[96m",gray:"\x1B[90m",white:"\x1B[37m"};function go(){return process.env.NO_COLOR?!1:process.platform==="win32"?!0:process.stdout.isTTY===!0}function Pe(e,t){return go()?`${t}${e}${Ee.reset}`:e}function M(e,t,r,s={}){let{logDir:n=".dndev-logs",fileLogging:i=!1}=s,o=G.getInstance(),a=null;if(i){let u=o.resolveAppPath(n);o.pathExists(u)||o.mkdir(u),a=o.resolveAppPath(`${n}/${e.replace(/[^a-zA-Z0-9]/g,"-")}.log`);let g=`=== ${e} Log Started at ${new Date().toISOString()} ===
3
+ `;o.writeSync(a,g)}let l=(u,g,p)=>{if(a){let m=new Date().toISOString(),S=p.length>0?" "+p.map(q=>typeof q=="object"?JSON.stringify(q,null,2):String(q)).join(" "):"",z=`${m} [${u}] ${g}${S}
4
+ `;o.appendFile(a,z)}},f=(u,g)=>{if(g.length===0)return u;let p=g.map(m=>typeof m=="object"?JSON.stringify(m,null,2):String(m)).join(" ");return`${u} ${p}`};return{debug:(u,...g)=>{t&&(i?l("DEBUG",u,g):he.log.message(Pe(f(u,g),Ee.gray)))},verbose:(u,...g)=>{r&&(i?l("VERBOSE",u,g):he.log.message(f(u,g)))},info:(u,...g)=>{i?l("INFO",u,g):he.log.info(Pe(f(u,g),Ee.brightCyan))},warn:(u,...g)=>{t&&i?l("WARN",u,g):he.log.warn(Pe(f(u,g),Ee.brightYellow))},error:(u,...g)=>{t&&i?l("ERROR",u,g):he.log.error(Pe(f(u,g),Ee.brightRed))},success:(u,...g)=>{t&&i?l("SUCCESS",u,g):he.log.success(Pe(f(u,g),Ee.brightGreen))},when:(u,g="debug")=>(p,...m)=>{if(u){let S=f(p,m);switch(g){case"verbose":r&&(he.log.message(S),l("VERBOSE",p,m));break;case"info":he.log.info(Pe(S,Ee.brightCyan)),l("INFO",p,m);break;case"warn":he.log.warn(Pe(S,Ee.brightYellow)),l("WARN",p,m);break;case"error":he.log.error(Pe(S,Ee.brightRed)),l("ERROR",p,m);break;case"success":he.log.success(Pe(S,Ee.brightGreen)),l("SUCCESS",p,m);break;default:t&&(he.log.message(Pe(S,Ee.gray)),l("DEBUG",p,m))}}},getLogFilePath:()=>a}}function Zr(e={}){let{mode:t="development",chunkingOptions:r={},debug:s,verbose:n=!0,isDev:i,isDebug:o,shouldAnalyze:a,build:l={}}=e,f=M("build",s,n),u=Wr(t,r);return f.debug("\u{1F41B} DEBUG MODE ENABLED:"),f.debug(" - Minification: DISABLED"),f.debug(" - Sourcemaps: ENABLED"),f.debug(" - Console logs: PRESERVED"),f.debug(" - Debugger statements: PRESERVED"),a&&(f.info("\u{1F4CA} Bundle analysis enabled"),f.info(` Visual treemap will open after build (stats.html)
5
+ `)),{outDir:"dist",sourcemap:i||o,cacheDir:"node_modules/.vite",target:"baseline-widely-available",minify:o?!1:"esbuild",reportCompressedSize:!1,chunkSizeWarningLimit:2048,assetsInlineLimit:0,esbuild:{format:"esm",drop:o?[]:["console","debugger"],legalComments:"none"},cssMinify:o?!1:"esbuild",cssCodeSplit:!0,rollupOptions:{external:bo(),output:{format:"es",entryFileNames:"assets/[name].[hash].js",chunkFileNames:"assets/[name].[hash].js",assetFileNames:"assets/[name].[hash][extname]",...u.manualChunks&&{manualChunks:u.manualChunks},compact:!0},onwarn(p,m){p.code!=="MODULE_LEVEL_DIRECTIVE"&&m(p)},plugins:[...o?[]:[po({include:["**/*.js","**/*.ts","**/*.tsx","**/*.jsx"],functions:["console.*","debugger"],labels:["debug"]})],...a?[(()=>{let p=G.getInstance(),m=p.getAppRoot(),S="dist",z=p.resolveAppPath(`${S}/stats.html`),q=()=>{try{let A=p.resolveAppPath(S);p.pathExists(A)||p.mkdir(A)}catch{}},k=mo({filename:z,open:!0,gzipSize:!0,brotliSize:!0,template:"treemap",sourcemap:i||o,projectRoot:m});if(k.buildStart){let A=k.buildStart.bind(k);k.buildStart=function(...D){q();let I=A.apply(this,D);return I&&typeof I.then=="function"?I.catch(E=>{}):I}}else k.buildStart=function(){q()};let C=["generateBundle","writeBundle","closeBundle"];for(let A of C)if(k[A]){let D=k[A];k[A]=function(...I){try{q();let E=D.apply(this,I);return E&&typeof E.then=="function"?E.catch(B=>{let L=B?.message||B?.toString()||String(B)||"Unknown error";f.warn(`Bundle visualizer warning in ${A}: ${L}`),A==="closeBundle"&&f.warn(`You can manually open ${z} to view the bundle analysis`)}):E}catch(E){let B=E?.message||E?.toString()||String(E)||"Unknown error";buildLogger.warn(`Bundle visualizer warning in ${A}: ${B}`),A==="closeBundle"&&buildLogger.warn(` You can manually open ${z} to view the bundle analysis`)}}}return k})()]:[]]}}}function bo(e){return e?["firebase-admin","gcp-metadata","google-logging-utils","@google-cloud/firestore",/\.node$/,"esbuild",/@esbuild\/.*/]:["gcp-metadata","google-logging-utils","payload","file-type","firebase-admin","firebase-admin/app","firebase-admin/auth","firebase-admin/firestore","firebase-admin/functions","firebase-admin/credential","@google-cloud/firestore","google-auth-library","google-gax","googleapis-common"]}function vo(){let e=!1,t=G.getInstance();if((t.pathExists("/.dockerenv")||t.pathExists("/run/.containerenv"))&&(e=!0),!e&&(process.env.DOCKER_CONTAINER==="true"||process.env.IS_DOCKER==="true"||process.env.DOCKER_BUILDKIT==="1"||process.env.CI==="true"&&process.env.DOCKER==="true")&&(e=!0),!e&&process.env.DOCKER_HOST&&process.env.DOCKER_HOST.includes("docker")&&(e=!0),!e&&process.platform==="linux"&&t.pathExists("/proc/self/cgroup"))try{let n=t.readSync("/proc/self/cgroup");n&&(n.includes("docker")||n.includes("containerd"))&&(e=!0)}catch{}let r=!1;if((process.env.WSL_DISTRO_NAME||process.env.WSLENV)&&(r=!0),!r&&process.platform==="linux"&&t.pathExists("/proc/version"))try{let n=(t.readSync("/proc/version")||"").toLowerCase();r=n.includes("microsoft")||n.includes("wsl")}catch{}if(!r&&process.platform==="linux"&&t.pathExists("/proc/sys/kernel/osrelease"))try{let n=(t.readSync("/proc/sys/kernel/osrelease")||"").toLowerCase()||"";(n.includes("microsoft")||n.includes("wsl"))&&(r=!0)}catch{}if(!r&&process.platform==="win32"){let n=process.cwd();n&&(n.includes("\\wsl$")||n.includes("\\wsl.localhost"))&&(r=!0)}let s=typeof process.versions?.bun=="string";return{isDocker:e,isWSL2:r,isBun:s}}function yo(e,t){if(e!==void 0)return e;let{isDocker:r,isWSL2:s,isBun:n}=vo();if(r||s||n){let i=r?"Docker":s?"WSL2":"Bun";return t.info(`Detected ${i} environment - enabling polling mode for file watching`),!0}}function es(e,t={},r){let s=G.getInstance(),n=s.getRepoRoot(),{watch:i,hmr:o,host:a,...l}=t||{},f=o||{},u=a===!0?"localhost":a||"localhost",g={...f.port&&{port:f.port},...f.clientPort&&{clientPort:f.clientPort},host:f.host??u,...f.protocol&&{protocol:f.protocol},overlay:f.overlay??!0,timeout:f.timeout??5e3},p=a!==void 0?a:!0,m=l.https===!0;return{port:e,host:p,open:t.open!==void 0?t.open:!0,https:m,fs:{allow:[n,s.resolveRepoPath("packages"),s.resolveRepoPath("node_modules")],strict:!1},watch:{usePolling:yo(t?.watch?.usePolling,r),interval:t?.watch?.interval??2e3,...t?.watch||{}},hmr:{...g,...f},headers:{"Cross-Origin-Opener-Policy":"same-origin-allow-popups","Cross-Origin-Embedder-Policy":"unsafe-none"},middlewareMode:!1,...l}}function ts(e={}){let t=e.https===!0;return{...e,https:t}}var me={CONCATENATE_DEDUPE:"CONCATENATE_DEDUPE",SHALLOW_MERGE:"SHALLOW_MERGE",DEEP_MERGE:"DEEP_MERGE",REPLACE:"REPLACE"};function ze(e,t,r,s={}){let{protectedKeys:n=[],onConflict:i}=s;if(t==null)return e;switch(r){case me.CONCATENATE_DEDUPE:{if(!Array.isArray(e)||!Array.isArray(t))return t;let o=[...e,...t];return[...new Set(o)]}case me.SHALLOW_MERGE:return typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)||Array.isArray(t)?t:{...e,...t};case me.DEEP_MERGE:{if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)||Array.isArray(t))return t;let o={...e};for(let a in t){if(n.includes(a)){i&&i(a,e[a],t[a]);continue}typeof o[a]=="object"&&typeof t[a]=="object"&&o[a]!==null&&t[a]!==null&&!Array.isArray(o[a])&&!Array.isArray(t[a])?o[a]=ze(o[a],t[a],me.DEEP_MERGE,{protectedKeys:n,onConflict:i}):o[a]=t[a]}return o}case me.REPLACE:default:return t}}function rs(e,t,r=[],s){let n=[...e,...t||[]],i=[...new Set(n)];return[...new Set([...i,...r])]}var _t={base:"/",mode:process.env.NODE_ENV==="production"?"production":"development",debug:!1,verbose:process.env.CI!=="true",server:{port:3e3,strictPort:!0,host:!0,open:!0,cors:!0,https:!0,hmr:{overlay:!0,timeout:5e3,usePolling:void 0,interval:2e3},watch:{usePolling:void 0,interval:2e3}},build:{sourcemap:!0,target:"es2020",minify:"esbuild",cssMinify:"esbuild",analyze:!0},preview:{port:4173,strictPort:!0,host:!0,open:!1,cors:!0,https:!0},routes:{hmr:!0},themes:{},i18n:{},assets:{},features:{},pwa:{enabled:!1},seo:{disabled:!1,generateRobotsTxt:!0,generateSitemap:!0,crawlDelay:1},serverShim:{enabled:!0},chunking:{reactCore:[]},discovery:{verbose:!0,cacheTimeout:6e4,fileLogging:!1,logDir:".dndev-logs"},pluginFactory:{verbose:!0,disableHmr:!1,hmrSmartDetection:!0,hmrDebounceMs:500,hmrCacheTimeout:3e4},resolve:{alias:{"@":"/src"},preserveSymlinks:!1},define:{__DEV__:JSON.stringify(process.env.NODE_ENV==="development"),__PROD__:JSON.stringify(process.env.NODE_ENV==="production")},optimizeDeps:{include:[...Xe.mandatoryIncludes],exclude:[...Xe.buildTools,...Object.values(W)],esbuildOptions:{format:"esm",target:"es2020",platform:"browser",define:{"process.env.NODE_ENV":JSON.stringify(process.env.NODE_ENV||"development")},external:["next","next/*"]}},plugins:[],css:{},envDir:void 0};function ss(e={},t={}){let{onConflict:r}=t,s={..._t},n=[],i=(o,a,l,f)=>{n.push({key:o,frameworkValue:a,userValue:l,reason:f}),r&&r(o,a,l,f)};return Object.keys(e).forEach(o=>{let a=e[o],l=s[o];if(o==="optimizeDeps"&&typeof a=="object"&&a!==null){let f=l?.include||[],u=l?.exclude||[],g=a.include||[],p=a.exclude||[],m=f.filter(C=>!C.startsWith("@donotdev/")),S=p.filter(C=>m.includes(C));if(S.length>0)for(let C of S)i("optimizeDeps.exclude",C,"excluded",`Framework requires ${C} to be included. It will be included despite your exclusion.`);let z=rs(f,g,m),q=ze(u,p,me.CONCATENATE_DEDUPE),k=ze(l?.esbuildOptions||{},a.esbuildOptions||{},me.DEEP_MERGE,{protectedKeys:["external"],onConflict:C=>i(`optimizeDeps.esbuildOptions.${C}`,l?.esbuildOptions?.[C],a.esbuildOptions?.[C],`Framework requires ${C} to remain as configured.`)});s[o]={...l,include:z,exclude:q,esbuildOptions:k,...Object.fromEntries(Object.entries(a).filter(([C])=>!["include","exclude","esbuildOptions"].includes(C)))};return}if(o==="css"&&typeof a=="object"&&a!==null){s[o]=ze(l||{},a,me.DEEP_MERGE,{protectedKeys:["postcss"],onConflict:()=>i("css.postcss","framework PostCSS config",a.postcss,"Framework PostCSS config is required and cannot be overridden. Your postcss config is ignored.")});return}if(o==="define"&&typeof a=="object"&&a!==null){s[o]=ze(l||{},a,me.DEEP_MERGE,{protectedKeys:["__DEV__","__PROD__"],onConflict:f=>i(`define.${f}`,l?.[f],a[f],`Framework requires ${f} to remain as configured.`)});return}if(Array.isArray(a)){Array.isArray(l)?s[o]=ze(l,a,me.CONCATENATE_DEDUPE):s[o]=a;return}if(typeof a=="object"&&a!==null&&typeof l=="object"&&l!==null&&!Array.isArray(l)){s[o]=ze(l,a,me.SHALLOW_MERGE);return}s[o]=a}),s}function ns(e){let{server:t={},preview:r={},mode:s,build:n={},resolve:i={},routes:o={},themes:a={},i18n:l={},assets:f={},features:u={},seo:g={},pwa:p={},serverShim:m={},chunking:S={},discovery:z={},pluginFactory:q={},debug:k,verbose:C,base:A,define:D={},optimizeDeps:I={},plugins:E=[],css:B={},envDir:L,...ue}=e,$=s!=="production",_=k||$,te=s==="production"&&(n.analyze??_t.build.analyze);return{mode:s,debug:k,verbose:C,isDev:$,isDebug:_,shouldAnalyze:te,serverOptions:t,previewOptions:r,buildOverrides:n,resolveOptions:i,routeOptions:o,themeOptions:a,i18nOptions:l,assetOptions:f,featureOptions:u,seoOptions:g,pwaOptions:p,serverShimOptions:m,chunkingOptions:S,discoveryOptions:z,pluginFactoryOptions:q,base:A,defineOptions:D,optimizeDepsOptions:I,pluginsOptions:E,cssOptions:B,envDir:L,restOptions:ue}}import{resolve as wo}from"node:path";import Eo from"autoprefixer";import xo from"postcss-import";import Po from"postcss-nesting";function is({postcssImport:e,postcssNesting:t,autoprefixer:r,resolve:s}){return{plugins:[s?e({resolve:s}):e,t,r({overrideBrowserslist:["> 1%","last 2 versions","Firefox ESR","not dead","not op_mini all"],grid:"autoplace"})]}}function os(e={}){return e.postcss?e.postcss:async()=>{let t=G.getInstance();return is({postcssImport:xo,postcssNesting:Po,autoprefixer:Eo,resolve:(s,n)=>{let i=t.resolvePackage(s,n);if(i)return i;if(s.startsWith("@donotdev/")){let o=s.split("/")[0]+"/"+s.split("/")[1],a=s.split("/").slice(2).join("/"),l=t.resolveFrameworkPackage(o,n);if(l&&a){let f=t.resolvePath(a,l);if(t.pathExists(f))return f}}return wo(n,s)}})}}import cf from"@vitejs/plugin-basic-ssl";import uf from"@vitejs/plugin-react";import ff from"vite-tsconfig-paths";var ie=class{static generateVirtualModule(t,r,s=!1,n=void 0,i=void 0){return r.isEmpty(t)?r.generateEmpty(t,s,n,i):r.generateModule(t,s,i)}static generateInspection(t,r,s,n){return r.generateInspection.length>=3?r.generateInspection(t,s,n):r.generateInspection(t,s)}static wrapVirtualModule(t,r){return`// Virtual module: ${t}
6
6
  // Generated by @donotdev/config discovery
7
7
  // Version: 1.0.0
8
8
 
@@ -38,13 +38,13 @@ var qi=Object.create;var Lr=Object.defineProperty;var Wi=Object.getOwnPropertyDe
38
38
  `);return`// Helper functions for ${t}
39
39
  // Generated by @donotdev/config
40
40
 
41
- ${s}`}static validateTemplates(t){return["isEmpty","generateModule","generateEmpty","generateInspection"].every(s=>t[s]&&typeof t[s]=="function")}static createTemplateConfig(t,r){let{isEmpty:s=()=>!1,generateModule:n=()=>"",generateEmpty:i=()=>"",generateInspection:o=()=>"",generateManifest:a=()=>({}),logConfig:l=()=>{},logStats:u=()=>{},logManifest:f=()=>{}}=r;return{isEmpty:s,generateModule:n,generateEmpty:i,generateInspection:o,generateManifest:a,logConfig:l,logStats:u,logManifest:f,pluginName:t,version:"1.0.0",createdAt:new Date().toISOString()}}static getEmptyResultWithError(t,r){let s=r?.message||r||"Unknown error";if(t&&typeof t._getEmptyResult=="function")try{let n=t._getEmptyResult();return n.errors&&Array.isArray(n.errors)?n.errors.push(s):n.errors===void 0&&(n.errors=[s]),n.source==="empty"&&(n.source="error"),n}catch{return{errors:[s],source:"error"}}return{errors:[s],source:"error"}}};function Re(e){let{pluginName:t,icon:r,virtualModuleId:s,DiscoveryClass:n,discoveryMethod:i,filePatterns:o,templates:a,defaultInspectionPath:l,manifestFileName:u,createDiscovery:f,discoveryOptions:g={},configKey:p}=e;return function(I={}){let{debug:q,verbose:H,virtualModuleId:$=s,inspectionFilePath:C=l,hmrDebounceMs:k,hmrCacheTimeout:D,hmrSmartDetection:N,disableHmr:E,...M}=I;if(!ie.validateTemplates(a))throw new Error(`Invalid templates for plugin ${t}`);let L={...At.discovery,...g,debug:q,verbose:H,...M},ue=p||(()=>{let b=t.match(/dndev-vite-(\w+)-discovery/);return b?b[1]:null})(),S=z(t,q,H,{fileLogging:L.fileLogging,logDir:L.logDir}),A=W.getInstance(),te=()=>{let b=A.getAppRoot(),P=A.getRepoRoot();return b&&b!==P},pt=Date.now(),fe=f?f(A,L):new n(A,L),xe="\0"+$,F="",O=!1,j=null,Y=0,He=!1,re=null,Me=!1,De=null,tt=!1;typeof global<"u"&&(global.__DNDEV_CLEAR_CACHE__=()=>(fe.clearCache(),re=null,S.info("Discovery cache cleared manually"),"Cache cleared"));function Kt(b){let X=ie.generateVirtualModule(b,a,q,L,ue).replace(/mode:\s*['"]development['"]/g,"mode: typeof process !== 'undefined' && process.env.NODE_ENV === 'production' ? 'production' : 'development'");return!E&&O&&(X+=`
41
+ ${s}`}static validateTemplates(t){return["isEmpty","generateModule","generateEmpty","generateInspection"].every(s=>t[s]&&typeof t[s]=="function")}static createTemplateConfig(t,r){let{isEmpty:s=()=>!1,generateModule:n=()=>"",generateEmpty:i=()=>"",generateInspection:o=()=>"",generateManifest:a=()=>({}),logConfig:l=()=>{},logStats:f=()=>{},logManifest:u=()=>{}}=r;return{isEmpty:s,generateModule:n,generateEmpty:i,generateInspection:o,generateManifest:a,logConfig:l,logStats:f,logManifest:u,pluginName:t,version:"1.0.0",createdAt:new Date().toISOString()}}static getEmptyResultWithError(t,r){let s=r?.message||r||"Unknown error";if(t&&typeof t._getEmptyResult=="function")try{let n=t._getEmptyResult();return n.errors&&Array.isArray(n.errors)?n.errors.push(s):n.errors===void 0&&(n.errors=[s]),n.source==="empty"&&(n.source="error"),n}catch{return{errors:[s],source:"error"}}return{errors:[s],source:"error"}}};function Se(e){let{pluginName:t,icon:r,virtualModuleId:s,DiscoveryClass:n,discoveryMethod:i,filePatterns:o,templates:a,defaultInspectionPath:l,manifestFileName:f,createDiscovery:u,discoveryOptions:g={},configKey:p}=e;return function(S={}){let{debug:z,verbose:q,virtualModuleId:k=s,inspectionFilePath:C=l,hmrDebounceMs:A,hmrCacheTimeout:D,hmrSmartDetection:I,disableHmr:E,...B}=S;if(!ie.validateTemplates(a))throw new Error(`Invalid templates for plugin ${t}`);let L={..._t.discovery,...g,debug:z,verbose:q,...B},ue=p||(()=>{let b=t.match(/dndev-vite-(\w+)-discovery/);return b?b[1]:null})(),$=M(t,z,q,{fileLogging:L.fileLogging,logDir:L.logDir}),_=G.getInstance(),te=()=>{let b=_.getAppRoot(),P=_.getRepoRoot();return b&&b!==P},gt=Date.now(),fe=u?u(_,L):new n(_,L),xe="\0"+k,F="",O=!1,j=null,Y=0,He=!1,re=null,Le=!1,De=null,tt=!1;typeof global<"u"&&(global.__DNDEV_CLEAR_CACHE__=()=>(fe.clearCache(),re=null,$.info("Discovery cache cleared manually"),"Cache cleared"));function Qt(b){let X=ie.generateVirtualModule(b,a,z,L,ue).replace(/mode:\s*['"]development['"]/g,"mode: typeof process !== 'undefined' && process.env.NODE_ENV === 'production' ? 'production' : 'development'");return!E&&O&&(X+=`
42
42
 
43
43
  // HMR boundary for ${t}
44
44
  if (import.meta.hot) {
45
45
  import.meta.hot.accept();
46
46
  }
47
- `),X}function Qt(b){return ie.generateInspection(b,a,F,L)}async function mt(){if(F)try{let b=await fe[i](),P=Qt(b),X=A.resolveAppPath(C);await A.write(X,P),S.debug(`Generated inspection file: ${A.getRelativePath(X)}`)}catch(b){S.error(`${t} failed to write inspection file (${C}): ${b.message}`),S.error(`Stack: ${b.stack||"No stack trace available"}`)}}function Rt(b){let P=b.replace(/\\/g,"/");if(E||P.includes("/node_modules/")||P.includes("/.git/")||P.includes("/dist/")||P.includes("/build/")||P.includes("/coverage/")||P.includes("/.vite/")||P.includes("/.turbo/")||P.endsWith(".d.ts")||P.endsWith(".tsbuildinfo")||P.endsWith(".map")||P.endsWith(".css.map")||P.endsWith(".generated.log")||/\.generated\.[a-z]+$/.test(P))return!1;let X=A.getRelativePath(P);if(X.startsWith("packages/"))return!1;let Je=X.startsWith("src/")&&/\.(ts|tsx)$/.test(X);return Je?Array.isArray(o)&&o.length>0?o.some(ye=>typeof ye=="function"?ye(P):typeof ye=="string"?ye.startsWith("**/")?P.endsWith(ye.slice(3)):P.endsWith(ye):!1):Je:!1}function Zt(b){if(E)return S.debug("Virtual modules are static - HMR disabled"),[];let P=Date.now();return Me?(S.debug("HMR already in progress, skipping update"),[]):P-Y<k?(He||(He=!0,j=setTimeout(()=>{He=!1,Y=Date.now(),Ve(b)},k)),[]):(Y=P,Ve(b))}function Ve(b){let P=Date.now();if(De===b.file&&P-Y<100)return S.debug(`Same file processed too recently: ${b.file}`),[];if(!Rt(b.file))return S.debug(`Skipping irrelevant file change: ${b.file}`),[];S.debug(`Relevant file changed: ${b.file}`),Me=!0,De=b.file;try{let X=Date.now()-(re?.timestamp||0);if(X<D&&re){S.debug(`Using cached discovery data (age: ${X}ms)`);let ye=b.server.moduleGraph.getModuleById(xe);return ye&&b.server.reloadModule(ye),[]}fe.clearCache();let Je=b.server.moduleGraph.getModuleById(xe);return Je&&b.server.reloadModule(Je),j&&clearTimeout(j),j=setTimeout(()=>{mt()},500),[]}finally{Me=!1,setTimeout(()=>{De===b.file&&(De=null)},200)}}return{name:t,enforce:"pre",configResolved(b){F=b.root,O=b.command==="serve",q&&S.debug(`${r} ${t} initialized`),O&&S.debug("\u{1F4A1} Dev mode: Press 'r' in terminal to restart, or use global.__DNDEV_CLEAR_CACHE__() in console"),a.logConfig&&a.logConfig(L),O?S.debug("Deferring discovery until first module load (dev mode)"):fe[i](!1).catch(P=>{S.error(`${t} failed initial discovery during plugin initialization: ${P.message}`),S.error(`Stack: ${P.stack||"No stack trace available"}`)})},config(b){return b.optimizeDeps||(b.optimizeDeps={}),b.optimizeDeps.exclude||(b.optimizeDeps.exclude=[]),b.optimizeDeps.exclude.includes($)||b.optimizeDeps.exclude.push($),b},resolveId(b){return b===$?(S.debug(`Resolving virtual module: ${b}`),{id:xe,moduleSideEffects:!0}):null},async load(b){if(b!==xe)return null;if(S.debug(`Loading virtual module: ${b}`),!te()){S.warn("\u26A0\uFE0F load() called before appRoot is set - waiting for config resolution");let P=0;for(;!te()&&P<100;)await new Promise(X=>setTimeout(X,10)),P++;if(!te())throw new Error("App root not set before discovery. Ensure configResolved hook has set appRoot.")}try{let P;return re?(S.debug("Using cached discovery data for virtual module"),P=re):(S.warn(`\u26A0\uFE0F No cached discovery data found for ${t} - running discovery in load() hook. This may indicate buildStart() hook did not run or failed. Performance may be impacted.`),P=await fe[i](),re=P,S.debug("Discovery completed for virtual module")),Kt(P)}catch(P){return S.error(`${t} virtual module (${xe}) failed to load: ${P.message}`),S.error(`Stack: ${P.stack||"No stack trace available"}`),a.generateEmpty({},q,L,ue)}},async buildStart(){if(tt=!1,!te()){S.warn("\u26A0\uFE0F buildStart() called before appRoot is set - waiting for config resolution");let b=0;for(;!te()&&b<100;)await new Promise(P=>setTimeout(P,10)),b++;if(!te())throw new Error("App root not set before discovery. Ensure configResolved hook has set appRoot.")}try{let b=await fe[i](!re);re=b,await mt(),a.logStats&&a.logStats(b,r,S)}catch(b){S.error(`${t} discovery failed during file scanning: ${b.message}`),S.error(`Stack: ${b.stack||"No stack trace available"}`),re=ie.getEmptyResultWithError(fe,b)}finally{tt=!0}},configureServer(){tt=!0},handleHotUpdate(b){return E?[]:tt?Zt(b):(S.debug("HMR disabled - discovery not complete yet"),[])},generateBundle(){if(!re){S.warn("No cached discovery data for manifest generation - skipping");return}try{let b=ie.generateManifest(re,a.generateManifest);this.emitFile({type:"asset",fileName:u,source:JSON.stringify(b,null,2)}),H&&a.logManifest&&a.logManifest(re,t)}catch(b){S.error(`${t} manifest generation failed: ${b.message}`),S.error(`Stack: ${b.stack||"No stack trace available"}`)}},transform(b,P){return P===xe?{code:b,map:null}:null}}}}var Gf={generateGlobals:ie.generateGlobals,generateExports:ie.generateExports,generateDefaultExport:ie.generateDefaultExport,wrapVirtualModule:ie.wrapVirtualModule,generateInspectionHeader:ie.generateInspectionHeader,validateTemplates:ie.validateTemplates,createTemplateConfig:ie.createTemplateConfig};var be=class e{constructor(t,r={}){if(this.constructor===e)throw new Error("BaseDiscovery is abstract and cannot be instantiated directly");this.pathResolver=t,this.options={...r},process.env.NODE_ENV==="development"&&(this.options.cacheTimeout=Math.max(this.options.cacheTimeout||6e4,3e5)),this.logger=z(this._getDiscoveryType(),this.options.debug,this.options.verbose,{fileLogging:this.options.fileLogging,logDir:this.options.logDir}),this.cache=null,this._lastDiscoveryTime=0}async discover(t=!1){if(!t&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let r=Date.now();try{let s=await this._getPatterns();this.options.verbose&&s&&(typeof s=="object"&&s.pattern?this.logger.verbose(`Pattern: ${s.pattern}`):typeof s=="string"&&this.logger.verbose(`Pattern: ${s}`),s.dirs&&this.logger.verbose(`Search directories: ${s.dirs.slice(0,3).join(", ")}${s.dirs.length>3?` (${s.dirs.length} total)`:""}`));let n=await this._scanFiles(s),i=await this._processFiles(n);this.cache={...i,timestamp:Date.now()};let o=Date.now()-r;return this.logger.debug(`Discovery completed in ${o}ms`),this._lastDiscoveryTime=Date.now(),this.cache}catch(s){return this.logger.error(`${this._getDiscoveryType()} discovery failed during file scanning: ${s.message}`),this.logger.error(`Stack: ${s.stack||"No stack trace available"}`),this._getEmptyResult()}}clearCache(){this.cache=null,this._lastDiscoveryTime=0,this.logger.debug("Cache cleared")}getCachedResults(){return this.cache}_getDiscoveryType(){throw new Error("_getDiscoveryType must be implemented by subclass")}_getPatterns(){throw new Error("_getPatterns must be implemented by subclass")}_getPatternType(){throw new Error("_getPatternType must be implemented by subclass")}async _processFiles(t){throw new Error("_processFiles must be implemented by subclass")}_getEmptyResult(){throw new Error("_getEmptyResult must be implemented by subclass")}_getDiscoverySummary(){throw new Error("_getDiscoverySummary must be implemented by subclass")}async _scanFiles(t){let r=this._getPatternType();return await this.pathResolver.resolveFiles(t,r)}_extractFileNameInfo(t){let r=t.split("/"),s=r[r.length-1],n=s.split(".")[0],i=s.split(".").pop();return{fileName:s,baseName:n,extension:i,directory:r.slice(0,-1).join("/")}}async _processSingleFile(t,r){try{let s=this.pathResolver.getFileInfo(t);return s?await r(s):(this.logger.debug(`Could not get file info: ${t}`),null)}catch(s){return this.logger.debug(`Error processing file ${t}: ${s.message}`),null}}async _batchProcessFiles(t,r){return(await Promise.all(t.map(n=>this._processSingleFile(n,r)))).filter(n=>n!==null)}_isCacheValid(){return this.cache?Date.now()-this.cache.timestamp<this.options.cacheTimeout:!1}};var Ht=class extends be{constructor(t,r={}){super(t,{assets:pe.assets.fallback,assetPatterns:pe.assets.patterns,frameworkPackage:rr.package,assetsPath:rr.assetsPath,modernFormats:pe.assets.modern,...r}),this.hasRunForSession=!1}_getDiscoveryType(){return"Asset"}async _getPatterns(){return await this.pathResolver.resolvePatterns("assets")}_getPatternType(){return"assets"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=await this._ensureDefaultAssets(r),n=this.pathResolver.resolveAppPath("public/logo.svg");this.pathResolver.pathExists(n)||this.logger.warn("logo.svg not found in public/. Add your logo.svg to generate PWA assets, or copy from node_modules/@donotdev/ui/assets/logo.svg");let o=[],a=this.pathResolver.resolveAppPath("public/logo.svg");this.pathResolver.pathExists(a)&&this.options.generateAssets!==!1&&(o=(await this._generateMissingAssets(r))?.generated||[]);let{consumerFiles:l}=t,u=await this._processAssetFiles(l),f=this._buildAssetManifest(u),g=await this._readLogoSvgContent("/logo.svg",r);return{assets:u,manifest:{...f,logoSvgContent:g},copiedAssets:s,generatedAssets:o,pwaIcons:this._extractPWAIcons(u)}}_extractPWAIcons(t){let r=[/icon-(\d+)x(\d+)\.(png|jpg|jpeg|webp|svg)/i,/apple-touch-icon/i,/android-chrome/i,/favicon\.(ico|svg)/i];return t.filter(s=>{let n=s.path.split("/").pop()||"";return r.some(i=>i.test(n))}).map(s=>{let n=s.path.split("/").pop()||"",i=n.match(/(\d+)x(\d+)/),o=i?{width:parseInt(i[1]),height:parseInt(i[2])}:this._getDefaultIconSize(n);return{type:"icon",path:s.path.replace(/^\/?public\//,""),size:o,format:s.format||this._getFormatFromPath(s.path),purpose:this._getIconPurpose(n)}})}_getDefaultIconSize(t){return t.includes("apple-touch-icon")?{width:180,height:180}:t.includes("favicon")?{width:32,height:32}:{width:192,height:192}}_getFormatFromPath(t){return t.split(".").pop()?.toLowerCase()||"png"}_getIconPurpose(t){return t.includes("maskable")||t.includes("mask")?"maskable":"any"}_getEmptyResult(){return{assets:[],manifest:this._getEmptyManifest(),copiedAssets:[],timestamp:Date.now()}}_getDiscoverySummary(){let t=this.cache?.assets?.length||0,r=this.cache?.copiedAssets?.length||0,s=this.cache?.copiedAssets?.filter(n=>n.startsWith("fonts/")).length||0;return s>0?`${t} assets, ${r} copied (${s} fonts)`:`${t} assets, ${r} copied`}async discoverAssets(t=!1){return await this.discover(t)}getAssets(){return this.cache?.assets||[]}getManifest(){return this.cache?.manifest||this._getEmptyManifest()}getOptimalAsset(t,r){let s=this.getAssets().map(i=>i.path),n=r||this.options.modernFormats;for(let i of n){let o=`/${t}.${i}`;if(s.includes(o))return o}return null}async _ensureDefaultAssets(t){this.logger.debug("Ensuring default assets with modern format support...");let r=[];try{let s=await this._resolveFrameworkAssetsDir(t);if(this.logger.debug(`Framework assets directory resolved to: ${s}`),!s)return this.logger.debug("Framework assets directory not found, skipping defaults"),r;let n=this.pathResolver.resolveAppPath(Te.public);this.pathResolver.pathExists(n)||(this.pathResolver.mkdir(n),this.logger.debug(`Created public directory: ${n}`));for(let i of this.options.assets)await this._ensureAsset(i,n,s)&&r.push(i);if(this.options.copyFonts!==!1){let i=await this._copyFrameworkFonts(s,n);r.push(...i)}else this.logger.debug("Font copying disabled, skipping framework fonts");r.length>0&&this.logger.debug(`Added ${r.length} default assets from DNDev framework`)}catch(s){this.logger.debug(`Failed to ensure default assets: ${s.message}`)}return r}async _ensureAsset(t,r,s){let n=this.pathResolver.resolveAppPath(`${Te.public}/${t}`);if(this.pathResolver.pathExists(n))return this.logger.debug(`Asset exists: ${t}`),!1;let i=this.pathResolver.normalizePath(`${s}/${t}`);if(this.pathResolver.pathExists(i)){if(await this.pathResolver.copy(i,n))return this.logger.debug(`Copied framework asset: ${t}`),!0;this.logger.debug(`Failed to copy framework asset: ${t}`)}return!1}async _copyFrameworkFonts(t,r){let s=[],n=this.pathResolver.normalizePath(`${t}/fonts`);if(!this.pathResolver.pathExists(n))return this.logger.debug("Framework fonts directory not found, skipping fonts"),s;let i=this.pathResolver.resolveAppPath(`${Te.public}/${Te.fonts}`);this.pathResolver.pathExists(i)||(this.pathResolver.mkdir(i),this.logger.debug(`Created fonts directory: ${i}`));try{let o=await this.pathResolver.findFiles(n,"*",{onlyFiles:!0,ignore:["**/dist/**","**/build/**","**/.git/**"]});for(let a of o){let l=a.split("/").pop()||a.split("\\").pop(),u=this.pathResolver.resolveAppPath(`${Te.public}/${Te.fonts}/${l}`);if(this.pathResolver.pathExists(u)){this.logger.debug(`Font already exists: ${l}`);continue}await this.pathResolver.copy(a,u)?(s.push(`fonts/${l}`),this.logger.debug(`Copied framework font: ${l}`)):this.logger.debug(`Failed to copy font: ${l}`)}s.length>0&&this.logger.debug(`Copied ${s.length} font files from framework`)}catch(o){this.logger.debug(`Error copying fonts: ${o.message}`)}return s}async _processAssetFiles(t){let r=[];for(let s of t)try{let n=this.pathResolver.getFileInfo(s);if(n&&n.isFile){let i=s.split("/").pop()||s.split("\\").pop(),o=this._analyzeAsset(i,n.size);o&&r.push(o)}}catch(n){this.logger.debug(`Error processing asset file ${s}: ${n.message}`)}return this.logger.debug(`Processed ${r.length} assets from ${t.length} files`),r}_analyzeAsset(t,r){let s=this._determineAssetType(t),n=this._determineAssetFormat(t);return this.options.assetPatterns.some(o=>this._matchesPattern(t,o))?{path:`/${t}`,name:t,type:s,format:n,size:r,sizeFormatted:this._formatBytes(r),isModern:this.options.modernFormats.includes(n)}:(this.logger.debug(`Asset ${t} does not match any pattern, skipping`),null)}_determineAssetType(t){let r=t.toLowerCase();if(r.includes("favicon"))return"favicon";if(r.includes("logo"))return"logo";if(r.includes("icon"))return"icon";if(r.includes("apple-touch"))return"apple-touch-icon";if(r.includes("android-chrome"))return"android-icon";if(r.includes("manifest"))return"manifest";let s=t.split(".").pop()?.toLowerCase();return["png","jpg","jpeg","gif","webp","avif","svg"].includes(s)?"image":["woff2","woff","ttf","otf"].includes(s)?"font":["json"].includes(s)?"json":["ico"].includes(s)?"icon":"unknown"}_determineAssetFormat(t){return t.split(".").pop()?.toLowerCase()||"unknown"}_formatBytes(t){if(t===0)return"0 Bytes";let r=1024,s=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(t)/Math.log(r));return parseFloat((t/Math.pow(r,n)).toFixed(2))+" "+s[n]}_matchesPattern(t,r){let s=t.toLowerCase(),n=r.toLowerCase();return s.includes(n.replace("*",""))}_buildAssetManifest(t){let r=t.map(n=>n.path);return{logo:{optimal:this._getOptimalAsset("logo",r,this.options.modernFormats),fallback:this._getOptimalAsset("logo",r,["png","jpg","jpeg"])},favicon:{optimal:this._getOptimalAsset("favicon",r,["svg","ico"]),fallback:this._getOptimalAsset("favicon",r,["ico"])},appleTouchIcon:this._getOptimalAsset("apple-touch-icon",r,["png"]),androidChrome:{192:this._getOptimalAsset("android-chrome-192x192",r,["png"]),512:this._getOptimalAsset("android-chrome-512x512",r,["png"])},manifest:r.find(n=>n.includes("manifest.json"))||null,modernFormats:t.filter(n=>n.isModern).map(n=>n.path),fallbackFormats:t.filter(n=>!n.isModern).map(n=>n.path)}}_getOptimalAsset(t,r,s){for(let n of s){let i=`/${t}.${n}`;if(r.includes(i))return i}return null}async _resolveFrameworkAssetsDir(t){try{let r=this.pathResolver.getRepoRoot(),s=await this._resolvePackage("@donotdev/ui",r);if(!s)return this.logger.debug("@donotdev/ui package not found"),null;let n=this.pathResolver.normalizePath(`${s}/assets`);return this.pathResolver.pathExists(n)?(this.logger.debug(`Using framework assets from: ${n}`),n):(this.logger.debug(`Assets directory not found: ${n}`),null)}catch(r){return this.logger.debug(`Error resolving framework assets directory: ${r.message}`),null}}async _resolvePackage(t,r){try{let s=this.pathResolver.resolveFrameworkPackage(t,r);return s?(this.logger.debug(`Found package: ${s}`),s):(this.logger.debug(`Package ${t} not found`),null)}catch(s){return this.logger.debug(`Error resolving package ${t}: ${s.message}`),null}}_getEmptyManifest(){return{logo:{optimal:null,fallback:null},favicon:{optimal:null,fallback:null},appleTouchIcon:null,androidChrome:{192:null,512:null},manifest:null,modernFormats:[],fallbackFormats:[],logoSvgContent:null}}async _readLogoSvgContent(t,r){if(!t||!t.endsWith(".svg"))return null;try{let s=t.slice(1),n=this.pathResolver.resolveAppPath(`${Te.public}/${s}`);return this.pathResolver.pathExists(n)&&await this.pathResolver.read(n,{format:"text"})||null}catch(s){return this.logger.debug(`Failed to read logo SVG content: ${s.message}`),null}}async _copyFrameworkLogo(t){try{let r=await this._resolveFrameworkAssetsDir(t);if(!r)return this.logger.debug("Framework assets directory not found"),!1;let s=this.pathResolver.normalizePath(`${r}/logo.svg`);if(!this.pathResolver.pathExists(s))return this.logger.debug("Framework logo.svg not found"),!1;let n=this.pathResolver.resolveAppPath(Te.public);this.pathResolver.pathExists(n)||this.pathResolver.mkdir(n);let i=this.pathResolver.resolveAppPath("public/logo.svg");return await this.pathResolver.copy(s,i)}catch(r){return this.logger.debug(`Failed to copy framework logo: ${r.message}`),!1}}async _generateMissingAssets(t){let r=this.pathResolver.resolveAppPath("public/logo.svg"),s=this.pathResolver.resolveAppPath("public");if(!this.pathResolver.pathExists(r))return this.logger.debug("logo.svg not found in public/, skipping asset generation"),{generated:[],skipped:[],error:"logo.svg not found in public/"};let n=[{name:"favicon.ico",size:32,format:"ico"},{name:"apple-touch-icon.png",size:180,format:"png"},{name:"icon-192x192.png",size:192,format:"png"},{name:"icon-512x512.png",size:512,format:"png"}],i=[{name:"favicon.svg",format:"svg"}],o=[],a=[];try{let l=await this.pathResolver.read(r,{format:"text"});if(!l)return{generated:[],skipped:[...i,...n].map(f=>f.name),error:"Failed to read logo.svg"};for(let f of i){let g=`${s}/${f.name}`;if(this.pathResolver.pathExists(g)){a.push(f.name);continue}try{await this.pathResolver.write(`public/${f.name}`,l),o.push(f.name)}catch(p){this.logger.debug(`Failed to copy ${f.name}: ${p.message}`),a.push(f.name)}}let u=await Promise.resolve().then(()=>Yi(Pi(),1)).catch(()=>null);if(!u)this.logger.debug("sharp not installed, skipping PNG/ICO generation"),a.push(...n.map(f=>f.name));else for(let f of n){let g=`${s}/${f.name}`;if(this.pathResolver.pathExists(g)){a.push(f.name);continue}try{let p=u.default(r).resize(f.size,f.size,{fit:"contain",background:{r:255,g:255,b:255,alpha:0}}),m;f.format==="ico"?m=await p.toFormat("png").toBuffer():m=await p.toFormat(f.format).toBuffer(),await this.pathResolver.write(`public/${f.name}`,m),o.push(f.name)}catch(p){this.logger.debug(`Failed to generate ${f.name}: ${p.message}`),a.push(f.name)}}return{generated:o,skipped:a,error:null}}catch(l){return this.logger.debug(`Asset generation failed: ${l.message}`),{generated:[],skipped:requiredAssets.map(u=>u.name),error:l.message}}}};var Fr={data:null},Mu={isEmpty:e=>!e.manifest||e.assets?.length===0,generateModule:(e,t,r="assets")=>{let{manifest:s,assets:n,copiedAssets:i}=e,o=s.logoSvgContent||null,a={totalAssets:n.length,copiedAssets:i.length,hasLogo:s.logo.optimal!==null,hasFavicon:s.favicon.optimal!==null,hasManifest:s.manifest!==null,timestamp:new Date().toISOString()};return`// ${U.assets} - Generated asset manifest
47
+ `),X}function Zt(b){return ie.generateInspection(b,a,F,L)}async function pt(){if(F)try{let b=await fe[i](),P=Zt(b),X=_.resolveAppPath(C);await _.write(X,P),$.debug(`Generated inspection file: ${_.getRelativePath(X)}`)}catch(b){$.error(`${t} failed to write inspection file (${C}): ${b.message}`),$.error(`Stack: ${b.stack||"No stack trace available"}`)}}function Rt(b){let P=b.replace(/\\/g,"/");if(E||P.includes("/node_modules/")||P.includes("/.git/")||P.includes("/dist/")||P.includes("/build/")||P.includes("/coverage/")||P.includes("/.vite/")||P.includes("/.turbo/")||P.endsWith(".d.ts")||P.endsWith(".tsbuildinfo")||P.endsWith(".map")||P.endsWith(".css.map")||P.endsWith(".generated.log")||/\.generated\.[a-z]+$/.test(P))return!1;let X=_.getRelativePath(P);if(X.startsWith("packages/"))return!1;let Je=X.startsWith("src/")&&/\.(ts|tsx)$/.test(X);return Je?Array.isArray(o)&&o.length>0?o.some(ye=>typeof ye=="function"?ye(P):typeof ye=="string"?ye.startsWith("**/")?P.endsWith(ye.slice(3)):P.endsWith(ye):!1):Je:!1}function er(b){if(E)return $.debug("Virtual modules are static - HMR disabled"),[];let P=Date.now();return Le?($.debug("HMR already in progress, skipping update"),[]):P-Y<A?(He||(He=!0,j=setTimeout(()=>{He=!1,Y=Date.now(),Ve(b)},A)),[]):(Y=P,Ve(b))}function Ve(b){let P=Date.now();if(De===b.file&&P-Y<100)return $.debug(`Same file processed too recently: ${b.file}`),[];if(!Rt(b.file))return $.debug(`Skipping irrelevant file change: ${b.file}`),[];$.debug(`Relevant file changed: ${b.file}`),Le=!0,De=b.file;try{let X=Date.now()-(re?.timestamp||0);if(X<D&&re){$.debug(`Using cached discovery data (age: ${X}ms)`);let ye=b.server.moduleGraph.getModuleById(xe);return ye&&b.server.reloadModule(ye),[]}fe.clearCache();let Je=b.server.moduleGraph.getModuleById(xe);return Je&&b.server.reloadModule(Je),j&&clearTimeout(j),j=setTimeout(()=>{pt()},500),[]}finally{Le=!1,setTimeout(()=>{De===b.file&&(De=null)},200)}}return{name:t,enforce:"pre",configResolved(b){F=b.root,O=b.command==="serve",z&&$.debug(`${r} ${t} initialized`),O&&$.debug("\u{1F4A1} Dev mode: Press 'r' in terminal to restart, or use global.__DNDEV_CLEAR_CACHE__() in console"),a.logConfig&&a.logConfig(L),O?$.debug("Deferring discovery until first module load (dev mode)"):fe[i](!1).catch(P=>{$.error(`${t} failed initial discovery during plugin initialization: ${P.message}`),$.error(`Stack: ${P.stack||"No stack trace available"}`)})},config(b){return b.optimizeDeps||(b.optimizeDeps={}),b.optimizeDeps.exclude||(b.optimizeDeps.exclude=[]),b.optimizeDeps.exclude.includes(k)||b.optimizeDeps.exclude.push(k),b},resolveId(b){return b===k?($.debug(`Resolving virtual module: ${b}`),{id:xe,moduleSideEffects:!0}):null},async load(b){if(b!==xe)return null;if($.debug(`Loading virtual module: ${b}`),!te()){$.warn("\u26A0\uFE0F load() called before appRoot is set - waiting for config resolution");let P=0;for(;!te()&&P<100;)await new Promise(X=>setTimeout(X,10)),P++;if(!te())throw new Error("App root not set before discovery. Ensure configResolved hook has set appRoot.")}try{let P;return re?($.debug("Using cached discovery data for virtual module"),P=re):($.warn(`\u26A0\uFE0F No cached discovery data found for ${t} - running discovery in load() hook. This may indicate buildStart() hook did not run or failed. Performance may be impacted.`),P=await fe[i](),re=P,$.debug("Discovery completed for virtual module")),Qt(P)}catch(P){return $.error(`${t} virtual module (${xe}) failed to load: ${P.message}`),$.error(`Stack: ${P.stack||"No stack trace available"}`),a.generateEmpty({},z,L,ue)}},async buildStart(){if(tt=!1,!te()){$.warn("\u26A0\uFE0F buildStart() called before appRoot is set - waiting for config resolution");let b=0;for(;!te()&&b<100;)await new Promise(P=>setTimeout(P,10)),b++;if(!te())throw new Error("App root not set before discovery. Ensure configResolved hook has set appRoot.")}try{let b=await fe[i](!re);re=b,await pt(),a.logStats&&a.logStats(b,r,$)}catch(b){$.error(`${t} discovery failed during file scanning: ${b.message}`),$.error(`Stack: ${b.stack||"No stack trace available"}`),re=ie.getEmptyResultWithError(fe,b)}finally{tt=!0}},configureServer(){tt=!0},handleHotUpdate(b){return E?[]:tt?er(b):($.debug("HMR disabled - discovery not complete yet"),[])},generateBundle(){if(!re){$.warn("No cached discovery data for manifest generation - skipping");return}try{let b=ie.generateManifest(re,a.generateManifest);this.emitFile({type:"asset",fileName:f,source:JSON.stringify(b,null,2)}),q&&a.logManifest&&a.logManifest(re,t)}catch(b){$.error(`${t} manifest generation failed: ${b.message}`),$.error(`Stack: ${b.stack||"No stack trace available"}`)}},transform(b,P){return P===xe?{code:b,map:null}:null}}}}var Yf={generateGlobals:ie.generateGlobals,generateExports:ie.generateExports,generateDefaultExport:ie.generateDefaultExport,wrapVirtualModule:ie.wrapVirtualModule,generateInspectionHeader:ie.generateInspectionHeader,validateTemplates:ie.validateTemplates,createTemplateConfig:ie.createTemplateConfig};var be=class e{constructor(t,r={}){if(this.constructor===e)throw new Error("BaseDiscovery is abstract and cannot be instantiated directly");this.pathResolver=t,this.options={...r},process.env.NODE_ENV==="development"&&(this.options.cacheTimeout=Math.max(this.options.cacheTimeout||6e4,3e5)),this.logger=M(this._getDiscoveryType(),this.options.debug,this.options.verbose,{fileLogging:this.options.fileLogging,logDir:this.options.logDir}),this.cache=null,this._lastDiscoveryTime=0}async discover(t=!1){if(!t&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let r=Date.now();try{let s=await this._getPatterns();this.options.verbose&&s&&(typeof s=="object"&&s.pattern?this.logger.verbose(`Pattern: ${s.pattern}`):typeof s=="string"&&this.logger.verbose(`Pattern: ${s}`),s.dirs&&this.logger.verbose(`Search directories: ${s.dirs.slice(0,3).join(", ")}${s.dirs.length>3?` (${s.dirs.length} total)`:""}`));let n=await this._scanFiles(s),i=await this._processFiles(n);this.cache={...i,timestamp:Date.now()};let o=Date.now()-r;return this.logger.debug(`Discovery completed in ${o}ms`),this._lastDiscoveryTime=Date.now(),this.cache}catch(s){return this.logger.error(`${this._getDiscoveryType()} discovery failed during file scanning: ${s.message}`),this.logger.error(`Stack: ${s.stack||"No stack trace available"}`),this._getEmptyResult()}}clearCache(){this.cache=null,this._lastDiscoveryTime=0,this.logger.debug("Cache cleared")}getCachedResults(){return this.cache}_getDiscoveryType(){throw new Error("_getDiscoveryType must be implemented by subclass")}_getPatterns(){throw new Error("_getPatterns must be implemented by subclass")}_getPatternType(){throw new Error("_getPatternType must be implemented by subclass")}async _processFiles(t){throw new Error("_processFiles must be implemented by subclass")}_getEmptyResult(){throw new Error("_getEmptyResult must be implemented by subclass")}_getDiscoverySummary(){throw new Error("_getDiscoverySummary must be implemented by subclass")}async _scanFiles(t){let r=this._getPatternType();return await this.pathResolver.resolveFiles(t,r)}_extractFileNameInfo(t){let r=t.split("/"),s=r[r.length-1],n=s.split(".")[0],i=s.split(".").pop();return{fileName:s,baseName:n,extension:i,directory:r.slice(0,-1).join("/")}}async _processSingleFile(t,r){try{let s=this.pathResolver.getFileInfo(t);return s?await r(s):(this.logger.debug(`Could not get file info: ${t}`),null)}catch(s){return this.logger.debug(`Error processing file ${t}: ${s.message}`),null}}async _batchProcessFiles(t,r){return(await Promise.all(t.map(n=>this._processSingleFile(n,r)))).filter(n=>n!==null)}_isCacheValid(){return this.cache?Date.now()-this.cache.timestamp<this.options.cacheTimeout:!1}};var Vt=class extends be{constructor(t,r={}){super(t,{assets:pe.assets.fallback,assetPatterns:pe.assets.patterns,frameworkPackage:sr.package,assetsPath:sr.assetsPath,modernFormats:pe.assets.modern,...r}),this.hasRunForSession=!1}_getDiscoveryType(){return"Asset"}async _getPatterns(){return await this.pathResolver.resolvePatterns("assets")}_getPatternType(){return"assets"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=await this._ensureDefaultAssets(r),n=this.pathResolver.resolveAppPath("public/logo.svg");this.pathResolver.pathExists(n)||this.logger.warn("logo.svg not found in public/. Add your logo.svg to generate PWA assets, or copy from node_modules/@donotdev/ui/assets/logo.svg");let o=[],a=this.pathResolver.resolveAppPath("public/logo.svg");this.pathResolver.pathExists(a)&&this.options.generateAssets!==!1&&(o=(await this._generateMissingAssets(r))?.generated||[]);let{consumerFiles:l}=t,f=await this._processAssetFiles(l),u=this._buildAssetManifest(f),g=await this._readLogoSvgContent("/logo.svg",r);return{assets:f,manifest:{...u,logoSvgContent:g},copiedAssets:s,generatedAssets:o,pwaIcons:this._extractPWAIcons(f)}}_extractPWAIcons(t){let r=[/icon-(\d+)x(\d+)\.(png|jpg|jpeg|webp|svg)/i,/apple-touch-icon/i,/android-chrome/i,/favicon\.(ico|svg)/i];return t.filter(s=>{let n=s.path.split("/").pop()||"";return r.some(i=>i.test(n))}).map(s=>{let n=s.path.split("/").pop()||"",i=n.match(/(\d+)x(\d+)/),o=i?{width:parseInt(i[1]),height:parseInt(i[2])}:this._getDefaultIconSize(n);return{type:"icon",path:s.path.replace(/^\/?public\//,""),size:o,format:s.format||this._getFormatFromPath(s.path),purpose:this._getIconPurpose(n)}})}_getDefaultIconSize(t){return t.includes("apple-touch-icon")?{width:180,height:180}:t.includes("favicon")?{width:32,height:32}:{width:192,height:192}}_getFormatFromPath(t){return t.split(".").pop()?.toLowerCase()||"png"}_getIconPurpose(t){return t.includes("maskable")||t.includes("mask")?"maskable":"any"}_getEmptyResult(){return{assets:[],manifest:this._getEmptyManifest(),copiedAssets:[],timestamp:Date.now()}}_getDiscoverySummary(){let t=this.cache?.assets?.length||0,r=this.cache?.copiedAssets?.length||0;return`${t} assets, ${r} copied`}async discoverAssets(t=!1){return await this.discover(t)}getAssets(){return this.cache?.assets||[]}getManifest(){return this.cache?.manifest||this._getEmptyManifest()}getOptimalAsset(t,r){let s=this.getAssets().map(i=>i.path),n=r||this.options.modernFormats;for(let i of n){let o=`/${t}.${i}`;if(s.includes(o))return o}return null}async _ensureDefaultAssets(t){this.logger.debug("Ensuring default assets with modern format support...");let r=[];try{let s=await this._resolveFrameworkAssetsDir(t);if(this.logger.debug(`Framework assets directory resolved to: ${s}`),!s)return this.logger.debug("Framework assets directory not found, skipping defaults"),r;let n=this.pathResolver.resolveAppPath(mt.public);this.pathResolver.pathExists(n)||(this.pathResolver.mkdir(n),this.logger.debug(`Created public directory: ${n}`));for(let i of this.options.assets)await this._ensureAsset(i,n,s)&&r.push(i);r.length>0&&this.logger.debug(`Added ${r.length} default assets from DNDev framework`)}catch(s){this.logger.debug(`Failed to ensure default assets: ${s.message}`)}return r}async _ensureAsset(t,r,s){let n=this.pathResolver.resolveAppPath(`${mt.public}/${t}`);if(this.pathResolver.pathExists(n))return this.logger.debug(`Asset exists: ${t}`),!1;let i=this.pathResolver.normalizePath(`${s}/${t}`);if(this.pathResolver.pathExists(i)){if(await this.pathResolver.copy(i,n))return this.logger.debug(`Copied framework asset: ${t}`),!0;this.logger.debug(`Failed to copy framework asset: ${t}`)}return!1}async _processAssetFiles(t){let r=[];for(let s of t)try{let n=this.pathResolver.getFileInfo(s);if(n&&n.isFile){let i=s.split("/").pop()||s.split("\\").pop(),o=this._analyzeAsset(i,n.size);o&&r.push(o)}}catch(n){this.logger.debug(`Error processing asset file ${s}: ${n.message}`)}return this.logger.debug(`Processed ${r.length} assets from ${t.length} files`),r}_analyzeAsset(t,r){let s=this._determineAssetType(t),n=this._determineAssetFormat(t);return this.options.assetPatterns.some(o=>this._matchesPattern(t,o))?{path:`/${t}`,name:t,type:s,format:n,size:r,sizeFormatted:this._formatBytes(r),isModern:this.options.modernFormats.includes(n)}:(this.logger.debug(`Asset ${t} does not match any pattern, skipping`),null)}_determineAssetType(t){let r=t.toLowerCase();if(r.includes("favicon"))return"favicon";if(r.includes("logo"))return"logo";if(r.includes("icon"))return"icon";if(r.includes("apple-touch"))return"apple-touch-icon";if(r.includes("android-chrome"))return"android-icon";if(r.includes("manifest"))return"manifest";let s=t.split(".").pop()?.toLowerCase();return["png","jpg","jpeg","gif","webp","avif","svg"].includes(s)?"image":["woff2","woff","ttf","otf"].includes(s)?"font":["json"].includes(s)?"json":["ico"].includes(s)?"icon":"unknown"}_determineAssetFormat(t){return t.split(".").pop()?.toLowerCase()||"unknown"}_formatBytes(t){if(t===0)return"0 Bytes";let r=1024,s=["Bytes","KB","MB","GB"],n=Math.floor(Math.log(t)/Math.log(r));return parseFloat((t/Math.pow(r,n)).toFixed(2))+" "+s[n]}_matchesPattern(t,r){let s=t.toLowerCase(),n=r.toLowerCase();return s.includes(n.replace("*",""))}_buildAssetManifest(t){let r=t.map(n=>n.path);return{logo:{optimal:this._getOptimalAsset("logo",r,this.options.modernFormats),fallback:this._getOptimalAsset("logo",r,["png","jpg","jpeg"])},favicon:{optimal:this._getOptimalAsset("favicon",r,["svg","ico"]),fallback:this._getOptimalAsset("favicon",r,["ico"])},appleTouchIcon:this._getOptimalAsset("apple-touch-icon",r,["png"]),androidChrome:{192:this._getOptimalAsset("android-chrome-192x192",r,["png"]),512:this._getOptimalAsset("android-chrome-512x512",r,["png"])},manifest:r.find(n=>n.includes("manifest.json"))||null,modernFormats:t.filter(n=>n.isModern).map(n=>n.path),fallbackFormats:t.filter(n=>!n.isModern).map(n=>n.path)}}_getOptimalAsset(t,r,s){for(let n of s){let i=`/${t}.${n}`;if(r.includes(i))return i}return null}async _resolveFrameworkAssetsDir(t){try{let r=this.pathResolver.getRepoRoot(),s=await this._resolvePackage("@donotdev/ui",r);if(!s)return this.logger.debug("@donotdev/ui package not found"),null;let n=this.pathResolver.normalizePath(`${s}/assets`);return this.pathResolver.pathExists(n)?(this.logger.debug(`Using framework assets from: ${n}`),n):(this.logger.debug(`Assets directory not found: ${n}`),null)}catch(r){return this.logger.debug(`Error resolving framework assets directory: ${r.message}`),null}}async _resolvePackage(t,r){try{let s=this.pathResolver.resolveFrameworkPackage(t,r);return s?(this.logger.debug(`Found package: ${s}`),s):(this.logger.debug(`Package ${t} not found`),null)}catch(s){return this.logger.debug(`Error resolving package ${t}: ${s.message}`),null}}_getEmptyManifest(){return{logo:{optimal:null,fallback:null},favicon:{optimal:null,fallback:null},appleTouchIcon:null,androidChrome:{192:null,512:null},manifest:null,modernFormats:[],fallbackFormats:[],logoSvgContent:null}}async _readLogoSvgContent(t,r){if(!t||!t.endsWith(".svg"))return null;try{let s=t.slice(1),n=this.pathResolver.resolveAppPath(`${mt.public}/${s}`);return this.pathResolver.pathExists(n)&&await this.pathResolver.read(n,{format:"text"})||null}catch(s){return this.logger.debug(`Failed to read logo SVG content: ${s.message}`),null}}async _copyFrameworkLogo(t){try{let r=await this._resolveFrameworkAssetsDir(t);if(!r)return this.logger.debug("Framework assets directory not found"),!1;let s=this.pathResolver.normalizePath(`${r}/logo.svg`);if(!this.pathResolver.pathExists(s))return this.logger.debug("Framework logo.svg not found"),!1;let n=this.pathResolver.resolveAppPath(mt.public);this.pathResolver.pathExists(n)||this.pathResolver.mkdir(n);let i=this.pathResolver.resolveAppPath("public/logo.svg");return await this.pathResolver.copy(s,i)}catch(r){return this.logger.debug(`Failed to copy framework logo: ${r.message}`),!1}}async _generateMissingAssets(t){let r=this.pathResolver.resolveAppPath("public/logo.svg"),s=this.pathResolver.resolveAppPath("public");if(!this.pathResolver.pathExists(r))return this.logger.debug("logo.svg not found in public/, skipping asset generation"),{generated:[],skipped:[],error:"logo.svg not found in public/"};let n=[{name:"favicon.ico",size:32,format:"ico"},{name:"apple-touch-icon.png",size:180,format:"png"},{name:"icon-192x192.png",size:192,format:"png"},{name:"icon-512x512.png",size:512,format:"png"}],i=[{name:"favicon.svg",format:"svg"}],o=[],a=[];try{let l=await this.pathResolver.read(r,{format:"text"});if(!l)return{generated:[],skipped:[...i,...n].map(u=>u.name),error:"Failed to read logo.svg"};for(let u of i){let g=`${s}/${u.name}`;if(this.pathResolver.pathExists(g)){a.push(u.name);continue}try{await this.pathResolver.write(`public/${u.name}`,l),o.push(u.name)}catch(p){this.logger.debug(`Failed to copy ${u.name}: ${p.message}`),a.push(u.name)}}let f=await Promise.resolve().then(()=>to($i(),1)).catch(()=>null);if(!f)this.logger.debug("sharp not installed, skipping PNG/ICO generation"),a.push(...n.map(u=>u.name));else for(let u of n){let g=`${s}/${u.name}`;if(this.pathResolver.pathExists(g)){a.push(u.name);continue}try{let p=f.default(r).resize(u.size,u.size,{fit:"contain",background:{r:255,g:255,b:255,alpha:0}}),m;u.format==="ico"?m=await p.toFormat("png").toBuffer():m=await p.toFormat(u.format).toBuffer(),await this.pathResolver.write(`public/${u.name}`,m),o.push(u.name)}catch(p){this.logger.debug(`Failed to generate ${u.name}: ${p.message}`),a.push(u.name)}}return{generated:o,skipped:a,error:null}}catch(l){return this.logger.debug(`Asset generation failed: ${l.message}`),{generated:[],skipped:requiredAssets.map(f=>f.name),error:l.message}}}};var Or={data:null},qu={isEmpty:e=>!e.manifest||e.assets?.length===0,generateModule:(e,t,r="assets")=>{let{manifest:s,assets:n,copiedAssets:i}=e,o=s.logoSvgContent||null,a={totalAssets:n.length,copiedAssets:i.length,hasLogo:s.logo.optimal!==null,hasFavicon:s.favicon.optimal!==null,hasManifest:s.manifest!==null,timestamp:new Date().toISOString()};return`// ${W.assets} - Generated asset manifest
48
48
  const assetManifest = ${JSON.stringify(s,null,2)};
49
49
  const assetStats = ${JSON.stringify(a,null,2)};
50
50
 
@@ -114,7 +114,7 @@ export default {
114
114
  getManifest,
115
115
  getAllAssets
116
116
  };
117
- `},generateEmpty:(e,t,r,s="assets")=>{let n={totalAssets:0,copiedAssets:0,hasLogo:!1,hasFavicon:!1,hasManifest:!1,timestamp:new Date().toISOString()};return`// ${U.assets} - Empty asset manifest
117
+ `},generateEmpty:(e,t,r,s="assets")=>{let n={totalAssets:0,copiedAssets:0,hasLogo:!1,hasFavicon:!1,hasManifest:!1,timestamp:new Date().toISOString()};return`// ${W.assets} - Empty asset manifest
118
118
  const assetManifest = {
119
119
  logo: { optimal: null, fallback: null },
120
120
  favicon: { optimal: null, fallback: null },
@@ -213,7 +213,7 @@ export default discoveredAssets;
213
213
  `:`/**
214
214
  * Generated Asset Discovery Results
215
215
  * Generated at: ${new Date().toISOString()}
216
- * Import from '${U.assets}'
216
+ * Import from '${W.assets}'
217
217
  */
218
218
 
219
219
  export const discoveredAssets = ${JSON.stringify(t,null,2)};
@@ -230,7 +230,7 @@ export const assetStats = {
230
230
  };
231
231
 
232
232
  export default discoveredAssets;
233
- `},generateManifest:e=>({assets:e.assets?.length||0,copied:e.copiedAssets?.length||0,timestamp:Date.now(),hasLogo:e.manifest?.logo?.optimal!==null,hasFavicon:e.manifest?.favicon?.optimal!==null}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.assets?.length||0,n=e.generatedAssets?.length||0;r&&(n>0?r.info(`${t} Assets: ${s} found, ${n} generated`):r.info(`${t} Assets: ${s} found`))}},zu=[e=>e.includes("/public/"),e=>e.endsWith(".png")||e.endsWith(".svg")||e.endsWith(".ico"),e=>e.includes("favicon")||e.includes("logo")||e.includes("manifest")];function Ri(e={}){let t=Re({pluginName:"dndev-vite-asset-discovery",icon:"\u{1F3AF}",virtualModuleId:U.assets,DiscoveryClass:Ht,discoveryMethod:"discoverAssets",filePatterns:zu,templates:Mu,defaultInspectionPath:Q.vite.assetInspection,manifestFileName:Q.manifests.asset,configKey:"assets"})(e),r=W.getInstance(),s=z("asset-plugin",e.debug,e.verbose),n=t.buildStart;return t.buildStart=async function(...i){n&&await n.apply(this,i);let o=null;try{let a=r.resolveAppPath(Q.vite.assetInspection);if(r.pathExists(a)){let l=r.readSync(a,{format:"json"});l&&(o=l,Fr.data=o)}}catch(a){s.debug(`Could not cache asset data: ${a.message}`)}},t}import{loadEnv as Bu}from"vite";var Si={isEmpty:e=>!e.env||Object.keys(e.env).length===0,generateModule:(e,t,r="env")=>{let{env:s,mode:n}=e;if(!s||Object.keys(s).length===0)return Si.generateEmpty(e,t,void 0,r);let i={totalVars:Object.keys(s).length,mode:n,source:e.source,generatedAt:new Date().toISOString()};return`// ${U.env} - Generated environment variables
233
+ `},generateManifest:e=>({assets:e.assets?.length||0,copied:e.copiedAssets?.length||0,timestamp:Date.now(),hasLogo:e.manifest?.logo?.optimal!==null,hasFavicon:e.manifest?.favicon?.optimal!==null}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.assets?.length||0,n=e.generatedAssets?.length||0;r&&(n>0?r.info(`${t} Assets: ${s} found, ${n} generated`):r.info(`${t} Assets: ${s} found`))}},Wu=[e=>e.includes("/public/"),e=>e.endsWith(".png")||e.endsWith(".svg")||e.endsWith(".ico"),e=>e.includes("favicon")||e.includes("logo")||e.includes("manifest")];function ki(e={}){let t=Se({pluginName:"dndev-vite-asset-discovery",icon:"\u{1F3AF}",virtualModuleId:W.assets,DiscoveryClass:Vt,discoveryMethod:"discoverAssets",filePatterns:Wu,templates:qu,defaultInspectionPath:Q.vite.assetInspection,manifestFileName:Q.manifests.asset,configKey:"assets"})(e),r=G.getInstance(),s=M("asset-plugin",e.debug,e.verbose),n=t.buildStart;return t.buildStart=async function(...i){n&&await n.apply(this,i);let o=null;try{let a=r.resolveAppPath(Q.vite.assetInspection);if(r.pathExists(a)){let l=r.readSync(a,{format:"json"});l&&(o=l,Or.data=o)}}catch(a){s.debug(`Could not cache asset data: ${a.message}`)}},t}import{loadEnv as Hu}from"vite";var Ai={isEmpty:e=>!e.env||Object.keys(e.env).length===0,generateModule:(e,t,r="env")=>{let{env:s,mode:n}=e;if(!s||Object.keys(s).length===0)return Ai.generateEmpty(e,t,void 0,r);let i={totalVars:Object.keys(s).length,mode:n,source:e.source,generatedAt:new Date().toISOString()};return`// ${W.env} - Generated environment variables
234
234
 
235
235
  const envData = ${JSON.stringify(s,null,2)};
236
236
  const envManifest = ${JSON.stringify(i,null,2)};
@@ -270,7 +270,7 @@ export const source = '${e.source}';
270
270
 
271
271
  // Default export
272
272
  export default envData;
273
- `},generateEmpty:(e,t,r,s="env")=>{let n={totalVars:0,mode:e.mode||"development",source:"empty",generatedAt:new Date().toISOString()};return`// ${U.env} - Empty environment data
273
+ `},generateEmpty:(e,t,r,s="env")=>{let n={totalVars:0,mode:e.mode||"development",source:"empty",generatedAt:new Date().toISOString()};return`// ${W.env} - Empty environment data
274
274
 
275
275
  const envData = {};
276
276
  const envManifest = ${JSON.stringify(n,null,2)};
@@ -309,12 +309,15 @@ export const source = 'empty';
309
309
 
310
310
  export default envData;
311
311
  `},generateInspection:e=>{let{env:t,mode:r}=e;return["/**"," * Generated Environment Variables",` * Mode: ${r}`,` * Generated at: ${new Date().toISOString()}`,` * Total variables: ${Object.keys(t).length}`," */","","```json",JSON.stringify(t,null,2),"```"].join(`
312
- `)},generateManifest:e=>({totalVars:Object.keys(e?.env||{}).length,mode:e?.mode||"development",variables:Object.keys(e?.env||{}),timestamp:Date.now()}),logStats:(e,t,r)=>{let s=Object.keys(e.env).length;r&&r.info(`${t} Env: ${s} VITE_* variables`)}},Or=class{constructor(t,r={}){this.pathResolver=t,this.options=r,this.mode=r.mode||"development",this.appRoot=null}async discoverEnv(){try{let t=this.pathResolver.getAppRoot();if(!t)throw new Error("App root not available in EnvDiscovery");let s={...Bu(this.mode,t,"VITE_")};return this.mode==="production"&&(delete s.VITE_USE_FIREBASE_EMULATOR,delete s.VITE_FIREBASE_EMULATOR_HOST,delete s.VITE_FIREBASE_AUTH_EMULATOR_HOST,delete s.VITE_FIREBASE_FIRESTORE_EMULATOR_HOST,delete s.VITE_FIREBASE_FUNCTIONS_EMULATOR_PORT),s.MODE=this.mode,s.DEV=this.mode==="development",s.PROD=this.mode==="production",s.SSR=!1,{env:s,mode:this.mode,source:`${t}/.env`,errors:[]}}catch(t){return{env:{},mode:this.mode,source:"error",errors:[t.message]}}}};function $i(e={}){return Re({pluginName:"dndev-vite-env-discovery",icon:"\u{1F510}",virtualModuleId:U.env,discoveryMethod:"discoverEnv",filePatterns:[],templates:Si,defaultInspectionPath:Q.vite.envInspection,manifestFileName:Q.manifests.env,configKey:"env",createDiscovery:(t,r)=>new Or(t,{...r,mode:e.mode||r.mode||"development"})})({...e,disableHmr:!0})}var Vt=class extends be{constructor(t,r={}){super(t,{fallbackLanguage:"en",additionalPaths:[],...r})}_getDiscoveryType(){return"I18n"}async _getPatterns(){return await this.pathResolver.resolvePatterns("i18n")}_getPatternType(){return"i18n"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=this.pathResolver.getRepoRoot();if(!r||r===s)throw this.logger.error(`I18n discovery: appRoot not properly set (appRoot: ${r}, repoRoot: ${s})`),new Error("App root not set before i18n discovery. Ensure configResolved hook has run.");this.logger.debug(`I18n discovery: appRoot=${r}, repoRoot=${s}`);let n=await this._getPatterns();this.logger.debug(`I18n patterns - eager: ${n.eager.length}, lazy: ${n.lazy.length}, framework eager: ${n.framework?.eager?.length||0}, framework lazy: ${n.framework?.lazy?.length||0}`),this.logger.debug(`isMonorepo: ${this.pathResolver.isMonorepo()}, repoRoot: ${this.pathResolver.getRepoRoot()}`);let i=$t("i18n"),o=n.eager||[],a=n.lazy||[],l=(this.options.additionalPaths||[]).map(F=>{let O=F.endsWith(".json")?F:`${F}/*_*.json`;return this.pathResolver.resolveAppPath(O)});l.length>0&&this.logger.debug(`Additional i18n paths configured: ${l.join(", ")}`);let u=n.framework?.eager||[],f=n.framework?.lazy||[];this.logger.debug(`Resolved patterns - eager: ${o.join(", ")}, lazy: ${a.join(", ")}, framework eager: ${u.join(", ")}, framework lazy: ${f.join(", ")}`),u.length===0&&f.length===0&&this.logger.error(`\u26A0\uFE0F Framework i18n patterns are EMPTY! isMonorepo=${this.pathResolver.isMonorepo()}, repoRoot=${this.pathResolver.getRepoRoot()}`);let g=this.pathResolver.normalizePath(r),p=this.pathResolver.normalizePath(s),m=(F,O)=>{let j=this.pathResolver.normalizePath(F),Y=this.pathResolver.normalizePath(O);return j.startsWith(Y)?j.slice(Y.length+1):j},I=o.map(F=>m(F,r)),H=[...a,...l].map(F=>m(F,r)),$=u.map(F=>m(F,s)),C=f.map(F=>m(F,s)),k={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:r},D=await this.pathResolver._globWithNormalization(I,k),N=await this.pathResolver._globWithNormalization(H,k),E={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:s,ignore:i.ignore?.filter(F=>F!=="**/node_modules/**")||[]};this.logger.debug(`\u{1F50D} Searching framework patterns with cwd: ${s}, ignore: ${JSON.stringify(E.ignore)}`);let M=await this.pathResolver._globWithNormalization($,E),L=await this.pathResolver._globWithNormalization(C,E);this.logger.debug(`Found ${D.length} eager, ${N.length} lazy, ${M.length} framework eager, ${L.length} framework lazy files`),M.length>0?this.logger.debug(`Framework eager files (first 3): ${M.slice(0,3).join(", ")}`):this.logger.error(`\u274C NO framework eager files found! Patterns were: ${u.join(", ")}`),L.length>0?this.logger.debug(`Framework lazy files (first 3): ${L.slice(0,3).join(", ")}`):this.logger.error(`\u274C NO framework lazy files found! Patterns were: ${f.join(", ")}`);let ue=[...new Set([...D,...N,...M,...L])],S=new Set([...D,...M]),A={mapping:{},content:{},eagerNamespaces:new Set,allNamespaces:new Set,supportedLanguages:new Set,files:[]},te=new Map,pt=[...M,...L];for(let F of pt){let O=this._processTranslationFile(F,M.includes(F),r);if(O){let j=`${O.namespace}_${O.language}`;te.set(j,O),A.allNamespaces.add(O.namespace),A.supportedLanguages.add(O.language),M.includes(F)&&A.eagerNamespaces.add(O.namespace)}}let fe=new Set;for(let F of ue){if(pt.includes(F))continue;let O=this._processTranslationFile(F,S.has(F),r);if(O){let{namespace:j,language:Y,importPath:He,content:re}=O,Me=`${O.namespace}_${O.language}`;if(te.has(Me)){let De=te.get(Me);O.content=this._mergeTranslations(De.content,re)}A.allNamespaces.add(j),A.supportedLanguages.add(Y),fe.add(Y),S.has(F)&&A.eagerNamespaces.add(j),A.mapping[j]||(A.mapping[j]={}),A.mapping[j][Y]=He,O.content&&(A.content[j]||(A.content[j]={}),A.content[j][Y]=O.content),A.files.push({path:F,relativePath:this.pathResolver.getRelativePath(F),namespace:j,language:Y,eager:S.has(F),size:O.content?JSON.stringify(O.content).length:0})}}for(let[F,O]of te){let[j,Y]=F.split("_");(!A.mapping[j]||!A.mapping[j][Y])&&(A.mapping[j]||(A.mapping[j]={}),A.mapping[j][Y]=O.importPath,A.content[j]||(A.content[j]={}),A.content[j][Y]=O.content)}let xe=fe.size>0?[...fe].sort():[this.options.fallbackLanguage];return{mapping:A.mapping,content:A.content,eagerNamespaces:[...A.eagerNamespaces].sort(),allNamespaces:[...A.allNamespaces].sort(),supportedLanguages:xe,fallbackLanguage:this.options.fallbackLanguage,files:A.files}}_getEmptyResult(){return{mapping:{},content:{},eagerNamespaces:[],allNamespaces:["common"],supportedLanguages:[this.options.fallbackLanguage],fallbackLanguage:this.options.fallbackLanguage,files:[],timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.allNamespaces?.length||0} namespaces, ${this.cache?.supportedLanguages?.length||0} languages`}async discover(t=!1){if(!t&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let r=Date.now();try{let s=await this._processFiles([]);this.cache={...s,timestamp:Date.now()};let n=Date.now()-r;return this.logger.debug(`Discovery completed in ${n}ms`),this._lastDiscoveryTime=Date.now(),this.cache}catch(s){throw this.logger.error(`I18n discovery failed: ${s.message}`),s}}async discoverTranslations(t=!1){return await this.discover(t)}getMapping(){return this.cache?.mapping||{}}getLanguages(){return this.cache?.supportedLanguages||[this.options.fallbackLanguage]}getNamespaces(){return this.cache?.allNamespaces||["common"]}getEagerNamespaces(){return this.cache?.eagerNamespaces||[]}_processTranslationFile(t,r,s){let n=t.split("/").pop()||t.split("\\").pop()||"",i,o,a=n.match(/^([^_]+)_([^.]+)\.json$/);if(!a)return this.logger.debug(`Invalid translation file name format: ${n}`),null;if([,i,o]=a,!i||!o)return this.logger.debug(`Invalid namespace or language in file: ${n}`),null;let u="./"+this.pathResolver.getRelativePath(t).replace(/\\/g,"/"),f;try{if(f=this.pathResolver.readSync(t,{format:"json"}),!f)return this.logger.debug(`Could not read file: ${t}`),null}catch(g){return this.logger.debug(`Error parsing JSON from ${t}: ${g.message}`),null}return{namespace:i,language:o,importPath:u,content:f}}_mergeTranslations(t,r){let s={...t};for(let[n,i]of Object.entries(r))typeof i=="object"&&i!==null&&!Array.isArray(i)?s[n]=this._mergeTranslations(s[n]||{},i):s[n]=i;return s}};var Uu={isEmpty:e=>!e.mapping||Object.keys(e.mapping).length===0,generateModule:(e,t,r="i18n")=>{let{mapping:s,eagerNamespaces:n,supportedLanguages:i,fallbackLanguage:o,stats:a,content:l={}}=e,u={mapping:s,languages:i,eager:n,fallback:o,content:l,storage:{type:"localStorage",prefix:"dndev_i18n_",ttl:1440*60*1e3,encryption:!1,maxSize:5*1024*1024},performance:{cacheSize:1e3,errorCacheTTL:300*1e3},manifest:{totalFiles:a?.totalFiles||0,totalNamespaces:a?.totalNamespaces||0,totalLanguages:a?.totalLanguages||0,eagerNamespaces:a?.eagerNamespaces||0,generatedAt:new Date().toISOString()},debug:t};return`// ${U.i18n} - Generated by @donotdev/config
312
+ `)},generateManifest:e=>({totalVars:Object.keys(e?.env||{}).length,mode:e?.mode||"development",variables:Object.keys(e?.env||{}),timestamp:Date.now()}),logStats:(e,t,r)=>{let s=Object.keys(e.env).length;r&&r.info(`${t} Env: ${s} VITE_* variables`)}},jr=class{constructor(t,r={}){this.pathResolver=t,this.options=r,this.mode=r.mode||"development",this.appRoot=null}async discoverEnv(){try{let t=this.pathResolver.getAppRoot();if(!t)throw new Error("App root not available in EnvDiscovery");let s={...Hu(this.mode,t,"VITE_")};return this.mode==="production"&&(delete s.VITE_USE_FIREBASE_EMULATOR,delete s.VITE_FIREBASE_EMULATOR_HOST,delete s.VITE_FIREBASE_AUTH_EMULATOR_HOST,delete s.VITE_FIREBASE_FIRESTORE_EMULATOR_HOST,delete s.VITE_FIREBASE_FUNCTIONS_EMULATOR_PORT),s.MODE=this.mode,s.DEV=this.mode==="development",s.PROD=this.mode==="production",s.SSR=!1,{env:s,mode:this.mode,source:`${t}/.env`,errors:[]}}catch(t){return{env:{},mode:this.mode,source:"error",errors:[t.message]}}}};function _i(e={}){return Se({pluginName:"dndev-vite-env-discovery",icon:"\u{1F510}",virtualModuleId:W.env,discoveryMethod:"discoverEnv",filePatterns:[],templates:Ai,defaultInspectionPath:Q.vite.envInspection,manifestFileName:Q.manifests.env,configKey:"env",createDiscovery:(t,r)=>new jr(t,{...r,mode:e.mode||r.mode||"development"})})({...e,disableHmr:!0})}import Lr from"node:fs";import Vu from"node:path";var Ni=/--(?:font-family|font-headline)\s*:\s*(?:['"]([^'"]+)['"]|([^;]+?));/g,We=class{constructor(t,r={}){if(!t)throw new Error("CSSExtractor requires PathResolver instance");this.pathResolver=t,this.options={debug:!1,customPatterns:{},...r},this.logger=r.logger||{debug:(s,...n)=>{this.options.debug}},this.patterns={selectors:{...ir.selectors,...this.options.customPatterns?.selectors},themes:{...ir.themes,...this.options.customPatterns?.themes}}}cssVarToJsIdentifier(t){if(!t||typeof t!="string")return this._debug(`Invalid CSS variable: ${t}`),null;let r=t.replace(/^--/,"");if(!r)return this._debug(`Empty CSS variable after removing --: ${t}`),null;let s=r.split("-").filter(o=>o.length>0);if(s.length===0)return this._debug(`No valid parts in CSS variable: ${t}`),null;let n=s.map((o,a)=>{let l=o.replace(/[^a-zA-Z0-9]/g,"");return l?a===0?l.toLowerCase():l.charAt(0).toUpperCase()+l.slice(1).toLowerCase():null}).filter(Boolean).join("");return!n||!/^[a-zA-Z][a-zA-Z0-9]*$/.test(n)?(this._debug(`Invalid JavaScript identifier generated from ${t}: ${n}`),null):["const","let","var","function","class","export","import","default","if","else","for","while"].includes(n)?`${n}Var`:n}_stripComments(t){return t.replace(/\/\*[\s\S]*?\*\//g,"")}extractThemes(t,r,s){let n=[],i,o=this.pathResolver.normalizePath(r),a=this._stripComments(t),l=/(?::root\.|\.)([a-z][a-z0-9-]*)\s*\{([^}]*--theme-label\s*:\s*['"]([^'"]+)['"][^}]*)\}/gim;for(;(i=l.exec(a))!==null;){let[,f,u,g]=i;if(!f||!g)continue;let p=u.match(this.patterns.themes.themeIcon),m=u.match(this.patterns.themes.themeIsDark),S={name:f,displayName:g,isDark:m?m[1]==="1":!1,meta:{icon:p?.[1]},source:this.pathResolver.getBasename(r)};this._debug(`Discovered theme: ${f} (${g})`),n.push(S),s.themes.set(f,{name:f,displayName:g,isDark:S.isDark,file:o,variables:new Set,meta:S.meta})}return n.length>0&&this._debug(`Extracted ${n.length} themes from ${o}`),n}extractClasses(t,r){(t.match(this.patterns.selectors.class)||[]).forEach(n=>{let i=n.slice(1);i.startsWith("_")||r.classes.add(i)})}extractVariables(t,r,s){(t.match(this.patterns.selectors.variable)||[]).forEach(i=>{i.startsWith("--")&&i.length>2?s==="framework"?r.variables.framework.add(i):r.variables.consumer.add(i):this._debug(`Skipping invalid CSS variable: ${i}`)})}extractFontFamilies(t){if(!t||typeof t!="string")return[];let r=this._stripComments(t),s=new Set,n;for(Ni.lastIndex=0;(n=Ni.exec(r))!==null;){let i=n[1];i&&i.trim()&&s.add(i.trim())}return Array.from(s)}extractKeyframes(t,r){(t.match(this.patterns.selectors.keyframe)||[]).forEach(n=>{let i=n.replace("@keyframes","").trim();i&&r.keyframes.add(i)})}validateCSS(t){let r=[],s=t.match(/--[a-zA-Z0-9-_]*[^a-zA-Z0-9-_:;\s]/g);return s&&s.forEach(i=>{r.push(`Possible malformed CSS variable: ${i}`)}),(t.match(/\.[a-z][a-z0-9-]+\s*\{[^}]*\}/gi)||[]).forEach(i=>{if(!i.includes("--theme-label")&&i.includes("--")){let o=i.match(/\.([a-z][a-z0-9-]+)/)?.[1];o&&r.push(`Theme class "${o}" missing --theme-label`)}}),r}extractAll(t,r,s="consumer"){let n={themes:new Map,classes:new Set,variables:{framework:new Set,consumer:new Set},keyframes:new Set},i=this.extractThemes(t,r,n);this.extractClasses(t,n),this.extractVariables(t,n,s),this.extractKeyframes(t,n);let o=this.validateCSS(t);return{themes:i,classes:Array.from(n.classes),variables:{framework:Array.from(n.variables.framework),consumer:Array.from(n.variables.consumer),all:[...Array.from(n.variables.framework),...Array.from(n.variables.consumer)].sort()},keyframes:Array.from(n.keyframes),warnings:o}}getPatterns(){return{...this.patterns}}setPatterns(t){this.patterns={...this.patterns,...t,selectors:{...this.patterns.selectors,...t.selectors},themes:{...this.patterns.themes,...t.themes}}}_debug(t,r){this.logger.debug(t,r||"")}};var Ju=3,Mr="<!-- DNDEV_FONT_PRELOADS -->";function Ii(e={}){let{debug:t=!1}=e,r=M("font-preload",t,!1),s,n={},i=[],o=[];return{name:"vite-font-preload-plugin",enforce:"post",configResolved(a){n={root:a.root,base:a.base&&a.base!=="/"?a.base.replace(/\/$/,""):"",outDir:a.build?.outDir??"dist"};try{s=G.getInstance()}catch(l){r.debug(`Font preload: PathResolver not ready: ${l?.message}`)}},async buildStart(){if(!(!s||!s.getAppRoot()))try{let l=await s.resolvePatterns("css"),{consumerFiles:f}=await s.resolveFiles(l,"css");if(!f?.length){i=[bt.Inter],r.debug("Font preload: no consumer CSS, using default Inter");return}let u=new We(s,{debug:t,logger:r}),g=new Set;for(let m of f)try{let S=await s.read(m,{format:"text"});S&&u.extractFontFamilies(S).forEach(q=>g.add(q))}catch(S){r.debug(`Font preload: skip read ${m}: ${S?.message}`)}if(g.size===0){i=[bt.Inter],r.debug("Font preload: no font families in CSS, using default Inter");return}let p=new Set;for(let m of g){let S=bt[m];S&&p.add(S)}i=Array.from(p),r.debug(`Font preload: stems ${i.join(", ")} from CSS`)}catch(l){r.debug(`Font preload: discovery failed, use Inter: ${l?.message}`),i=[bt.Inter]}},generateBundle(a,l){if(!i.length)return;let f=n.base||"",u=[];for(let[g,p]of Object.entries(l)){if(p.type!=="asset"||!g.endsWith(".woff2")&&!g.endsWith(".woff"))continue;let m=g.toLowerCase();if(i.some(z=>m.includes(z))){let z=f?`${f}/${g}`:`/${g}`;u.push(z)}}o=u.slice(0,Ju)},writeBundle(){if(!o.length)return;let a=n.root||process.cwd(),l=n.outDir||"dist",f=Vu.join(a,l,"index.html");try{if(!Lr.existsSync(f)){r.debug(`Font preload: index.html not found at ${f}`);return}let u=Lr.readFileSync(f,"utf8"),g=o.map(p=>`<link rel="preload" as="font" href="${p}" type="font/woff2" crossorigin="anonymous" />`).join(`
313
+ `);if(u.includes(Mr))u=u.replace(Mr,`${Mr}
314
+ ${g}`);else{let p=u.indexOf("<!-- Fonts:"),m=p!==-1?u.indexOf("-->",p)+3:u.indexOf("</head>");m!==-1&&(u=u.slice(0,m)+`
315
+ ${g}`+u.slice(m))}Lr.writeFileSync(f,u,"utf8"),r.debug(`Font preload: injected ${o.length} link(s)`)}catch(u){r.debug(`Font preload: write failed: ${u?.message}`)}}}}var Jt=class extends be{constructor(t,r={}){super(t,{fallbackLanguage:"en",additionalPaths:[],...r})}_getDiscoveryType(){return"I18n"}async _getPatterns(){return await this.pathResolver.resolvePatterns("i18n")}_getPatternType(){return"i18n"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=this.pathResolver.getRepoRoot();if(!r||r===s)throw this.logger.error(`I18n discovery: appRoot not properly set (appRoot: ${r}, repoRoot: ${s})`),new Error("App root not set before i18n discovery. Ensure configResolved hook has run.");this.logger.debug(`I18n discovery: appRoot=${r}, repoRoot=${s}`);let n=await this._getPatterns();this.logger.debug(`I18n patterns - eager: ${n.eager.length}, lazy: ${n.lazy.length}, framework eager: ${n.framework?.eager?.length||0}, framework lazy: ${n.framework?.lazy?.length||0}`),this.logger.debug(`isMonorepo: ${this.pathResolver.isMonorepo()}, repoRoot: ${this.pathResolver.getRepoRoot()}`);let i=kt("i18n"),o=n.eager||[],a=n.lazy||[],l=(this.options.additionalPaths||[]).map(F=>{let O=F.endsWith(".json")?F:`${F}/*_*.json`;return this.pathResolver.resolveAppPath(O)});l.length>0&&this.logger.debug(`Additional i18n paths configured: ${l.join(", ")}`);let f=n.framework?.eager||[],u=n.framework?.lazy||[];this.logger.debug(`Resolved patterns - eager: ${o.join(", ")}, lazy: ${a.join(", ")}, framework eager: ${f.join(", ")}, framework lazy: ${u.join(", ")}`),f.length===0&&u.length===0&&this.logger.error(`\u26A0\uFE0F Framework i18n patterns are EMPTY! isMonorepo=${this.pathResolver.isMonorepo()}, repoRoot=${this.pathResolver.getRepoRoot()}`);let g=this.pathResolver.normalizePath(r),p=this.pathResolver.normalizePath(s),m=(F,O)=>{let j=this.pathResolver.normalizePath(F),Y=this.pathResolver.normalizePath(O);return j.startsWith(Y)?j.slice(Y.length+1):j},S=o.map(F=>m(F,r)),q=[...a,...l].map(F=>m(F,r)),k=f.map(F=>m(F,s)),C=u.map(F=>m(F,s)),A={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:r},D=await this.pathResolver._globWithNormalization(S,A),I=await this.pathResolver._globWithNormalization(q,A),E={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:s,ignore:i.ignore?.filter(F=>F!=="**/node_modules/**")||[]};this.logger.debug(`\u{1F50D} Searching framework patterns with cwd: ${s}, ignore: ${JSON.stringify(E.ignore)}`);let B=await this.pathResolver._globWithNormalization(k,E),L=await this.pathResolver._globWithNormalization(C,E);this.logger.debug(`Found ${D.length} eager, ${I.length} lazy, ${B.length} framework eager, ${L.length} framework lazy files`),B.length>0?this.logger.debug(`Framework eager files (first 3): ${B.slice(0,3).join(", ")}`):this.logger.error(`\u274C NO framework eager files found! Patterns were: ${f.join(", ")}`),L.length>0?this.logger.debug(`Framework lazy files (first 3): ${L.slice(0,3).join(", ")}`):this.logger.error(`\u274C NO framework lazy files found! Patterns were: ${u.join(", ")}`);let ue=[...new Set([...D,...I,...B,...L])],$=new Set([...D,...B]),_={mapping:{},content:{},eagerNamespaces:new Set,allNamespaces:new Set,supportedLanguages:new Set,files:[]},te=new Map,gt=[...B,...L];for(let F of gt){let O=this._processTranslationFile(F,B.includes(F),r);if(O){let j=`${O.namespace}_${O.language}`;te.set(j,O),_.allNamespaces.add(O.namespace),_.supportedLanguages.add(O.language),B.includes(F)&&_.eagerNamespaces.add(O.namespace)}}let fe=new Set;for(let F of ue){if(gt.includes(F))continue;let O=this._processTranslationFile(F,$.has(F),r);if(O){let{namespace:j,language:Y,importPath:He,content:re}=O,Le=`${O.namespace}_${O.language}`;if(te.has(Le)){let De=te.get(Le);O.content=this._mergeTranslations(De.content,re)}_.allNamespaces.add(j),_.supportedLanguages.add(Y),fe.add(Y),$.has(F)&&_.eagerNamespaces.add(j),_.mapping[j]||(_.mapping[j]={}),_.mapping[j][Y]=He,O.content&&(_.content[j]||(_.content[j]={}),_.content[j][Y]=O.content),_.files.push({path:F,relativePath:this.pathResolver.getRelativePath(F),namespace:j,language:Y,eager:$.has(F),size:O.content?JSON.stringify(O.content).length:0})}}for(let[F,O]of te){let[j,Y]=F.split("_");(!_.mapping[j]||!_.mapping[j][Y])&&(_.mapping[j]||(_.mapping[j]={}),_.mapping[j][Y]=O.importPath,_.content[j]||(_.content[j]={}),_.content[j][Y]=O.content)}let xe=fe.size>0?[...fe].sort():[this.options.fallbackLanguage];return{mapping:_.mapping,content:_.content,eagerNamespaces:[..._.eagerNamespaces].sort(),allNamespaces:[..._.allNamespaces].sort(),supportedLanguages:xe,fallbackLanguage:this.options.fallbackLanguage,files:_.files}}_getEmptyResult(){return{mapping:{},content:{},eagerNamespaces:[],allNamespaces:["common"],supportedLanguages:[this.options.fallbackLanguage],fallbackLanguage:this.options.fallbackLanguage,files:[],timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.allNamespaces?.length||0} namespaces, ${this.cache?.supportedLanguages?.length||0} languages`}async discover(t=!1){if(!t&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let r=Date.now();try{let s=await this._processFiles([]);this.cache={...s,timestamp:Date.now()};let n=Date.now()-r;return this.logger.debug(`Discovery completed in ${n}ms`),this._lastDiscoveryTime=Date.now(),this.cache}catch(s){throw this.logger.error(`I18n discovery failed: ${s.message}`),s}}async discoverTranslations(t=!1){return await this.discover(t)}getMapping(){return this.cache?.mapping||{}}getLanguages(){return this.cache?.supportedLanguages||[this.options.fallbackLanguage]}getNamespaces(){return this.cache?.allNamespaces||["common"]}getEagerNamespaces(){return this.cache?.eagerNamespaces||[]}_processTranslationFile(t,r,s){let n=t.split("/").pop()||t.split("\\").pop()||"",i,o,a=n.match(/^([^_]+)_([^.]+)\.json$/);if(!a)return this.logger.debug(`Invalid translation file name format: ${n}`),null;if([,i,o]=a,!i||!o)return this.logger.debug(`Invalid namespace or language in file: ${n}`),null;let f="./"+this.pathResolver.getRelativePath(t).replace(/\\/g,"/"),u;try{if(u=this.pathResolver.readSync(t,{format:"json"}),!u)return this.logger.debug(`Could not read file: ${t}`),null}catch(g){return this.logger.debug(`Error parsing JSON from ${t}: ${g.message}`),null}return{namespace:i,language:o,importPath:f,content:u}}_mergeTranslations(t,r){let s={...t};for(let[n,i]of Object.entries(r))typeof i=="object"&&i!==null&&!Array.isArray(i)?s[n]=this._mergeTranslations(s[n]||{},i):s[n]=i;return s}};var Xu={isEmpty:e=>!e.mapping||Object.keys(e.mapping).length===0,generateModule:(e,t,r="i18n")=>{let{mapping:s,eagerNamespaces:n,supportedLanguages:i,fallbackLanguage:o,stats:a,content:l={}}=e,f={mapping:s,languages:i,eager:n,fallback:o,content:l,storage:{type:"localStorage",prefix:"dndev_i18n_",ttl:1440*60*1e3,encryption:!1,maxSize:5*1024*1024},performance:{cacheSize:1e3,errorCacheTTL:300*1e3},manifest:{totalFiles:a?.totalFiles||0,totalNamespaces:a?.totalNamespaces||0,totalLanguages:a?.totalLanguages||0,eagerNamespaces:a?.eagerNamespaces||0,generatedAt:new Date().toISOString()},debug:t};return`// ${W.i18n} - Generated by @donotdev/config
313
316
  // \u{1F680} STATIC INJECTION PATTERN - Zero Runtime Loading
314
317
  // Generated at: ${new Date().toISOString()}
315
318
 
316
319
  // ===== STATIC EXPORTS - IMMEDIATE AVAILABILITY =====
317
- export const I18N_CONFIG = ${JSON.stringify(u,null,2)};
320
+ export const I18N_CONFIG = ${JSON.stringify(f,null,2)};
318
321
  export const LANGUAGES = ${JSON.stringify(i,null,2)};
319
322
  export const FALLBACK_LANGUAGE = '${o}';
320
323
  export const EAGER_NAMESPACES = ${JSON.stringify(n,null,2)};
@@ -447,7 +450,7 @@ export default {
447
450
  getInlineContent,
448
451
  };
449
452
 
450
- `},generateEmpty:(e,t,r,s="i18n")=>{let n=r.fallbackLanguage||"en",i={mapping:{},languages:[n],eager:[],fallback:n,content:{},storage:{type:"localStorage",prefix:"dndev_i18n_",ttl:1440*60*1e3,encryption:!1,maxSize:5*1024*1024},performance:{cacheSize:1e3,errorCacheTTL:300*1e3},manifest:{totalFiles:0,totalNamespaces:0,totalLanguages:1,eagerNamespaces:0,generatedAt:new Date().toISOString()},debug:t};return`// ${U.i18n} - Empty i18n configuration
453
+ `},generateEmpty:(e,t,r,s="i18n")=>{let n=r.fallbackLanguage||"en",i={mapping:{},languages:[n],eager:[],fallback:n,content:{},storage:{type:"localStorage",prefix:"dndev_i18n_",ttl:1440*60*1e3,encryption:!1,maxSize:5*1024*1024},performance:{cacheSize:1e3,errorCacheTTL:300*1e3},manifest:{totalFiles:0,totalNamespaces:0,totalLanguages:1,eagerNamespaces:0,generatedAt:new Date().toISOString()},debug:t};return`// ${W.i18n} - Empty i18n configuration
451
454
  // No translation files found - using fallback configuration
452
455
  // Generated at: ${new Date().toISOString()}
453
456
 
@@ -567,7 +570,7 @@ export default {
567
570
  files: translationFiles,
568
571
  manifest: i18nManifest,
569
572
  };
570
- `},generateManifest:e=>({namespaces:e.stats?.totalNamespaces||0,languages:e.stats?.totalLanguages||0,fallbackLanguage:e.fallbackLanguage,eagerNamespaces:e.stats?.eagerNamespaces||0,platform:"vite",timestamp:Date.now()}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.supportedLanguages||[],n=Object.keys(e.mapping||{}).filter(i=>i!=="default").length||0;r&&r.info(`${t} I18n: ${s.length} languages, ${n} namespaces`)}},Gu=[e=>e.endsWith(".json")&&e.includes("locale"),e=>/[a-z]+_[a-z]{2}\.json$/i.test(e),e=>e.includes("/locales/")&&e.endsWith(".json")];function ki(e={}){return Re({pluginName:"dndev-vite-i18n-discovery",icon:"\u{1F310}",virtualModuleId:U.i18n,DiscoveryClass:Vt,discoveryMethod:"discoverTranslations",filePatterns:Gu,templates:Uu,defaultInspectionPath:Q.vite.i18nInspection,manifestFileName:Q.manifests.i18n,configKey:"i18n",discoveryOptions:{fallbackLanguage:e.fallbackLanguage||"en",...e}})({...e,hmrSmartDetection:!1})}function Ai(e={}){let t=[],r="";return{name:"dndev-optional-dep-resolver",enforce:"pre",configResolved(){let s=W.getInstance(),n=s.getAppRoot(),i=Xe.optionalFeatures||[];for(let o of i)s.resolvePackage(o,n)||t.push(o);r=s.getEmptyModulePath(),e.debug&&t.length>0},resolveId(s){return t.includes(s)?r:null}}}function jr(e){return!e||typeof e!="string"?null:e.startsWith("@")?e.split("/").slice(0,2).join("/"):e.split("/")[0]}function qu(e){return!e||typeof e!="string"?!1:!e.startsWith(".")&&!e.startsWith("/")&&!e.startsWith("\\")&&!e.startsWith("\0")}function Wu(e,t){if(!e||!t||!t.getRepoRoot())return!1;let s=e;e.startsWith("@fs/")&&(s=e.slice(4));let n=t.resolveRepoPath("packages"),i=t.normalizePath(s);return n&&i.startsWith(n)}function Hu(e,t){if(!e||!t)return null;let r=jr(e);if(!r)return null;let s=t.resolveAppPath(`node_modules/${r}`);return t.pathExists(s)?t.resolveAppPath(`node_modules/${e}`):null}function _i(e,t,r){return!qu(e)||!Wu(t,r)?null:Hu(e,r)}function Ni(e={}){let{debug:t=!1,verbose:r=!0}=e,s=z("peer-dependency-resolver",t,r);return{name:"dndev-peer-dependency-resolver",enforce:"pre",configResolved(n){let i=W.getInstance(),o=i.getAppRoot();if(!o){s.warn("App root not set, peer dependency resolution may fail");return}this.pathResolver=i,this.appRoot=o},resolveId(n,i){if(!i||!this.appRoot||!this.pathResolver)return null;if(_i(n,i,this.pathResolver)){let a=jr(n),l=this.pathResolver.resolveAppPath(`node_modules/${n}`),u=this.pathResolver.resolveAppPath(`node_modules/${a}`);return this.pathResolver.pathExists(u)?n===a?((t||r)&&s.debug(`[PeerDeps] Resolving bare import "${n}" from app's node_modules: ${u}`),u):((t||r)&&s.debug(`[PeerDeps] Resolving subpath "${n}" from app's node_modules: ${l}`),l):(t&&s.debug(`[PeerDeps] Package directory not found: ${u}, skipping resolution`),null)}return null}}}import{VitePWA as Vu}from"vite-plugin-pwa";var Jt=class extends be{constructor(t,r={}){super(t,{...r})}_getDiscoveryType(){return"PWA"}async _getPatterns(){return await this.pathResolver.resolvePatterns("pwa")}_getPatternType(){return"pwa"}async _processFiles(t){let{frameworkFiles:r,consumerFiles:s}=t,n=[...r,...s];this.logger.debug(`Processing ${n.length} PWA files`);let i=[];this.options.assetData?.pwaIcons&&(this.logger.debug(`Using ${this.options.assetData.pwaIcons.length} icons from AssetDiscovery`),i=[...this.options.assetData.pwaIcons]);let o=await this._analyzePWAFiles(n),a=o.filter(p=>p.type==="manifest"||p.type==="service-worker");i.push(...a);let l=o.filter(p=>p.type==="icon"),u=new Set(i.filter(p=>p.type==="icon").map(p=>p.path)),f=l.filter(p=>!u.has(p.path));i.push(...f);let g=this._generatePWAManifest(i);return{assets:i,manifest:g,totalFiles:n.length,timestamp:Date.now()}}_getEmptyResult(){return{assets:[],manifest:this._getDefaultManifest(),totalFiles:0,timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.assets?.length||0} PWA assets discovered`}async _analyzePWAFiles(t){let r=[];for(let s of t){let n=typeof s=="string"?{absolutePath:s,relativePath:this.pathResolver.getRelativePath(s),fileName:s.split("/").pop()||"",extension:(s.split(".").pop()||"").toLowerCase()}:s,i=await this._analyzePWAAsset(n);i&&r.push(i)}return r}async _analyzePWAAsset(t){let r=await this.pathResolver.read(t.absolutePath,{format:"text"});if(!r)return null;let s=t.relativePath,n=t.fileName;return n.includes("manifest.json")?this._parseManifestFile(r,s):n.includes("service-worker")||n.includes("sw.")?this._parseServiceWorkerFile(r,s):this._isPWAIcon(n)?this._parseIconFile(t,s):null}_parseManifestFile(t,r){try{let s=typeof t=="string"?JSON.parse(t):t;return{type:"manifest",path:r,content:s,size:typeof t=="string"?t.length:JSON.stringify(s).length}}catch(s){return this.logger.debug(`Failed to parse manifest: ${s.message}`),null}}_parseServiceWorkerFile(t,r){return{type:"service-worker",path:r,size:t.length,hasWorkbox:t.includes("workbox")}}_parseIconFile(t,r){let s=t.fileName,n=this._extractIconSize(s);return{type:"icon",path:r,size:n,format:t.extension,purpose:this._getIconPurpose(s)}}_isPWAIcon(t){return["icon","logo","apple-touch-icon","android-chrome","favicon"].some(s=>t.includes(s))}_extractIconSize(t){let r=t.match(/(\d+)x(\d+)/);return r?{width:parseInt(r[1]),height:parseInt(r[2])}:t.includes("favicon")?{width:32,height:32}:t.includes("apple-touch-icon")?{width:180,height:180}:t.includes("icon-192")?{width:192,height:192}:t.includes("icon-512")?{width:512,height:512}:{width:192,height:192}}_getIconPurpose(t){return t.includes("maskable")?"maskable":t.includes("apple-touch")?"apple-touch":t.includes("android-chrome")?"android":"any"}_generatePWAManifest(t){let r=t.filter(i=>i.type==="icon"),n=t.find(i=>i.type==="manifest")?.content||this._getDefaultManifest();return r.length>0&&(n.icons=r.map(i=>({src:`/${i.path}`,sizes:`${i.size.width}x${i.size.height}`,type:`image/${i.format}`,purpose:i.purpose}))),n}_getDefaultManifest(){let t=this.options?.app||{};return{name:t.name,short_name:t.shortName,description:t.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:[]}}generateManifestContent(t){let r=t.manifest||this._getDefaultManifest();return JSON.stringify(r,null,2)}generateServiceWorkerContent(t,r={}){let s=this._getWorkboxDefaults(r),n=r.backgroundSync!==!1&&r.backgroundSync,i=r.precacheManifest||[],o=JSON.stringify(i,null,2);return`// Generated by @donotdev/config - PWA Service Worker with Workbox
573
+ `},generateManifest:e=>({namespaces:e.stats?.totalNamespaces||0,languages:e.stats?.totalLanguages||0,fallbackLanguage:e.fallbackLanguage,eagerNamespaces:e.stats?.eagerNamespaces||0,platform:"vite",timestamp:Date.now()}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.supportedLanguages||[],n=Object.keys(e.mapping||{}).filter(i=>i!=="default").length||0;r&&r.info(`${t} I18n: ${s.length} languages, ${n} namespaces`)}},Yu=[e=>e.endsWith(".json")&&e.includes("locale"),e=>/[a-z]+_[a-z]{2}\.json$/i.test(e),e=>e.includes("/locales/")&&e.endsWith(".json")];function Di(e={}){return Se({pluginName:"dndev-vite-i18n-discovery",icon:"\u{1F310}",virtualModuleId:W.i18n,DiscoveryClass:Jt,discoveryMethod:"discoverTranslations",filePatterns:Yu,templates:Xu,defaultInspectionPath:Q.vite.i18nInspection,manifestFileName:Q.manifests.i18n,configKey:"i18n",discoveryOptions:{fallbackLanguage:e.fallbackLanguage||"en",...e}})({...e,hmrSmartDetection:!1})}function Ti(e={}){let t=[],r="";return{name:"dndev-optional-dep-resolver",enforce:"pre",configResolved(){let s=G.getInstance(),n=s.getAppRoot(),i=Xe.optionalFeatures||[];for(let o of i)s.resolvePackage(o,n)||t.push(o);r=s.getEmptyModulePath(),e.debug&&t.length>0},resolveId(s){return t.includes(s)?r:null}}}function zr(e){return!e||typeof e!="string"?null:e.startsWith("@")?e.split("/").slice(0,2).join("/"):e.split("/")[0]}function Ku(e){return!e||typeof e!="string"?!1:!e.startsWith(".")&&!e.startsWith("/")&&!e.startsWith("\\")&&!e.startsWith("\0")}function Qu(e,t){if(!e||!t||!t.getRepoRoot())return!1;let s=e;e.startsWith("@fs/")&&(s=e.slice(4));let n=t.resolveRepoPath("packages"),i=t.normalizePath(s);return n&&i.startsWith(n)}function Zu(e,t){if(!e||!t)return null;let r=zr(e);if(!r)return null;let s=t.resolveAppPath(`node_modules/${r}`);return t.pathExists(s)?t.resolveAppPath(`node_modules/${e}`):null}function Ci(e,t,r){return!Ku(e)||!Qu(t,r)?null:Zu(e,r)}function Fi(e={}){let{debug:t=!1,verbose:r=!0}=e,s=M("peer-dependency-resolver",t,r);return{name:"dndev-peer-dependency-resolver",enforce:"pre",configResolved(n){let i=G.getInstance(),o=i.getAppRoot();if(!o){s.warn("App root not set, peer dependency resolution may fail");return}this.pathResolver=i,this.appRoot=o},resolveId(n,i){if(!i||!this.appRoot||!this.pathResolver)return null;if(Ci(n,i,this.pathResolver)){let a=zr(n),l=this.pathResolver.resolveAppPath(`node_modules/${n}`),f=this.pathResolver.resolveAppPath(`node_modules/${a}`);return this.pathResolver.pathExists(f)?n===a?((t||r)&&s.debug(`[PeerDeps] Resolving bare import "${n}" from app's node_modules: ${f}`),f):((t||r)&&s.debug(`[PeerDeps] Resolving subpath "${n}" from app's node_modules: ${l}`),l):(t&&s.debug(`[PeerDeps] Package directory not found: ${f}, skipping resolution`),null)}return null}}}import{VitePWA as ef}from"vite-plugin-pwa";var Xt=class extends be{constructor(t,r={}){super(t,{...r})}_getDiscoveryType(){return"PWA"}async _getPatterns(){return await this.pathResolver.resolvePatterns("pwa")}_getPatternType(){return"pwa"}async _processFiles(t){let{frameworkFiles:r,consumerFiles:s}=t,n=[...r,...s];this.logger.debug(`Processing ${n.length} PWA files`);let i=[];this.options.assetData?.pwaIcons&&(this.logger.debug(`Using ${this.options.assetData.pwaIcons.length} icons from AssetDiscovery`),i=[...this.options.assetData.pwaIcons]);let o=await this._analyzePWAFiles(n),a=o.filter(p=>p.type==="manifest"||p.type==="service-worker");i.push(...a);let l=o.filter(p=>p.type==="icon"),f=new Set(i.filter(p=>p.type==="icon").map(p=>p.path)),u=l.filter(p=>!f.has(p.path));i.push(...u);let g=this._generatePWAManifest(i);return{assets:i,manifest:g,totalFiles:n.length,timestamp:Date.now()}}_getEmptyResult(){return{assets:[],manifest:this._getDefaultManifest(),totalFiles:0,timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.assets?.length||0} PWA assets discovered`}async _analyzePWAFiles(t){let r=[];for(let s of t){let n=typeof s=="string"?{absolutePath:s,relativePath:this.pathResolver.getRelativePath(s),fileName:s.split("/").pop()||"",extension:(s.split(".").pop()||"").toLowerCase()}:s,i=await this._analyzePWAAsset(n);i&&r.push(i)}return r}async _analyzePWAAsset(t){let r=await this.pathResolver.read(t.absolutePath,{format:"text"});if(!r)return null;let s=t.relativePath,n=t.fileName;return n.includes("manifest.json")?this._parseManifestFile(r,s):n.includes("service-worker")||n.includes("sw.")?this._parseServiceWorkerFile(r,s):this._isPWAIcon(n)?this._parseIconFile(t,s):null}_parseManifestFile(t,r){try{let s=typeof t=="string"?JSON.parse(t):t;return{type:"manifest",path:r,content:s,size:typeof t=="string"?t.length:JSON.stringify(s).length}}catch(s){return this.logger.debug(`Failed to parse manifest: ${s.message}`),null}}_parseServiceWorkerFile(t,r){return{type:"service-worker",path:r,size:t.length,hasWorkbox:t.includes("workbox")}}_parseIconFile(t,r){let s=t.fileName,n=this._extractIconSize(s);return{type:"icon",path:r,size:n,format:t.extension,purpose:this._getIconPurpose(s)}}_isPWAIcon(t){return["icon","logo","apple-touch-icon","android-chrome","favicon"].some(s=>t.includes(s))}_extractIconSize(t){let r=t.match(/(\d+)x(\d+)/);return r?{width:parseInt(r[1]),height:parseInt(r[2])}:t.includes("favicon")?{width:32,height:32}:t.includes("apple-touch-icon")?{width:180,height:180}:t.includes("icon-192")?{width:192,height:192}:t.includes("icon-512")?{width:512,height:512}:{width:192,height:192}}_getIconPurpose(t){return t.includes("maskable")?"maskable":t.includes("apple-touch")?"apple-touch":t.includes("android-chrome")?"android":"any"}_generatePWAManifest(t){let r=t.filter(i=>i.type==="icon"),n=t.find(i=>i.type==="manifest")?.content||this._getDefaultManifest();return r.length>0&&(n.icons=r.map(i=>({src:`/${i.path}`,sizes:`${i.size.width}x${i.size.height}`,type:`image/${i.format}`,purpose:i.purpose}))),n}_getDefaultManifest(){let t=this.options?.app||{};return{name:t.name,short_name:t.shortName,description:t.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:[]}}generateManifestContent(t){let r=t.manifest||this._getDefaultManifest();return JSON.stringify(r,null,2)}generateServiceWorkerContent(t,r={}){let s=this._getWorkboxDefaults(r),n=r.backgroundSync!==!1&&r.backgroundSync,i=r.precacheManifest||[],o=JSON.stringify(i,null,2);return`// Generated by @donotdev/config - PWA Service Worker with Workbox
571
574
  // Generated at ${new Date().toISOString()}
572
575
 
573
576
  importScripts('https://storage.googleapis.com/workbox-cdn/releases/7.0.0/workbox-sw.js');
@@ -601,22 +604,22 @@ self.addEventListener('message', (event) => {
601
604
  self.addEventListener('activate', (event) => {
602
605
  event.waitUntil(self.clients.claim());
603
606
  });
604
- `}_getWorkboxDefaults(t={}){return{globPatterns:t.globPatterns||["**/*.{js,css,html,ico,png,svg,woff2}"],runtimeCaching:t.runtimeCaching||[{urlPattern:/^https:\/\/fonts\.googleapis\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"google-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/^https:\/\/fonts\.gstatic\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"gstatic-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/\.(?:png|jpg|jpeg|svg|gif|webp|avif)$/,handler:"StaleWhileRevalidate",options:{cacheName:"images-cache",expiration:{maxEntries:60,maxAgeSeconds:3600*24*30}}},{urlPattern:/\/api\/.*/i,handler:"NetworkFirst",options:{cacheName:"api-cache",expiration:{maxEntries:50,maxAgeSeconds:300},networkTimeoutSeconds:10}},{urlPattern:({request:r})=>r.destination==="document",handler:"NetworkFirst",options:{cacheName:"pages-cache",expiration:{maxEntries:32,maxAgeSeconds:3600*24},networkTimeoutSeconds:10}}],cleanupOutdatedCaches:t.cleanupOutdatedCaches!==!1,skipWaiting:t.skipWaiting!==!1,clientsClaim:t.clientsClaim!==!1,maximumFileSizeToCacheInBytes:t.maximumFileSizeToCacheInBytes||5*1024*1024,navigateFallback:t.navigateFallback||"/",navigateFallbackDenylist:t.navigateFallbackDenylist||[/^\/api\/.*/]}}_generateWorkboxRuntimeCaching(t,r={}){return t.map((s,n)=>{let{urlPattern:i,handler:o,options:a={}}=s,l=o==="CacheFirst"?"CacheFirst":o==="NetworkFirst"?"NetworkFirst":o==="StaleWhileRevalidate"?"StaleWhileRevalidate":"NetworkFirst",u;typeof i=="function"?u="({ request }) => request.destination === 'document'":i instanceof RegExp?u=i.toString():u=JSON.stringify(i);let f=[];a.expiration&&f.push(`new ExpirationPlugin({
607
+ `}_getWorkboxDefaults(t={}){return{globPatterns:t.globPatterns||["**/*.{js,css,html,ico,png,svg,woff2}"],runtimeCaching:t.runtimeCaching||[{urlPattern:/^https:\/\/fonts\.googleapis\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"google-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/^https:\/\/fonts\.gstatic\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"gstatic-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/\.(?:png|jpg|jpeg|svg|gif|webp|avif)$/,handler:"StaleWhileRevalidate",options:{cacheName:"images-cache",expiration:{maxEntries:60,maxAgeSeconds:3600*24*30}}},{urlPattern:/\/api\/.*/i,handler:"NetworkFirst",options:{cacheName:"api-cache",expiration:{maxEntries:50,maxAgeSeconds:300},networkTimeoutSeconds:10}},{urlPattern:({request:r})=>r.destination==="document",handler:"NetworkFirst",options:{cacheName:"pages-cache",expiration:{maxEntries:32,maxAgeSeconds:3600*24},networkTimeoutSeconds:10}}],cleanupOutdatedCaches:t.cleanupOutdatedCaches!==!1,skipWaiting:t.skipWaiting!==!1,clientsClaim:t.clientsClaim!==!1,maximumFileSizeToCacheInBytes:t.maximumFileSizeToCacheInBytes||5*1024*1024,navigateFallback:t.navigateFallback||"/",navigateFallbackDenylist:t.navigateFallbackDenylist||[/^\/api\/.*/]}}_generateWorkboxRuntimeCaching(t,r={}){return t.map((s,n)=>{let{urlPattern:i,handler:o,options:a={}}=s,l=o==="CacheFirst"?"CacheFirst":o==="NetworkFirst"?"NetworkFirst":o==="StaleWhileRevalidate"?"StaleWhileRevalidate":"NetworkFirst",f;typeof i=="function"?f="({ request }) => request.destination === 'document'":i instanceof RegExp?f=i.toString():f=JSON.stringify(i);let u=[];a.expiration&&u.push(`new ExpirationPlugin({
605
608
  maxEntries: ${a.expiration.maxEntries||50},
606
609
  maxAgeSeconds: ${a.expiration.maxAgeSeconds||3600*24},
607
- })`),a.cacheableResponse&&f.push(`new CacheableResponsePlugin({
610
+ })`),a.cacheableResponse&&u.push(`new CacheableResponsePlugin({
608
611
  statuses: ${JSON.stringify(a.cacheableResponse.statuses||[0,200])},
609
- })`),a.backgroundSync&&f.push(`new BackgroundSyncPlugin('${a.backgroundSync.queueName||"background-sync-queue"}', {
612
+ })`),a.backgroundSync&&u.push(`new BackgroundSyncPlugin('${a.backgroundSync.queueName||"background-sync-queue"}', {
610
613
  maxRetentionTime: ${a.backgroundSync.maxRetentionTime||1440},
611
614
  })`);let g="";return a.cacheName&&(g+=`
612
- cacheName: '${a.cacheName}',`),f.length>0&&(g+=`
615
+ cacheName: '${a.cacheName}',`),u.length>0&&(g+=`
613
616
  plugins: [
614
- ${f.join(`,
617
+ ${u.join(`,
615
618
  `)}
616
619
  ],`),a.networkTimeoutSeconds&&(g+=`
617
620
  networkTimeoutSeconds: ${a.networkTimeoutSeconds},`),`// Runtime cache ${n+1}: ${a.cacheName||"cache-"+n}
618
621
  registerRoute(
619
- ${u},
622
+ ${f},
620
623
  new ${l}({${g}
621
624
  })
622
625
  );`}).join(`
@@ -635,7 +638,7 @@ registerRoute(
635
638
  }),
636
639
  'POST'
637
640
  );
638
- `}getPWAHeaders(){return[{source:"/manifest.json",headers:[{key:"Content-Type",value:"application/manifest+json"},{key:"Cache-Control",value:"public, max-age=3600"}]},{source:"/sw.js",headers:[{key:"Content-Type",value:"application/javascript"},{key:"Cache-Control",value:"no-cache"}]}]}getPWARewrites(){return{beforeFiles:[],afterFiles:[{source:"/sw.js",destination:"/sw.js"},{source:"/workbox-:path*",destination:"/workbox-:path*"}],fallback:[]}}async discoverNextBuildAssets(t=".next"){let r=this.pathResolver.resolveAppPath(`${t}/static`),s=this.pathResolver.resolveAppPath(`${t}/static/chunks`),n=this.pathResolver.resolveAppPath(`${t}/static/css`),i=[];try{let o=[`${r}/**/*.{js,css,woff2,woff,ttf,eot}`,`${s}/**/*.{js,css}`,`${n}/**/*.css`];for(let a of o){let l=await this.pathResolver.findFiles(this.pathResolver.getAppRoot(),a.replace(this.pathResolver.getAppRoot(),""),{onlyFiles:!0});for(let u of l){let f=this.pathResolver.getRelativePath(u);if(f.startsWith(`${t}/static/`)){let g=`/_next/${f.replace(`${t}/static/`,"")}`;i.push({url:g,revision:null})}}}}catch(o){this.logger?.warn(`Failed to discover Next.js build assets: ${o.message}`)}return i}generatePrecacheManifest(t=[],r=null){let s=t;return r&&typeof r=="function"&&(s=r(s)),s}async discoverPWAAssets(t=!1){return await this.discover(t)}getPWAAssets(){return this.cache?.assets||[]}getPWAManifest(){return this.cache?.manifest||this._getDefaultManifest()}};function Ii(e={}){if(!e.enabled)return null;let t=e.app||{},r=[];if(t.name||r.push("name"),t.shortName||r.push("shortName"),t.description||r.push("description"),r.length>0){let f=z("PWA",e.debug,!0);f.warn(`\u26A0\uFE0F PWA is enabled but appConfig.app is missing required fields: ${r.join(", ")}`),f.warn(" Add these to your src/config/app.ts:"),f.warn(" export const appConfig: AppConfig = {"),f.warn(" app: {"),t.name||f.warn(' name: "Your App Name",'),t.shortName||f.warn(' shortName: "App",'),t.description||f.warn(' description: "Your app description",'),f.warn(" },"),f.warn(" // ... rest of config"),f.warn(" };"),f.warn("")}let s=W.getInstance(),n=Fr.data;if(!n)try{let f=s.resolveAppPath(Q.vite.assetInspection);s.pathExists(f)}catch{}let i=new Jt(s,{...e,assetData:n}),o=e.devEnabled===!0,a={registerType:e.registerType||"prompt",includeAssets:["favicon.ico","favicon.svg","apple-touch-icon.png"],manifest:async()=>{let f=e.app||{},p=(await i.discoverPWAAssets()).assets.filter(m=>m.type==="icon").map(m=>({src:`/${m.path}`,sizes:`${m.size.width}x${m.size.height}`,type:`image/${m.format}`,purpose:m.purpose}));return{name:f.name,short_name:f.shortName,description:f.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:p.length>0?p:[]}},workbox:{globPatterns:["**/*.{js,css,html,ico,png,svg,woff2}"],runtimeCaching:[{urlPattern:/^https:\/\/fonts\.googleapis\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"google-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/^https:\/\/fonts\.gstatic\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"gstatic-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/\.(?:png|jpg|jpeg|svg|gif|webp|avif)$/,handler:"StaleWhileRevalidate",options:{cacheName:"images-cache",expiration:{maxEntries:60,maxAgeSeconds:3600*24*30}}},{urlPattern:/\/api\/.*/i,handler:"NetworkFirst",options:{cacheName:"api-cache",expiration:{maxEntries:50,maxAgeSeconds:300},networkTimeoutSeconds:10}},{urlPattern:({request:f})=>f.destination==="document",handler:"NetworkFirst",options:{cacheName:"pages-cache",expiration:{maxEntries:32,maxAgeSeconds:3600*24},networkTimeoutSeconds:10}}],cleanupOutdatedCaches:!0,skipWaiting:!0,clientsClaim:!0,maximumFileSizeToCacheInBytes:5*1024*1024,navigateFallback:"/index.html",navigateFallbackDenylist:[/^\/api\/.*/],manifestTransforms:[f=>{let g=f.find(p=>p.url==="/index.html"||p.url==="index.html");return g&&!f.find(p=>p.url==="/")&&f.push({url:"/",revision:g.revision}),{manifest:f,warnings:[]}}]},devOptions:{enabled:o,type:"module"}},u={...a,manifest:async()=>{let f=await a.manifest();if(e.manifest){if(typeof e.manifest=="function"){let g=await e.manifest();return{...f,...g}}return{...f,...e.manifest}}return f},workbox:{...a.workbox,...e.workbox||{},runtimeCaching:[...a.workbox.runtimeCaching,...e.workbox?.runtimeCaching||[]],manifestTransforms:[...a.workbox.manifestTransforms||[],...e.workbox?.manifestTransforms||[]]}};return Vu(u)}function Di(e,t="unknown"){try{let r=/export\s+const\s+meta\s*[^=]*=\s*(\{[\s\S]*?\});/,s=e.match(r);if(!s)return null;let n=s[1];n=n.replace(/icon:\s*<(\w+)[\s\/][^>]*\/?>/g,(l,u)=>`icon: '${u}'`);let i=/(?:export\s+)?const\s+(\w+)\s*=\s*['"]([^'"]+)['"]/g;return[...e.matchAll(i)].forEach(l=>{let u=l[1],f=l[2];n=n.replace(new RegExp(`\\b${u}\\b`,"g"),`'${f}'`)}),Function(`return ${n}`)()}catch{return null}}var xt=null,Ti=null;function Ju(e){let r=(e.split("/").pop()?.replace(/\.tsx?$/,"")||"Component").replace(/[^a-zA-Z0-9]/g,"");return r.charAt(0).toUpperCase()+r.slice(1)}var Xt=class extends be{constructor(t,r={}){super(t,{additionalPatterns:[],...r}),this.routes=[],this.errors=[],this.source="auto-discovery"}_getDiscoveryType(){return"Route"}async _getPatterns(){return await this.pathResolver.resolvePatterns("routes")}_getPatternType(){return"routes"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=process.env.DNDEV_BUILD_ID;if(xt&&Ti===s)return this.logger.debug("Using cached route discovery results"),this.routes=xt.routes,this.errors=xt.errors,this.source=xt.source,{routes:this.routes,errors:this.errors,source:this.source,totalFiles:this.routes.length};if(this.logger.debug("Route discovery mode: AUTO-DISCOVERY"),this.logger.debug(`App root: ${r}`),this.options.verbose||this.options.debug){let n=t?.consumerFiles?.length||0;if(this.logger.info(`\u{1F50D} Route discovery: Scanning ${n} files in ${r}`),this.options.debug){let i=await this._getPatterns();this.logger.debug(`Patterns: ${JSON.stringify(i)}`)}}return await this._performAutoDiscovery(t,r),(this.options.verbose||this.options.debug)&&(this.logger.info(`\u{1F50D} Route discovery: Found ${this.routes.length} routes`),this.routes.length===0&&this.logger.warn("\u26A0\uFE0F No routes discovered! Check that pages exist in src/pages/")),xt={routes:this.routes,errors:this.errors,source:this.source},Ti=process.env.DNDEV_BUILD_ID,{routes:this.routes,errors:this.errors,source:this.source,totalFiles:this.routes.length}}_getEmptyResult(){return{routes:[],errors:[],source:"empty",totalFiles:0,timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.routes?.length||0} routes discovered via ${this.cache?.source||"unknown"}`}async discoverRoutes(t=!1){return await this.discover(t)}getRoutes(){return this.cache?.routes||[]}async _performAutoDiscovery(t,r){let{consumerFiles:s}=t,n=await this._batchProcessFiles(s,u=>this._analyzePageFile(u,r)),i=await this._scanAdditionalPatterns(r),o=await this._batchProcessFiles(i,u=>this._analyzePageFile(u,r)),a=[...n,...o];this.logger.debug(`Auto-discovering from ${s.length} app + ${i.length} additional files`),this.routes=a.filter(u=>u.path==="home"||u.path==="/home"?(this.logger.debug(`Filtered reserved route: ${u.path} - Use root "/" instead (${u.file})`),!1):!0);let l=new Map;for(let u of this.routes){let f=u.path;if(l.has(f)){let g=l.get(f);throw new Error(`Route conflict: Multiple routes found for path '${f}'. Routes: ${g.file} and ${u.file}. Use PageMeta route override to specify unique paths. Example: export const meta: PageMeta = { route: '/custom-path' };`)}l.set(f,u)}this.logger.debug(`Auto-discovered ${this.routes.length} routes from ${s.length+i.length} files`)}async _scanAdditionalPatterns(t){let r=this.options.additionalPatterns.map(s=>this.pathResolver.resolveAppPath(s));if(r.length===0)return[];try{let{consumerFiles:s}=await this.pathResolver.resolveFiles({consumer:r,framework:[]},"routes");return s}catch(s){return this.logger.debug(`Error scanning additional patterns: ${s.message}`),[]}}async _analyzePageFile(t,r){let s=await this.pathResolver.read(t.absolutePath,{format:"text"});if(!s)return null;let n=t.relativePath,i="/src/"+n.replace(/\\/g,"/");i=i.replace(/src\/src\//g,"src/").replace(/src\/src\//g,"src/");let o=this._extractMetaExport(s,t.absolutePath),a=Ju(i),u=a===tr.HOMEPAGE_COMPONENT?tr.HOMEPAGE_PATH:this._resolveRoutePath(o,n,t.absolutePath),f=this._extractPageMeta(n,s),{entity:g,action:p,...m}=o||{};return{path:u,component:a,importPath:i,auth:o?.auth||!1,meta:{...f,...m,entity:f.entity,action:f.action},metaExport:o,file:n}}_extractMetaExport(t,r){try{let s=Di(t,r);return s?(this.logger.debug(`Extracted meta export from ${r}: ${JSON.stringify(s)}`),s):null}catch(s){return this.logger.debug(`Error parsing meta export from ${r}: ${s.message}`),null}}_generateRoutePath(t){let r=t.replace(/\.tsx$/,"").replace(/Page$/,"").replace(/^src\//,"").replace(/^pages\//,"").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return(r.endsWith("/index")||r==="index")&&(r=r.replace(/\/index$/,"")||"/"),r==="/"?"/":"/"+r.replace(/\/+/g,"/")}_resolveRoutePath(t,r,s){if(!t?.route)return this._generateRoutePath(r);if(typeof t.route=="string"){let n=t.route.trim();return n==="/"?"/":(n=n.replace(/\/+/g,"/"),n.startsWith("/")||(n="/"+n),n)}if(typeof t.route=="object"&&t.route!==null){let n=this._generateRoutePath(r),i=t.route.params;if(Array.isArray(i)&&i.length>0){let o=i.map(a=>`:${a}`).join("/");return`${n}/${o}`}return n}return this.logger.warn(`Invalid route format in ${s}. Use string format: route: "/path/:param" or object format: route: { params: ['id'] }`),this.logger.debug(`Falling back to auto-generated path for ${s}`),this._generateRoutePath(r)}_extractPageMeta(t,r){let s=t.split("/").pop()?.replace(".tsx","")||"",n=s.replace(/Page$/,"");n=n.replace(/([A-Z])/g," $1").trim(),n=n.charAt(0).toUpperCase()+n.slice(1);let i=t.split("/"),o=null,a=null;return i.length>1&&(o=i[i.length-2],s.includes("List")?a="list":s.includes("Form")||s.includes("Create")||s.includes("Edit")?a="form":(s.includes("Detail")||s.includes("View"))&&(a="detail")),{title:n,entity:o,action:a,file:t}}};var Xu={isEmpty:e=>!e.routes||e.routes.length===0,generateModule:(e,t,r="routes")=>{let s={totalRoutes:e.routes.length,authRequired:e.routes.filter(i=>i.auth&&i.auth.required).length,publicRoutes:e.routes.filter(i=>!i.auth||i.auth===!1).length,source:e.source,generatedAt:new Date().toISOString(),errors:e.errors.length},n=e.routes.map(i=>` {
641
+ `}getPWAHeaders(){return[{source:"/manifest.json",headers:[{key:"Content-Type",value:"application/manifest+json"},{key:"Cache-Control",value:"public, max-age=3600"}]},{source:"/sw.js",headers:[{key:"Content-Type",value:"application/javascript"},{key:"Cache-Control",value:"no-cache"}]}]}getPWARewrites(){return{beforeFiles:[],afterFiles:[{source:"/sw.js",destination:"/sw.js"},{source:"/workbox-:path*",destination:"/workbox-:path*"}],fallback:[]}}async discoverNextBuildAssets(t=".next"){let r=this.pathResolver.resolveAppPath(`${t}/static`),s=this.pathResolver.resolveAppPath(`${t}/static/chunks`),n=this.pathResolver.resolveAppPath(`${t}/static/css`),i=[];try{let o=[`${r}/**/*.{js,css,woff2,woff,ttf,eot}`,`${s}/**/*.{js,css}`,`${n}/**/*.css`];for(let a of o){let l=await this.pathResolver.findFiles(this.pathResolver.getAppRoot(),a.replace(this.pathResolver.getAppRoot(),""),{onlyFiles:!0});for(let f of l){let u=this.pathResolver.getRelativePath(f);if(u.startsWith(`${t}/static/`)){let g=`/_next/${u.replace(`${t}/static/`,"")}`;i.push({url:g,revision:null})}}}}catch(o){this.logger?.warn(`Failed to discover Next.js build assets: ${o.message}`)}return i}generatePrecacheManifest(t=[],r=null){let s=t;return r&&typeof r=="function"&&(s=r(s)),s}async discoverPWAAssets(t=!1){return await this.discover(t)}getPWAAssets(){return this.cache?.assets||[]}getPWAManifest(){return this.cache?.manifest||this._getDefaultManifest()}};function Oi(e={}){if(!e.enabled)return null;let t=e.app||{},r=[];if(t.name||r.push("name"),t.shortName||r.push("shortName"),t.description||r.push("description"),r.length>0){let u=M("PWA",e.debug,!0);u.warn(`\u26A0\uFE0F PWA is enabled but appConfig.app is missing required fields: ${r.join(", ")}`),u.warn(" Add these to your src/config/app.ts:"),u.warn(" export const appConfig: AppConfig = {"),u.warn(" app: {"),t.name||u.warn(' name: "Your App Name",'),t.shortName||u.warn(' shortName: "App",'),t.description||u.warn(' description: "Your app description",'),u.warn(" },"),u.warn(" // ... rest of config"),u.warn(" };"),u.warn("")}let s=G.getInstance(),n=Or.data;if(!n)try{let u=s.resolveAppPath(Q.vite.assetInspection);s.pathExists(u)}catch{}let i=new Xt(s,{...e,assetData:n}),o=e.devEnabled===!0,a={registerType:e.registerType||"prompt",includeAssets:["favicon.ico","favicon.svg","apple-touch-icon.png"],manifest:async()=>{let u=e.app||{},p=(await i.discoverPWAAssets()).assets.filter(m=>m.type==="icon").map(m=>({src:`/${m.path}`,sizes:`${m.size.width}x${m.size.height}`,type:`image/${m.format}`,purpose:m.purpose}));return{name:u.name,short_name:u.shortName,description:u.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:p.length>0?p:[]}},workbox:{globPatterns:["**/*.{js,css,html,ico,png,svg,woff2}"],runtimeCaching:[{urlPattern:/^https:\/\/fonts\.googleapis\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"google-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/^https:\/\/fonts\.gstatic\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"gstatic-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/\.(?:png|jpg|jpeg|svg|gif|webp|avif)$/,handler:"StaleWhileRevalidate",options:{cacheName:"images-cache",expiration:{maxEntries:60,maxAgeSeconds:3600*24*30}}},{urlPattern:/\/api\/.*/i,handler:"NetworkFirst",options:{cacheName:"api-cache",expiration:{maxEntries:50,maxAgeSeconds:300},networkTimeoutSeconds:10}},{urlPattern:({request:u})=>u.destination==="document",handler:"NetworkFirst",options:{cacheName:"pages-cache",expiration:{maxEntries:32,maxAgeSeconds:3600*24},networkTimeoutSeconds:10}}],cleanupOutdatedCaches:!0,skipWaiting:!0,clientsClaim:!0,maximumFileSizeToCacheInBytes:5*1024*1024,navigateFallback:"/index.html",navigateFallbackDenylist:[/^\/api\/.*/],manifestTransforms:[u=>{let g=u.find(p=>p.url==="/index.html"||p.url==="index.html");return g&&!u.find(p=>p.url==="/")&&u.push({url:"/",revision:g.revision}),{manifest:u,warnings:[]}}]},devOptions:{enabled:o,type:"module"}},f={...a,manifest:async()=>{let u=await a.manifest();if(e.manifest){if(typeof e.manifest=="function"){let g=await e.manifest();return{...u,...g}}return{...u,...e.manifest}}return u},workbox:{...a.workbox,...e.workbox||{},runtimeCaching:[...a.workbox.runtimeCaching,...e.workbox?.runtimeCaching||[]],manifestTransforms:[...a.workbox.manifestTransforms||[],...e.workbox?.manifestTransforms||[]]}};return ef(f)}function ji(e,t="unknown"){try{let r=/export\s+const\s+meta\s*[^=]*=\s*(\{[\s\S]*?\});/,s=e.match(r);if(!s)return null;let n=s[1];n=n.replace(/icon:\s*<(\w+)[\s\/][^>]*\/?>/g,(l,f)=>`icon: '${f}'`);let i=/(?:export\s+)?const\s+(\w+)\s*=\s*['"]([^'"]+)['"]/g;return[...e.matchAll(i)].forEach(l=>{let f=l[1],u=l[2];n=n.replace(new RegExp(`\\b${f}\\b`,"g"),`'${u}'`)}),Function(`return ${n}`)()}catch{return null}}var Pt=null,Li=null;function tf(e){let r=(e.split("/").pop()?.replace(/\.tsx?$/,"")||"Component").replace(/[^a-zA-Z0-9]/g,"");return r.charAt(0).toUpperCase()+r.slice(1)}var Yt=class extends be{constructor(t,r={}){super(t,{additionalPatterns:[],...r}),this.routes=[],this.errors=[],this.source="auto-discovery"}_getDiscoveryType(){return"Route"}async _getPatterns(){return await this.pathResolver.resolvePatterns("routes")}_getPatternType(){return"routes"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=process.env.DNDEV_BUILD_ID;if(Pt&&Li===s)return this.logger.debug("Using cached route discovery results"),this.routes=Pt.routes,this.errors=Pt.errors,this.source=Pt.source,{routes:this.routes,errors:this.errors,source:this.source,totalFiles:this.routes.length};if(this.logger.debug("Route discovery mode: AUTO-DISCOVERY"),this.logger.debug(`App root: ${r}`),this.options.verbose||this.options.debug){let n=t?.consumerFiles?.length||0;if(this.logger.info(`\u{1F50D} Route discovery: Scanning ${n} files in ${r}`),this.options.debug){let i=await this._getPatterns();this.logger.debug(`Patterns: ${JSON.stringify(i)}`)}}return await this._performAutoDiscovery(t,r),(this.options.verbose||this.options.debug)&&(this.logger.info(`\u{1F50D} Route discovery: Found ${this.routes.length} routes`),this.routes.length===0&&this.logger.warn("\u26A0\uFE0F No routes discovered! Check that pages exist in src/pages/")),Pt={routes:this.routes,errors:this.errors,source:this.source},Li=process.env.DNDEV_BUILD_ID,{routes:this.routes,errors:this.errors,source:this.source,totalFiles:this.routes.length}}_getEmptyResult(){return{routes:[],errors:[],source:"empty",totalFiles:0,timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.routes?.length||0} routes discovered via ${this.cache?.source||"unknown"}`}async discoverRoutes(t=!1){return await this.discover(t)}getRoutes(){return this.cache?.routes||[]}async _performAutoDiscovery(t,r){let{consumerFiles:s}=t,n=await this._batchProcessFiles(s,f=>this._analyzePageFile(f,r)),i=await this._scanAdditionalPatterns(r),o=await this._batchProcessFiles(i,f=>this._analyzePageFile(f,r)),a=[...n,...o];this.logger.debug(`Auto-discovering from ${s.length} app + ${i.length} additional files`),this.routes=a.filter(f=>f.path==="home"||f.path==="/home"?(this.logger.debug(`Filtered reserved route: ${f.path} - Use root "/" instead (${f.file})`),!1):!0);let l=new Map;for(let f of this.routes){let u=f.path;if(l.has(u)){let g=l.get(u);throw new Error(`Route conflict: Multiple routes found for path '${u}'. Routes: ${g.file} and ${f.file}. Use PageMeta route override to specify unique paths. Example: export const meta: PageMeta = { route: '/custom-path' };`)}l.set(u,f)}this.logger.debug(`Auto-discovered ${this.routes.length} routes from ${s.length+i.length} files`)}async _scanAdditionalPatterns(t){let r=this.options.additionalPatterns.map(s=>this.pathResolver.resolveAppPath(s));if(r.length===0)return[];try{let{consumerFiles:s}=await this.pathResolver.resolveFiles({consumer:r,framework:[]},"routes");return s}catch(s){return this.logger.debug(`Error scanning additional patterns: ${s.message}`),[]}}async _analyzePageFile(t,r){let s=await this.pathResolver.read(t.absolutePath,{format:"text"});if(!s)return null;let n=t.relativePath,i="/src/"+n.replace(/\\/g,"/");i=i.replace(/src\/src\//g,"src/").replace(/src\/src\//g,"src/");let o=this._extractMetaExport(s,t.absolutePath),a=tf(i),f=a===rr.HOMEPAGE_COMPONENT?rr.HOMEPAGE_PATH:this._resolveRoutePath(o,n,t.absolutePath),u=this._extractPageMeta(n,s),{entity:g,action:p,...m}=o||{};return{path:f,component:a,importPath:i,auth:o?.auth||!1,meta:{...u,...m,entity:u.entity,action:u.action},metaExport:o,file:n}}_extractMetaExport(t,r){try{let s=ji(t,r);return s?(this.logger.debug(`Extracted meta export from ${r}: ${JSON.stringify(s)}`),s):null}catch(s){return this.logger.debug(`Error parsing meta export from ${r}: ${s.message}`),null}}_generateRoutePath(t){let r=t.replace(/\.tsx$/,"").replace(/Page$/,"").replace(/^src\//,"").replace(/^pages\//,"").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return(r.endsWith("/index")||r==="index")&&(r=r.replace(/\/index$/,"")||"/"),r==="/"?"/":"/"+r.replace(/\/+/g,"/")}_resolveRoutePath(t,r,s){if(!t?.route)return this._generateRoutePath(r);if(typeof t.route=="string"){let n=t.route.trim();return n==="/"?"/":(n=n.replace(/\/+/g,"/"),n.startsWith("/")||(n="/"+n),n)}if(typeof t.route=="object"&&t.route!==null){let n=this._generateRoutePath(r),i=t.route.params;if(Array.isArray(i)&&i.length>0){let o=i.map(a=>`:${a}`).join("/");return`${n}/${o}`}return n}return this.logger.warn(`Invalid route format in ${s}. Use string format: route: "/path/:param" or object format: route: { params: ['id'] }`),this.logger.debug(`Falling back to auto-generated path for ${s}`),this._generateRoutePath(r)}_extractPageMeta(t,r){let s=t.split("/").pop()?.replace(".tsx","")||"",n=s.replace(/Page$/,"");n=n.replace(/([A-Z])/g," $1").trim(),n=n.charAt(0).toUpperCase()+n.slice(1);let i=t.split("/"),o=null,a=null;return i.length>1&&(o=i[i.length-2],s.includes("List")?a="list":s.includes("Form")||s.includes("Create")||s.includes("Edit")?a="form":(s.includes("Detail")||s.includes("View"))&&(a="detail")),{title:n,entity:o,action:a,file:t}}};var rf={isEmpty:e=>!e.routes||e.routes.length===0,generateModule:(e,t,r="routes")=>{let s={totalRoutes:e.routes.length,authRequired:e.routes.filter(i=>i.auth&&i.auth.required).length,publicRoutes:e.routes.filter(i=>!i.auth||i.auth===!1).length,source:e.source,generatedAt:new Date().toISOString(),errors:e.errors.length},n=e.routes.map(i=>` {
639
642
  path: '${i.path}',
640
643
  component: () => import('${i.importPath}'),
641
644
  auth: ${JSON.stringify(i.auth,null,2).replace(/\n/g,`
@@ -644,7 +647,7 @@ registerRoute(
644
647
  `)}
645
648
  }`).join(`,
646
649
  `);return`
647
- // ${U.routes} - Generated route data
650
+ // ${W.routes} - Generated route data
648
651
  import { lazy } from 'react';
649
652
 
650
653
  const routeData = [
@@ -684,7 +687,7 @@ export const source = '${e.source}';
684
687
 
685
688
  export default { routes: routeData, manifest: routeManifest, source: '${e.source}' };
686
689
  `},generateEmpty:(e,t,r,s="routes")=>{let n={totalRoutes:0,authRequired:0,publicRoutes:0,source:"empty",generatedAt:new Date().toISOString()};return`
687
- // ${U.routes} - Empty route data
690
+ // ${W.routes} - Empty route data
688
691
 
689
692
  const routeData = [];
690
693
  const routeManifest = ${JSON.stringify(n,null,2)};
@@ -748,7 +751,7 @@ export default discoveredRoutes;
748
751
  * Generated Route Discovery Results
749
752
  * Source: ${e.source}
750
753
  * Generated at: ${new Date().toISOString()}
751
- * Import from '${U.routes}'
754
+ * Import from '${W.routes}'
752
755
  */
753
756
 
754
757
  export const discoveredRoutes = [
@@ -762,7 +765,7 @@ export const routeManifest = {
762
765
  };
763
766
 
764
767
  export default discoveredRoutes;
765
- `},generateManifest:e=>({routes:e?.routes?.length||0,source:e?.source||"unknown",timestamp:Date.now(),errors:e?.errors?.length||0}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.routes||[],n=s.filter(o=>o.auth&&o.auth.required).length,i=s.length;r&&r.info(`${t} Routes: ${i} found${n>0?`, ${n} are authguarded`:""}`)}},Yu=[e=>e.endsWith("Page.tsx")];function Ci(e={}){return Re({pluginName:"dndev-vite-route-discovery",icon:"\u{1F6E3}\uFE0F",virtualModuleId:U.routes,DiscoveryClass:Xt,discoveryMethod:"discoverRoutes",filePatterns:Yu,templates:Xu,defaultInspectionPath:Q.vite.routeInspection,manifestFileName:Q.manifests.route,configKey:"routes"})({...e,disableHmr:e?.hmr===!1,hmrSmartDetection:!1})}import{loadEnv as ef}from"vite";import{readFileSync as Ku,readdirSync as Qu,existsSync as Zu}from"fs";import{join as Fi}from"path";var Yt=class{constructor(t={}){let{debug:r=!1,generateRobotsTxt:s=!0,generateSitemap:n=!0,baseUrl:i,siteName:o,crawlDelay:a=1,routes:l={},...u}=t;if(!i||!o)throw new Error("SEOGenerator requires baseUrl and siteName options");this.options={debug:r,generateRobotsTxt:s,generateSitemap:n,baseUrl:i,siteName:o,crawlDelay:a,routes:l,defaultImage:"/og-image.jpg",twitterHandle:"@donotdev",defaultAuthor:"DNDev Team",defaultLanguage:"en",staticTags:{},...u},this.appRoot=u.appRoot||null,this.logger=z("SEO Generator",t.debug,t.verbose)}async generateSEOFiles(t,r,s=null){try{let n=this.generateRouteMetaTags(t.routes||[]),i={routes:t.routes||[],routeMetaTags:n,baseUrl:this.options.baseUrl,siteName:this.options.siteName},o=this.discoverBlogPosts(),a={robotsTxt:null,sitemap:null,rss:null,manifest:null,totalRoutes:i.routes.length,publicRoutes:i.routes.filter(l=>!l.auth||l.auth===!1).length,protectedRoutes:i.routes.filter(l=>l.auth&&l.auth.required).length,blogPosts:o.length};return this.options.generateRobotsTxt&&(a.robotsTxt=await this.generateRobotsTxt(i,r,s)),this.options.generateSitemap&&(a.sitemap=await this.generateSitemap(i,r,s,o)),o.length>0&&(a.rss=await this.generateRSSFeed(o,r,s)),a.manifest=await this.generateManifest(i,r,s),a}catch(n){throw this.logger.error(`SEO generator failed to create files (robots.txt/sitemap.xml/manifest): ${n.message}`),this.logger.error(`Stack: ${n.stack||"No stack trace available"}`),n}}async generateRobotsTxt(t,r,s=null){if(s&&await s("robots.txt"))return this.logger.info("\u2705 robots.txt already exists, skipping generation"),{fileName:"robots.txt",skipped:!0};let n=[];(t.routes||[]).forEach(o=>{if(o.auth&&o.auth.required){let a=o.path.startsWith("/")?o.path:`/${o.path}`;n.push(a)}}),n.push("/admin","/api","/_next","/static");let i=this.generateRobotsTxtContent({disallowedPaths:[...new Set(n)],sitemap:`${this.options.baseUrl}/sitemap.xml`,crawlDelay:this.options.crawlDelay});return await r("robots.txt",i),{fileName:"robots.txt",content:i,disallowedPaths:n.length}}async generateSitemap(t,r,s=null,n=[]){if(s&&await s("sitemap.xml"))return this.logger.info("\u2705 sitemap.xml already exists, skipping generation"),{fileName:"sitemap.xml",skipped:!0};let o=(t.routes||[]).filter(l=>!l.auth||l.auth===!1).map(l=>({url:l.path,lastmod:new Date().toISOString().split("T")[0],changefreq:"weekly",priority:l.path==="/"?"1.0":"0.8"}));if(n.length>0){o.push({url:"/blog",lastmod:n[0]?.date||new Date().toISOString().split("T")[0],changefreq:"weekly",priority:"0.7"});for(let l of n)o.push({url:`/blog/${l.slug}`,lastmod:l.date,changefreq:"monthly",priority:"0.6"})}let a=this.generateSitemapContent(o);return await r("sitemap.xml",a),{fileName:"sitemap.xml",content:a,publicRoutes:o.length}}async generateManifest(t,r,s=null){if(s&&await s("seo-manifest.json"))return this.logger.info("\u2705 seo-manifest.json already exists, skipping generation"),{fileName:"seo-manifest.json",skipped:!0};let n={totalRoutes:t.routes?.length||0,publicRoutes:t.routes?.filter(o=>!o.auth||o.auth===!1).length||0,protectedRoutes:t.routes?.filter(o=>o.auth&&o.auth.required).length||0,baseUrl:this.options.baseUrl,siteName:this.options.siteName,generatedAt:new Date().toISOString(),routeMetaTags:t.routeMetaTags||[]},i=JSON.stringify(n,null,2);return await r("seo-manifest.json",i),{fileName:"seo-manifest.json",content:i,manifest:n}}generateRobotsTxtContent(t={}){let{allowedPaths:r=["/"],disallowedPaths:s=["/admin","/api"],sitemap:n,crawlDelay:i}=t,o=l=>l?l==="*"?"*":l.startsWith("/")?l:`/${l}`:"/",a=["User-agent: *",...s.map(l=>`Disallow: ${o(l)}`),...r.map(l=>`Allow: ${o(l)}`)];return i&&a.push(`Crawl-delay: ${i}`),n&&a.push(`Sitemap: ${n}`),a.join(`
768
+ `},generateManifest:e=>({routes:e?.routes?.length||0,source:e?.source||"unknown",timestamp:Date.now(),errors:e?.errors?.length||0}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.routes||[],n=s.filter(o=>o.auth&&o.auth.required).length,i=s.length;r&&r.info(`${t} Routes: ${i} found${n>0?`, ${n} are authguarded`:""}`)}},sf=[e=>e.endsWith("Page.tsx")];function Mi(e={}){return Se({pluginName:"dndev-vite-route-discovery",icon:"\u{1F6E3}\uFE0F",virtualModuleId:W.routes,DiscoveryClass:Yt,discoveryMethod:"discoverRoutes",filePatterns:sf,templates:rf,defaultInspectionPath:Q.vite.routeInspection,manifestFileName:Q.manifests.route,configKey:"routes"})({...e,disableHmr:e?.hmr===!1,hmrSmartDetection:!1})}import{loadEnv as lf}from"vite";import{readFileSync as nf,readdirSync as of,existsSync as af}from"fs";import{join as zi}from"path";var Kt=class{constructor(t={}){let{debug:r=!1,generateRobotsTxt:s=!0,generateSitemap:n=!0,baseUrl:i,siteName:o,crawlDelay:a=1,routes:l={},...f}=t;if(!i||!o)throw new Error("SEOGenerator requires baseUrl and siteName options");this.options={debug:r,generateRobotsTxt:s,generateSitemap:n,baseUrl:i,siteName:o,crawlDelay:a,routes:l,defaultImage:"/og-image.jpg",twitterHandle:"@donotdev",defaultAuthor:"DNDev Team",defaultLanguage:"en",staticTags:{},...f},this.appRoot=f.appRoot||null,this.logger=M("SEO Generator",t.debug,t.verbose)}async generateSEOFiles(t,r,s=null){try{let n=this.generateRouteMetaTags(t.routes||[]),i={routes:t.routes||[],routeMetaTags:n,baseUrl:this.options.baseUrl,siteName:this.options.siteName},o=this.discoverBlogPosts(),a={robotsTxt:null,sitemap:null,rss:null,manifest:null,totalRoutes:i.routes.length,publicRoutes:i.routes.filter(l=>!l.auth||l.auth===!1).length,protectedRoutes:i.routes.filter(l=>l.auth&&l.auth.required).length,blogPosts:o.length};return this.options.generateRobotsTxt&&(a.robotsTxt=await this.generateRobotsTxt(i,r,s)),this.options.generateSitemap&&(a.sitemap=await this.generateSitemap(i,r,s,o)),o.length>0&&(a.rss=await this.generateRSSFeed(o,r,s)),a.manifest=await this.generateManifest(i,r,s),a}catch(n){throw this.logger.error(`SEO generator failed to create files (robots.txt/sitemap.xml/manifest): ${n.message}`),this.logger.error(`Stack: ${n.stack||"No stack trace available"}`),n}}async generateRobotsTxt(t,r,s=null){if(s&&await s("robots.txt"))return this.logger.info("\u2705 robots.txt already exists, skipping generation"),{fileName:"robots.txt",skipped:!0};let n=[];(t.routes||[]).forEach(o=>{if(o.auth&&o.auth.required){let a=o.path.startsWith("/")?o.path:`/${o.path}`;n.push(a)}}),n.push("/admin","/api","/_next","/static");let i=this.generateRobotsTxtContent({disallowedPaths:[...new Set(n)],sitemap:`${this.options.baseUrl}/sitemap.xml`,crawlDelay:this.options.crawlDelay});return await r("robots.txt",i),{fileName:"robots.txt",content:i,disallowedPaths:n.length}}async generateSitemap(t,r,s=null,n=[]){if(s&&await s("sitemap.xml"))return this.logger.info("\u2705 sitemap.xml already exists, skipping generation"),{fileName:"sitemap.xml",skipped:!0};let o=(t.routes||[]).filter(l=>!l.auth||l.auth===!1).map(l=>({url:l.path,lastmod:new Date().toISOString().split("T")[0],changefreq:"weekly",priority:l.path==="/"?"1.0":"0.8"}));if(n.length>0){o.push({url:"/blog",lastmod:n[0]?.date||new Date().toISOString().split("T")[0],changefreq:"weekly",priority:"0.7"});for(let l of n)o.push({url:`/blog/${l.slug}`,lastmod:l.date,changefreq:"monthly",priority:"0.6"})}let a=this.generateSitemapContent(o);return await r("sitemap.xml",a),{fileName:"sitemap.xml",content:a,publicRoutes:o.length}}async generateManifest(t,r,s=null){if(s&&await s("seo-manifest.json"))return this.logger.info("\u2705 seo-manifest.json already exists, skipping generation"),{fileName:"seo-manifest.json",skipped:!0};let n={totalRoutes:t.routes?.length||0,publicRoutes:t.routes?.filter(o=>!o.auth||o.auth===!1).length||0,protectedRoutes:t.routes?.filter(o=>o.auth&&o.auth.required).length||0,baseUrl:this.options.baseUrl,siteName:this.options.siteName,generatedAt:new Date().toISOString(),routeMetaTags:t.routeMetaTags||[]},i=JSON.stringify(n,null,2);return await r("seo-manifest.json",i),{fileName:"seo-manifest.json",content:i,manifest:n}}generateRobotsTxtContent(t={}){let{allowedPaths:r=["/"],disallowedPaths:s=["/admin","/api"],sitemap:n,crawlDelay:i}=t,o=l=>l?l==="*"?"*":l.startsWith("/")?l:`/${l}`:"/",a=["User-agent: *",...s.map(l=>`Disallow: ${o(l)}`),...r.map(l=>`Allow: ${o(l)}`)];return i&&a.push(`Crawl-delay: ${i}`),n&&a.push(`Sitemap: ${n}`),a.join(`
766
769
  `)}generateSitemapContent(t){return`<?xml version="1.0" encoding="UTF-8"?>
767
770
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
768
771
  ${t.map(({url:s,lastmod:n,changefreq:i,priority:o})=>{let a=[` <loc>${this.options.baseUrl}${s}</loc>`];return n&&a.push(` <lastmod>${n}</lastmod>`),i&&a.push(` <changefreq>${i}</changefreq>`),o&&a.push(` <priority>${o}</priority>`),` <url>
@@ -770,8 +773,8 @@ ${a.join(`
770
773
  `)}
771
774
  </url>`}).join(`
772
775
  `)}
773
- </urlset>`}generateRouteMetaTags(t){return t.map(r=>{let s=this.options.siteName;if(r.meta?.title)s=`${r.meta.title} - ${this.options.siteName}`;else if(r.path!=="/"){let i=r.path.split("/").filter(Boolean);i.length>0&&(s=`${i[i.length-1].split("-").map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join(" ")} - ${this.options.siteName}`)}let n=`Welcome to ${this.options.siteName}`;if(r.meta?.description)n=r.meta.description;else if(r.meta?.entity&&r.meta?.action)n=`${r.meta.action} ${r.meta.entity} on ${this.options.siteName}`;else if(r.path!=="/"){let i=r.path.split("/").filter(Boolean);i.length>0&&(n=`Explore ${i[i.length-1].split("-").map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join(" ").toLowerCase()} on ${this.options.siteName}`)}return{path:r.path,meta:{title:s,description:n,canonical:`${this.options.baseUrl}${r.path}`,robots:r.auth&&r.auth.required?"noindex, nofollow":"index, follow"}}})}discoverBlogPosts(){if(!this.appRoot)return[];let t=Fi(this.appRoot,"src","content","blog");try{if(!Zu(t))return[];let r=Qu(t).filter(n=>n.endsWith("_en.md"));if(r.length===0)return[];let s=[];for(let n of r){let i=Ku(Fi(t,n),"utf-8"),o=n.replace(/_en\.md$/,""),a=i.match(/^---\r?\n([\s\S]*?)\r?\n---/),l={};if(a)for(let u of a[1].split(`
774
- `)){let f=u.indexOf(":");f!==-1&&(l[u.slice(0,f).trim()]=u.slice(f+1).trim())}s.push({slug:o,title:l.title||o,description:l.description||"",date:l.date||new Date().toISOString().split("T")[0],tags:l.tags?l.tags.split(",").map(u=>u.trim()):[],image:l.image||null})}return s.sort((n,i)=>i.date.localeCompare(n.date)),this.logger.info(`\u{1F4DD} Discovered ${s.length} blog post(s) in src/content/blog/`),s}catch(r){return this.logger.debug(`Blog content discovery skipped: ${r.message}`),[]}}async generateRSSFeed(t,r,s=null){if(s&&await s("rss.xml"))return this.logger.info("\u2705 rss.xml already exists, skipping generation"),{fileName:"rss.xml",skipped:!0};let n=t.map(o=>` <item>
776
+ </urlset>`}generateRouteMetaTags(t){return t.map(r=>{let s=this.options.siteName;if(r.meta?.title)s=`${r.meta.title} - ${this.options.siteName}`;else if(r.path!=="/"){let i=r.path.split("/").filter(Boolean);i.length>0&&(s=`${i[i.length-1].split("-").map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join(" ")} - ${this.options.siteName}`)}let n=`Welcome to ${this.options.siteName}`;if(r.meta?.description)n=r.meta.description;else if(r.meta?.entity&&r.meta?.action)n=`${r.meta.action} ${r.meta.entity} on ${this.options.siteName}`;else if(r.path!=="/"){let i=r.path.split("/").filter(Boolean);i.length>0&&(n=`Explore ${i[i.length-1].split("-").map(l=>l.charAt(0).toUpperCase()+l.slice(1)).join(" ").toLowerCase()} on ${this.options.siteName}`)}return{path:r.path,meta:{title:s,description:n,canonical:`${this.options.baseUrl}${r.path}`,robots:r.auth&&r.auth.required?"noindex, nofollow":"index, follow"}}})}discoverBlogPosts(){if(!this.appRoot)return[];let t=zi(this.appRoot,"src","content","blog");try{if(!af(t))return[];let r=of(t).filter(n=>n.endsWith("_en.md"));if(r.length===0)return[];let s=[];for(let n of r){let i=nf(zi(t,n),"utf-8"),o=n.replace(/_en\.md$/,""),a=i.match(/^---\r?\n([\s\S]*?)\r?\n---/),l={};if(a)for(let f of a[1].split(`
777
+ `)){let u=f.indexOf(":");u!==-1&&(l[f.slice(0,u).trim()]=f.slice(u+1).trim())}s.push({slug:o,title:l.title||o,description:l.description||"",date:l.date||new Date().toISOString().split("T")[0],tags:l.tags?l.tags.split(",").map(f=>f.trim()):[],image:l.image||null})}return s.sort((n,i)=>i.date.localeCompare(n.date)),this.logger.info(`\u{1F4DD} Discovered ${s.length} blog post(s) in src/content/blog/`),s}catch(r){return this.logger.debug(`Blog content discovery skipped: ${r.message}`),[]}}async generateRSSFeed(t,r,s=null){if(s&&await s("rss.xml"))return this.logger.info("\u2705 rss.xml already exists, skipping generation"),{fileName:"rss.xml",skipped:!0};let n=t.map(o=>` <item>
775
778
  <title><![CDATA[${o.title}]]></title>
776
779
  <link>${this.options.baseUrl}/blog/${o.slug}</link>
777
780
  <guid>${this.options.baseUrl}/blog/${o.slug}</guid>
@@ -790,7 +793,7 @@ ${a.join(`
790
793
  <atom:link href="${this.options.baseUrl}/rss.xml" rel="self" type="application/rss+xml"/>
791
794
  ${n}
792
795
  </channel>
793
- </rss>`;return await r("rss.xml",i),{fileName:"rss.xml",content:i,postCount:t.length}}getGenerationSummary(t){let r=t.routes?.length||0,s=t.routes?.filter(i=>!i.auth||i.auth===!1).length||0,n=t.routes?.filter(i=>i.auth&&i.auth.required).length||0;return`${r} routes (${s} public, ${n} protected)`}formatAPIResponse(t){return{totalRoutes:t.routes?.length||0,publicRoutes:t.routes?.filter(r=>!r.auth||r.auth===!1).length||0,protectedRoutes:t.routes?.filter(r=>r.auth&&r.auth.required).length||0,baseUrl:this.options.baseUrl,siteName:this.options.siteName,generatedAt:new Date().toISOString()}}};function Oi(e={}){let{disabled:t=!1,debug:r,generateRobotsTxt:s,generateSitemap:n,routes:i={},baseUrl:o,siteName:a,crawlDelay:l,isDev:u,...f}=e;if(t)return{name:"seo-disabled"};let g=z("SEO Plugin",r,!0),p=W.getInstance(),m=null,I=null,q=!1;async function H(){try{let $=p.resolveAppPath("src/routes.generated.log"),C=p.readSync($,{format:"text"});if(!C)return g.error(`SEO plugin: routes discovery file not found at ${$}`),g.error("This indicates route discovery failed or did not run. SEO files will be generated with empty routes."),{routes:[],errors:[`Routes file missing: ${$}`],source:"fallback"};let k=C.match(/export const discoveredRoutes = (\[[\s\S]*?\]);/);if(!k)return g.error(`SEO plugin: failed to parse routes from ${$}`),g.error("Expected format: export const discoveredRoutes = [...];"),g.error("This indicates route discovery generated invalid output. SEO files will be generated with empty routes."),{routes:[],errors:[`Invalid routes file format: ${$}`],source:"fallback"};let D=k[1].replace(/component:\s*\(\)\s*=>\s*Promise\.resolve\(\{[^}]*\}\),?/g,"").replace(/component:\s*\(\)\s*=>\s*import\([^)]*\),?/g,"").replace(/component:\s*[^,}\n]+,?/g,"").replace(/,\s*,/g,",").replace(/,\s*}/g,"}").replace(/,\s*]/g,"]"),N=Function(`"use strict"; return ${D}`)();return{routes:N,errors:[],source:"generated",totalFiles:N.length}}catch($){return g.warn(`Error parsing generated routes: ${$.message}, falling back to empty routes`),{routes:[],errors:[],source:"fallback"}}}return{name:"vite-seo-plugin",enforce:"pre",configResolved($){let C=p.getAppRoot(),k=$.mode||"production",N=ef(k,C,"VITE_").VITE_APP_URL||process.env.VITE_APP_URL||null;N&&r&&g.debug(`Using app URL from VITE_APP_URL: ${N}`),m=a||null,I=o||N||null,g.verbose(`Name: ${m||"Not found"}`),g.verbose(`URL: ${I||"Not found"}`),m&&g.debug(` - Site name from appConfig: "${m}"`);let E=[];if(I||E.push("baseUrl (VITE_APP_URL in .env)"),m||E.push("siteName (APP_NAME in src/config/app.ts)"),E.length>0){q=!0,g.warn("\u26A0\uFE0F SEO Plugin disabled - missing required configuration:"),E.forEach(M=>g.warn(` - ${M}`)),g.warn(""),g.warn(" To fix:"),I||g.warn(" 1. Add VITE_APP_URL=https://yourdomain.com to your .env file"),m||(g.warn(" 2. Add APP_NAME export to src/config/app.ts:"),g.warn(' export const APP_NAME = "Your App Name";')),g.warn(""),g.warn(" robots.txt and sitemap.xml will NOT be generated."),g.warn("");return}g.debug(`Generate robots.txt: ${s}`),g.debug(`Generate sitemap: ${n}`)},async generateBundle(){if(!q)try{let $=new Yt({debug:r,generateRobotsTxt:s,generateSitemap:n,baseUrl:I,siteName:m,crawlDelay:l,routes:i,appRoot:p.getAppRoot(),...f}),C=await H(),k=async(E,M)=>{this.emitFile({type:"asset",fileName:E,source:M})},D=async E=>!1,N=await $.generateSEOFiles(C,k,D);N.robotsTxt&&!N.robotsTxt.skipped&&g.info(`\u{1F916} robots.txt: ${N.robotsTxt.disallowedPaths||0} disallowed paths`),N.sitemap&&!N.sitemap.skipped&&g.info(`\u{1F5FA}\uFE0F sitemap.xml: ${N.sitemap.publicRoutes||0} routes`),N.rss&&!N.rss.skipped&&g.info(`\u{1F4E1} rss.xml: ${N.rss.postCount||0} blog posts`),N.manifest&&!N.manifest.skipped&&g.info("\u{1F4C4} seo-manifest.json")}catch($){g.error(`SEO plugin failed to generate files (robots.txt/sitemap.xml): ${$.message}`),g.error(`Stack: ${$.stack||"No stack trace available"}`)}}}}function ji(e={}){let{debug:t}=e;return{name:"dndev-server-shim",enforce:"pre",resolveId(r,s){return r.startsWith("node:")?(z("server-shim",t,!0).warn(`Blocking Node.js built-in module import: ${r}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):sr.includes(r)||sr.some(n=>r.startsWith(`${n}/`))?(z("server-shim",t,!0).warn(`Blocking server-only subpath import: ${r}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):qr.includes(r)?(z("server-shim",t,!0).warn(`Blocking server-only import: ${r}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):null},load(r){return r==="\0virtual:empty-server-module"?`
796
+ </rss>`;return await r("rss.xml",i),{fileName:"rss.xml",content:i,postCount:t.length}}getGenerationSummary(t){let r=t.routes?.length||0,s=t.routes?.filter(i=>!i.auth||i.auth===!1).length||0,n=t.routes?.filter(i=>i.auth&&i.auth.required).length||0;return`${r} routes (${s} public, ${n} protected)`}formatAPIResponse(t){return{totalRoutes:t.routes?.length||0,publicRoutes:t.routes?.filter(r=>!r.auth||r.auth===!1).length||0,protectedRoutes:t.routes?.filter(r=>r.auth&&r.auth.required).length||0,baseUrl:this.options.baseUrl,siteName:this.options.siteName,generatedAt:new Date().toISOString()}}};function Bi(e={}){let{disabled:t=!1,debug:r,generateRobotsTxt:s,generateSitemap:n,routes:i={},baseUrl:o,siteName:a,crawlDelay:l,isDev:f,...u}=e;if(t)return{name:"seo-disabled"};let g=M("SEO Plugin",r,!0),p=G.getInstance(),m=null,S=null,z=!1;async function q(){try{let k=p.resolveAppPath("src/routes.generated.log"),C=p.readSync(k,{format:"text"});if(!C)return g.error(`SEO plugin: routes discovery file not found at ${k}`),g.error("This indicates route discovery failed or did not run. SEO files will be generated with empty routes."),{routes:[],errors:[`Routes file missing: ${k}`],source:"fallback"};let A=C.match(/export const discoveredRoutes = (\[[\s\S]*?\]);/);if(!A)return g.error(`SEO plugin: failed to parse routes from ${k}`),g.error("Expected format: export const discoveredRoutes = [...];"),g.error("This indicates route discovery generated invalid output. SEO files will be generated with empty routes."),{routes:[],errors:[`Invalid routes file format: ${k}`],source:"fallback"};let D=A[1].replace(/component:\s*\(\)\s*=>\s*Promise\.resolve\(\{[^}]*\}\),?/g,"").replace(/component:\s*\(\)\s*=>\s*import\([^)]*\),?/g,"").replace(/component:\s*[^,}\n]+,?/g,"").replace(/,\s*,/g,",").replace(/,\s*}/g,"}").replace(/,\s*]/g,"]"),I=Function(`"use strict"; return ${D}`)();return{routes:I,errors:[],source:"generated",totalFiles:I.length}}catch(k){return g.warn(`Error parsing generated routes: ${k.message}, falling back to empty routes`),{routes:[],errors:[],source:"fallback"}}}return{name:"vite-seo-plugin",enforce:"pre",configResolved(k){let C=p.getAppRoot(),A=k.mode||"production",I=lf(A,C,"VITE_").VITE_APP_URL||process.env.VITE_APP_URL||null;I&&r&&g.debug(`Using app URL from VITE_APP_URL: ${I}`),m=a||null,S=o||I||null,g.verbose(`Name: ${m||"Not found"}`),g.verbose(`URL: ${S||"Not found"}`),m&&g.debug(` - Site name from appConfig: "${m}"`);let E=[];if(S||E.push("baseUrl (VITE_APP_URL in .env)"),m||E.push("siteName (APP_NAME in src/config/app.ts)"),E.length>0){z=!0,g.warn("\u26A0\uFE0F SEO Plugin disabled - missing required configuration:"),E.forEach(B=>g.warn(` - ${B}`)),g.warn(""),g.warn(" To fix:"),S||g.warn(" 1. Add VITE_APP_URL=https://yourdomain.com to your .env file"),m||(g.warn(" 2. Add APP_NAME export to src/config/app.ts:"),g.warn(' export const APP_NAME = "Your App Name";')),g.warn(""),g.warn(" robots.txt and sitemap.xml will NOT be generated."),g.warn("");return}g.debug(`Generate robots.txt: ${s}`),g.debug(`Generate sitemap: ${n}`)},async generateBundle(){if(!z)try{let k=new Kt({debug:r,generateRobotsTxt:s,generateSitemap:n,baseUrl:S,siteName:m,crawlDelay:l,routes:i,appRoot:p.getAppRoot(),...u}),C=await q(),A=async(E,B)=>{this.emitFile({type:"asset",fileName:E,source:B})},D=async E=>!1,I=await k.generateSEOFiles(C,A,D);I.robotsTxt&&!I.robotsTxt.skipped&&g.info(`\u{1F916} robots.txt: ${I.robotsTxt.disallowedPaths||0} disallowed paths`),I.sitemap&&!I.sitemap.skipped&&g.info(`\u{1F5FA}\uFE0F sitemap.xml: ${I.sitemap.publicRoutes||0} routes`),I.rss&&!I.rss.skipped&&g.info(`\u{1F4E1} rss.xml: ${I.rss.postCount||0} blog posts`),I.manifest&&!I.manifest.skipped&&g.info("\u{1F4C4} seo-manifest.json")}catch(k){g.error(`SEO plugin failed to generate files (robots.txt/sitemap.xml): ${k.message}`),g.error(`Stack: ${k.stack||"No stack trace available"}`)}}}}function Ui(e={}){let{debug:t}=e;return{name:"dndev-server-shim",enforce:"pre",resolveId(r,s){return r.startsWith("node:")?(M("server-shim",t,!0).warn(`Blocking Node.js built-in module import: ${r}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):nr.includes(r)||nr.some(n=>r.startsWith(`${n}/`))?(M("server-shim",t,!0).warn(`Blocking server-only subpath import: ${r}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):Vr.includes(r)?(M("server-shim",t,!0).warn(`Blocking server-only import: ${r}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):null},load(r){return r==="\0virtual:empty-server-module"?`
794
797
  // Node.js built-in modules shims for browser compatibility
795
798
  export const URL = globalThis.URL;
796
799
  export const URLSearchParams = globalThis.URLSearchParams;
@@ -1069,7 +1072,7 @@ ${n}
1069
1072
  // Google Logging Utils shims
1070
1073
  export const LoggingWinston = class LoggingWinston {};
1071
1074
  export const LoggingBunyan = class LoggingBunyan {};
1072
- `:null}}}var gt=class{constructor(t,r={}){if(!t)throw new Error("CSSExtractor requires PathResolver instance");this.pathResolver=t,this.options={debug:!1,customPatterns:{},...r},this.logger=r.logger||{debug:(s,...n)=>{this.options.debug}},this.patterns={selectors:{...nr.selectors,...this.options.customPatterns?.selectors},themes:{...nr.themes,...this.options.customPatterns?.themes}}}cssVarToJsIdentifier(t){if(!t||typeof t!="string")return this._debug(`Invalid CSS variable: ${t}`),null;let r=t.replace(/^--/,"");if(!r)return this._debug(`Empty CSS variable after removing --: ${t}`),null;let s=r.split("-").filter(o=>o.length>0);if(s.length===0)return this._debug(`No valid parts in CSS variable: ${t}`),null;let n=s.map((o,a)=>{let l=o.replace(/[^a-zA-Z0-9]/g,"");return l?a===0?l.toLowerCase():l.charAt(0).toUpperCase()+l.slice(1).toLowerCase():null}).filter(Boolean).join("");return!n||!/^[a-zA-Z][a-zA-Z0-9]*$/.test(n)?(this._debug(`Invalid JavaScript identifier generated from ${t}: ${n}`),null):["const","let","var","function","class","export","import","default","if","else","for","while"].includes(n)?`${n}Var`:n}_stripComments(t){return t.replace(/\/\*[\s\S]*?\*\//g,"")}extractThemes(t,r,s){let n=[],i,o=this.pathResolver.normalizePath(r),a=this._stripComments(t),l=/(?::root\.|\.)([a-z][a-z0-9-]*)\s*\{([^}]*--theme-label\s*:\s*['"]([^'"]+)['"][^}]*)\}/gim;for(;(i=l.exec(a))!==null;){let[,u,f,g]=i;if(!u||!g)continue;let p=f.match(this.patterns.themes.themeIcon),m=f.match(this.patterns.themes.themeIsDark),I={name:u,displayName:g,isDark:m?m[1]==="1":!1,meta:{icon:p?.[1]},source:this.pathResolver.getBasename(r)};this._debug(`Discovered theme: ${u} (${g})`),n.push(I),s.themes.set(u,{name:u,displayName:g,isDark:I.isDark,file:o,variables:new Set,meta:I.meta})}return n.length>0&&this._debug(`Extracted ${n.length} themes from ${o}`),n}extractClasses(t,r){(t.match(this.patterns.selectors.class)||[]).forEach(n=>{let i=n.slice(1);i.startsWith("_")||r.classes.add(i)})}extractVariables(t,r,s){(t.match(this.patterns.selectors.variable)||[]).forEach(i=>{i.startsWith("--")&&i.length>2?s==="framework"?r.variables.framework.add(i):r.variables.consumer.add(i):this._debug(`Skipping invalid CSS variable: ${i}`)})}extractKeyframes(t,r){(t.match(this.patterns.selectors.keyframe)||[]).forEach(n=>{let i=n.replace("@keyframes","").trim();i&&r.keyframes.add(i)})}validateCSS(t){let r=[],s=t.match(/--[a-zA-Z0-9-_]*[^a-zA-Z0-9-_:;\s]/g);return s&&s.forEach(i=>{r.push(`Possible malformed CSS variable: ${i}`)}),(t.match(/\.[a-z][a-z0-9-]+\s*\{[^}]*\}/gi)||[]).forEach(i=>{if(!i.includes("--theme-label")&&i.includes("--")){let o=i.match(/\.([a-z][a-z0-9-]+)/)?.[1];o&&r.push(`Theme class "${o}" missing --theme-label`)}}),r}extractAll(t,r,s="consumer"){let n={themes:new Map,classes:new Set,variables:{framework:new Set,consumer:new Set},keyframes:new Set},i=this.extractThemes(t,r,n);this.extractClasses(t,n),this.extractVariables(t,n,s),this.extractKeyframes(t,n);let o=this.validateCSS(t);return{themes:i,classes:Array.from(n.classes),variables:{framework:Array.from(n.variables.framework),consumer:Array.from(n.variables.consumer),all:[...Array.from(n.variables.framework),...Array.from(n.variables.consumer)].sort()},keyframes:Array.from(n.keyframes),warnings:o}}getPatterns(){return{...this.patterns}}setPatterns(t){this.patterns={...this.patterns,...t,selectors:{...this.patterns.selectors,...t.selectors},themes:{...this.patterns.themes,...t.themes}}}_debug(t,r){this.logger.debug(t,r||"")}};var Pt=class extends be{constructor(t,r,s={}){super(r,s),this.cssExtractor=t||new gt(r,{debug:s.debug,logger:this.logger}),this.discovered={themes:new Map,variables:{framework:new Set,consumer:new Set},classes:new Set,keyframes:new Set},this._addEssentialThemes()}_getDiscoveryType(){return"Theme"}async _getPatterns(){return await this.pathResolver.resolvePatterns("css")}_getPatternType(){return"css"}async _processFiles(t){this.discovered={themes:new Map,variables:{framework:new Set,consumer:new Set},classes:new Set,keyframes:new Set},this._addEssentialThemes();let{frameworkFiles:r,consumerFiles:s}=t;this.logger.debug(`Scanning ${r.length} framework + ${s.length} consumer CSS files`),this.logger.debug("\u{1F50D} FILES DISCOVERED:"),this.logger.debug("Framework files:",r),this.logger.debug("Consumer files:",s),r.length>0?(this.logger.debug(`Framework files found: ${r.length}`),this.logger.debug("Framework files:",r)):this.logger.debug("No framework files found"),s.length>0?(this.logger.debug(`Consumer files found: ${s.length}`),this.logger.debug("Consumer files:",s)):this.logger.debug("No consumer files found"),await this._processFrameworkFiles(r),await this._processConsumerFiles(s);let n=this._serializeThemes();return this.logger.debug(`Discovered ${n.length} themes:`,n.map(i=>i.name)),{themes:n,variables:{framework:Array.from(this.discovered.variables.framework).sort(),consumer:Array.from(this.discovered.variables.consumer).sort(),all:[...Array.from(this.discovered.variables.framework),...Array.from(this.discovered.variables.consumer)].sort()},classes:Array.from(this.discovered.classes).sort(),keyframes:Array.from(this.discovered.keyframes).sort()}}_getEmptyResult(){let t=this._serializeThemes();return{themes:t.length>0?t:this._getEssentialThemesFallback(),variables:{framework:[],consumer:[],all:[]},classes:[],keyframes:[],timestamp:Date.now()}}_getEssentialThemesFallback(){return ir.map(t=>({name:t.name,displayName:t.displayName,meta:{icon:t.icon,category:t.isDark?"dark":"light"},essential:!0,isDark:t.isDark,source:"built-in",variableCount:0}))}_getDiscoverySummary(){return""}async discoverThemes(t=!1){return await this.discover(t)}getThemes(){return this.cache?.themes||[]}getVariables(){return this.cache?.variables||{framework:[],consumer:[],all:[]}}getClasses(){return this.cache?.classes||[]}async _processFrameworkFiles(t){for(let r of t)try{let s=await this.pathResolver.read(r,{format:"text"}),n=this.pathResolver.normalizePath(r);this.cssExtractor.extractThemes(s,n,this.discovered),this.cssExtractor.extractClasses(s,this.discovered),this.cssExtractor.extractVariables(s,this.discovered,"framework"),this.cssExtractor.extractKeyframes(s,this.discovered),this.logger.debug(`\u2705 Processed framework: ${this.pathResolver.getRelativePath(n)}`)}catch(s){this.logger.debug(`Error scanning framework file ${r}: ${s.message}`)}}async _processConsumerFiles(t){for(let r of t)try{let s=await this.pathResolver.read(r,{format:"text"}),n=this.pathResolver.normalizePath(r);this.cssExtractor.extractThemes(s,n,this.discovered),this.cssExtractor.extractVariables(s,this.discovered,"consumer"),this.logger.debug(`\u2705 Processed consumer: ${this.pathResolver.getRelativePath(n)}`)}catch(s){this.logger.debug(`Error scanning consumer file ${r}: ${s.message}`)}}_addEssentialThemes(){ir.forEach(t=>{this.discovered.themes.set(t.name,{name:t.name,displayName:t.displayName,meta:{icon:t.icon,category:t.isDark?"dark":"light"},essential:!0,isDark:t.isDark,source:"built-in",variables:new Set})})}_serializeThemes(){return Array.from(this.discovered.themes.values()).map(t=>({name:t.name,displayName:t.displayName,meta:t.meta,source:t.source,essential:t.essential||!1,isDark:t.isDark||!1,variableCount:t.variables?.size||0}))}};var Li={isEmpty:e=>!e.themes||e.themes.length===0,generateModule:(e,t,r="themes")=>{let{themes:s}=e;if(!s||s.length===0)return Li.generateEmpty(e,t,void 0,r);let n=s.find(o=>o.essential&&o.name==="light")||s[0],i={totalThemes:s.length,defaultTheme:n?.name||"light",hasCustomThemes:s.some(o=>!o.essential),timestamp:new Date().toISOString()};return`// Virtual module: ${U.themes}
1075
+ `:null}}}var St=class extends be{constructor(t,r,s={}){super(r,s),this.cssExtractor=t||new We(r,{debug:s.debug,logger:this.logger}),this.discovered={themes:new Map,variables:{framework:new Set,consumer:new Set},classes:new Set,keyframes:new Set},this._addEssentialThemes()}_getDiscoveryType(){return"Theme"}async _getPatterns(){return await this.pathResolver.resolvePatterns("css")}_getPatternType(){return"css"}async _processFiles(t){this.discovered={themes:new Map,variables:{framework:new Set,consumer:new Set},classes:new Set,keyframes:new Set},this._addEssentialThemes();let{frameworkFiles:r,consumerFiles:s}=t;this.logger.debug(`Scanning ${r.length} framework + ${s.length} consumer CSS files`),this.logger.debug("\u{1F50D} FILES DISCOVERED:"),this.logger.debug("Framework files:",r),this.logger.debug("Consumer files:",s),r.length>0?(this.logger.debug(`Framework files found: ${r.length}`),this.logger.debug("Framework files:",r)):this.logger.debug("No framework files found"),s.length>0?(this.logger.debug(`Consumer files found: ${s.length}`),this.logger.debug("Consumer files:",s)):this.logger.debug("No consumer files found"),await this._processFrameworkFiles(r),await this._processConsumerFiles(s);let n=this._serializeThemes();return this.logger.debug(`Discovered ${n.length} themes:`,n.map(i=>i.name)),{themes:n,variables:{framework:Array.from(this.discovered.variables.framework).sort(),consumer:Array.from(this.discovered.variables.consumer).sort(),all:[...Array.from(this.discovered.variables.framework),...Array.from(this.discovered.variables.consumer)].sort()},classes:Array.from(this.discovered.classes).sort(),keyframes:Array.from(this.discovered.keyframes).sort()}}_getEmptyResult(){let t=this._serializeThemes();return{themes:t.length>0?t:this._getEssentialThemesFallback(),variables:{framework:[],consumer:[],all:[]},classes:[],keyframes:[],timestamp:Date.now()}}_getEssentialThemesFallback(){return or.map(t=>({name:t.name,displayName:t.displayName,meta:{icon:t.icon,category:t.isDark?"dark":"light"},essential:!0,isDark:t.isDark,source:"built-in",variableCount:0}))}_getDiscoverySummary(){return""}async discoverThemes(t=!1){return await this.discover(t)}getThemes(){return this.cache?.themes||[]}getVariables(){return this.cache?.variables||{framework:[],consumer:[],all:[]}}getClasses(){return this.cache?.classes||[]}async _processFrameworkFiles(t){for(let r of t)try{let s=await this.pathResolver.read(r,{format:"text"}),n=this.pathResolver.normalizePath(r);this.cssExtractor.extractThemes(s,n,this.discovered),this.cssExtractor.extractClasses(s,this.discovered),this.cssExtractor.extractVariables(s,this.discovered,"framework"),this.cssExtractor.extractKeyframes(s,this.discovered),this.logger.debug(`\u2705 Processed framework: ${this.pathResolver.getRelativePath(n)}`)}catch(s){this.logger.debug(`Error scanning framework file ${r}: ${s.message}`)}}async _processConsumerFiles(t){for(let r of t)try{let s=await this.pathResolver.read(r,{format:"text"}),n=this.pathResolver.normalizePath(r);this.cssExtractor.extractThemes(s,n,this.discovered),this.cssExtractor.extractVariables(s,this.discovered,"consumer"),this.logger.debug(`\u2705 Processed consumer: ${this.pathResolver.getRelativePath(n)}`)}catch(s){this.logger.debug(`Error scanning consumer file ${r}: ${s.message}`)}}_addEssentialThemes(){or.forEach(t=>{this.discovered.themes.set(t.name,{name:t.name,displayName:t.displayName,meta:{icon:t.icon,category:t.isDark?"dark":"light"},essential:!0,isDark:t.isDark,source:"built-in",variables:new Set})})}_serializeThemes(){return Array.from(this.discovered.themes.values()).map(t=>({name:t.name,displayName:t.displayName,meta:t.meta,source:t.source,essential:t.essential||!1,isDark:t.isDark||!1,variableCount:t.variables?.size||0}))}};var Gi={isEmpty:e=>!e.themes||e.themes.length===0,generateModule:(e,t,r="themes")=>{let{themes:s}=e;if(!s||s.length===0)return Gi.generateEmpty(e,t,void 0,r);let n=s.find(o=>o.essential&&o.name==="light")||s[0],i={totalThemes:s.length,defaultTheme:n?.name||"light",hasCustomThemes:s.some(o=>!o.essential),timestamp:new Date().toISOString()};return`// Virtual module: ${W.themes}
1073
1076
  // \u{1F680} STATIC INJECTION PATTERN - Zero Runtime Loading
1074
1077
  // Generated by @donotdev/config at ${new Date().toISOString()}
1075
1078
 
@@ -1144,7 +1147,7 @@ export default {
1144
1147
  getAllThemes,
1145
1148
  getThemeNames
1146
1149
  };
1147
- `},generateEmpty:(e,t,r,s="themes")=>{let n=e.themes&&e.themes.length>0?e.themes:[{name:"light",displayName:"Light",meta:{icon:"Sun",category:"light"},essential:!0,isDark:!1,source:"built-in",variableCount:0}],i=n.find(a=>a.essential&&a.name==="light")||n[0],o={totalThemes:n.length,defaultTheme:i?.name||"light",hasCustomThemes:n.some(a=>!a.essential),timestamp:new Date().toISOString()};return`// ${U.themes} - Using framework essential themes (fallback)
1150
+ `},generateEmpty:(e,t,r,s="themes")=>{let n=e.themes&&e.themes.length>0?e.themes:[{name:"light",displayName:"Light",meta:{icon:"Sun",category:"light"},essential:!0,isDark:!1,source:"built-in",variableCount:0}],i=n.find(a=>a.essential&&a.name==="light")||n[0],o={totalThemes:n.length,defaultTheme:i?.name||"light",hasCustomThemes:n.some(a=>!a.essential),timestamp:new Date().toISOString()};return`// ${W.themes} - Using framework essential themes (fallback)
1148
1151
  // Generated by @donotdev/config at ${new Date().toISOString()}
1149
1152
 
1150
1153
  export const THEMES = ${JSON.stringify(n,null,2)};
@@ -1230,7 +1233,7 @@ export default discoveredThemes;
1230
1233
  `;let s=r.find(n=>n.essential&&n.name==="light")||r[0];return`/**
1231
1234
  * Generated Theme Discovery Results
1232
1235
  * Generated at: ${new Date().toISOString()}
1233
- * Import from '${U.themes}'
1236
+ * Import from '${W.themes}'
1234
1237
  */
1235
1238
 
1236
1239
  export const discoveredThemes = ${JSON.stringify(r,null,2)};
@@ -1245,11 +1248,11 @@ export const themeManifest = {
1245
1248
  };
1246
1249
 
1247
1250
  export default discoveredThemes;
1248
- `},generateManifest:e=>({themes:e.themes?.length||0,timestamp:Date.now(),hasCustomThemes:e.themes?.some(t=>!t.essential)||!1}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.themes||[],n=s.filter(o=>!o.essential).length,i=s.length;r&&(i===0?r.warn(`${t} No themes discovered - using framework essential themes fallback`):r.info(`${t} Themes: ${i} discovered${n>0?` (${n} custom)`:""}`))}};function Mi(e={}){let t=Date.now();return z("theme-plugin",e.debug,e.verbose).debug("\u{1F3A8} Creating theme discovery plugin..."),Re({pluginName:"dndev-theme",icon:"\u{1F3A8}",virtualModuleId:U.themes,DiscoveryClass:Pt,discoveryMethod:"discoverThemes",filePatterns:["**/*.css"],templates:Li,defaultInspectionPath:Q.vite.themeInspection,manifestFileName:Q.manifests.theme,configKey:"themes",createDiscovery:(n,i)=>{let o=new gt(n,{debug:i.debug,logger:z("css-extractor",i.debug,i.verbose)});return new Pt(o,n,i)}})(e)}function zi(e={}){let t=z("vite-plugins",e.debug,e.verbose);try{let{mode:r,debug:s,verbose:n,isDev:i,server:o={},routes:a={},themes:l={},i18n:u={},assets:f={},seo:g={},pwa:p={},serverShim:m={},pluginFactory:I={}}=e,q=a.debug??s,H=l.debug??s,$=u.debug??s,C=f.debug??s,k=m.debug??s,D=[];D.push(ji({...m,debug:k}));let N;try{N=W.getInstance()}catch(E){throw new Error(`Failed to initialize PathResolver: ${E.message||E}`)}return D.push({name:"dndev-file-watcher-fix",enforce:"pre",configResolved(E){if(s){t.debug("\u{1F4CB} Vite resolved config (configResolved):");let L={root:E.root,mode:E.mode,envDir:E.envDir,base:E.base,build:E.build?{outDir:E.build.outDir,minify:E.build.minify}:void 0,server:E.server?{port:E.server.port,host:E.server.host}:void 0,plugins:E.plugins?{count:E.plugins.length,names:E.plugins.map(ue=>ue?.name||"unnamed").filter(Boolean)}:void 0};t.debug(JSON.stringify(L,null,2))}N.setAppRoot(E.root);let M=N.getAppRoot();if(i&&E.server?.port){let L=E.server.https?"https":"http";process.env.VITE_APP_URL=`${L}://localhost:${E.server.port}`,(s||n)&&t.debug(`VITE_APP_URL set: ${process.env.VITE_APP_URL}`)}else i&&t.warn("VITE_APP_URL not set in dev mode. Server port not available.");try{let L=N.getRepoRoot();t.verbose(`Repo: ${L}`),t.verbose(`App: ${M}`)}catch(L){t.debug(`Could not log PathResolver values: ${L.message}`)}if(E.server){let L=S=>{let A=S.replace(/\\/g,"/"),te=M.replace(/\\/g,"/");return!A.startsWith(te)};E.server.watch||(E.server.watch={});let ue=["**/node_modules/**","**/.git/**","**/dist/**","**/build/**","**/.next/**","**/.turbo/**","**/.vite/**","**/functions/**","**/.generated/**"];E.server.watch={...E.server.watch,ignored:[...E.server.watch.ignored||[],...ue,L]},t.verbose(`Fixed file watcher to use app root: ${M}`)}}}),D.push(Ni({debug:s,verbose:n})),D.push(Ai({debug:s})),D.push(rf({fastRefresh:!0,jsxRuntime:"automatic"})),D.push(sf({ignoreConfigErrors:!0})),o.https!==!1&&D.push(tf()),D.push(Ci({...I,...a,debug:q})),D.push(Mi({...I,...l,debug:H})),D.push(ki({...I,...u,debug:$})),D.push(Ri({...I,...f,debug:C})),D.push($i({...I,mode:r,debug:s,verbose:n})),D.push(Oi({...g,debug:s,isDev:i})),p.enabled&&D.push(Ii({...p,debug:s})),D}catch(r){throw z("vite-plugins",!1,!0).error(`Failed to create Vite plugins: ${r.message}`),r}}function nf(e){if(!e)return{};let t={};return Array.isArray(e)?e.forEach(({find:r,replacement:s})=>{typeof r=="string"&&(t[r]=s)}):typeof e=="object"&&Object.assign(t,e),t}function Bi(e={}){let{alias:t,...r}=e,{conditions:s,...n}=r;return{alias:{"@":"/src",...nf(t)},dedupe:["react","react-dom","react-router-dom"],preserveSymlinks:!1,conditions:["browser","module","import","vite-app",...s||[]],...n}}function Ui(e={}){let{include:t=[],exclude:r=[],esbuildOptions:s={},...n}=e,i=[...t,...Xe.optionalFeatures],o=[...new Set(i)],a=[...new Set(r)];return{include:o,exclude:a,esbuildOptions:s,...n}}function of(e={}){return e==null&&(e={}),async(t={})=>{t==null&&(t={});try{let r=process.env.CI==="true";process.env.DNDEV_BUILD_ID||(process.env.DNDEV_BUILD_ID=r?`ci-${Math.random().toString(36).slice(2,9)}`:Math.random().toString(36).slice(2,9));let s=t.command,n=t.mode,{appConfig:i,...o}=e;if(!i)throw new Error(`appConfig is required. Import appConfig from src/config/app.ts and pass it to defineViteConfig({ appConfig, ... })
1249
- Make sure the import statement in vite.config.ts is: import { appConfig } from "./src/config/app";`);if(typeof i!="object"||i===null)throw new Error(`appConfig must be an object, but got ${typeof i}. Make sure you are exporting appConfig from src/config/app.ts correctly.`);let a=i?.features?{debug:i.features.debug}:void 0,l=i?.seo&&typeof i.seo!="boolean"?{...i.seo,siteName:i.seo.siteName||i.app?.name}:i?.app?.name?{siteName:i.app.name}:void 0,{features:u,seo:f,...g}=o,p=i?.app?{name:i.app.name,shortName:i.app.shortName,description:i.app.description}:void 0,{pwa:m={},...I}=g,q={...m,app:m.app||p},H={...a?{features:a}:{},...l?{seo:l}:{},...Object.keys(q).length>0?{pwa:q}:{},...I,mode:n},$;try{$=es(H)}catch(we){throw new Error(`mergeOptions failed: ${we?.message||we||"Unknown error"}`)}let C;try{C=ts($)}catch(we){throw new Error(`normalizeOptions failed: ${we?.message||we||"Unknown error"}`)}if(!C)throw new Error("normalizeOptions returned undefined");let{mode:k,debug:D,verbose:N,isDev:E,isDebug:M,shouldAnalyze:L,serverOptions:ue,previewOptions:S,buildOverrides:A,resolveOptions:te,routeOptions:pt,themeOptions:fe,i18nOptions:xe,assetOptions:F,featureOptions:O,seoOptions:j,pwaOptions:Y,serverShimOptions:He,chunkingOptions:re,pluginFactoryOptions:Me,base:De,defineOptions:tt,optimizeDepsOptions:Kt,pluginsOptions:Qt,cssOptions:mt,envDir:Rt,restOptions:Zt}=C,Ve=z("vite-config",D,N);Ve.debug(`Mode: ${k}, Dev: ${E}`);let b=process.env.DNDEV_BUILD_ID,P;s==="build"?P=`Building for ${k}`:s==="serve"?P=`Development server (${k})`:s==="preview"?P=`Preview server (serving ${k} build)`:P=`Running ${s} (${k})`,Ve.info(`
1250
- \u{1F3D7}\uFE0F DnDev Framework - ${P}${b?` [build:${b}]`:""}`),Ve.info(` Platform: Vite | Command: ${s} | Mode: ${k}
1251
- `);let X=zi({mode:k,debug:D,verbose:N,isDev:E,routes:pt,themes:fe,i18n:xe,assets:F,features:O,seo:j,pwa:Y,serverShim:He,chunkingOptions:re,pluginFactory:Me});if(!Array.isArray(X))throw new Error(`createVitePlugins returned ${typeof X}, expected array. Value: ${X}`);let Je=Yr({mode:k,chunkingOptions:re,debug:D,isDev:E,isDebug:M,shouldAnalyze:L}),ye=Kr(ue.port||3e3,ue,Ve),Gi=Qr(S);return{...De&&{base:De},plugins:[...X,...Qt],appType:"spa",assetsInclude:["**/*.woff","**/*.woff2","**/*.ttf","**/*.otf","**/*.eot"],...k==="production"&&{build:Je},...s==="serve"&&{server:ye},...s==="preview"&&{preview:Gi},...Rt&&{envDir:Rt},customLogger:k==="production"&&!D?(()=>{let we={hasWarned:!1,_shouldSuppress(ge){return ge.includes("dist/")||ge.includes("kB")||ge.includes("\u2502")||ge.includes("gzip:")||ge.includes("\u2713 built in")||ge.match(/built in \d+\.\d+s/)},info(ge){we._shouldSuppress(ge)},warn(ge){we._shouldSuppress(ge)},error(ge){},warnOnce(ge){we.hasWarned||(we.hasWarned=!0)},clearScreen(){},hasErrorLogged(){return!1}};return we})():void 0,css:{postcss:ss(mt),...mt},optimizeDeps:Ui(Kt),resolve:Bi(te),define:{...tt,"process.env.NODE_ENV":JSON.stringify(n),__DEV__:JSON.stringify(E),__PROD__:JSON.stringify(!E)},...Zt}}catch(r){let s=r||new Error("Unknown error occurred"),n=s?.message||s?.toString()||String(s)||"Unknown error",i=s?.stack||"",o=new Error(`Failed to create Vite config: ${n}${i?`
1252
- ${i}`:""}`);throw o.stack=i||o.stack,o}}}export{of as defineViteConfig};
1251
+ `},generateManifest:e=>({themes:e.themes?.length||0,timestamp:Date.now(),hasCustomThemes:e.themes?.some(t=>!t.essential)||!1}),logConfig:e=>{},logStats:(e,t,r)=>{let s=e.themes||[],n=s.filter(o=>!o.essential).length,i=s.length;r&&(i===0?r.warn(`${t} No themes discovered - using framework essential themes fallback`):r.info(`${t} Themes: ${i} discovered${n>0?` (${n} custom)`:""}`))}};function qi(e={}){let t=Date.now();return M("theme-plugin",e.debug,e.verbose).debug("\u{1F3A8} Creating theme discovery plugin..."),Se({pluginName:"dndev-theme",icon:"\u{1F3A8}",virtualModuleId:W.themes,DiscoveryClass:St,discoveryMethod:"discoverThemes",filePatterns:["**/*.css"],templates:Gi,defaultInspectionPath:Q.vite.themeInspection,manifestFileName:Q.manifests.theme,configKey:"themes",createDiscovery:(n,i)=>{let o=new We(n,{debug:i.debug,logger:M("css-extractor",i.debug,i.verbose)});return new St(o,n,i)}})(e)}function Wi(e={}){let t=M("vite-plugins",e.debug,e.verbose);try{let{mode:r,debug:s,verbose:n,isDev:i,server:o={},routes:a={},themes:l={},i18n:f={},assets:u={},seo:g={},pwa:p={},serverShim:m={},pluginFactory:S={}}=e,z=a.debug??s,q=l.debug??s,k=f.debug??s,C=u.debug??s,A=m.debug??s,D=[];D.push(Ui({...m,debug:A}));let I;try{I=G.getInstance()}catch(E){throw new Error(`Failed to initialize PathResolver: ${E.message||E}`)}return D.push({name:"dndev-file-watcher-fix",enforce:"pre",configResolved(E){if(s){t.debug("\u{1F4CB} Vite resolved config (configResolved):");let L={root:E.root,mode:E.mode,envDir:E.envDir,base:E.base,build:E.build?{outDir:E.build.outDir,minify:E.build.minify}:void 0,server:E.server?{port:E.server.port,host:E.server.host}:void 0,plugins:E.plugins?{count:E.plugins.length,names:E.plugins.map(ue=>ue?.name||"unnamed").filter(Boolean)}:void 0};t.debug(JSON.stringify(L,null,2))}I.setAppRoot(E.root);let B=I.getAppRoot();if(i&&E.server?.port){let L=E.server.https?"https":"http";process.env.VITE_APP_URL=`${L}://localhost:${E.server.port}`,(s||n)&&t.debug(`VITE_APP_URL set: ${process.env.VITE_APP_URL}`)}else i&&t.warn("VITE_APP_URL not set in dev mode. Server port not available.");try{let L=I.getRepoRoot();t.verbose(`Repo: ${L}`),t.verbose(`App: ${B}`)}catch(L){t.debug(`Could not log PathResolver values: ${L.message}`)}if(E.server){let L=$=>{let _=$.replace(/\\/g,"/"),te=B.replace(/\\/g,"/");return!_.startsWith(te)};E.server.watch||(E.server.watch={});let ue=["**/node_modules/**","**/.git/**","**/dist/**","**/build/**","**/.next/**","**/.turbo/**","**/.vite/**","**/functions/**","**/.generated/**"];E.server.watch={...E.server.watch,ignored:[...E.server.watch.ignored||[],...ue,L]},t.verbose(`Fixed file watcher to use app root: ${B}`)}}}),D.push(Fi({debug:s,verbose:n})),D.push(Ti({debug:s})),D.push(uf({fastRefresh:!0,jsxRuntime:"automatic"})),D.push(ff({ignoreConfigErrors:!0})),o.https!==!1&&D.push(cf()),D.push(Mi({...S,...a,debug:z})),D.push(qi({...S,...l,debug:q})),D.push(Di({...S,...f,debug:k})),D.push(ki({...S,...u,debug:C})),D.push(_i({...S,mode:r,debug:s,verbose:n})),D.push(Bi({...g,debug:s,isDev:i})),p.enabled&&D.push(Oi({...p,debug:s})),D.push(Ii({debug:s})),D}catch(r){throw M("vite-plugins",!1,!0).error(`Failed to create Vite plugins: ${r.message}`),r}}function hf(e){if(!e)return{};let t={};return Array.isArray(e)?e.forEach(({find:r,replacement:s})=>{typeof r=="string"&&(t[r]=s)}):typeof e=="object"&&Object.assign(t,e),t}function Hi(e={}){let{alias:t,...r}=e,{conditions:s,...n}=r;return{alias:{"@":"/src",...hf(t)},dedupe:["react","react-dom","react-router-dom"],preserveSymlinks:!1,conditions:["browser","module","import","vite-app",...s||[]],...n}}function Vi(e={}){let{include:t=[],exclude:r=[],esbuildOptions:s={},...n}=e,i=[...t,...Xe.optionalFeatures],o=[...new Set(i)],a=[...new Set(r)];return{include:o,exclude:a,esbuildOptions:s,...n}}function df(e={}){return e==null&&(e={}),async(t={})=>{t==null&&(t={});try{let r=process.env.CI==="true";process.env.DNDEV_BUILD_ID||(process.env.DNDEV_BUILD_ID=r?`ci-${Math.random().toString(36).slice(2,9)}`:Math.random().toString(36).slice(2,9));let s=t.command,n=t.mode,{appConfig:i,...o}=e;if(!i)throw new Error(`appConfig is required. Import appConfig from src/config/app.ts and pass it to defineViteConfig({ appConfig, ... })
1252
+ Make sure the import statement in vite.config.ts is: import { appConfig } from "./src/config/app";`);if(typeof i!="object"||i===null)throw new Error(`appConfig must be an object, but got ${typeof i}. Make sure you are exporting appConfig from src/config/app.ts correctly.`);let a=i?.features?{debug:i.features.debug}:void 0,l=i?.seo&&typeof i.seo!="boolean"?{...i.seo,siteName:i.seo.siteName||i.app?.name}:i?.app?.name?{siteName:i.app.name}:void 0,{features:f,seo:u,...g}=o,p=i?.app?{name:i.app.name,shortName:i.app.shortName,description:i.app.description}:void 0,{pwa:m={},...S}=g,z={...m,app:m.app||p},q={...a?{features:a}:{},...l?{seo:l}:{},...Object.keys(z).length>0?{pwa:z}:{},...S,mode:n},k;try{k=ss(q)}catch(we){throw new Error(`mergeOptions failed: ${we?.message||we||"Unknown error"}`)}let C;try{C=ns(k)}catch(we){throw new Error(`normalizeOptions failed: ${we?.message||we||"Unknown error"}`)}if(!C)throw new Error("normalizeOptions returned undefined");let{mode:A,debug:D,verbose:I,isDev:E,isDebug:B,shouldAnalyze:L,serverOptions:ue,previewOptions:$,buildOverrides:_,resolveOptions:te,routeOptions:gt,themeOptions:fe,i18nOptions:xe,assetOptions:F,featureOptions:O,seoOptions:j,pwaOptions:Y,serverShimOptions:He,chunkingOptions:re,pluginFactoryOptions:Le,base:De,defineOptions:tt,optimizeDepsOptions:Qt,pluginsOptions:Zt,cssOptions:pt,envDir:Rt,restOptions:er}=C,Ve=M("vite-config",D,I);Ve.debug(`Mode: ${A}, Dev: ${E}`);let b=process.env.DNDEV_BUILD_ID,P;s==="build"?P=`Building for ${A}`:s==="serve"?P=`Development server (${A})`:s==="preview"?P=`Preview server (serving ${A} build)`:P=`Running ${s} (${A})`,Ve.info(`
1253
+ \u{1F3D7}\uFE0F DnDev Framework - ${P}${b?` [build:${b}]`:""}`),Ve.info(` Platform: Vite | Command: ${s} | Mode: ${A}
1254
+ `);let X=Wi({mode:A,debug:D,verbose:I,isDev:E,routes:gt,themes:fe,i18n:xe,assets:F,features:O,seo:j,pwa:Y,serverShim:He,chunkingOptions:re,pluginFactory:Le});if(!Array.isArray(X))throw new Error(`createVitePlugins returned ${typeof X}, expected array. Value: ${X}`);let Je=Zr({mode:A,chunkingOptions:re,debug:D,isDev:E,isDebug:B,shouldAnalyze:L}),ye=es(ue.port||3e3,ue,Ve),Ji=ts($);return{...De&&{base:De},plugins:[...X,...Zt],appType:"spa",assetsInclude:["**/*.woff","**/*.woff2","**/*.ttf","**/*.otf","**/*.eot"],...A==="production"&&{build:Je},...s==="serve"&&{server:ye},...s==="preview"&&{preview:Ji},...Rt&&{envDir:Rt},customLogger:A==="production"&&!D?(()=>{let we={hasWarned:!1,_shouldSuppress(ge){return ge.includes("dist/")||ge.includes("kB")||ge.includes("\u2502")||ge.includes("gzip:")||ge.includes("\u2713 built in")||ge.match(/built in \d+\.\d+s/)},info(ge){we._shouldSuppress(ge)},warn(ge){we._shouldSuppress(ge)},error(ge){},warnOnce(ge){we.hasWarned||(we.hasWarned=!0)},clearScreen(){},hasErrorLogged(){return!1}};return we})():void 0,css:{postcss:os(pt),...pt},optimizeDeps:Vi(Qt),resolve:Hi(te),define:{...tt,"process.env.NODE_ENV":JSON.stringify(n),__DEV__:JSON.stringify(E),__PROD__:JSON.stringify(!E)},...er}}catch(r){let s=r||new Error("Unknown error occurred"),n=s?.message||s?.toString()||String(s)||"Unknown error",i=s?.stack||"",o=new Error(`Failed to create Vite config: ${n}${i?`
1255
+ ${i}`:""}`);throw o.stack=i||o.stack,o}}}export{df as defineViteConfig};
1253
1256
  /*! Bundled license information:
1254
1257
 
1255
1258
  sharp/lib/is.js: