@visulima/packem 1.4.2 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/packem.cjs CHANGED
@@ -84,11 +84,11 @@ ${e.replaceAll(/^\n|\n$/g,"")}
84
84
  `,"normalizeCodeFrame"),Rt=Je(e=>{const t=Cr(e);let o=(e.plugin?`[${e.plugin}] `:"")+e.message;e.id&&(o+=`
85
85
  file: ${$.cyan(e.id+(e.loc?":"+e.loc.line+":"+e.loc.column:""))}`),e.frame&&(o+=`
86
86
  `+$.yellow(_r(e.frame))),e.message=o,t!==void 0&&(e.stack=`${e.message}
87
- ${t}`)},"enhanceRollupError");var Mr=Object.defineProperty,Jt=m((e,t)=>Mr(e,"name",{value:t,configurable:!0}),"d$3");const ye="rollup-watch.json",tt=Jt(({context:e,doOnSuccessCleanup:t,fileCache:o,mode:s,runBuilder:n,runOnsuccess:r,watcher:i,useCache:l})=>{const c="watcher:"+s;i.on("change",async(a,{event:p})=>{await t?.(),e.logger.info({message:`${$.cyan(f.relative(".",a))} was ${p}d`,prefix:c})}),i.on("restart",()=>{e.logger.info({message:"Rebuilding ...",prefix:c})}),i.on("event",async a=>{switch(a.code){case"END":{e.logger.success({message:"Rebuild finished",prefix:c}),await r?.();break}case"BUNDLE_START":{e.logger.info({message:$.cyan("build started..."),prefix:c});break}case"BUNDLE_END":{await a.result.close(),l&&o.set(s==="bundle"?ye:"dts-"+ye,a.result.cache),e.logger.raw(`
87
+ ${t}`)},"enhanceRollupError");var Mr=Object.defineProperty,Jt=m((e,t)=>Mr(e,"name",{value:t,configurable:!0}),"d$3");const ye="rollup-watch.json",tt=Jt(({context:e,doOnSuccessCleanup:t,fileCache:o,mode:s,runBuilder:n,runOnsuccess:r,useCache:i,watcher:l})=>{const c="watcher:"+s;l.on("change",async(a,{event:p})=>{await t?.(),e.logger.info({message:`${$.cyan(f.relative(".",a))} was ${p}d`,prefix:c})}),l.on("restart",()=>{e.logger.info({message:"Rebuilding ...",prefix:c})}),l.on("event",async a=>{switch(a.code){case"END":{e.logger.success({message:"Rebuild finished",prefix:c}),await r?.();break}case"BUNDLE_START":{e.logger.info({message:$.cyan("build started..."),prefix:c});break}case"BUNDLE_END":{await a.result.close(),i&&o.set(s==="bundle"?ye:"dts-"+ye,a.result.cache),e.logger.raw(`
88
88
  ⚡️ Build run in `+a.duration+`ms
89
89
 
90
90
  `),await n?.(!0);break}case"ERROR":{Rt(a.error),e.logger.error({context:[a.error],message:"Rebuild failed: "+a.error.message,prefix:c});break}}})},"watchHandler"),Ir=Jt(async(e,t,o,s,n)=>{const r=await Ft(e,t);if(await e.hooks.callHook("rollup:options",e,r),Object.keys(r.input).length===0)return;let i=!0;(e.options.rollup.isolatedDeclarations||e.options.isolatedDeclarationTransformer||e.options.rollup.css)&&(i=!1),i&&(r.cache=t.get(ye)),e.options.rollup.watch&&typeof r.watch=="object"&&r.watch.include===void 0&&(r.watch={...r.watch,...e.options.rollup.watch},r.watch.include=[f.join(e.options.sourceDir,"**","*"),"package.json","packem.config.*"],Array.isArray(e.options.rollup.watch.include)?r.watch.include=[...r.watch.include,...e.options.rollup.watch.include]:e.options.rollup.watch.include&&r.watch.include.push(e.options.rollup.watch.include),r.watch.chokidar={cwd:e.options.rootDir,...r.watch.chokidar,ignored:["**/.git/**","**/node_modules/**","**/test-results/**",...r.watch.chokidar?.ignored??[]]});const l=ne.watch(r);await e.hooks.callHook("rollup:watch",e,l);const c=[...Array.isArray(r.input)?r.input:typeof r.input=="string"?[r.input]:Object.keys(r.input??{})];let a="Starting watcher for entries:";for(const p of c)a+=$.gray(`
91
- └─ ${f.relative(process.cwd(),p)}`);if(e.logger.info(a),tt({context:e,doOnSuccessCleanup:n,fileCache:t,mode:"bundle",runBuilder:o,runOnsuccess:s,watcher:l,useCache:i}),e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer)e.logger.info({message:"Using isolated declaration transformer to generate declaration files...",prefix:"dts"});else if(e.options.declaration){const p=await Tt(e,t);i&&(p.cache=t.get("dts-"+ye)),await e.hooks.callHook("rollup:dts:options",e,p);const d=ne.watch(p);await e.hooks.callHook("rollup:watch",e,d),tt({context:e,fileCache:t,mode:"types",watcher:d,useCache:i})}},"watch");var Fr=Object.defineProperty,qt=m((e,t)=>Fr(e,"name",{value:t,configurable:!0}),"s$4");const Tr=qt(e=>{try{JSON.parse(e)}catch{return!1}return!0},"isJson");let Ar=class{static{m(this,"g")}static{qt(this,"FileCache")}#s;#e;#n;#t=!0;#o=new Map;constructor(t,o,s,n){this.#s=t,this.#n=s,o===void 0?n.debug({message:"Could not create cache directory.",prefix:"file-cache"}):(this.#e=o,n.debug({message:"Cache path is: "+this.#e,prefix:"file-cache"}))}set isEnabled(t){this.#t=t}has(t,o){return!this.#t||this.#e===void 0?!1:E.isAccessibleSync(this.getFilePath(t,o))}get(t,o){if(!this.#t||this.#e===void 0)return;const s=this.getFilePath(t,o);if(this.#o.has(s))return this.#o.get(s);if(!E.isAccessibleSync(s))return;const n=E.readFileSync(s);if(Tr(n)){const r=JSON.parse(n);return this.#o.set(s,r),r}return this.#o.set(s,n),n}set(t,o,s){if(!this.#t||this.#e===void 0||o===void 0)return;const n=this.getFilePath(t,s);typeof o=="object"&&(o=JSON.stringify(o)),E.writeFileSync(n,o,{overwrite:!0})}getFilePath(t,o){let s=t.replaceAll(f.toNamespacedPath(this.#s),"");return s=s.replaceAll(":","-"),f.join(this.#e,this.#n,o?.replaceAll(":","-")??"",f.toNamespacedPath(s))}};var Rr=Object.defineProperty,Jr=m((e,t)=>Rr(e,"name",{value:t,configurable:!0}),"t$1");const qr=Jr(async(e,t="")=>{let o=t;if(!o){const s=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const n of s)if(await E.isAccessible(f.join(e,n))){o="./"+n;break}}if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(o))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return o},"findPackemFile");var Br=Object.defineProperty,pe=m((e,t)=>Br(e,"name",{value:t,configurable:!0}),"l$4");const Wr=H.createFilter,Lr=pe((e,t)=>{const{sideEffects:o}=t;let s;if(typeof o=="boolean")s=pe(()=>o,"hasSideEffects");else if(Array.isArray(o))if(o.length<=0)s=pe(()=>!1,"hasSideEffects");else{const n=o.map(r=>r.includes("/")?r:`**/${r}`);s=Wr(n,null,{resolve:e})}else s=pe(()=>null,"hasSideEffects");return s},"getPackageSideEffect");var Pe,ot;function zr(){if(ot)return Pe;ot=1;var e=Do,t=e.spawn,o=e.exec;Pe=m(function(i,l,c){if(typeof l=="function"&&c===void 0&&(c=l,l=void 0),i=parseInt(i),Number.isNaN(i)){if(c)return c(new Error("pid must be a number"));throw new Error("pid must be a number")}var a={},p={};switch(a[i]=[],p[i]=1,process.platform){case"win32":o("taskkill /pid "+i+" /T /F",c);break;case"darwin":r(i,a,p,function(d){return t("pgrep",["-P",d])},function(){s(a,l,c)});break;default:r(i,a,p,function(d){return t("ps",["-o","pid","--no-headers","--ppid",d])},function(){s(a,l,c)});break}},"treeKill");function s(i,l,c){var a={};try{Object.keys(i).forEach(function(p){i[p].forEach(function(d){a[d]||(n(d,l),a[d]=1)}),a[p]||(n(p,l),a[p]=1)})}catch(p){if(c)return c(p);throw p}if(c)return c()}m(s,"killAll");function n(i,l){try{process.kill(parseInt(i,10),l)}catch(c){if(c.code!=="ESRCH")throw c}}m(n,"killPid");function r(i,l,c,a,p){var d=a(i),u="";d.stdout.on("data",function(h){var h=h.toString("ascii");u+=h});var g=m(function(y){if(delete c[i],y!=0){Object.keys(c).length==0&&p();return}u.match(/\d+/g).forEach(function(h){h=parseInt(h,10),l[i].push(h),l[h]=[],c[h]=1,r(h,l,c,a,p)})},"onClose");d.on("close",g)}return m(r,"buildProcessTree"),Pe}m(zr,"requireTreeKill");var Ur=zr();const Kr=ct.g(Ur);var Vr=Object.defineProperty,Bt=m((e,t)=>Vr(e,"name",{value:t,configurable:!0}),"l$3");const Hr=Bt(e=>process.platform==="win32"&&"cmd"in e&&"code"in e&&typeof e.cmd=="string"&&e.cmd.startsWith("taskkill")&&e.code===128,"isTaskKillCmdProcessNotFoundError"),Gr=Bt(async({pid:e,signal:t})=>await new Promise((o,s)=>{if(!Number.isInteger(e)||e<=0){s(new Error("Invalid process ID"));return}Kr(e,t,n=>{if(n&&!Hr(n)){s(n);return}o()})}),"killProcess");var Yr=Object.defineProperty,Qr=m((e,t)=>Yr(e,"name",{value:t,configurable:!0}),"n");const Wt=Qr(e=>{const t=f.join(e,"package.json");if(!E.isAccessibleSync(t))throw new Error("package.json not found at "+t);return{packageJson:yo.parsePackageJson(t),packageJsonPath:t}},"loadPackageJson");var Xr=Object.defineProperty,Zr=m((e,t)=>Xr(e,"name",{value:t,configurable:!0}),"r$2");const st=Zr((e,t)=>{if(e.warnings.size>0&&(t&&e.logger.raw(`
91
+ └─ ${f.relative(process.cwd(),p)}`);if(e.logger.info(a),tt({context:e,doOnSuccessCleanup:n,fileCache:t,mode:"bundle",runBuilder:o,runOnsuccess:s,useCache:i,watcher:l}),e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer)e.logger.info({message:"Using isolated declaration transformer to generate declaration files...",prefix:"dts"});else if(e.options.declaration){const p=await Tt(e,t);i&&(p.cache=t.get("dts-"+ye)),await e.hooks.callHook("rollup:dts:options",e,p);const d=ne.watch(p);await e.hooks.callHook("rollup:watch",e,d),tt({context:e,fileCache:t,mode:"types",useCache:i,watcher:d})}},"watch");var Fr=Object.defineProperty,qt=m((e,t)=>Fr(e,"name",{value:t,configurable:!0}),"s$4");const Tr=qt(e=>{try{JSON.parse(e)}catch{return!1}return!0},"isJson");let Ar=class{static{m(this,"g")}static{qt(this,"FileCache")}#s;#e;#n;#t=!0;#o=new Map;constructor(t,o,s,n){this.#s=t,this.#n=s,o===void 0?n.debug({message:"Could not create cache directory.",prefix:"file-cache"}):(this.#e=o,n.debug({message:"Cache path is: "+this.#e,prefix:"file-cache"}))}set isEnabled(t){this.#t=t}has(t,o){return!this.#t||this.#e===void 0?!1:E.isAccessibleSync(this.getFilePath(t,o))}get(t,o){if(!this.#t||this.#e===void 0)return;const s=this.getFilePath(t,o);if(this.#o.has(s))return this.#o.get(s);if(!E.isAccessibleSync(s))return;const n=E.readFileSync(s);if(Tr(n)){const r=JSON.parse(n);return this.#o.set(s,r),r}return this.#o.set(s,n),n}set(t,o,s){if(!this.#t||this.#e===void 0||o===void 0)return;const n=this.getFilePath(t,s);typeof o=="object"&&(o=JSON.stringify(o)),E.writeFileSync(n,o,{overwrite:!0})}getFilePath(t,o){let s=t.replaceAll(f.toNamespacedPath(this.#s),"");return s=s.replaceAll(":","-"),f.join(this.#e,this.#n,o?.replaceAll(":","-")??"",f.toNamespacedPath(s))}};var Rr=Object.defineProperty,Jr=m((e,t)=>Rr(e,"name",{value:t,configurable:!0}),"t$1");const qr=Jr(async(e,t="")=>{let o=t;if(!o){const s=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const n of s)if(await E.isAccessible(f.join(e,n))){o="./"+n;break}}if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(o))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return o},"findPackemFile");var Br=Object.defineProperty,pe=m((e,t)=>Br(e,"name",{value:t,configurable:!0}),"l$4");const Wr=H.createFilter,Lr=pe((e,t)=>{const{sideEffects:o}=t;let s;if(typeof o=="boolean")s=pe(()=>o,"hasSideEffects");else if(Array.isArray(o))if(o.length<=0)s=pe(()=>!1,"hasSideEffects");else{const n=o.map(r=>r.includes("/")?r:`**/${r}`);s=Wr(n,null,{resolve:e})}else s=pe(()=>null,"hasSideEffects");return s},"getPackageSideEffect");var Pe,ot;function zr(){if(ot)return Pe;ot=1;var e=Do,t=e.spawn,o=e.exec;Pe=m(function(i,l,c){if(typeof l=="function"&&c===void 0&&(c=l,l=void 0),i=parseInt(i),Number.isNaN(i)){if(c)return c(new Error("pid must be a number"));throw new Error("pid must be a number")}var a={},p={};switch(a[i]=[],p[i]=1,process.platform){case"win32":o("taskkill /pid "+i+" /T /F",c);break;case"darwin":r(i,a,p,function(d){return t("pgrep",["-P",d])},function(){s(a,l,c)});break;default:r(i,a,p,function(d){return t("ps",["-o","pid","--no-headers","--ppid",d])},function(){s(a,l,c)});break}},"treeKill");function s(i,l,c){var a={};try{Object.keys(i).forEach(function(p){i[p].forEach(function(d){a[d]||(n(d,l),a[d]=1)}),a[p]||(n(p,l),a[p]=1)})}catch(p){if(c)return c(p);throw p}if(c)return c()}m(s,"killAll");function n(i,l){try{process.kill(parseInt(i,10),l)}catch(c){if(c.code!=="ESRCH")throw c}}m(n,"killPid");function r(i,l,c,a,p){var d=a(i),u="";d.stdout.on("data",function(h){var h=h.toString("ascii");u+=h});var g=m(function(y){if(delete c[i],y!=0){Object.keys(c).length==0&&p();return}u.match(/\d+/g).forEach(function(h){h=parseInt(h,10),l[i].push(h),l[h]=[],c[h]=1,r(h,l,c,a,p)})},"onClose");d.on("close",g)}return m(r,"buildProcessTree"),Pe}m(zr,"requireTreeKill");var Ur=zr();const Kr=ct.g(Ur);var Vr=Object.defineProperty,Bt=m((e,t)=>Vr(e,"name",{value:t,configurable:!0}),"l$3");const Hr=Bt(e=>process.platform==="win32"&&"cmd"in e&&"code"in e&&typeof e.cmd=="string"&&e.cmd.startsWith("taskkill")&&e.code===128,"isTaskKillCmdProcessNotFoundError"),Gr=Bt(async({pid:e,signal:t})=>await new Promise((o,s)=>{if(!Number.isInteger(e)||e<=0){s(new Error("Invalid process ID"));return}Kr(e,t,n=>{if(n&&!Hr(n)){s(n);return}o()})}),"killProcess");var Yr=Object.defineProperty,Qr=m((e,t)=>Yr(e,"name",{value:t,configurable:!0}),"n");const Wt=Qr(e=>{const t=f.join(e,"package.json");if(!E.isAccessibleSync(t))throw new Error("package.json not found at "+t);return{packageJson:yo.parsePackageJson(t),packageJsonPath:t}},"loadPackageJson");var Xr=Object.defineProperty,Zr=m((e,t)=>Xr(e,"name",{value:t,configurable:!0}),"r$2");const st=Zr((e,t)=>{if(e.warnings.size>0&&(t&&e.logger.raw(`
92
92
  `),e.logger.warn(`Build is done with some warnings:
93
93
 
94
94
  ${[...e.warnings].map(o=>`- ${o}`).join(`
package/dist/packem.mjs CHANGED
@@ -90,11 +90,11 @@ ${e.replaceAll(/^\n|\n$/g,"")}
90
90
  `,"normalizeCodeFrame"),co=Ge(e=>{const t=$i(e);let o=(e.plugin?`[${e.plugin}] `:"")+e.message;e.id&&(o+=`
91
91
  file: ${D(e.id+(e.loc?":"+e.loc.line+":"+e.loc.column:""))}`),e.frame&&(o+=`
92
92
  `+ko(ji(e.frame))),e.message=o,t!==void 0&&(e.stack=`${e.message}
93
- ${t}`)},"enhanceRollupError");var xi=Object.defineProperty,po=m((e,t)=>xi(e,"name",{value:t,configurable:!0}),"d$3");const ke="rollup-watch.json",ht=po(({context:e,doOnSuccessCleanup:t,fileCache:o,mode:s,runBuilder:n,runOnsuccess:r,watcher:i,useCache:l})=>{const c="watcher:"+s;i.on("change",async(a,{event:p})=>{await t?.(),e.logger.info({message:`${D(T(".",a))} was ${p}d`,prefix:c})}),i.on("restart",()=>{e.logger.info({message:"Rebuilding ...",prefix:c})}),i.on("event",async a=>{switch(a.code){case"END":{e.logger.success({message:"Rebuild finished",prefix:c}),await r?.();break}case"BUNDLE_START":{e.logger.info({message:D("build started..."),prefix:c});break}case"BUNDLE_END":{await a.result.close(),l&&o.set(s==="bundle"?ke:"dts-"+ke,a.result.cache),e.logger.raw(`
93
+ ${t}`)},"enhanceRollupError");var xi=Object.defineProperty,po=m((e,t)=>xi(e,"name",{value:t,configurable:!0}),"d$3");const ke="rollup-watch.json",ht=po(({context:e,doOnSuccessCleanup:t,fileCache:o,mode:s,runBuilder:n,runOnsuccess:r,useCache:i,watcher:l})=>{const c="watcher:"+s;l.on("change",async(a,{event:p})=>{await t?.(),e.logger.info({message:`${D(T(".",a))} was ${p}d`,prefix:c})}),l.on("restart",()=>{e.logger.info({message:"Rebuilding ...",prefix:c})}),l.on("event",async a=>{switch(a.code){case"END":{e.logger.success({message:"Rebuild finished",prefix:c}),await r?.();break}case"BUNDLE_START":{e.logger.info({message:D("build started..."),prefix:c});break}case"BUNDLE_END":{await a.result.close(),i&&o.set(s==="bundle"?ke:"dts-"+ke,a.result.cache),e.logger.raw(`
94
94
  ⚡️ Build run in `+a.duration+`ms
95
95
 
96
96
  `),await n?.(!0);break}case"ERROR":{co(a.error),e.logger.error({context:[a.error],message:"Rebuild failed: "+a.error.message,prefix:c});break}}})},"watchHandler"),ki=po(async(e,t,o,s,n)=>{const r=await io(e,t);if(await e.hooks.callHook("rollup:options",e,r),Object.keys(r.input).length===0)return;let i=!0;(e.options.rollup.isolatedDeclarations||e.options.isolatedDeclarationTransformer||e.options.rollup.css)&&(i=!1),i&&(r.cache=t.get(ke)),e.options.rollup.watch&&typeof r.watch=="object"&&r.watch.include===void 0&&(r.watch={...r.watch,...e.options.rollup.watch},r.watch.include=[j(e.options.sourceDir,"**","*"),"package.json","packem.config.*"],Array.isArray(e.options.rollup.watch.include)?r.watch.include=[...r.watch.include,...e.options.rollup.watch.include]:e.options.rollup.watch.include&&r.watch.include.push(e.options.rollup.watch.include),r.watch.chokidar={cwd:e.options.rootDir,...r.watch.chokidar,ignored:["**/.git/**","**/node_modules/**","**/test-results/**",...r.watch.chokidar?.ignored??[]]});const l=Ye(r);await e.hooks.callHook("rollup:watch",e,l);const c=[...Array.isArray(r.input)?r.input:typeof r.input=="string"?[r.input]:Object.keys(r.input??{})];let a="Starting watcher for entries:";for(const p of c)a+=G(`
97
- └─ ${T(process.cwd(),p)}`);if(e.logger.info(a),ht({context:e,doOnSuccessCleanup:n,fileCache:t,mode:"bundle",runBuilder:o,runOnsuccess:s,watcher:l,useCache:i}),e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer)e.logger.info({message:"Using isolated declaration transformer to generate declaration files...",prefix:"dts"});else if(e.options.declaration){const p=await ao(e,t);i&&(p.cache=t.get("dts-"+ke)),await e.hooks.callHook("rollup:dts:options",e,p);const d=Ye(p);await e.hooks.callHook("rollup:watch",e,d),ht({context:e,fileCache:t,mode:"types",watcher:d,useCache:i})}},"watch");var Ei=Object.defineProperty,uo=m((e,t)=>Ei(e,"name",{value:t,configurable:!0}),"s$4");const Si=uo(e=>{try{JSON.parse(e)}catch{return!1}return!0},"isJson");let Oi=class{static{m(this,"g")}static{uo(this,"FileCache")}#s;#e;#n;#t=!0;#o=new Map;constructor(t,o,s,n){this.#s=t,this.#n=s,o===void 0?n.debug({message:"Could not create cache directory.",prefix:"file-cache"}):(this.#e=o,n.debug({message:"Cache path is: "+this.#e,prefix:"file-cache"}))}set isEnabled(t){this.#t=t}has(t,o){return!this.#t||this.#e===void 0?!1:z(this.getFilePath(t,o))}get(t,o){if(!this.#t||this.#e===void 0)return;const s=this.getFilePath(t,o);if(this.#o.has(s))return this.#o.get(s);if(!z(s))return;const n=We(s);if(Si(n)){const r=JSON.parse(n);return this.#o.set(s,r),r}return this.#o.set(s,n),n}set(t,o,s){if(!this.#t||this.#e===void 0||o===void 0)return;const n=this.getFilePath(t,s);typeof o=="object"&&(o=JSON.stringify(o)),ne(n,o,{overwrite:!0})}getFilePath(t,o){let s=t.replaceAll(be(this.#s),"");return s=s.replaceAll(":","-"),j(this.#e,this.#n,o?.replaceAll(":","-")??"",be(s))}};var Di=Object.defineProperty,Ni=m((e,t)=>Di(e,"name",{value:t,configurable:!0}),"t$1");const Pi=Ni(async(e,t="")=>{let o=t;if(!o){const s=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const n of s)if(await Le(j(e,n))){o="./"+n;break}}if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(o))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return o},"findPackemFile");var Ci=Object.defineProperty,ye=m((e,t)=>Ci(e,"name",{value:t,configurable:!0}),"l$4");const _i=Z,Mi=ye((e,t)=>{const{sideEffects:o}=t;let s;if(typeof o=="boolean")s=ye(()=>o,"hasSideEffects");else if(Array.isArray(o))if(o.length<=0)s=ye(()=>!1,"hasSideEffects");else{const n=o.map(r=>r.includes("/")?r:`**/${r}`);s=_i(n,null,{resolve:e})}else s=ye(()=>null,"hasSideEffects");return s},"getPackageSideEffect");var Fe,yt;function Ii(){if(yt)return Fe;yt=1;var e=ms,t=e.spawn,o=e.exec;Fe=m(function(i,l,c){if(typeof l=="function"&&c===void 0&&(c=l,l=void 0),i=parseInt(i),Number.isNaN(i)){if(c)return c(new Error("pid must be a number"));throw new Error("pid must be a number")}var a={},p={};switch(a[i]=[],p[i]=1,process.platform){case"win32":o("taskkill /pid "+i+" /T /F",c);break;case"darwin":r(i,a,p,function(d){return t("pgrep",["-P",d])},function(){s(a,l,c)});break;default:r(i,a,p,function(d){return t("ps",["-o","pid","--no-headers","--ppid",d])},function(){s(a,l,c)});break}},"treeKill");function s(i,l,c){var a={};try{Object.keys(i).forEach(function(p){i[p].forEach(function(d){a[d]||(n(d,l),a[d]=1)}),a[p]||(n(p,l),a[p]=1)})}catch(p){if(c)return c(p);throw p}if(c)return c()}m(s,"killAll");function n(i,l){try{process.kill(parseInt(i,10),l)}catch(c){if(c.code!=="ESRCH")throw c}}m(n,"killPid");function r(i,l,c,a,p){var d=a(i),u="";d.stdout.on("data",function(g){var g=g.toString("ascii");u+=g});var f=m(function(h){if(delete c[i],h!=0){Object.keys(c).length==0&&p();return}u.match(/\d+/g).forEach(function(g){g=parseInt(g,10),l[i].push(g),l[g]=[],c[g]=1,r(g,l,c,a,p)})},"onClose");d.on("close",f)}return m(r,"buildProcessTree"),Fe}m(Ii,"requireTreeKill");var Ti=Ii();const Fi=es(Ti);var Ai=Object.defineProperty,fo=m((e,t)=>Ai(e,"name",{value:t,configurable:!0}),"l$3");const Ri=fo(e=>process.platform==="win32"&&"cmd"in e&&"code"in e&&typeof e.cmd=="string"&&e.cmd.startsWith("taskkill")&&e.code===128,"isTaskKillCmdProcessNotFoundError"),Ji=fo(async({pid:e,signal:t})=>await new Promise((o,s)=>{if(!Number.isInteger(e)||e<=0){s(new Error("Invalid process ID"));return}Fi(e,t,n=>{if(n&&!Ri(n)){s(n);return}o()})}),"killProcess");var Bi=Object.defineProperty,Li=m((e,t)=>Bi(e,"name",{value:t,configurable:!0}),"n");const mo=Li(e=>{const t=j(e,"package.json");if(!z(t))throw new Error("package.json not found at "+t);return{packageJson:gs(t),packageJsonPath:t}},"loadPackageJson");var Wi=Object.defineProperty,Ui=m((e,t)=>Wi(e,"name",{value:t,configurable:!0}),"r$2");const bt=Ui((e,t)=>{if(e.warnings.size>0&&(t&&e.logger.raw(`
97
+ └─ ${T(process.cwd(),p)}`);if(e.logger.info(a),ht({context:e,doOnSuccessCleanup:n,fileCache:t,mode:"bundle",runBuilder:o,runOnsuccess:s,useCache:i,watcher:l}),e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer)e.logger.info({message:"Using isolated declaration transformer to generate declaration files...",prefix:"dts"});else if(e.options.declaration){const p=await ao(e,t);i&&(p.cache=t.get("dts-"+ke)),await e.hooks.callHook("rollup:dts:options",e,p);const d=Ye(p);await e.hooks.callHook("rollup:watch",e,d),ht({context:e,fileCache:t,mode:"types",useCache:i,watcher:d})}},"watch");var Ei=Object.defineProperty,uo=m((e,t)=>Ei(e,"name",{value:t,configurable:!0}),"s$4");const Si=uo(e=>{try{JSON.parse(e)}catch{return!1}return!0},"isJson");let Oi=class{static{m(this,"g")}static{uo(this,"FileCache")}#s;#e;#n;#t=!0;#o=new Map;constructor(t,o,s,n){this.#s=t,this.#n=s,o===void 0?n.debug({message:"Could not create cache directory.",prefix:"file-cache"}):(this.#e=o,n.debug({message:"Cache path is: "+this.#e,prefix:"file-cache"}))}set isEnabled(t){this.#t=t}has(t,o){return!this.#t||this.#e===void 0?!1:z(this.getFilePath(t,o))}get(t,o){if(!this.#t||this.#e===void 0)return;const s=this.getFilePath(t,o);if(this.#o.has(s))return this.#o.get(s);if(!z(s))return;const n=We(s);if(Si(n)){const r=JSON.parse(n);return this.#o.set(s,r),r}return this.#o.set(s,n),n}set(t,o,s){if(!this.#t||this.#e===void 0||o===void 0)return;const n=this.getFilePath(t,s);typeof o=="object"&&(o=JSON.stringify(o)),ne(n,o,{overwrite:!0})}getFilePath(t,o){let s=t.replaceAll(be(this.#s),"");return s=s.replaceAll(":","-"),j(this.#e,this.#n,o?.replaceAll(":","-")??"",be(s))}};var Di=Object.defineProperty,Ni=m((e,t)=>Di(e,"name",{value:t,configurable:!0}),"t$1");const Pi=Ni(async(e,t="")=>{let o=t;if(!o){const s=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const n of s)if(await Le(j(e,n))){o="./"+n;break}}if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(o))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return o},"findPackemFile");var Ci=Object.defineProperty,ye=m((e,t)=>Ci(e,"name",{value:t,configurable:!0}),"l$4");const _i=Z,Mi=ye((e,t)=>{const{sideEffects:o}=t;let s;if(typeof o=="boolean")s=ye(()=>o,"hasSideEffects");else if(Array.isArray(o))if(o.length<=0)s=ye(()=>!1,"hasSideEffects");else{const n=o.map(r=>r.includes("/")?r:`**/${r}`);s=_i(n,null,{resolve:e})}else s=ye(()=>null,"hasSideEffects");return s},"getPackageSideEffect");var Fe,yt;function Ii(){if(yt)return Fe;yt=1;var e=ms,t=e.spawn,o=e.exec;Fe=m(function(i,l,c){if(typeof l=="function"&&c===void 0&&(c=l,l=void 0),i=parseInt(i),Number.isNaN(i)){if(c)return c(new Error("pid must be a number"));throw new Error("pid must be a number")}var a={},p={};switch(a[i]=[],p[i]=1,process.platform){case"win32":o("taskkill /pid "+i+" /T /F",c);break;case"darwin":r(i,a,p,function(d){return t("pgrep",["-P",d])},function(){s(a,l,c)});break;default:r(i,a,p,function(d){return t("ps",["-o","pid","--no-headers","--ppid",d])},function(){s(a,l,c)});break}},"treeKill");function s(i,l,c){var a={};try{Object.keys(i).forEach(function(p){i[p].forEach(function(d){a[d]||(n(d,l),a[d]=1)}),a[p]||(n(p,l),a[p]=1)})}catch(p){if(c)return c(p);throw p}if(c)return c()}m(s,"killAll");function n(i,l){try{process.kill(parseInt(i,10),l)}catch(c){if(c.code!=="ESRCH")throw c}}m(n,"killPid");function r(i,l,c,a,p){var d=a(i),u="";d.stdout.on("data",function(g){var g=g.toString("ascii");u+=g});var f=m(function(h){if(delete c[i],h!=0){Object.keys(c).length==0&&p();return}u.match(/\d+/g).forEach(function(g){g=parseInt(g,10),l[i].push(g),l[g]=[],c[g]=1,r(g,l,c,a,p)})},"onClose");d.on("close",f)}return m(r,"buildProcessTree"),Fe}m(Ii,"requireTreeKill");var Ti=Ii();const Fi=es(Ti);var Ai=Object.defineProperty,fo=m((e,t)=>Ai(e,"name",{value:t,configurable:!0}),"l$3");const Ri=fo(e=>process.platform==="win32"&&"cmd"in e&&"code"in e&&typeof e.cmd=="string"&&e.cmd.startsWith("taskkill")&&e.code===128,"isTaskKillCmdProcessNotFoundError"),Ji=fo(async({pid:e,signal:t})=>await new Promise((o,s)=>{if(!Number.isInteger(e)||e<=0){s(new Error("Invalid process ID"));return}Fi(e,t,n=>{if(n&&!Ri(n)){s(n);return}o()})}),"killProcess");var Bi=Object.defineProperty,Li=m((e,t)=>Bi(e,"name",{value:t,configurable:!0}),"n");const mo=Li(e=>{const t=j(e,"package.json");if(!z(t))throw new Error("package.json not found at "+t);return{packageJson:gs(t),packageJsonPath:t}},"loadPackageJson");var Wi=Object.defineProperty,Ui=m((e,t)=>Wi(e,"name",{value:t,configurable:!0}),"r$2");const bt=Ui((e,t)=>{if(e.warnings.size>0&&(t&&e.logger.raw(`
98
98
  `),e.logger.warn(`Build is done with some warnings:
99
99
 
100
100
  ${[...e.warnings].map(o=>`- ${o}`).join(`
@@ -1,3 +1,3 @@
1
- "use strict";const t=require("lightningcss"),e=require("../../../../packem_shared/ensure-auto-modules-DBW-5Idh.cjs"),a={name:"lightningCSS",async process({code:i,map:n}){let o=!1;typeof this.options.modules=="boolean"?o=this.options.modules:typeof this.options.modules=="object"&&(o=e.n(this.options.modules.include,this.id)),this.autoModules&&this.options.modules===void 0&&(o=e.n(this.autoModules,this.id));const s=t.transform({...this.options,code:Buffer.from(i),cssModules:this.options.modules??o,filename:this.id,inputSourceMap:n,minify:!1,sourceMap:!this.sourceMap,targets:t.browserslistToTargets(this.browserTargets)});return s.warnings.length>0&&this.warn(`warnings when transforming css:
2
- `+s.warnings.map(r=>r.message).join(`
3
- `)),{code:s.code.toString(),map:s.map?JSON.parse(Buffer.from(s.map).toString()):void 0}},test:/\.css$/i};module.exports=a;
1
+ "use strict";const t=require("lightningcss"),o=require("../../../../packem_shared/ensure-auto-modules-DBW-5Idh.cjs"),a={name:"lightningCSS",async process({code:i,map:n}){let s=!1;typeof this.options.modules=="boolean"?s=this.options.modules:typeof this.options.modules=="object"&&(s=o.n(this.options.modules.include,this.id)),this.autoModules&&this.options.modules===void 0&&(s=o.n(this.autoModules,this.id));const e=t.transform({...this.options,code:Buffer.from(i),cssModules:this.options.modules??s,filename:this.id,inputSourceMap:n,minify:!1,sourceMap:!this.sourceMap,targets:t.browserslistToTargets(this.browserTargets)});return e.warnings.length>0&&this.warn(`warnings when transforming css:
2
+ `+e.warnings.map(r=>r.message).join(`
3
+ `)),{code:e.code.toString(),map:e.map?JSON.parse(Buffer.from(e.map).toString()):void 0,moduleSideEffects:s||typeof this.inject=="object"&&this.inject.treeshakeable?!1:"no-treeshake"}},test:/\.css$/i};module.exports=a;
@@ -1,3 +1,3 @@
1
- import{transform as r,browserslistToTargets as a}from"lightningcss";import{n as t}from"../../../../packem_shared/ensure-auto-modules-9cmxx7iZ.mjs";const d={name:"lightningCSS",async process({code:i,map:e}){let o=!1;typeof this.options.modules=="boolean"?o=this.options.modules:typeof this.options.modules=="object"&&(o=t(this.options.modules.include,this.id)),this.autoModules&&this.options.modules===void 0&&(o=t(this.autoModules,this.id));const s=r({...this.options,code:Buffer.from(i),cssModules:this.options.modules??o,filename:this.id,inputSourceMap:e,minify:!1,sourceMap:!this.sourceMap,targets:a(this.browserTargets)});return s.warnings.length>0&&this.warn(`warnings when transforming css:
2
- `+s.warnings.map(n=>n.message).join(`
3
- `)),{code:s.code.toString(),map:s.map?JSON.parse(Buffer.from(s.map).toString()):void 0}},test:/\.css$/i};export{d as default};
1
+ import{transform as r,browserslistToTargets as a}from"lightningcss";import{n as t}from"../../../../packem_shared/ensure-auto-modules-9cmxx7iZ.mjs";const d={name:"lightningCSS",async process({code:e,map:i}){let s=!1;typeof this.options.modules=="boolean"?s=this.options.modules:typeof this.options.modules=="object"&&(s=t(this.options.modules.include,this.id)),this.autoModules&&this.options.modules===void 0&&(s=t(this.autoModules,this.id));const o=r({...this.options,code:Buffer.from(e),cssModules:this.options.modules??s,filename:this.id,inputSourceMap:i,minify:!1,sourceMap:!this.sourceMap,targets:a(this.browserTargets)});return o.warnings.length>0&&this.warn(`warnings when transforming css:
2
+ `+o.warnings.map(n=>n.message).join(`
3
+ `)),{code:o.code.toString(),map:o.map?JSON.parse(Buffer.from(o.map).toString()):void 0,moduleSideEffects:s||typeof this.inject=="object"&&this.inject.treeshakeable?!1:"no-treeshake"}},test:/\.css$/i};export{d as default};
@@ -1,19 +1,19 @@
1
- "use strict";var $e=Object.defineProperty;var d=(e,t)=>$e(e,"name",{value:t,configurable:!0});const be=require("node:url"),we=require("@csstools/postcss-slow-plugins"),X=require("@rollup/pluginutils"),h=require("@visulima/path"),Se=require("postcss"),D=require("../../../../../packem_shared/resolve-CisvRjnr.cjs"),I=require("../../../../../packem_shared/get-hash-n81THiHZ.cjs"),j=require("../../../../../packem_shared/sourcemap-CXAd1Jcz.cjs"),Z=require("../../../../../packem_shared/ensure-auto-modules-DBW-5Idh.cjs"),K=require("@visulima/package"),je=require("postcss-load-config"),F=require("icss-utils"),V=require("@visulima/fs"),Oe=require("@visulima/path/utils"),v=require("@csstools/css-parser-algorithms"),x=require("@csstools/css-tokenizer"),xe=require("postcss-modules-extract-imports"),Pe=require("postcss-modules-local-by-default"),ke=require("postcss-modules-scope"),Ne=require("postcss-modules-values"),Re=require("postcss-value-parser"),Ie=require("mime-types");var W=typeof document<"u"?document.currentScript:null;const P=d(e=>e&&typeof e=="object"&&"default"in e?e.default:e,"_interopDefaultCompat"),Ce=P(we),Ue=P(Se),_e=P(je),Ee=P(xe),Le=P(Pe),De=P(ke),qe=P(Ne),z=P(Re);var Te=Object.defineProperty,Fe=d((e,t)=>Te(e,"name",{value:t,configurable:!0}),"e$3");const We=Fe((e,...t)=>{const s=I.f([e,"0iOXBLSx",...t].join(":")).slice(0,8);return X.makeLegalIdentifier(`${e}_${s}`)},"default");var Me=Object.defineProperty,Ae=d((e,t)=>Me(e,"name",{value:t,configurable:!0}),"p$4");let M;const Be=Ae(async(e,t,s,o)=>{if(!o)return{file:"",options:{},plugins:[]};const{dir:r}=h.parse(e),n=o.path?h.resolve(o.path):r;let i;try{i=(await K.findMonorepoRoot(t)).path}catch{try{i=await K.findPackageRoot(t)}catch{}}try{let p;M?p=M:(p=await _e({cwd:t,env:s,...o.ctx},n,{stopDir:i}),M=p);const l={file:p.file,options:p.options,plugins:await I.d(p.plugins,t)};return l.options.parser&&(l.options.parser=await I.e(l.options.parser,"parser",t)),l.options.syntax&&(l.options.syntax=await I.e(l.options.syntax,"syntax",t)),l.options.stringifier&&(l.options.stringifier=await I.e(l.options.stringifier,"stringifier",t)),l}catch(p){if(p.message.includes("No PostCSS Config found in"))return{file:"",options:{},plugins:[]};throw p}},"loadConfig");var ze=Object.defineProperty,Je=d((e,t)=>ze(e,"name",{value:t,configurable:!0}),"i$5");const Ge=Je(async(e,t,s,o,r)=>{const n=D.r([e,`./${e}`],{baseDirs:[h.dirname(t)],caller:"ICSS loader",extensions:s}),i=await V.readFile(n),{messages:p}=await o.process(i,{...r,from:n}),l={};for(const c of p)c.type==="icss"&&Object.assign(l,c.export);return l},"load");var He=Object.defineProperty,Xe=d((e,t)=>He(e,"name",{value:t,configurable:!0}),"t$3");const Ve=Xe(async(e,t,s,o,r,n)=>{const i={};for await(const[p,l]of Object.entries(e)){const c=await t(p,s,o,r,n);for(const[a,f]of Object.entries(l))i[a]=c[f]}return i},"resolve");var Qe=Object.defineProperty,Ye=d((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"c$4");const A="styles-icss",Ze=[".css",".pcss",".postcss",".sss"],re=Ye(e=>{const t=e?.load??Ge,s=e?.extensions??Ze;return{async OnceExit(o,{result:r}){if(!o.source?.input.file)return;const n={...r.opts,map:void 0},{icssExports:i,icssImports:p}=F.extractICSS(o),l=await Ve(p,t,o.source.input.file,s,r.processor,n);F.replaceSymbols(o,l);for(const[c,a]of Object.entries(i))r.messages.push({export:{[c]:F.replaceValueSymbols(a,l)},plugin:A,type:"icss"});for(const c of Object.keys(p))r.messages.push({import:c,plugin:A,type:"icss-dependency"})},postcssPlugin:A}},"plugin");re.postcss=!0;var Ke=Object.defineProperty,et=d((e,t)=>Ke(e,"name",{value:t,configurable:!0}),"t$2");const J=et((e,t,s,o)=>{const r=[];if(e!==void 0){let n="layer";e&&(n="layer("+e+")"),r.push(n)}return s!==void 0&&r.push("supports("+s+")"),o!==void 0&&r.push("scope("+o+")"),t!==void 0&&r.push(t),r.join(" ")},"formatImportPrelude");var tt=Object.defineProperty,st=d((e,t)=>tt(e,"name",{value:t,configurable:!0}),"p$3");const rt=st((e,t)=>{t.reverse();const s=t.pop();if(!s)return e;let o=`${e} ${J(s.layer,s.media,s.supports,s.scope)}`;for(const r of t)o=`'data:text/css;base64,${Buffer.from(`@import ${o}`).toString("base64")}' ${J(r.layer,r.media,r.supports,r.scope)}`;return o},"base64EncodedConditionalImport");var nt=Object.defineProperty,q=d((e,t)=>nt(e,"name",{value:t,configurable:!0}),"e$2");const ot=q(e=>e.type==="warning","isWarning"),G=q(e=>e.type==="nodes","isNodesStatement"),L=q(e=>e.type==="import","isImportStatement"),it=q(e=>e.type==="pre-import","isPreImportStatement");var at=Object.defineProperty,ct=d((e,t)=>at(e,"name",{value:t,configurable:!0}),"u$1");const pt=ct((e,t)=>{e.statements.forEach((s,o)=>{if(ot(s)||it(s)||s.conditions.length===0)return;if(L(s)){s.node.params=rt(s.fullUri,s.conditions);return}const{nodes:r}=s;if(r.length===0)return;const{parent:n}=r[0];if(!n)return;const i=[];for(const c of s.conditions){if(c.media!==void 0){const a=t({name:"media",params:c.media,source:s.importingNode?.source??n.source});i.push(a)}if(c.scope!==void 0){const a=t({name:"scope",params:c.scope,source:s.importingNode?.source??n.source});i.push(a)}if(c.supports!==void 0){const a=t({name:"supports",params:"("+c.supports+")",source:s.importingNode?.source??n.source});i.push(a)}if(c.layer!==void 0){const a=t({name:"layer",params:c.layer,source:s.importingNode?.source??n.source});i.push(a)}}const p=i[0];if(!p)return;for(let c=0;c<i.length-1;c++)i[c].append(i[c+1]);const l=i.at(-1);n.insertBefore(r[0],p),r.forEach(c=>{c.parent=void 0}),l.append(r),e.statements[o]={conditions:s.conditions,from:s.from,importingNode:s.importingNode,nodes:[p],type:"nodes"}})},"applyConditions");var lt=Object.defineProperty,ut=d((e,t)=>lt(e,"name",{value:t,configurable:!0}),"r$3");const ft=ut(e=>{e.statements.forEach((t,s)=>{if(s!==0)if(t.parent!==void 0){const{before:o}=t.parent.node.raws;G(t)?t.nodes[0].raws.before=o:t.node.raws.before=o}else G(t)&&(t.nodes[0].raws.before=t.nodes[0].raws.before??`
2
- `)})},"applyRaws");var dt=Object.defineProperty,mt=d((e,t)=>dt(e,"name",{value:t,configurable:!0}),"t$1");const ht=mt((e,t)=>{t.nodes=[],e.charset&&(e.charset.parent=void 0,t.append(e.charset)),e.statements.forEach(s=>{L(s)?(s.node.parent=void 0,t.append(s.node)):G(s)&&s.nodes.forEach(o=>{o.parent=void 0,t.append(o)})})},"applyStyles");var gt=Object.defineProperty,yt=d((e,t)=>gt(e,"name",{value:t,configurable:!0}),"o$2");const vt=yt((e,t,s)=>{const o={baseDirs:[t],caller:"@import resolver",extensions:s},r=new URL(e,"file://").pathname,n=[r];return(Oe.isRelative(r)||r.startsWith("/"))&&n.push("."+r),r.startsWith("/")&&n.push(r.slice(1)),D.r(n,o)},"importResolve");var $t=Object.defineProperty,ne=d((e,t)=>$t(e,"name",{value:t,configurable:!0}),"e$1");const bt=/^data:text\/css(?:;(?:base64|plain))?,/i,wt=/^data:text\/css;base64,/i,St=/^data:text\/css;plain,/i,H=ne(e=>e!==void 0&&bt.test(e),"isValidDataURL"),jt=ne(e=>wt.test(e)?Buffer.from(e.slice(21),"base64").toString():St.test(e)?decodeURIComponent(e.slice(20)):decodeURIComponent(e.slice(14)),"dataURLContents");var Ot=Object.defineProperty,xt=d((e,t)=>Ot(e,"name",{value:t,configurable:!0}),"o");const Pt="css-noop",Q=xt(()=>({postcssPlugin:Pt}),"noopPlugin");Q.postcss=!0;var kt=Object.defineProperty,oe=d((e,t)=>kt(e,"name",{value:t,configurable:!0}),"a$4");const ie=oe(async(e,t,s,o,r,n)=>(n===void 0&&(n=0),o.length===0&&o.push(Q()),await e(o).process(t,{from:s,parser:r[n]}).catch(async i=>{if(n++,n===r.length)throw i;return await ie(e,t,s,o,r,n)})),"runPostcss"),Nt=oe(async(e,t,s,o,r)=>{const{plugins:n}=o,i=[];return e.opts.syntax?.parse&&i.push(e.opts.syntax.parse),e.opts.parser&&i.push(e.opts.parser),i.push(void 0),await ie(r,t,s,n,i)},"processContent"),Rt=/^charset$/i,ae=/^import$/i,It=/^url$/i,E=/^layer$/i,Ct=/^supports$/i,Ut=/^scope$/i;var _t=Object.defineProperty,Y=d((e,t)=>_t(e,"name",{value:t,configurable:!0}),"a$3");const Et=Y(e=>{for(let t=0;t<e.length;t++){const s=e[t];if(!v.isWhiteSpaceOrCommentNode(s)&&v.isSimpleBlockNode(s)&&x.isTokenOpenParen(s.startToken))return e}return[new v.SimpleBlockNode([x.TokenType.OpenParen,"(",-1,-1,void 0],[x.TokenType.CloseParen,")",-1,-1,void 0],e)]},"wrapInParenthesisIfNeeded"),ee=Y(e=>{if(e.startsWith("#"))return"";if(!e.includes("#"))return e;try{const t=new URL(e,"http://example.com");return t.hash?e.slice(0,e.length-t.hash.length):e}catch{return e}},"stripHash"),Lt=Y(e=>{const t=x.tokenize({css:e});if(t.length===2&&(x.isTokenString(t[0])||x.isTokenURL(t[0]))){let c=t[0][4].value;return c=ee(c),c?{fullUri:t[0][1],uri:c}:!1}const s=v.parseListOfComponentValues(t);let o="",r="",n,i,p,l;for(let c=0;c<s.length;c++){const a=s[c];if(!v.isWhiteSpaceOrCommentNode(a)){if(v.isTokenNode(a)&&(x.isTokenString(a.value)||x.isTokenURL(a.value))){if(o)return!1;o=a.value[4].value,r=a.value[1];continue}if(v.isFunctionNode(a)&&It.test(a.getName())){if(o)return!1;for(let f=0;f<a.value.length;f++){const u=a.value[f];if(!v.isWhiteSpaceOrCommentNode(u)){if(!o&&v.isTokenNode(u)&&x.isTokenString(u.value)){o=u.value[4].value,r=v.stringify([[a]]);continue}return!1}}continue}if(!o)return!1;if(v.isTokenNode(a)&&x.isTokenIdent(a.value)&&E.test(a.value[4].value)){if(n!==void 0||p!==void 0)return!1;n="";continue}if(v.isFunctionNode(a)&&E.test(a.getName())){if(n!==void 0||p!==void 0)return!1;n=v.stringify([a.value]);continue}if(v.isFunctionNode(a)&&Ct.test(a.getName())){if(p!==void 0)return!1;p=v.stringify([a.value]);continue}if(v.isFunctionNode(a)&&Ut.test(a.getName())){if(l!==void 0)return!1;l=v.stringify([Et(a.value)]);continue}i=v.stringify([s.slice(c)]);break}}return o=ee(o),o?{fullUri:r,layer:n,media:i,scope:l,supports:p,uri:o}:!1},"parseAtImport");var Dt=Object.defineProperty,C=d((e,t)=>Dt(e,"name",{value:t,configurable:!0}),"d");const ce=C((e,t,s,o)=>{const r=[];let n=t;const i=e.length;for(n;n<i;n++){const p=e[n];if(r.push(p),e[n+1]?.type!=="comment")break}return[n,{conditions:[],from:o,importingNode:s,nodes:r,type:"nodes"}]},"consumeComments"),qt=C((e,t,s,o,r)=>{const n=Lt(t.params);if(!n)return e.warn(`Invalid @import statement in '${t.toString()}'`,{node:t});const i={conditions:[...o],from:r,fullUri:n.fullUri,importingNode:s,node:t,type:"import",uri:n.uri};return(n.layer!==void 0||n.media!==void 0||n.supports!==void 0||n.scope!==void 0)&&i.conditions.push({layer:n.layer,media:n.media,scope:n.scope,supports:n.supports}),i},"parseImport"),Tt=C((e,t,s,o,r,n)=>{const i=[];let p=o;const l=t.length;for(p;p<l;p++){const c=t[p];if(c.type==="comment"){const[a,f]=ce(t,p,r,n);i.push(f),p=a;continue}if(c.type==="atrule"&&ae.test(c.name)){i.push(qt(e,c,r,s,n));continue}break}return[p-1,i]},"consumeImports"),Ft=C((e,t,s,o,r)=>{const n=[];let i=s;const p=e.length;for(i;i<p;i++){const l=e[i];n.push(l);const c=e[i+1];if(!(c&&c.type==="atrule"&&E.test(c.name)&&!c.nodes))break}return[i,{conditions:[...t],from:r,importingNode:o,nodes:n,type:"nodes"}]},"consumeLayers"),Wt=C((e,t,s,o,r)=>{const n=[];let i=s;const p=e.length;for(i;i<p;i++){const l=e[i];if(l.type==="comment"){const[c,a]=ce(e,i,o,r);n.push(a),i=c;continue}if(l.type==="atrule"&&E.test(l.name)&&!l.nodes)if(t.length>0){n.push({conditions:[...t],from:r,importingNode:o,node:l,type:"pre-import"});continue}else{const[c,a]=Ft(e,t,i,o,r);n.push(a),i=c;continue}break}return[i-1,n]},"consumeBeforeImports"),pe=C((e,t,s,o,r)=>{const n={statements:[]};if(t.type==="document")return t.each(f=>{const u=pe(e,f,s,o,r);if(n.charset&&u.charset&&n.charset.params.toLowerCase()!==u.charset.params.toLowerCase())throw u.charset.error(`Incompatible @charset statements:
1
+ "use strict";var $e=Object.defineProperty;var d=(e,t)=>$e(e,"name",{value:t,configurable:!0});const be=require("node:url"),we=require("@csstools/postcss-slow-plugins"),X=require("@rollup/pluginutils"),h=require("@visulima/path"),je=require("postcss"),D=require("../../../../../packem_shared/resolve-CisvRjnr.cjs"),I=require("../../../../../packem_shared/get-hash-n81THiHZ.cjs"),S=require("../../../../../packem_shared/sourcemap-CXAd1Jcz.cjs"),Z=require("../../../../../packem_shared/ensure-auto-modules-DBW-5Idh.cjs"),F=require("icss-utils"),V=require("@visulima/fs"),Se=require("@visulima/path/utils"),v=require("@csstools/css-parser-algorithms"),x=require("@csstools/css-tokenizer"),K=require("@visulima/package"),Oe=require("postcss-load-config"),xe=require("postcss-modules-extract-imports"),Pe=require("postcss-modules-local-by-default"),ke=require("postcss-modules-scope"),Ne=require("postcss-modules-values"),Re=require("postcss-value-parser"),Ie=require("mime-types");var W=typeof document<"u"?document.currentScript:null;const P=d(e=>e&&typeof e=="object"&&"default"in e?e.default:e,"_interopDefaultCompat"),Ce=P(we),Ue=P(je),Ee=P(Oe),_e=P(xe),Le=P(Pe),De=P(ke),qe=P(Ne),z=P(Re);var Te=Object.defineProperty,Fe=d((e,t)=>Te(e,"name",{value:t,configurable:!0}),"e$3");const We=Fe((e,...t)=>{const s=I.f([e,"0iOXBLSx",...t].join(":")).slice(0,8);return X.makeLegalIdentifier(`${e}_${s}`)},"default");var Me=Object.defineProperty,Ae=d((e,t)=>Me(e,"name",{value:t,configurable:!0}),"i$5");const Be=Ae(async(e,t,s,o,n)=>{const r=D.r([e,`./${e}`],{baseDirs:[h.dirname(t)],caller:"ICSS loader",extensions:s}),i=await V.readFile(r),{messages:p}=await o.process(i,{...n,from:r}),l={};for(const c of p)c.type==="icss"&&Object.assign(l,c.export);return l},"load");var ze=Object.defineProperty,Je=d((e,t)=>ze(e,"name",{value:t,configurable:!0}),"t$3");const Ge=Je(async(e,t,s,o,n,r)=>{const i={};for await(const[p,l]of Object.entries(e)){const c=await t(p,s,o,n,r);for(const[a,f]of Object.entries(l))i[a]=c[f]}return i},"resolve");var He=Object.defineProperty,Xe=d((e,t)=>He(e,"name",{value:t,configurable:!0}),"c$4");const M="styles-icss",Ve=[".css",".pcss",".postcss",".sss"],re=Xe(e=>{const t=e?.load??Be,s=e?.extensions??Ve;return{async OnceExit(o,{result:n}){if(!o.source?.input.file)return;const r={...n.opts,map:void 0},{icssExports:i,icssImports:p}=F.extractICSS(o),l=await Ge(p,t,o.source.input.file,s,n.processor,r);F.replaceSymbols(o,l);for(const[c,a]of Object.entries(i))n.messages.push({export:{[c]:F.replaceValueSymbols(a,l)},plugin:M,type:"icss"});for(const c of Object.keys(p))n.messages.push({import:c,plugin:M,type:"icss-dependency"})},postcssPlugin:M}},"plugin");re.postcss=!0;var Qe=Object.defineProperty,Ye=d((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"t$2");const J=Ye((e,t,s,o)=>{const n=[];if(e!==void 0){let r="layer";e&&(r="layer("+e+")"),n.push(r)}return s!==void 0&&n.push("supports("+s+")"),o!==void 0&&n.push("scope("+o+")"),t!==void 0&&n.push(t),n.join(" ")},"formatImportPrelude");var Ze=Object.defineProperty,Ke=d((e,t)=>Ze(e,"name",{value:t,configurable:!0}),"p$4");const et=Ke((e,t)=>{t.reverse();const s=t.pop();if(!s)return e;let o=`${e} ${J(s.layer,s.media,s.supports,s.scope)}`;for(const n of t)o=`'data:text/css;base64,${Buffer.from(`@import ${o}`).toString("base64")}' ${J(n.layer,n.media,n.supports,n.scope)}`;return o},"base64EncodedConditionalImport");var tt=Object.defineProperty,q=d((e,t)=>tt(e,"name",{value:t,configurable:!0}),"e$2");const st=q(e=>e.type==="warning","isWarning"),G=q(e=>e.type==="nodes","isNodesStatement"),L=q(e=>e.type==="import","isImportStatement"),rt=q(e=>e.type==="pre-import","isPreImportStatement");var nt=Object.defineProperty,ot=d((e,t)=>nt(e,"name",{value:t,configurable:!0}),"u$1");const it=ot((e,t)=>{e.statements.forEach((s,o)=>{if(st(s)||rt(s)||s.conditions.length===0)return;if(L(s)){s.node.params=et(s.fullUri,s.conditions);return}const{nodes:n}=s;if(n.length===0)return;const{parent:r}=n[0];if(!r)return;const i=[];for(const c of s.conditions){if(c.media!==void 0){const a=t({name:"media",params:c.media,source:s.importingNode?.source??r.source});i.push(a)}if(c.scope!==void 0){const a=t({name:"scope",params:c.scope,source:s.importingNode?.source??r.source});i.push(a)}if(c.supports!==void 0){const a=t({name:"supports",params:"("+c.supports+")",source:s.importingNode?.source??r.source});i.push(a)}if(c.layer!==void 0){const a=t({name:"layer",params:c.layer,source:s.importingNode?.source??r.source});i.push(a)}}const p=i[0];if(!p)return;for(let c=0;c<i.length-1;c++)i[c].append(i[c+1]);const l=i.at(-1);r.insertBefore(n[0],p),n.forEach(c=>{c.parent=void 0}),l.append(n),e.statements[o]={conditions:s.conditions,from:s.from,importingNode:s.importingNode,nodes:[p],type:"nodes"}})},"applyConditions");var at=Object.defineProperty,ct=d((e,t)=>at(e,"name",{value:t,configurable:!0}),"r$3");const pt=ct(e=>{e.statements.forEach((t,s)=>{if(s!==0)if(t.parent!==void 0){const{before:o}=t.parent.node.raws;G(t)?t.nodes[0].raws.before=o:t.node.raws.before=o}else G(t)&&(t.nodes[0].raws.before=t.nodes[0].raws.before??`
2
+ `)})},"applyRaws");var lt=Object.defineProperty,ut=d((e,t)=>lt(e,"name",{value:t,configurable:!0}),"t$1");const ft=ut((e,t)=>{t.nodes=[],e.charset&&(e.charset.parent=void 0,t.append(e.charset)),e.statements.forEach(s=>{L(s)?(s.node.parent=void 0,t.append(s.node)):G(s)&&s.nodes.forEach(o=>{o.parent=void 0,t.append(o)})})},"applyStyles");var dt=Object.defineProperty,mt=d((e,t)=>dt(e,"name",{value:t,configurable:!0}),"o$2");const ht=mt((e,t,s)=>{const o={baseDirs:[t],caller:"@import resolver",extensions:s},n=new URL(e,"file://").pathname,r=[n];return(Se.isRelative(n)||n.startsWith("/"))&&r.push("."+n),n.startsWith("/")&&r.push(n.slice(1)),D.r(r,o)},"importResolve");var gt=Object.defineProperty,ne=d((e,t)=>gt(e,"name",{value:t,configurable:!0}),"e$1");const yt=/^data:text\/css(?:;(?:base64|plain))?,/i,vt=/^data:text\/css;base64,/i,$t=/^data:text\/css;plain,/i,H=ne(e=>e!==void 0&&yt.test(e),"isValidDataURL"),bt=ne(e=>vt.test(e)?Buffer.from(e.slice(21),"base64").toString():$t.test(e)?decodeURIComponent(e.slice(20)):decodeURIComponent(e.slice(14)),"dataURLContents");var wt=Object.defineProperty,jt=d((e,t)=>wt(e,"name",{value:t,configurable:!0}),"o");const St="css-noop",Q=jt(()=>({postcssPlugin:St}),"noopPlugin");Q.postcss=!0;var Ot=Object.defineProperty,oe=d((e,t)=>Ot(e,"name",{value:t,configurable:!0}),"a$4");const ie=oe(async(e,t,s,o,n,r)=>(r===void 0&&(r=0),o.length===0&&o.push(Q()),await e(o).process(t,{from:s,parser:n[r]}).catch(async i=>{if(r++,r===n.length)throw i;return await ie(e,t,s,o,n,r)})),"runPostcss"),xt=oe(async(e,t,s,o,n)=>{const{plugins:r}=o,i=[];return e.opts.syntax?.parse&&i.push(e.opts.syntax.parse),e.opts.parser&&i.push(e.opts.parser),i.push(void 0),await ie(n,t,s,r,i)},"processContent"),Pt=/^charset$/i,ae=/^import$/i,kt=/^url$/i,_=/^layer$/i,Nt=/^supports$/i,Rt=/^scope$/i;var It=Object.defineProperty,Y=d((e,t)=>It(e,"name",{value:t,configurable:!0}),"a$3");const Ct=Y(e=>{for(let t=0;t<e.length;t++){const s=e[t];if(!v.isWhiteSpaceOrCommentNode(s)&&v.isSimpleBlockNode(s)&&x.isTokenOpenParen(s.startToken))return e}return[new v.SimpleBlockNode([x.TokenType.OpenParen,"(",-1,-1,void 0],[x.TokenType.CloseParen,")",-1,-1,void 0],e)]},"wrapInParenthesisIfNeeded"),ee=Y(e=>{if(e.startsWith("#"))return"";if(!e.includes("#"))return e;try{const t=new URL(e,"http://example.com");return t.hash?e.slice(0,e.length-t.hash.length):e}catch{return e}},"stripHash"),Ut=Y(e=>{const t=x.tokenize({css:e});if(t.length===2&&(x.isTokenString(t[0])||x.isTokenURL(t[0]))){let c=t[0][4].value;return c=ee(c),c?{fullUri:t[0][1],uri:c}:!1}const s=v.parseListOfComponentValues(t);let o="",n="",r,i,p,l;for(let c=0;c<s.length;c++){const a=s[c];if(!v.isWhiteSpaceOrCommentNode(a)){if(v.isTokenNode(a)&&(x.isTokenString(a.value)||x.isTokenURL(a.value))){if(o)return!1;o=a.value[4].value,n=a.value[1];continue}if(v.isFunctionNode(a)&&kt.test(a.getName())){if(o)return!1;for(let f=0;f<a.value.length;f++){const u=a.value[f];if(!v.isWhiteSpaceOrCommentNode(u)){if(!o&&v.isTokenNode(u)&&x.isTokenString(u.value)){o=u.value[4].value,n=v.stringify([[a]]);continue}return!1}}continue}if(!o)return!1;if(v.isTokenNode(a)&&x.isTokenIdent(a.value)&&_.test(a.value[4].value)){if(r!==void 0||p!==void 0)return!1;r="";continue}if(v.isFunctionNode(a)&&_.test(a.getName())){if(r!==void 0||p!==void 0)return!1;r=v.stringify([a.value]);continue}if(v.isFunctionNode(a)&&Nt.test(a.getName())){if(p!==void 0)return!1;p=v.stringify([a.value]);continue}if(v.isFunctionNode(a)&&Rt.test(a.getName())){if(l!==void 0)return!1;l=v.stringify([Ct(a.value)]);continue}i=v.stringify([s.slice(c)]);break}}return o=ee(o),o?{fullUri:n,layer:r,media:i,scope:l,supports:p,uri:o}:!1},"parseAtImport");var Et=Object.defineProperty,C=d((e,t)=>Et(e,"name",{value:t,configurable:!0}),"d");const ce=C((e,t,s,o)=>{const n=[];let r=t;const i=e.length;for(r;r<i;r++){const p=e[r];if(n.push(p),e[r+1]?.type!=="comment")break}return[r,{conditions:[],from:o,importingNode:s,nodes:n,type:"nodes"}]},"consumeComments"),_t=C((e,t,s,o,n)=>{const r=Ut(t.params);if(!r)return e.warn(`Invalid @import statement in '${t.toString()}'`,{node:t});const i={conditions:[...o],from:n,fullUri:r.fullUri,importingNode:s,node:t,type:"import",uri:r.uri};return(r.layer!==void 0||r.media!==void 0||r.supports!==void 0||r.scope!==void 0)&&i.conditions.push({layer:r.layer,media:r.media,scope:r.scope,supports:r.supports}),i},"parseImport"),Lt=C((e,t,s,o,n,r)=>{const i=[];let p=o;const l=t.length;for(p;p<l;p++){const c=t[p];if(c.type==="comment"){const[a,f]=ce(t,p,n,r);i.push(f),p=a;continue}if(c.type==="atrule"&&ae.test(c.name)){i.push(_t(e,c,n,s,r));continue}break}return[p-1,i]},"consumeImports"),Dt=C((e,t,s,o,n)=>{const r=[];let i=s;const p=e.length;for(i;i<p;i++){const l=e[i];r.push(l);const c=e[i+1];if(!(c&&c.type==="atrule"&&_.test(c.name)&&!c.nodes))break}return[i,{conditions:[...t],from:n,importingNode:o,nodes:r,type:"nodes"}]},"consumeLayers"),qt=C((e,t,s,o,n)=>{const r=[];let i=s;const p=e.length;for(i;i<p;i++){const l=e[i];if(l.type==="comment"){const[c,a]=ce(e,i,o,n);r.push(a),i=c;continue}if(l.type==="atrule"&&_.test(l.name)&&!l.nodes)if(t.length>0){r.push({conditions:[...t],from:n,importingNode:o,node:l,type:"pre-import"});continue}else{const[c,a]=Dt(e,t,i,o,n);r.push(a),i=c;continue}break}return[i-1,r]},"consumeBeforeImports"),pe=C((e,t,s,o,n)=>{const r={statements:[]};if(t.type==="document")return t.each(f=>{const u=pe(e,f,s,o,n);if(r.charset&&u.charset&&r.charset.params.toLowerCase()!==u.charset.params.toLowerCase())throw u.charset.error(`Incompatible @charset statements:
3
3
  ${u.charset.params} specified in ${u.charset.source?.input.file}
4
- ${n.charset.params} specified in ${n.charset.source?.input.file}`);!n.charset&&u.charset&&(n.charset=u.charset),n.statements.push(...u.statements)}),n;let i,p=[],l=[],c;for(let f=0;f<t.nodes.length;f++){const u=t.nodes[f];if(f===0&&u.type==="atrule"&&Rt.test(u.name)){i=u;continue}if(l.length===0&&(u.type==="comment"||u.type==="atrule"&&E.test(u.name)&&!u.nodes)){[f,p]=Wt(t.nodes,o,f,s,r);continue}if(l.length===0&&u.type==="atrule"&&ae.test(u.name)){[f,l]=Tt(e,t.nodes,o,f,s,r);continue}c={conditions:[...o],from:r,importingNode:s,nodes:t.nodes.slice(f),type:"nodes"};break}const a=[];return p.length>0&&a.push(...p),l.length>0&&a.push(...l),c&&a.push(c),{charset:i,statements:a}},"parseStylesheet");var Mt=Object.defineProperty,T=d((e,t)=>Mt(e,"name",{value:t,configurable:!0}),"h");const At=/^(?:[a-z]+:)?\/\//i,Bt=T(e=>{if(At.test(e))return!1;try{if(new URL(e,"https://example.com").search)return!1}catch{}return!0},"isProcessableURL"),te=T(async(e,t,s,o,r,n)=>{const{conditions:i,from:p,node:l}=t,c=i.map(g=>J(g.layer,g.media,g.supports,g.scope)).join(":");if(o.skipDuplicates){if(r.importedFiles[s]?.[c])return{statements:[]};r.importedFiles[s]||(r.importedFiles[s]={}),r.importedFiles[s][c]=!0}if(p.includes(s))return{statements:[]};const a=await o.load(s,o);if(a.trim()===""&&o.warnOnEmpty)return e.warn(`${s} is empty`,{node:l}),{statements:[]};if(o.skipDuplicates&&r.hashFiles[a]?.[c])return{statements:[]};const f=await Nt(e,a,s,o,n),u=f.root;return o.debug&&u.append({text:s}),e.messages=[...e.messages,...f.messages],o.skipDuplicates&&(u.some(g=>g.type==="atrule"&&g.name==="import")||(r.hashFiles[a]||(r.hashFiles[a]={}),r.hashFiles[a][c]=!0)),await le(o,e,u,r,l,i,[...p,s],n)},"loadImportContent"),zt=T(async(e,t,s,o,r)=>{if(H(s.uri)){s.stylesheet=await te(t,s,s.uri,e,o,r);return}if(H(s.from.at(-1))){s.stylesheet={statements:[]},t.warn(`Unable to import '${s.uri}' from a stylesheet that is embedded in a data url`,{node:s.node});return}const n=s.node;let i;n.source?.input.file&&(i=n.source.input.file);const p=i?h.dirname(i):e.root;for(const[c,a]of Object.entries(e.alias))s.uri!==c&&!s.uri.startsWith(`${c}/`)||(s.uri=h.normalize(a)+s.uri.slice(c.length));let l;try{l=await e.resolve(s.uri,p,e.extensions,n)}catch{s.node.warn(t,`Unable to resolve "${s.uri}" from "${p}"`);return}t.messages.push({file:l,parent:i,plugin:"packem-postcss-import",type:"dependency"}),s.stylesheet=await te(t,s,l,e,o,r)},"resolveImportId"),le=T(async(e,t,s,o,r,n,i,p)=>{let{charset:l,statements:c}=pe(t,s,r,n,i);{const a=[];for await(const f of c)!L(f)||!Bt(f.uri)||e.filter&&!e.filter(f.uri)||a.push(zt(e,t,f,o,p));a.length>0&&await Promise.all(a)}for(let a=0;a<c.length;a++){const f=c[a];if(L(f)&&f.stylesheet){if(l&&f.stylesheet.charset&&l.params.toLowerCase()!==f.stylesheet.charset.params.toLowerCase())throw f.stylesheet.charset.error(`Incompatible @charset statements:
4
+ ${r.charset.params} specified in ${r.charset.source?.input.file}`);!r.charset&&u.charset&&(r.charset=u.charset),r.statements.push(...u.statements)}),r;let i,p=[],l=[],c;for(let f=0;f<t.nodes.length;f++){const u=t.nodes[f];if(f===0&&u.type==="atrule"&&Pt.test(u.name)){i=u;continue}if(l.length===0&&(u.type==="comment"||u.type==="atrule"&&_.test(u.name)&&!u.nodes)){[f,p]=qt(t.nodes,o,f,s,n);continue}if(l.length===0&&u.type==="atrule"&&ae.test(u.name)){[f,l]=Lt(e,t.nodes,o,f,s,n);continue}c={conditions:[...o],from:n,importingNode:s,nodes:t.nodes.slice(f),type:"nodes"};break}const a=[];return p.length>0&&a.push(...p),l.length>0&&a.push(...l),c&&a.push(c),{charset:i,statements:a}},"parseStylesheet");var Tt=Object.defineProperty,T=d((e,t)=>Tt(e,"name",{value:t,configurable:!0}),"h");const Ft=/^(?:[a-z]+:)?\/\//i,Wt=T(e=>{if(Ft.test(e))return!1;try{if(new URL(e,"https://example.com").search)return!1}catch{}return!0},"isProcessableURL"),te=T(async(e,t,s,o,n,r)=>{const{conditions:i,from:p,node:l}=t,c=i.map(g=>J(g.layer,g.media,g.supports,g.scope)).join(":");if(o.skipDuplicates){if(n.importedFiles[s]?.[c])return{statements:[]};n.importedFiles[s]||(n.importedFiles[s]={}),n.importedFiles[s][c]=!0}if(p.includes(s))return{statements:[]};const a=await o.load(s,o);if(a.trim()===""&&o.warnOnEmpty)return e.warn(`${s} is empty`,{node:l}),{statements:[]};if(o.skipDuplicates&&n.hashFiles[a]?.[c])return{statements:[]};const f=await xt(e,a,s,o,r),u=f.root;return o.debug&&u.append({text:s}),e.messages=[...e.messages,...f.messages],o.skipDuplicates&&(u.some(g=>g.type==="atrule"&&g.name==="import")||(n.hashFiles[a]||(n.hashFiles[a]={}),n.hashFiles[a][c]=!0)),await le(o,e,u,n,l,i,[...p,s],r)},"loadImportContent"),Mt=T(async(e,t,s,o,n)=>{if(H(s.uri)){s.stylesheet=await te(t,s,s.uri,e,o,n);return}if(H(s.from.at(-1))){s.stylesheet={statements:[]},t.warn(`Unable to import '${s.uri}' from a stylesheet that is embedded in a data url`,{node:s.node});return}const r=s.node;let i;r.source?.input.file&&(i=r.source.input.file);const p=i?h.dirname(i):e.root;for(const[c,a]of Object.entries(e.alias))s.uri!==c&&!s.uri.startsWith(`${c}/`)||(s.uri=h.normalize(a)+s.uri.slice(c.length));let l;try{l=await e.resolve(s.uri,p,e.extensions,r)}catch{s.node.warn(t,`Unable to resolve "${s.uri}" from "${p}"`);return}t.messages.push({file:l,parent:i,plugin:"packem-postcss-import",type:"dependency"}),s.stylesheet=await te(t,s,l,e,o,n)},"resolveImportId"),le=T(async(e,t,s,o,n,r,i,p)=>{let{charset:l,statements:c}=pe(t,s,n,r,i);{const a=[];for await(const f of c)!L(f)||!Wt(f.uri)||e.filter&&!e.filter(f.uri)||a.push(Mt(e,t,f,o,p));a.length>0&&await Promise.all(a)}for(let a=0;a<c.length;a++){const f=c[a];if(L(f)&&f.stylesheet){if(l&&f.stylesheet.charset&&l.params.toLowerCase()!==f.stylesheet.charset.params.toLowerCase())throw f.stylesheet.charset.error(`Incompatible @charset statements:
5
5
  ${f.stylesheet.charset.params} specified in ${f.stylesheet.charset.source?.input.file}
6
- ${l.params} specified in ${l.source?.input.file}`);!l&&f.stylesheet.charset&&(l=f.stylesheet.charset),c.splice(a,1,...f.stylesheet.statements),a--}}return{charset:l,statements:c}},"parseStyles");var Jt=Object.defineProperty,Gt=d((e,t)=>Jt(e,"name",{value:t,configurable:!0}),"r$1");const Ht=Gt(e=>H(e)?jt(e):V.readFileSync(e),"loadContent");var Xt=Object.defineProperty,Vt=d((e,t)=>Xt(e,"name",{value:t,configurable:!0}),"i$1");const Qt="css-import",Yt=[".css",".pcss",".postcss",".sss"],ue=Vt(e=>{const t={alias:e?.alias??{},extensions:e?.extensions??Yt,load:Ht,plugins:[],resolve:e?.resolve??vt,skipDuplicates:!1,...e};return{async Once(s,{atRule:o,postcss:r,result:n}){const i={hashFiles:{},importedFiles:{}};if(s.source?.input.file&&(i.importedFiles[s.source.input.file]={}),!Array.isArray(t.plugins))throw new TypeError("plugins option must be an array");const p=await le(t,n,s,i,null,[],[],r);ft(p),pt(p,o),ht(p,s)},postcssPlugin:Qt}},"plugin");ue.postcss=!0;var Zt=Object.defineProperty,Kt=d((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"n$1");const es=Kt((e="[name]_[local]_[hash:8]")=>(t,s,o)=>{const{base:r,dir:n,name:i}=h.parse(s),p=I.f(`${r}:${o}`),l=j.H.exec(e),c=l&&Number.parseInt(l[1],10);return X.makeLegalIdentifier(e.replace("[dir]",h.basename(n)).replace("[name]",i.replace(/\.module$/,"")).replace("[local]",t).replace(j.H,c?p.slice(0,c):p))},"generate");var ts=Object.defineProperty,ss=d((e,t)=>ts(e,"name",{value:t,configurable:!0}),"r");const rs=ss(e=>{const t={mode:"local",...e,generateScopedName:typeof e.generateScopedName=="function"?e.generateScopedName:es(e.generateScopedName)};return[qe(),Le({mode:t.mode}),Ee({failOnWrongOrder:t.failOnWrongOrder}),De({exportGlobals:t.exportGlobals,generateScopedName:t.generateScopedName})]},"default");var ns=Object.defineProperty,os=d((e,t)=>ns(e,"name",{value:t,configurable:!0}),"c$2");const is=os((e,t,s)=>{const{base:o,dir:r,ext:n,name:i}=h.parse(t),p=I.f(`${o}:${Buffer.from(s).toString()}`),l=j.H.exec(e),c=l&&Number.parseInt(l[1],10);return e.replace("[dir]",h.basename(r)).replace("[name]",i).replace("[extname]",n).replace(".[ext]",n).replace("[ext]",n.slice(1)).replace(j.H,c?p.slice(0,c):p.slice(0,8))},"default");var as=Object.defineProperty,cs=d((e,t)=>as(e,"name",{value:t,configurable:!0}),"a$2");const ps=cs((e,t)=>{const s=Ie.lookup(e)||"application/octet-stream",o=Buffer.from(t).toString("base64");return`data:${s};base64,${o}`},"default");var ls=Object.defineProperty,us=d((e,t)=>ls(e,"name",{value:t,configurable:!0}),"a$1");const fs=us(async(e,t)=>{const s=new URL(e,"file://"),o=s.hash?s.hash.slice(1):"",r=e.split("?")[0]??"",n=[r];r.startsWith("/")&&n.push("."+r),!r.startsWith("/")&&!r.startsWith(".")&&n.push("./"+r);const i=D.r(n,{baseDirs:t,caller:"URL resolver"}),p=new URLSearchParams(s.search).toString();return{from:i,source:V.readFileSync(i,{buffer:!0}),urlQuery:(p?"?"+p:"")+(o?"#"+o:"")}},"urlResolve");var ds=Object.defineProperty,fe=d((e,t)=>ds(e,"name",{value:t,configurable:!0}),"n");const se=/^url$/i,ms=/^(?:-webkit-)?image-set$/i,hs=fe(e=>/(?:url|(?:-webkit-)?image-set)\(/i.test(e.value),"isDeclWithUrl"),gs=fe((e,t)=>{e.walk(s=>{if(s.type==="function"){if(se.test(s.value)){const{nodes:o}=s,[r]=o,n=r?.type==="string"?r.value:z.stringify(o);t(n.replaceAll(/^\s+|\s+$/g,""),r);return}if(ms.test(s.value))for(const o of s.nodes){if(o.type==="string"){t(o.value.replaceAll(/^\s+|\s+$/g,""),o);continue}if(o.type==="function"&&se.test(o.value)){const{nodes:r}=o,[n]=r,i=n?.type==="string"?n.value:z.stringify(r);t(i.replaceAll(/^\s+|\s+$/g,""),n)}}}})},"walkUrls");var ys=Object.defineProperty,vs=d((e,t)=>ys(e,"name",{value:t,configurable:!0}),"$");const B="packem-css-url",$s="assets/[name]-[hash][extname]",bs="assets/[name][extname]",ws="./assets/",Ss=".",de=vs(e=>{const t={alias:{},assetDir:Ss,inline:!1,resolve:fs,...e},s=t.hash??!0?typeof t.hash=="string"?t.hash:$s:bs;return{async Once(o,{result:r}){if(!o.source?.input.file)return;const{file:n}=o.source.input,i=j.m(o.source.input.map?.text??void 0).resolve(h.dirname(n)).toConsumer(),p=[],l=new Set(r.messages.filter(a=>a.type==="dependency").map(a=>a.file));o.walkDecls(a=>{if(!hs(a))return;const f=z(a.value);gs(f,(u,g)=>{for(const[b,$]of Object.entries(t.alias))u!==b&&!u.startsWith(`${b}/`)||(u=h.normalize($)+u.slice(b.length));if(!g||u.length===0){a.warn(r,`Empty URL in \`${a.toString()}\``);return}if(j.D.test(u))return;if(!h.isAbsolute(u))try{new URL(u);return}catch{}const S=new Set;if(a.source?.input.file&&l.has(a.source.input.file)&&S.add(h.dirname(a.source.input.file)),a.source?.start){const b=a.source.start,$=i?.originalPositionFor(b),O=$?.source&&h.dirname($.source);O&&S.add(h.normalize(O))}S.add(h.dirname(n)),p.push({baseDirs:S,decl:a,node:g,parsed:f,url:u})})});const c=new Map;for await(const{baseDirs:a,decl:f,node:u,parsed:g,url:S}of p){let b;try{b||(b=await t.resolve(S,[...a]))}catch{}if(!b){f.warn(r,`Unresolved URL \`${S}\` in \`${f.toString()}\``);continue}const{from:$,source:O,urlQuery:m}=b;if(!(O instanceof Uint8Array)||typeof $!="string"){f.warn(r,`Incorrectly resolved URL \`${S}\` in \`${f.toString()}\``);continue}if(r.messages.push({file:$,plugin:B,type:"dependency"}),t.inline)u.type="string",u.value=ps($,O);else{const w=h.normalize(is(s,$,O));let y=w;const k=j.F.test(w);for(let N=1;c.has(y)&&c.get(y)!==$;N++)y=k?w.replace(j.F,`${String(N)}$1`):`${w}${String(N)}`;c.set(y,$);const U=typeof t.publicPath=="string"?t.publicPath+(/[/\\]$/.test(t.publicPath)?"":"/")+h.basename(y):`${ws}${h.basename(y)}`;u.type="string",u.value=typeof t.publicPath=="function"?t.publicPath(u.value,U,n):U,m&&(u.value+=m),typeof t.assetDir=="string"?y=h.join(t.assetDir,y):typeof t.assetDir=="function"&&(y=t.assetDir($,y,n)),r.messages.push({plugin:B,source:O,to:y,type:"asset"})}f.value=g.toString()}},postcssPlugin:B}},"plugin");de.postcss=!0;var js=Object.defineProperty,me=d((e,t)=>js(e,"name",{value:t,configurable:!0}),"j");const Os=h.dirname(be.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:W&&W.tagName.toUpperCase()==="SCRIPT"&&W.src||new URL("rollup/plugins/css/loaders/postcss/index.cjs",document.baseURI).href));let _;const R="css",xs=new Set([R]),Ps=me(e=>{const t=X.makeLegalIdentifier(e);return xs.has(t)?`_${t}`:t},"getClassNameDefault"),ks={alwaysProcess:!0,name:"postcss",async process({code:e,extracted:t,map:s}){const o=await Be(this.id,this.cwd,this.environment,this.options.config),r=[];let n=!1;typeof this.options.modules=="boolean"?n=this.options.modules:typeof this.options.modules=="object"&&(n=Z.n(this.options.modules.include,this.id)),this.autoModules&&this.options.modules===void 0&&(n=Z.n(this.autoModules,this.id));const i={},p=[],l={...o.options,...this.options,from:this.id,map:{annotation:!1,inline:!1,prev:j.m(s).relative(h.dirname(this.id)).toObject(),sourcesContent:this.sourceMap?this.sourceMap.content:!0},plugins:[],to:this.options.to??this.id};if(this.options.import&&r.push(ue({debug:this.debug,extensions:this.extensions,plugins:[],root:this.cwd,warnOnEmpty:!0,...this.options.import})),this.options.url&&r.push(de({inline:!!this.inject,...this.options.url})),this.options.plugins&&r.push(...this.options.plugins),r.push(...o.plugins),n){const m=typeof this.options.modules=="object"?this.options.modules:{};r.push(...rs({failOnWrongOrder:!0,...m}),re({extensions:this.extensions}))}r.length===0&&r.push(Q),this.debug&&r.push(Ce({ignore:["css-noop"]}));const c=await Ue(r).process(e,l);for(const m of c.messages)switch(m.type){case"warning":{this.warn({message:m.text,plugin:m.plugin});break}case"icss":{Object.assign(i,m.export);break}case"icss-dependency":{p.push(m.import);break}case"dependency":{this.deps.add(h.normalize(m.file));break}case"asset":{this.assets.set(m.to,m.source);break}}if(s=j.m(c.map.toJSON()).resolve(h.dirname(l.to)).toString(),!this.extract&&this.sourceMap){const m=j.m(s).modify(w=>{w.file=void 0}).relative();this.sourceMap.transform&&m.modify(this.sourceMap.transform),s=m.toString(),c.css+=m.toCommentData()}const a=me(m=>We(m,h.basename(this.id)),"saferId"),f=a("modules"),u=[`var ${R} = ${JSON.stringify(c.css)};`],g=[],S=[R];if(this.namedExports){this.dts&&g.push(`declare const ${R}: string;`);const m=typeof this.namedExports=="function"?this.namedExports:Ps;for(const w in i){const y=m(w);w!==y&&this.warn(`Exported \`${w}\` as \`${y}\` in ${h.relative(this.cwd,this.id)}`);const k=JSON.stringify(i[w]);u.push(`var ${y} = ${k};`),this.dts&&g.push(`declare const ${y}: ${k};`),S.push(y)}}if(this.extract&&(t={css:c.css,id:this.id,map:s}),this.inject)if(typeof this.inject=="function")u.push(this.inject(R,this.id,u),`var ${f} = ${JSON.stringify(i)};`);else{const{treeshakeable:m,...w}=typeof this.inject=="object"?this.inject:{},y=a("injector"),k=`${y}(${R},${JSON.stringify(w)});`;if(_||(_=D.r(["./runtime/inject-css"],{baseDirs:[h.join(Os,"..","..")]}),_=`"${h.normalize(_)}"`),u.unshift(`import ${y} from ${_};`),m||u.push(`var ${f} = ${JSON.stringify(i)};`,k),m){u.push("var injected = false;");const U=`if (!injected) { injected = true; ${k} }`;if(i.inject)throw new Error("`inject` keyword is reserved when using `inject.treeshakeable` option");let N="";for(const[he,ge]of Object.entries(i)){const ye=JSON.stringify(he),ve=JSON.stringify(ge);N+=`get ${ye}() { ${U} return ${ve}; },
6
+ ${l.params} specified in ${l.source?.input.file}`);!l&&f.stylesheet.charset&&(l=f.stylesheet.charset),c.splice(a,1,...f.stylesheet.statements),a--}}return{charset:l,statements:c}},"parseStyles");var At=Object.defineProperty,Bt=d((e,t)=>At(e,"name",{value:t,configurable:!0}),"r$1");const zt=Bt(e=>H(e)?bt(e):V.readFileSync(e),"loadContent");var Jt=Object.defineProperty,Gt=d((e,t)=>Jt(e,"name",{value:t,configurable:!0}),"i$1");const Ht="css-import",Xt=[".css",".pcss",".postcss",".sss"],ue=Gt(e=>{const t={alias:e?.alias??{},extensions:e?.extensions??Xt,load:zt,plugins:[],resolve:e?.resolve??ht,skipDuplicates:!1,...e};return{async Once(s,{atRule:o,postcss:n,result:r}){const i={hashFiles:{},importedFiles:{}};if(s.source?.input.file&&(i.importedFiles[s.source.input.file]={}),!Array.isArray(t.plugins))throw new TypeError("plugins option must be an array");const p=await le(t,r,s,i,null,[],[],n);pt(p),it(p,o),ft(p,s)},postcssPlugin:Ht}},"plugin");ue.postcss=!0;var Vt=Object.defineProperty,Qt=d((e,t)=>Vt(e,"name",{value:t,configurable:!0}),"p$1");let A;const Yt=Qt(async(e,t,s,o)=>{if(!o)return{file:"",options:{},plugins:[]};const{dir:n}=h.parse(e),r=o.path?h.resolve(o.path):n;let i;try{i=(await K.findMonorepoRoot(t)).path}catch{try{i=await K.findPackageRoot(t)}catch{}}try{let p;A?p=A:(p=await Ee({cwd:t,env:s,...o.ctx},r,{stopDir:i}),A=p);const l={file:p.file,options:p.options,plugins:await I.d(p.plugins,t)};return l.options.parser&&(l.options.parser=await I.e(l.options.parser,"parser",t)),l.options.syntax&&(l.options.syntax=await I.e(l.options.syntax,"syntax",t)),l.options.stringifier&&(l.options.stringifier=await I.e(l.options.stringifier,"stringifier",t)),l}catch(p){if(p.message.includes("No PostCSS Config found in"))return{file:"",options:{},plugins:[]};throw p}},"loadConfig");var Zt=Object.defineProperty,Kt=d((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"n$1");const es=Kt((e="[name]_[local]_[hash:8]")=>(t,s,o)=>{const{base:n,dir:r,name:i}=h.parse(s),p=I.f(`${n}:${o}`),l=S.H.exec(e),c=l&&Number.parseInt(l[1],10);return X.makeLegalIdentifier(e.replace("[dir]",h.basename(r)).replace("[name]",i.replace(/\.module$/,"")).replace("[local]",t).replace(S.H,c?p.slice(0,c):p))},"generate");var ts=Object.defineProperty,ss=d((e,t)=>ts(e,"name",{value:t,configurable:!0}),"r");const rs=ss(e=>{const t={mode:"local",...e,generateScopedName:typeof e.generateScopedName=="function"?e.generateScopedName:es(e.generateScopedName)};return[qe(),Le({mode:t.mode}),_e({failOnWrongOrder:t.failOnWrongOrder}),De({exportGlobals:t.exportGlobals,generateScopedName:t.generateScopedName})]},"default");var ns=Object.defineProperty,os=d((e,t)=>ns(e,"name",{value:t,configurable:!0}),"c$2");const is=os((e,t,s)=>{const{base:o,dir:n,ext:r,name:i}=h.parse(t),p=I.f(`${o}:${Buffer.from(s).toString()}`),l=S.H.exec(e),c=l&&Number.parseInt(l[1],10);return e.replace("[dir]",h.basename(n)).replace("[name]",i).replace("[extname]",r).replace(".[ext]",r).replace("[ext]",r.slice(1)).replace(S.H,c?p.slice(0,c):p.slice(0,8))},"default");var as=Object.defineProperty,cs=d((e,t)=>as(e,"name",{value:t,configurable:!0}),"a$1");const ps=cs((e,t)=>{const s=Ie.lookup(e)||"application/octet-stream",o=Buffer.from(t).toString("base64");return`data:${s};base64,${o}`},"default");var ls=Object.defineProperty,us=d((e,t)=>ls(e,"name",{value:t,configurable:!0}),"a");const fs=us(async(e,t)=>{const s=new URL(e,"file://"),o=s.hash?s.hash.slice(1):"",n=e.split("?")[0]??"",r=[n];n.startsWith("/")&&r.push("."+n),!n.startsWith("/")&&!n.startsWith(".")&&r.push("./"+n);const i=D.r(r,{baseDirs:t,caller:"URL resolver"}),p=new URLSearchParams(s.search).toString();return{from:i,source:V.readFileSync(i,{buffer:!0}),urlQuery:(p?"?"+p:"")+(o?"#"+o:"")}},"urlResolve");var ds=Object.defineProperty,fe=d((e,t)=>ds(e,"name",{value:t,configurable:!0}),"n");const se=/^url$/i,ms=/^(?:-webkit-)?image-set$/i,hs=fe(e=>/(?:url|(?:-webkit-)?image-set)\(/i.test(e.value),"isDeclWithUrl"),gs=fe((e,t)=>{e.walk(s=>{if(s.type==="function"){if(se.test(s.value)){const{nodes:o}=s,[n]=o,r=n?.type==="string"?n.value:z.stringify(o);t(r.replaceAll(/^\s+|\s+$/g,""),n);return}if(ms.test(s.value))for(const o of s.nodes){if(o.type==="string"){t(o.value.replaceAll(/^\s+|\s+$/g,""),o);continue}if(o.type==="function"&&se.test(o.value)){const{nodes:n}=o,[r]=n,i=r?.type==="string"?r.value:z.stringify(n);t(i.replaceAll(/^\s+|\s+$/g,""),r)}}}})},"walkUrls");var ys=Object.defineProperty,vs=d((e,t)=>ys(e,"name",{value:t,configurable:!0}),"$");const B="packem-css-url",$s="assets/[name]-[hash][extname]",bs="assets/[name][extname]",ws="./assets/",js=".",de=vs(e=>{const t={alias:{},assetDir:js,inline:!1,resolve:fs,...e},s=t.hash??!0?typeof t.hash=="string"?t.hash:$s:bs;return{async Once(o,{result:n}){if(!o.source?.input.file)return;const{file:r}=o.source.input,i=S.m(o.source.input.map?.text??void 0).resolve(h.dirname(r)).toConsumer(),p=[],l=new Set(n.messages.filter(a=>a.type==="dependency").map(a=>a.file));o.walkDecls(a=>{if(!hs(a))return;const f=z(a.value);gs(f,(u,g)=>{for(const[b,$]of Object.entries(t.alias))u!==b&&!u.startsWith(`${b}/`)||(u=h.normalize($)+u.slice(b.length));if(!g||u.length===0){a.warn(n,`Empty URL in \`${a.toString()}\``);return}if(S.D.test(u))return;if(!h.isAbsolute(u))try{new URL(u);return}catch{}const j=new Set;if(a.source?.input.file&&l.has(a.source.input.file)&&j.add(h.dirname(a.source.input.file)),a.source?.start){const b=a.source.start,$=i?.originalPositionFor(b),O=$?.source&&h.dirname($.source);O&&j.add(h.normalize(O))}j.add(h.dirname(r)),p.push({baseDirs:j,decl:a,node:g,parsed:f,url:u})})});const c=new Map;for await(const{baseDirs:a,decl:f,node:u,parsed:g,url:j}of p){let b;try{b||(b=await t.resolve(j,[...a]))}catch{}if(!b){f.warn(n,`Unresolved URL \`${j}\` in \`${f.toString()}\``);continue}const{from:$,source:O,urlQuery:m}=b;if(!(O instanceof Uint8Array)||typeof $!="string"){f.warn(n,`Incorrectly resolved URL \`${j}\` in \`${f.toString()}\``);continue}if(n.messages.push({file:$,plugin:B,type:"dependency"}),t.inline)u.type="string",u.value=ps($,O);else{const w=h.normalize(is(s,$,O));let y=w;const k=S.F.test(w);for(let N=1;c.has(y)&&c.get(y)!==$;N++)y=k?w.replace(S.F,`${String(N)}$1`):`${w}${String(N)}`;c.set(y,$);const U=typeof t.publicPath=="string"?t.publicPath+(/[/\\]$/.test(t.publicPath)?"":"/")+h.basename(y):`${ws}${h.basename(y)}`;u.type="string",u.value=typeof t.publicPath=="function"?t.publicPath(u.value,U,r):U,m&&(u.value+=m),typeof t.assetDir=="string"?y=h.join(t.assetDir,y):typeof t.assetDir=="function"&&(y=t.assetDir($,y,r)),n.messages.push({plugin:B,source:O,to:y,type:"asset"})}f.value=g.toString()}},postcssPlugin:B}},"plugin");de.postcss=!0;var Ss=Object.defineProperty,me=d((e,t)=>Ss(e,"name",{value:t,configurable:!0}),"j");const Os=h.dirname(be.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:W&&W.tagName.toUpperCase()==="SCRIPT"&&W.src||new URL("rollup/plugins/css/loaders/postcss/index.cjs",document.baseURI).href));let E;const R="css",xs=new Set([R]),Ps=me(e=>{const t=X.makeLegalIdentifier(e);return xs.has(t)?`_${t}`:t},"getClassNameDefault"),ks={alwaysProcess:!0,name:"postcss",async process({code:e,extracted:t,map:s}){const o=await Yt(this.id,this.cwd,this.environment,this.options.config),n=[];let r=!1;typeof this.options.modules=="boolean"?r=this.options.modules:typeof this.options.modules=="object"&&(r=Z.n(this.options.modules.include,this.id)),this.autoModules&&this.options.modules===void 0&&(r=Z.n(this.autoModules,this.id));const i={},p=[],l={...o.options,...this.options,from:this.id,map:{annotation:!1,inline:!1,prev:S.m(s).relative(h.dirname(this.id)).toObject(),sourcesContent:this.sourceMap?this.sourceMap.content:!0},plugins:[],to:this.options.to??this.id};if(this.options.import&&n.push(ue({debug:this.debug,extensions:this.extensions,plugins:[],root:this.cwd,warnOnEmpty:!0,...this.options.import})),this.options.url&&n.push(de({inline:!!this.inject,...this.options.url})),this.options.plugins&&n.push(...this.options.plugins),n.push(...o.plugins),r){const m=typeof this.options.modules=="object"?this.options.modules:{};n.push(...rs({failOnWrongOrder:!0,...m}),re({extensions:this.extensions}))}n.length===0&&n.push(Q),this.debug&&n.push(Ce({ignore:["css-noop"]}));const c=await Ue(n).process(e,l);for(const m of c.messages)switch(m.type){case"warning":{this.warn({message:m.text,plugin:m.plugin});break}case"icss":{Object.assign(i,m.export);break}case"icss-dependency":{p.push(m.import);break}case"dependency":{this.deps.add(h.normalize(m.file));break}case"asset":{this.assets.set(m.to,m.source);break}}if(s=S.m(c.map.toJSON()).resolve(h.dirname(l.to)).toString(),!this.extract&&this.sourceMap){const m=S.m(s).modify(w=>{w.file=void 0}).relative();this.sourceMap.transform&&m.modify(this.sourceMap.transform),s=m.toString(),c.css+=m.toCommentData()}const a=me(m=>We(m,h.basename(this.id)),"saferId"),f=a("modules"),u=[`var ${R} = ${JSON.stringify(c.css)};`],g=[],j=[R];if(this.namedExports){this.dts&&g.push(`declare const ${R}: string;`);const m=typeof this.namedExports=="function"?this.namedExports:Ps;for(const w in i){const y=m(w);w!==y&&this.warn(`Exported \`${w}\` as \`${y}\` in ${h.relative(this.cwd,this.id)}`);const k=JSON.stringify(i[w]);u.push(`var ${y} = ${k};`),this.dts&&g.push(`declare const ${y}: ${k};`),j.push(y)}}if(this.extract&&(t={css:c.css,id:this.id,map:s}),this.inject)if(typeof this.inject=="function")u.push(this.inject(R,this.id,u),`var ${f} = ${JSON.stringify(i)};`);else{const{treeshakeable:m,...w}=typeof this.inject=="object"?this.inject:{},y=a("injector"),k=`${y}(${R},${JSON.stringify(w)});`;if(E||(E=D.r(["./runtime/inject-css"],{baseDirs:[h.join(Os,"..","..")]}),E=`"${h.normalize(E)}"`),u.unshift(`import ${y} from ${E};`),m||u.push(`var ${f} = ${JSON.stringify(i)};`,k),m){u.push("var injected = false;");const U=`if (!injected) { injected = true; ${k} }`;if(i.inject)throw new Error("`inject` keyword is reserved when using `inject.treeshakeable` option");let N="";for(const[he,ge]of Object.entries(i)){const ye=JSON.stringify(he),ve=JSON.stringify(ge);N+=`get ${ye}() { ${U} return ${ve}; },
7
7
  `}N+=`inject: function inject() { ${U} },`,u.push(`var ${f} = {${N}};`)}}!this.inject&&Object.keys(i).length>0&&u.push(`var ${f} = ${JSON.stringify(i)};`);const b=`
8
- export default ${n?f:R};
9
- `;if(u.push(b),this.dts&&(n&&g.push(`
8
+ export default ${r?f:R};
9
+ `;if(u.push(b),this.dts&&(r&&g.push(`
10
10
  interface ModulesExports {
11
11
  ${Object.keys(i).map(m=>` '${m}': string;`).join(`
12
12
  `)}
13
13
  }
14
14
  `,typeof this.inject=="object"&&this.inject.treeshakeable?"interface ModulesExports {inject:()=>void}":"",`declare const ${f}: ModulesExports;`),g.push(b)),this.namedExports){const m=`export {
15
- ${S.filter(Boolean).join(`,
15
+ ${j.filter(Boolean).join(`,
16
16
  `)}
17
17
  };`;u.push(m),this.dts&&g.push(m)}const $=u.filter(Boolean).join(`
18
18
  `),O=g.length>0?g.filter(Boolean).join(`
19
- `):void 0;return this.emit?{code:c.css,map:s,meta:{icssDependencies:p,moduleContents:$,types:O}}:{code:$,extracted:t,map:s,meta:{types:O}}}};module.exports=ks;
19
+ `):void 0;return this.emit?{code:c.css,map:s,meta:{icssDependencies:p,moduleContents:$,types:O}}:{code:$,extracted:t,map:s,meta:{types:O},moduleSideEffects:r||typeof this.inject=="object"&&this.inject.treeshakeable?!1:"no-treeshake"}}};module.exports=ks;
@@ -1,12 +1,12 @@
1
- var Re=Object.defineProperty;var d=(e,t)=>Re(e,"name",{value:t,configurable:!0});import{fileURLToPath as ke}from"node:url";import Ne from"@csstools/postcss-slow-plugins";import{makeLegalIdentifier as q}from"@rollup/pluginutils";import{parse as Z,resolve as Ee,dirname as S,normalize as x,basename as I,isAbsolute as Ie,join as pe,relative as Ce}from"@visulima/path";import Ue from"postcss";import{r as F}from"../../../../../packem_shared/resolve-aYsRgS8e.mjs";import{f as K,d as De,e as A}from"../../../../../packem_shared/get-hash-WS4xNEhC.mjs";import{H as L,m as D,D as Le,F as se}from"../../../../../packem_shared/sourcemap-DDVjvayf.mjs";import{n as re}from"../../../../../packem_shared/ensure-auto-modules-9cmxx7iZ.mjs";import{findMonorepoRoot as _e,findPackageRoot as Fe}from"@visulima/package";import Te from"postcss-load-config";import{extractICSS as We,replaceSymbols as Ae,replaceValueSymbols as Me}from"icss-utils";import{readFile as Be,readFileSync as le}from"@visulima/fs";import{isRelative as Xe}from"@visulima/path/utils";import{isWhiteSpaceOrCommentNode as H,isSimpleBlockNode as Ge,SimpleBlockNode as Je,parseListOfComponentValues as He,isTokenNode as M,isFunctionNode as U,stringify as N}from"@csstools/css-parser-algorithms";import{isTokenOpenParen as Ve,TokenType as oe,tokenize as ze,isTokenString as B,isTokenURL as ne,isTokenIdent as Qe}from"@csstools/css-tokenizer";import Ye from"postcss-modules-extract-imports";import qe from"postcss-modules-local-by-default";import Ze from"postcss-modules-scope";import Ke from"postcss-modules-values";import V from"postcss-value-parser";import{lookup as et}from"mime-types";var tt=Object.defineProperty,st=d((e,t)=>tt(e,"name",{value:t,configurable:!0}),"e$3");const rt=st((e,...t)=>{const s=K([e,"0iOXBLSx",...t].join(":")).slice(0,8);return q(`${e}_${s}`)},"default");var ot=Object.defineProperty,nt=d((e,t)=>ot(e,"name",{value:t,configurable:!0}),"p$4");let X;const it=nt(async(e,t,s,n)=>{if(!n)return{file:"",options:{},plugins:[]};const{dir:r}=Z(e),o=n.path?Ee(n.path):r;let i;try{i=(await _e(t)).path}catch{try{i=await Fe(t)}catch{}}try{let p;X?p=X:(p=await Te({cwd:t,env:s,...n.ctx},o,{stopDir:i}),X=p);const l={file:p.file,options:p.options,plugins:await De(p.plugins,t)};return l.options.parser&&(l.options.parser=await A(l.options.parser,"parser",t)),l.options.syntax&&(l.options.syntax=await A(l.options.syntax,"syntax",t)),l.options.stringifier&&(l.options.stringifier=await A(l.options.stringifier,"stringifier",t)),l}catch(p){if(p.message.includes("No PostCSS Config found in"))return{file:"",options:{},plugins:[]};throw p}},"loadConfig");var at=Object.defineProperty,ct=d((e,t)=>at(e,"name",{value:t,configurable:!0}),"i$5");const pt=ct(async(e,t,s,n,r)=>{const o=F([e,`./${e}`],{baseDirs:[S(t)],caller:"ICSS loader",extensions:s}),i=await Be(o),{messages:p}=await n.process(i,{...r,from:o}),l={};for(const c of p)c.type==="icss"&&Object.assign(l,c.export);return l},"load");var lt=Object.defineProperty,ut=d((e,t)=>lt(e,"name",{value:t,configurable:!0}),"t$3");const ft=ut(async(e,t,s,n,r,o)=>{const i={};for await(const[p,l]of Object.entries(e)){const c=await t(p,s,n,r,o);for(const[a,f]of Object.entries(l))i[a]=c[f]}return i},"resolve");var mt=Object.defineProperty,dt=d((e,t)=>mt(e,"name",{value:t,configurable:!0}),"c$4");const G="styles-icss",ht=[".css",".pcss",".postcss",".sss"],ue=dt(e=>{const t=e?.load??pt,s=e?.extensions??ht;return{async OnceExit(n,{result:r}){if(!n.source?.input.file)return;const o={...r.opts,map:void 0},{icssExports:i,icssImports:p}=We(n),l=await ft(p,t,n.source.input.file,s,r.processor,o);Ae(n,l);for(const[c,a]of Object.entries(i))r.messages.push({export:{[c]:Me(a,l)},plugin:G,type:"icss"});for(const c of Object.keys(p))r.messages.push({import:c,plugin:G,type:"icss-dependency"})},postcssPlugin:G}},"plugin");ue.postcss=!0;var gt=Object.defineProperty,vt=d((e,t)=>gt(e,"name",{value:t,configurable:!0}),"t$2");const z=vt((e,t,s,n)=>{const r=[];if(e!==void 0){let o="layer";e&&(o="layer("+e+")"),r.push(o)}return s!==void 0&&r.push("supports("+s+")"),n!==void 0&&r.push("scope("+n+")"),t!==void 0&&r.push(t),r.join(" ")},"formatImportPrelude");var yt=Object.defineProperty,$t=d((e,t)=>yt(e,"name",{value:t,configurable:!0}),"p$3");const bt=$t((e,t)=>{t.reverse();const s=t.pop();if(!s)return e;let n=`${e} ${z(s.layer,s.media,s.supports,s.scope)}`;for(const r of t)n=`'data:text/css;base64,${Buffer.from(`@import ${n}`).toString("base64")}' ${z(r.layer,r.media,r.supports,r.scope)}`;return n},"base64EncodedConditionalImport");var wt=Object.defineProperty,T=d((e,t)=>wt(e,"name",{value:t,configurable:!0}),"e$2");const St=T(e=>e.type==="warning","isWarning"),Q=T(e=>e.type==="nodes","isNodesStatement"),_=T(e=>e.type==="import","isImportStatement"),jt=T(e=>e.type==="pre-import","isPreImportStatement");var Ot=Object.defineProperty,Pt=d((e,t)=>Ot(e,"name",{value:t,configurable:!0}),"u$1");const xt=Pt((e,t)=>{e.statements.forEach((s,n)=>{if(St(s)||jt(s)||s.conditions.length===0)return;if(_(s)){s.node.params=bt(s.fullUri,s.conditions);return}const{nodes:r}=s;if(r.length===0)return;const{parent:o}=r[0];if(!o)return;const i=[];for(const c of s.conditions){if(c.media!==void 0){const a=t({name:"media",params:c.media,source:s.importingNode?.source??o.source});i.push(a)}if(c.scope!==void 0){const a=t({name:"scope",params:c.scope,source:s.importingNode?.source??o.source});i.push(a)}if(c.supports!==void 0){const a=t({name:"supports",params:"("+c.supports+")",source:s.importingNode?.source??o.source});i.push(a)}if(c.layer!==void 0){const a=t({name:"layer",params:c.layer,source:s.importingNode?.source??o.source});i.push(a)}}const p=i[0];if(!p)return;for(let c=0;c<i.length-1;c++)i[c].append(i[c+1]);const l=i.at(-1);o.insertBefore(r[0],p),r.forEach(c=>{c.parent=void 0}),l.append(r),e.statements[n]={conditions:s.conditions,from:s.from,importingNode:s.importingNode,nodes:[p],type:"nodes"}})},"applyConditions");var Rt=Object.defineProperty,kt=d((e,t)=>Rt(e,"name",{value:t,configurable:!0}),"r$3");const Nt=kt(e=>{e.statements.forEach((t,s)=>{if(s!==0)if(t.parent!==void 0){const{before:n}=t.parent.node.raws;Q(t)?t.nodes[0].raws.before=n:t.node.raws.before=n}else Q(t)&&(t.nodes[0].raws.before=t.nodes[0].raws.before??`
2
- `)})},"applyRaws");var Et=Object.defineProperty,It=d((e,t)=>Et(e,"name",{value:t,configurable:!0}),"t$1");const Ct=It((e,t)=>{t.nodes=[],e.charset&&(e.charset.parent=void 0,t.append(e.charset)),e.statements.forEach(s=>{_(s)?(s.node.parent=void 0,t.append(s.node)):Q(s)&&s.nodes.forEach(n=>{n.parent=void 0,t.append(n)})})},"applyStyles");var Ut=Object.defineProperty,Dt=d((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"o$2");const Lt=Dt((e,t,s)=>{const n={baseDirs:[t],caller:"@import resolver",extensions:s},r=new URL(e,"file://").pathname,o=[r];return(Xe(r)||r.startsWith("/"))&&o.push("."+r),r.startsWith("/")&&o.push(r.slice(1)),F(o,n)},"importResolve");var _t=Object.defineProperty,fe=d((e,t)=>_t(e,"name",{value:t,configurable:!0}),"e$1");const Ft=/^data:text\/css(?:;(?:base64|plain))?,/i,Tt=/^data:text\/css;base64,/i,Wt=/^data:text\/css;plain,/i,Y=fe(e=>e!==void 0&&Ft.test(e),"isValidDataURL"),At=fe(e=>Tt.test(e)?Buffer.from(e.slice(21),"base64").toString():Wt.test(e)?decodeURIComponent(e.slice(20)):decodeURIComponent(e.slice(14)),"dataURLContents");var Mt=Object.defineProperty,Bt=d((e,t)=>Mt(e,"name",{value:t,configurable:!0}),"o");const Xt="css-noop",ee=Bt(()=>({postcssPlugin:Xt}),"noopPlugin");ee.postcss=!0;var Gt=Object.defineProperty,me=d((e,t)=>Gt(e,"name",{value:t,configurable:!0}),"a$4");const de=me(async(e,t,s,n,r,o)=>(o===void 0&&(o=0),n.length===0&&n.push(ee()),await e(n).process(t,{from:s,parser:r[o]}).catch(async i=>{if(o++,o===r.length)throw i;return await de(e,t,s,n,r,o)})),"runPostcss"),Jt=me(async(e,t,s,n,r)=>{const{plugins:o}=n,i=[];return e.opts.syntax?.parse&&i.push(e.opts.syntax.parse),e.opts.parser&&i.push(e.opts.parser),i.push(void 0),await de(r,t,s,o,i)},"processContent"),Ht=/^charset$/i,he=/^import$/i,Vt=/^url$/i,C=/^layer$/i,zt=/^supports$/i,Qt=/^scope$/i;var Yt=Object.defineProperty,te=d((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"a$3");const qt=te(e=>{for(let t=0;t<e.length;t++){const s=e[t];if(!H(s)&&Ge(s)&&Ve(s.startToken))return e}return[new Je([oe.OpenParen,"(",-1,-1,void 0],[oe.CloseParen,")",-1,-1,void 0],e)]},"wrapInParenthesisIfNeeded"),ie=te(e=>{if(e.startsWith("#"))return"";if(!e.includes("#"))return e;try{const t=new URL(e,"http://example.com");return t.hash?e.slice(0,e.length-t.hash.length):e}catch{return e}},"stripHash"),Zt=te(e=>{const t=ze({css:e});if(t.length===2&&(B(t[0])||ne(t[0]))){let c=t[0][4].value;return c=ie(c),c?{fullUri:t[0][1],uri:c}:!1}const s=He(t);let n="",r="",o,i,p,l;for(let c=0;c<s.length;c++){const a=s[c];if(!H(a)){if(M(a)&&(B(a.value)||ne(a.value))){if(n)return!1;n=a.value[4].value,r=a.value[1];continue}if(U(a)&&Vt.test(a.getName())){if(n)return!1;for(let f=0;f<a.value.length;f++){const u=a.value[f];if(!H(u)){if(!n&&M(u)&&B(u.value)){n=u.value[4].value,r=N([[a]]);continue}return!1}}continue}if(!n)return!1;if(M(a)&&Qe(a.value)&&C.test(a.value[4].value)){if(o!==void 0||p!==void 0)return!1;o="";continue}if(U(a)&&C.test(a.getName())){if(o!==void 0||p!==void 0)return!1;o=N([a.value]);continue}if(U(a)&&zt.test(a.getName())){if(p!==void 0)return!1;p=N([a.value]);continue}if(U(a)&&Qt.test(a.getName())){if(l!==void 0)return!1;l=N([qt(a.value)]);continue}i=N([s.slice(c)]);break}}return n=ie(n),n?{fullUri:r,layer:o,media:i,scope:l,supports:p,uri:n}:!1},"parseAtImport");var Kt=Object.defineProperty,R=d((e,t)=>Kt(e,"name",{value:t,configurable:!0}),"d");const ge=R((e,t,s,n)=>{const r=[];let o=t;const i=e.length;for(o;o<i;o++){const p=e[o];if(r.push(p),e[o+1]?.type!=="comment")break}return[o,{conditions:[],from:n,importingNode:s,nodes:r,type:"nodes"}]},"consumeComments"),es=R((e,t,s,n,r)=>{const o=Zt(t.params);if(!o)return e.warn(`Invalid @import statement in '${t.toString()}'`,{node:t});const i={conditions:[...n],from:r,fullUri:o.fullUri,importingNode:s,node:t,type:"import",uri:o.uri};return(o.layer!==void 0||o.media!==void 0||o.supports!==void 0||o.scope!==void 0)&&i.conditions.push({layer:o.layer,media:o.media,scope:o.scope,supports:o.supports}),i},"parseImport"),ts=R((e,t,s,n,r,o)=>{const i=[];let p=n;const l=t.length;for(p;p<l;p++){const c=t[p];if(c.type==="comment"){const[a,f]=ge(t,p,r,o);i.push(f),p=a;continue}if(c.type==="atrule"&&he.test(c.name)){i.push(es(e,c,r,s,o));continue}break}return[p-1,i]},"consumeImports"),ss=R((e,t,s,n,r)=>{const o=[];let i=s;const p=e.length;for(i;i<p;i++){const l=e[i];o.push(l);const c=e[i+1];if(!(c&&c.type==="atrule"&&C.test(c.name)&&!c.nodes))break}return[i,{conditions:[...t],from:r,importingNode:n,nodes:o,type:"nodes"}]},"consumeLayers"),rs=R((e,t,s,n,r)=>{const o=[];let i=s;const p=e.length;for(i;i<p;i++){const l=e[i];if(l.type==="comment"){const[c,a]=ge(e,i,n,r);o.push(a),i=c;continue}if(l.type==="atrule"&&C.test(l.name)&&!l.nodes)if(t.length>0){o.push({conditions:[...t],from:r,importingNode:n,node:l,type:"pre-import"});continue}else{const[c,a]=ss(e,t,i,n,r);o.push(a),i=c;continue}break}return[i-1,o]},"consumeBeforeImports"),ve=R((e,t,s,n,r)=>{const o={statements:[]};if(t.type==="document")return t.each(f=>{const u=ve(e,f,s,n,r);if(o.charset&&u.charset&&o.charset.params.toLowerCase()!==u.charset.params.toLowerCase())throw u.charset.error(`Incompatible @charset statements:
1
+ var ke=Object.defineProperty;var d=(e,t)=>ke(e,"name",{value:t,configurable:!0});import{fileURLToPath as Re}from"node:url";import Ee from"@csstools/postcss-slow-plugins";import{makeLegalIdentifier as q}from"@rollup/pluginutils";import{dirname as S,normalize as x,parse as Z,resolve as Ne,basename as I,isAbsolute as Ie,join as pe,relative as Ce}from"@visulima/path";import Ue from"postcss";import{r as F}from"../../../../../packem_shared/resolve-aYsRgS8e.mjs";import{f as K,d as De,e as A}from"../../../../../packem_shared/get-hash-WS4xNEhC.mjs";import{H as L,m as D,D as Le,F as se}from"../../../../../packem_shared/sourcemap-DDVjvayf.mjs";import{n as re}from"../../../../../packem_shared/ensure-auto-modules-9cmxx7iZ.mjs";import{extractICSS as _e,replaceSymbols as Fe,replaceValueSymbols as Te}from"icss-utils";import{readFile as We,readFileSync as le}from"@visulima/fs";import{isRelative as Ae}from"@visulima/path/utils";import{isWhiteSpaceOrCommentNode as H,isSimpleBlockNode as Me,SimpleBlockNode as Be,parseListOfComponentValues as Xe,isTokenNode as M,isFunctionNode as U,stringify as E}from"@csstools/css-parser-algorithms";import{isTokenOpenParen as Ge,TokenType as oe,tokenize as Je,isTokenString as B,isTokenURL as ne,isTokenIdent as He}from"@csstools/css-tokenizer";import{findMonorepoRoot as Ve,findPackageRoot as ze}from"@visulima/package";import Qe from"postcss-load-config";import Ye from"postcss-modules-extract-imports";import qe from"postcss-modules-local-by-default";import Ze from"postcss-modules-scope";import Ke from"postcss-modules-values";import V from"postcss-value-parser";import{lookup as et}from"mime-types";var tt=Object.defineProperty,st=d((e,t)=>tt(e,"name",{value:t,configurable:!0}),"e$3");const rt=st((e,...t)=>{const s=K([e,"0iOXBLSx",...t].join(":")).slice(0,8);return q(`${e}_${s}`)},"default");var ot=Object.defineProperty,nt=d((e,t)=>ot(e,"name",{value:t,configurable:!0}),"i$5");const it=nt(async(e,t,s,n,o)=>{const r=F([e,`./${e}`],{baseDirs:[S(t)],caller:"ICSS loader",extensions:s}),i=await We(r),{messages:p}=await n.process(i,{...o,from:r}),l={};for(const c of p)c.type==="icss"&&Object.assign(l,c.export);return l},"load");var at=Object.defineProperty,ct=d((e,t)=>at(e,"name",{value:t,configurable:!0}),"t$3");const pt=ct(async(e,t,s,n,o,r)=>{const i={};for await(const[p,l]of Object.entries(e)){const c=await t(p,s,n,o,r);for(const[a,f]of Object.entries(l))i[a]=c[f]}return i},"resolve");var lt=Object.defineProperty,ut=d((e,t)=>lt(e,"name",{value:t,configurable:!0}),"c$4");const X="styles-icss",ft=[".css",".pcss",".postcss",".sss"],ue=ut(e=>{const t=e?.load??it,s=e?.extensions??ft;return{async OnceExit(n,{result:o}){if(!n.source?.input.file)return;const r={...o.opts,map:void 0},{icssExports:i,icssImports:p}=_e(n),l=await pt(p,t,n.source.input.file,s,o.processor,r);Fe(n,l);for(const[c,a]of Object.entries(i))o.messages.push({export:{[c]:Te(a,l)},plugin:X,type:"icss"});for(const c of Object.keys(p))o.messages.push({import:c,plugin:X,type:"icss-dependency"})},postcssPlugin:X}},"plugin");ue.postcss=!0;var mt=Object.defineProperty,dt=d((e,t)=>mt(e,"name",{value:t,configurable:!0}),"t$2");const z=dt((e,t,s,n)=>{const o=[];if(e!==void 0){let r="layer";e&&(r="layer("+e+")"),o.push(r)}return s!==void 0&&o.push("supports("+s+")"),n!==void 0&&o.push("scope("+n+")"),t!==void 0&&o.push(t),o.join(" ")},"formatImportPrelude");var ht=Object.defineProperty,gt=d((e,t)=>ht(e,"name",{value:t,configurable:!0}),"p$4");const vt=gt((e,t)=>{t.reverse();const s=t.pop();if(!s)return e;let n=`${e} ${z(s.layer,s.media,s.supports,s.scope)}`;for(const o of t)n=`'data:text/css;base64,${Buffer.from(`@import ${n}`).toString("base64")}' ${z(o.layer,o.media,o.supports,o.scope)}`;return n},"base64EncodedConditionalImport");var yt=Object.defineProperty,T=d((e,t)=>yt(e,"name",{value:t,configurable:!0}),"e$2");const $t=T(e=>e.type==="warning","isWarning"),Q=T(e=>e.type==="nodes","isNodesStatement"),_=T(e=>e.type==="import","isImportStatement"),bt=T(e=>e.type==="pre-import","isPreImportStatement");var wt=Object.defineProperty,St=d((e,t)=>wt(e,"name",{value:t,configurable:!0}),"u$1");const jt=St((e,t)=>{e.statements.forEach((s,n)=>{if($t(s)||bt(s)||s.conditions.length===0)return;if(_(s)){s.node.params=vt(s.fullUri,s.conditions);return}const{nodes:o}=s;if(o.length===0)return;const{parent:r}=o[0];if(!r)return;const i=[];for(const c of s.conditions){if(c.media!==void 0){const a=t({name:"media",params:c.media,source:s.importingNode?.source??r.source});i.push(a)}if(c.scope!==void 0){const a=t({name:"scope",params:c.scope,source:s.importingNode?.source??r.source});i.push(a)}if(c.supports!==void 0){const a=t({name:"supports",params:"("+c.supports+")",source:s.importingNode?.source??r.source});i.push(a)}if(c.layer!==void 0){const a=t({name:"layer",params:c.layer,source:s.importingNode?.source??r.source});i.push(a)}}const p=i[0];if(!p)return;for(let c=0;c<i.length-1;c++)i[c].append(i[c+1]);const l=i.at(-1);r.insertBefore(o[0],p),o.forEach(c=>{c.parent=void 0}),l.append(o),e.statements[n]={conditions:s.conditions,from:s.from,importingNode:s.importingNode,nodes:[p],type:"nodes"}})},"applyConditions");var Ot=Object.defineProperty,Pt=d((e,t)=>Ot(e,"name",{value:t,configurable:!0}),"r$3");const xt=Pt(e=>{e.statements.forEach((t,s)=>{if(s!==0)if(t.parent!==void 0){const{before:n}=t.parent.node.raws;Q(t)?t.nodes[0].raws.before=n:t.node.raws.before=n}else Q(t)&&(t.nodes[0].raws.before=t.nodes[0].raws.before??`
2
+ `)})},"applyRaws");var kt=Object.defineProperty,Rt=d((e,t)=>kt(e,"name",{value:t,configurable:!0}),"t$1");const Et=Rt((e,t)=>{t.nodes=[],e.charset&&(e.charset.parent=void 0,t.append(e.charset)),e.statements.forEach(s=>{_(s)?(s.node.parent=void 0,t.append(s.node)):Q(s)&&s.nodes.forEach(n=>{n.parent=void 0,t.append(n)})})},"applyStyles");var Nt=Object.defineProperty,It=d((e,t)=>Nt(e,"name",{value:t,configurable:!0}),"o$2");const Ct=It((e,t,s)=>{const n={baseDirs:[t],caller:"@import resolver",extensions:s},o=new URL(e,"file://").pathname,r=[o];return(Ae(o)||o.startsWith("/"))&&r.push("."+o),o.startsWith("/")&&r.push(o.slice(1)),F(r,n)},"importResolve");var Ut=Object.defineProperty,fe=d((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"e$1");const Dt=/^data:text\/css(?:;(?:base64|plain))?,/i,Lt=/^data:text\/css;base64,/i,_t=/^data:text\/css;plain,/i,Y=fe(e=>e!==void 0&&Dt.test(e),"isValidDataURL"),Ft=fe(e=>Lt.test(e)?Buffer.from(e.slice(21),"base64").toString():_t.test(e)?decodeURIComponent(e.slice(20)):decodeURIComponent(e.slice(14)),"dataURLContents");var Tt=Object.defineProperty,Wt=d((e,t)=>Tt(e,"name",{value:t,configurable:!0}),"o");const At="css-noop",ee=Wt(()=>({postcssPlugin:At}),"noopPlugin");ee.postcss=!0;var Mt=Object.defineProperty,me=d((e,t)=>Mt(e,"name",{value:t,configurable:!0}),"a$4");const de=me(async(e,t,s,n,o,r)=>(r===void 0&&(r=0),n.length===0&&n.push(ee()),await e(n).process(t,{from:s,parser:o[r]}).catch(async i=>{if(r++,r===o.length)throw i;return await de(e,t,s,n,o,r)})),"runPostcss"),Bt=me(async(e,t,s,n,o)=>{const{plugins:r}=n,i=[];return e.opts.syntax?.parse&&i.push(e.opts.syntax.parse),e.opts.parser&&i.push(e.opts.parser),i.push(void 0),await de(o,t,s,r,i)},"processContent"),Xt=/^charset$/i,he=/^import$/i,Gt=/^url$/i,C=/^layer$/i,Jt=/^supports$/i,Ht=/^scope$/i;var Vt=Object.defineProperty,te=d((e,t)=>Vt(e,"name",{value:t,configurable:!0}),"a$3");const zt=te(e=>{for(let t=0;t<e.length;t++){const s=e[t];if(!H(s)&&Me(s)&&Ge(s.startToken))return e}return[new Be([oe.OpenParen,"(",-1,-1,void 0],[oe.CloseParen,")",-1,-1,void 0],e)]},"wrapInParenthesisIfNeeded"),ie=te(e=>{if(e.startsWith("#"))return"";if(!e.includes("#"))return e;try{const t=new URL(e,"http://example.com");return t.hash?e.slice(0,e.length-t.hash.length):e}catch{return e}},"stripHash"),Qt=te(e=>{const t=Je({css:e});if(t.length===2&&(B(t[0])||ne(t[0]))){let c=t[0][4].value;return c=ie(c),c?{fullUri:t[0][1],uri:c}:!1}const s=Xe(t);let n="",o="",r,i,p,l;for(let c=0;c<s.length;c++){const a=s[c];if(!H(a)){if(M(a)&&(B(a.value)||ne(a.value))){if(n)return!1;n=a.value[4].value,o=a.value[1];continue}if(U(a)&&Gt.test(a.getName())){if(n)return!1;for(let f=0;f<a.value.length;f++){const u=a.value[f];if(!H(u)){if(!n&&M(u)&&B(u.value)){n=u.value[4].value,o=E([[a]]);continue}return!1}}continue}if(!n)return!1;if(M(a)&&He(a.value)&&C.test(a.value[4].value)){if(r!==void 0||p!==void 0)return!1;r="";continue}if(U(a)&&C.test(a.getName())){if(r!==void 0||p!==void 0)return!1;r=E([a.value]);continue}if(U(a)&&Jt.test(a.getName())){if(p!==void 0)return!1;p=E([a.value]);continue}if(U(a)&&Ht.test(a.getName())){if(l!==void 0)return!1;l=E([zt(a.value)]);continue}i=E([s.slice(c)]);break}}return n=ie(n),n?{fullUri:o,layer:r,media:i,scope:l,supports:p,uri:n}:!1},"parseAtImport");var Yt=Object.defineProperty,k=d((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"d");const ge=k((e,t,s,n)=>{const o=[];let r=t;const i=e.length;for(r;r<i;r++){const p=e[r];if(o.push(p),e[r+1]?.type!=="comment")break}return[r,{conditions:[],from:n,importingNode:s,nodes:o,type:"nodes"}]},"consumeComments"),qt=k((e,t,s,n,o)=>{const r=Qt(t.params);if(!r)return e.warn(`Invalid @import statement in '${t.toString()}'`,{node:t});const i={conditions:[...n],from:o,fullUri:r.fullUri,importingNode:s,node:t,type:"import",uri:r.uri};return(r.layer!==void 0||r.media!==void 0||r.supports!==void 0||r.scope!==void 0)&&i.conditions.push({layer:r.layer,media:r.media,scope:r.scope,supports:r.supports}),i},"parseImport"),Zt=k((e,t,s,n,o,r)=>{const i=[];let p=n;const l=t.length;for(p;p<l;p++){const c=t[p];if(c.type==="comment"){const[a,f]=ge(t,p,o,r);i.push(f),p=a;continue}if(c.type==="atrule"&&he.test(c.name)){i.push(qt(e,c,o,s,r));continue}break}return[p-1,i]},"consumeImports"),Kt=k((e,t,s,n,o)=>{const r=[];let i=s;const p=e.length;for(i;i<p;i++){const l=e[i];r.push(l);const c=e[i+1];if(!(c&&c.type==="atrule"&&C.test(c.name)&&!c.nodes))break}return[i,{conditions:[...t],from:o,importingNode:n,nodes:r,type:"nodes"}]},"consumeLayers"),es=k((e,t,s,n,o)=>{const r=[];let i=s;const p=e.length;for(i;i<p;i++){const l=e[i];if(l.type==="comment"){const[c,a]=ge(e,i,n,o);r.push(a),i=c;continue}if(l.type==="atrule"&&C.test(l.name)&&!l.nodes)if(t.length>0){r.push({conditions:[...t],from:o,importingNode:n,node:l,type:"pre-import"});continue}else{const[c,a]=Kt(e,t,i,n,o);r.push(a),i=c;continue}break}return[i-1,r]},"consumeBeforeImports"),ve=k((e,t,s,n,o)=>{const r={statements:[]};if(t.type==="document")return t.each(f=>{const u=ve(e,f,s,n,o);if(r.charset&&u.charset&&r.charset.params.toLowerCase()!==u.charset.params.toLowerCase())throw u.charset.error(`Incompatible @charset statements:
3
3
  ${u.charset.params} specified in ${u.charset.source?.input.file}
4
- ${o.charset.params} specified in ${o.charset.source?.input.file}`);!o.charset&&u.charset&&(o.charset=u.charset),o.statements.push(...u.statements)}),o;let i,p=[],l=[],c;for(let f=0;f<t.nodes.length;f++){const u=t.nodes[f];if(f===0&&u.type==="atrule"&&Ht.test(u.name)){i=u;continue}if(l.length===0&&(u.type==="comment"||u.type==="atrule"&&C.test(u.name)&&!u.nodes)){[f,p]=rs(t.nodes,n,f,s,r);continue}if(l.length===0&&u.type==="atrule"&&he.test(u.name)){[f,l]=ts(e,t.nodes,n,f,s,r);continue}c={conditions:[...n],from:r,importingNode:s,nodes:t.nodes.slice(f),type:"nodes"};break}const a=[];return p.length>0&&a.push(...p),l.length>0&&a.push(...l),c&&a.push(c),{charset:i,statements:a}},"parseStylesheet");var os=Object.defineProperty,W=d((e,t)=>os(e,"name",{value:t,configurable:!0}),"h");const ns=/^(?:[a-z]+:)?\/\//i,is=W(e=>{if(ns.test(e))return!1;try{if(new URL(e,"https://example.com").search)return!1}catch{}return!0},"isProcessableURL"),ae=W(async(e,t,s,n,r,o)=>{const{conditions:i,from:p,node:l}=t,c=i.map(h=>z(h.layer,h.media,h.supports,h.scope)).join(":");if(n.skipDuplicates){if(r.importedFiles[s]?.[c])return{statements:[]};r.importedFiles[s]||(r.importedFiles[s]={}),r.importedFiles[s][c]=!0}if(p.includes(s))return{statements:[]};const a=await n.load(s,n);if(a.trim()===""&&n.warnOnEmpty)return e.warn(`${s} is empty`,{node:l}),{statements:[]};if(n.skipDuplicates&&r.hashFiles[a]?.[c])return{statements:[]};const f=await Jt(e,a,s,n,o),u=f.root;return n.debug&&u.append({text:s}),e.messages=[...e.messages,...f.messages],n.skipDuplicates&&(u.some(h=>h.type==="atrule"&&h.name==="import")||(r.hashFiles[a]||(r.hashFiles[a]={}),r.hashFiles[a][c]=!0)),await ye(n,e,u,r,l,i,[...p,s],o)},"loadImportContent"),as=W(async(e,t,s,n,r)=>{if(Y(s.uri)){s.stylesheet=await ae(t,s,s.uri,e,n,r);return}if(Y(s.from.at(-1))){s.stylesheet={statements:[]},t.warn(`Unable to import '${s.uri}' from a stylesheet that is embedded in a data url`,{node:s.node});return}const o=s.node;let i;o.source?.input.file&&(i=o.source.input.file);const p=i?S(i):e.root;for(const[c,a]of Object.entries(e.alias))s.uri!==c&&!s.uri.startsWith(`${c}/`)||(s.uri=x(a)+s.uri.slice(c.length));let l;try{l=await e.resolve(s.uri,p,e.extensions,o)}catch{s.node.warn(t,`Unable to resolve "${s.uri}" from "${p}"`);return}t.messages.push({file:l,parent:i,plugin:"packem-postcss-import",type:"dependency"}),s.stylesheet=await ae(t,s,l,e,n,r)},"resolveImportId"),ye=W(async(e,t,s,n,r,o,i,p)=>{let{charset:l,statements:c}=ve(t,s,r,o,i);{const a=[];for await(const f of c)!_(f)||!is(f.uri)||e.filter&&!e.filter(f.uri)||a.push(as(e,t,f,n,p));a.length>0&&await Promise.all(a)}for(let a=0;a<c.length;a++){const f=c[a];if(_(f)&&f.stylesheet){if(l&&f.stylesheet.charset&&l.params.toLowerCase()!==f.stylesheet.charset.params.toLowerCase())throw f.stylesheet.charset.error(`Incompatible @charset statements:
4
+ ${r.charset.params} specified in ${r.charset.source?.input.file}`);!r.charset&&u.charset&&(r.charset=u.charset),r.statements.push(...u.statements)}),r;let i,p=[],l=[],c;for(let f=0;f<t.nodes.length;f++){const u=t.nodes[f];if(f===0&&u.type==="atrule"&&Xt.test(u.name)){i=u;continue}if(l.length===0&&(u.type==="comment"||u.type==="atrule"&&C.test(u.name)&&!u.nodes)){[f,p]=es(t.nodes,n,f,s,o);continue}if(l.length===0&&u.type==="atrule"&&he.test(u.name)){[f,l]=Zt(e,t.nodes,n,f,s,o);continue}c={conditions:[...n],from:o,importingNode:s,nodes:t.nodes.slice(f),type:"nodes"};break}const a=[];return p.length>0&&a.push(...p),l.length>0&&a.push(...l),c&&a.push(c),{charset:i,statements:a}},"parseStylesheet");var ts=Object.defineProperty,W=d((e,t)=>ts(e,"name",{value:t,configurable:!0}),"h");const ss=/^(?:[a-z]+:)?\/\//i,rs=W(e=>{if(ss.test(e))return!1;try{if(new URL(e,"https://example.com").search)return!1}catch{}return!0},"isProcessableURL"),ae=W(async(e,t,s,n,o,r)=>{const{conditions:i,from:p,node:l}=t,c=i.map(h=>z(h.layer,h.media,h.supports,h.scope)).join(":");if(n.skipDuplicates){if(o.importedFiles[s]?.[c])return{statements:[]};o.importedFiles[s]||(o.importedFiles[s]={}),o.importedFiles[s][c]=!0}if(p.includes(s))return{statements:[]};const a=await n.load(s,n);if(a.trim()===""&&n.warnOnEmpty)return e.warn(`${s} is empty`,{node:l}),{statements:[]};if(n.skipDuplicates&&o.hashFiles[a]?.[c])return{statements:[]};const f=await Bt(e,a,s,n,r),u=f.root;return n.debug&&u.append({text:s}),e.messages=[...e.messages,...f.messages],n.skipDuplicates&&(u.some(h=>h.type==="atrule"&&h.name==="import")||(o.hashFiles[a]||(o.hashFiles[a]={}),o.hashFiles[a][c]=!0)),await ye(n,e,u,o,l,i,[...p,s],r)},"loadImportContent"),os=W(async(e,t,s,n,o)=>{if(Y(s.uri)){s.stylesheet=await ae(t,s,s.uri,e,n,o);return}if(Y(s.from.at(-1))){s.stylesheet={statements:[]},t.warn(`Unable to import '${s.uri}' from a stylesheet that is embedded in a data url`,{node:s.node});return}const r=s.node;let i;r.source?.input.file&&(i=r.source.input.file);const p=i?S(i):e.root;for(const[c,a]of Object.entries(e.alias))s.uri!==c&&!s.uri.startsWith(`${c}/`)||(s.uri=x(a)+s.uri.slice(c.length));let l;try{l=await e.resolve(s.uri,p,e.extensions,r)}catch{s.node.warn(t,`Unable to resolve "${s.uri}" from "${p}"`);return}t.messages.push({file:l,parent:i,plugin:"packem-postcss-import",type:"dependency"}),s.stylesheet=await ae(t,s,l,e,n,o)},"resolveImportId"),ye=W(async(e,t,s,n,o,r,i,p)=>{let{charset:l,statements:c}=ve(t,s,o,r,i);{const a=[];for await(const f of c)!_(f)||!rs(f.uri)||e.filter&&!e.filter(f.uri)||a.push(os(e,t,f,n,p));a.length>0&&await Promise.all(a)}for(let a=0;a<c.length;a++){const f=c[a];if(_(f)&&f.stylesheet){if(l&&f.stylesheet.charset&&l.params.toLowerCase()!==f.stylesheet.charset.params.toLowerCase())throw f.stylesheet.charset.error(`Incompatible @charset statements:
5
5
  ${f.stylesheet.charset.params} specified in ${f.stylesheet.charset.source?.input.file}
6
- ${l.params} specified in ${l.source?.input.file}`);!l&&f.stylesheet.charset&&(l=f.stylesheet.charset),c.splice(a,1,...f.stylesheet.statements),a--}}return{charset:l,statements:c}},"parseStyles");var cs=Object.defineProperty,ps=d((e,t)=>cs(e,"name",{value:t,configurable:!0}),"r$1");const ls=ps(e=>Y(e)?At(e):le(e),"loadContent");var us=Object.defineProperty,fs=d((e,t)=>us(e,"name",{value:t,configurable:!0}),"i$1");const ms="css-import",ds=[".css",".pcss",".postcss",".sss"],$e=fs(e=>{const t={alias:e?.alias??{},extensions:e?.extensions??ds,load:ls,plugins:[],resolve:e?.resolve??Lt,skipDuplicates:!1,...e};return{async Once(s,{atRule:n,postcss:r,result:o}){const i={hashFiles:{},importedFiles:{}};if(s.source?.input.file&&(i.importedFiles[s.source.input.file]={}),!Array.isArray(t.plugins))throw new TypeError("plugins option must be an array");const p=await ye(t,o,s,i,null,[],[],r);Nt(p),xt(p,n),Ct(p,s)},postcssPlugin:ms}},"plugin");$e.postcss=!0;var hs=Object.defineProperty,gs=d((e,t)=>hs(e,"name",{value:t,configurable:!0}),"n$1");const vs=gs((e="[name]_[local]_[hash:8]")=>(t,s,n)=>{const{base:r,dir:o,name:i}=Z(s),p=K(`${r}:${n}`),l=L.exec(e),c=l&&Number.parseInt(l[1],10);return q(e.replace("[dir]",I(o)).replace("[name]",i.replace(/\.module$/,"")).replace("[local]",t).replace(L,c?p.slice(0,c):p))},"generate");var ys=Object.defineProperty,$s=d((e,t)=>ys(e,"name",{value:t,configurable:!0}),"r");const bs=$s(e=>{const t={mode:"local",...e,generateScopedName:typeof e.generateScopedName=="function"?e.generateScopedName:vs(e.generateScopedName)};return[Ke(),qe({mode:t.mode}),Ye({failOnWrongOrder:t.failOnWrongOrder}),Ze({exportGlobals:t.exportGlobals,generateScopedName:t.generateScopedName})]},"default");var ws=Object.defineProperty,Ss=d((e,t)=>ws(e,"name",{value:t,configurable:!0}),"c$2");const js=Ss((e,t,s)=>{const{base:n,dir:r,ext:o,name:i}=Z(t),p=K(`${n}:${Buffer.from(s).toString()}`),l=L.exec(e),c=l&&Number.parseInt(l[1],10);return e.replace("[dir]",I(r)).replace("[name]",i).replace("[extname]",o).replace(".[ext]",o).replace("[ext]",o.slice(1)).replace(L,c?p.slice(0,c):p.slice(0,8))},"default");var Os=Object.defineProperty,Ps=d((e,t)=>Os(e,"name",{value:t,configurable:!0}),"a$2");const xs=Ps((e,t)=>{const s=et(e)||"application/octet-stream",n=Buffer.from(t).toString("base64");return`data:${s};base64,${n}`},"default");var Rs=Object.defineProperty,ks=d((e,t)=>Rs(e,"name",{value:t,configurable:!0}),"a$1");const Ns=ks(async(e,t)=>{const s=new URL(e,"file://"),n=s.hash?s.hash.slice(1):"",r=e.split("?")[0]??"",o=[r];r.startsWith("/")&&o.push("."+r),!r.startsWith("/")&&!r.startsWith(".")&&o.push("./"+r);const i=F(o,{baseDirs:t,caller:"URL resolver"}),p=new URLSearchParams(s.search).toString();return{from:i,source:le(i,{buffer:!0}),urlQuery:(p?"?"+p:"")+(n?"#"+n:"")}},"urlResolve");var Es=Object.defineProperty,be=d((e,t)=>Es(e,"name",{value:t,configurable:!0}),"n");const ce=/^url$/i,Is=/^(?:-webkit-)?image-set$/i,Cs=be(e=>/(?:url|(?:-webkit-)?image-set)\(/i.test(e.value),"isDeclWithUrl"),Us=be((e,t)=>{e.walk(s=>{if(s.type==="function"){if(ce.test(s.value)){const{nodes:n}=s,[r]=n,o=r?.type==="string"?r.value:V.stringify(n);t(o.replaceAll(/^\s+|\s+$/g,""),r);return}if(Is.test(s.value))for(const n of s.nodes){if(n.type==="string"){t(n.value.replaceAll(/^\s+|\s+$/g,""),n);continue}if(n.type==="function"&&ce.test(n.value)){const{nodes:r}=n,[o]=r,i=o?.type==="string"?o.value:V.stringify(r);t(i.replaceAll(/^\s+|\s+$/g,""),o)}}}})},"walkUrls");var Ds=Object.defineProperty,Ls=d((e,t)=>Ds(e,"name",{value:t,configurable:!0}),"$");const J="packem-css-url",_s="assets/[name]-[hash][extname]",Fs="assets/[name][extname]",Ts="./assets/",Ws=".",we=Ls(e=>{const t={alias:{},assetDir:Ws,inline:!1,resolve:Ns,...e},s=t.hash??!0?typeof t.hash=="string"?t.hash:_s:Fs;return{async Once(n,{result:r}){if(!n.source?.input.file)return;const{file:o}=n.source.input,i=D(n.source.input.map?.text??void 0).resolve(S(o)).toConsumer(),p=[],l=new Set(r.messages.filter(a=>a.type==="dependency").map(a=>a.file));n.walkDecls(a=>{if(!Cs(a))return;const f=V(a.value);Us(f,(u,h)=>{for(const[y,v]of Object.entries(t.alias))u!==y&&!u.startsWith(`${y}/`)||(u=x(v)+u.slice(y.length));if(!h||u.length===0){a.warn(r,`Empty URL in \`${a.toString()}\``);return}if(Le.test(u))return;if(!Ie(u))try{new URL(u);return}catch{}const b=new Set;if(a.source?.input.file&&l.has(a.source.input.file)&&b.add(S(a.source.input.file)),a.source?.start){const y=a.source.start,v=i?.originalPositionFor(y),w=v?.source&&S(v.source);w&&b.add(x(w))}b.add(S(o)),p.push({baseDirs:b,decl:a,node:h,parsed:f,url:u})})});const c=new Map;for await(const{baseDirs:a,decl:f,node:u,parsed:h,url:b}of p){let y;try{y||(y=await t.resolve(b,[...a]))}catch{}if(!y){f.warn(r,`Unresolved URL \`${b}\` in \`${f.toString()}\``);continue}const{from:v,source:w,urlQuery:m}=y;if(!(w instanceof Uint8Array)||typeof v!="string"){f.warn(r,`Incorrectly resolved URL \`${b}\` in \`${f.toString()}\``);continue}if(r.messages.push({file:v,plugin:J,type:"dependency"}),t.inline)u.type="string",u.value=xs(v,w);else{const $=x(js(s,v,w));let g=$;const j=se.test($);for(let O=1;c.has(g)&&c.get(g)!==v;O++)g=j?$.replace(se,`${String(O)}$1`):`${$}${String(O)}`;c.set(g,v);const k=typeof t.publicPath=="string"?t.publicPath+(/[/\\]$/.test(t.publicPath)?"":"/")+I(g):`${Ts}${I(g)}`;u.type="string",u.value=typeof t.publicPath=="function"?t.publicPath(u.value,k,o):k,m&&(u.value+=m),typeof t.assetDir=="string"?g=pe(t.assetDir,g):typeof t.assetDir=="function"&&(g=t.assetDir(v,g,o)),r.messages.push({plugin:J,source:w,to:g,type:"asset"})}f.value=h.toString()}},postcssPlugin:J}},"plugin");we.postcss=!0;var As=Object.defineProperty,Se=d((e,t)=>As(e,"name",{value:t,configurable:!0}),"j");const Ms=S(ke(import.meta.url));let E;const P="css",Bs=new Set([P]),Xs=Se(e=>{const t=q(e);return Bs.has(t)?`_${t}`:t},"getClassNameDefault"),mr={alwaysProcess:!0,name:"postcss",async process({code:e,extracted:t,map:s}){const n=await it(this.id,this.cwd,this.environment,this.options.config),r=[];let o=!1;typeof this.options.modules=="boolean"?o=this.options.modules:typeof this.options.modules=="object"&&(o=re(this.options.modules.include,this.id)),this.autoModules&&this.options.modules===void 0&&(o=re(this.autoModules,this.id));const i={},p=[],l={...n.options,...this.options,from:this.id,map:{annotation:!1,inline:!1,prev:D(s).relative(S(this.id)).toObject(),sourcesContent:this.sourceMap?this.sourceMap.content:!0},plugins:[],to:this.options.to??this.id};if(this.options.import&&r.push($e({debug:this.debug,extensions:this.extensions,plugins:[],root:this.cwd,warnOnEmpty:!0,...this.options.import})),this.options.url&&r.push(we({inline:!!this.inject,...this.options.url})),this.options.plugins&&r.push(...this.options.plugins),r.push(...n.plugins),o){const m=typeof this.options.modules=="object"?this.options.modules:{};r.push(...bs({failOnWrongOrder:!0,...m}),ue({extensions:this.extensions}))}r.length===0&&r.push(ee),this.debug&&r.push(Ne({ignore:["css-noop"]}));const c=await Ue(r).process(e,l);for(const m of c.messages)switch(m.type){case"warning":{this.warn({message:m.text,plugin:m.plugin});break}case"icss":{Object.assign(i,m.export);break}case"icss-dependency":{p.push(m.import);break}case"dependency":{this.deps.add(x(m.file));break}case"asset":{this.assets.set(m.to,m.source);break}}if(s=D(c.map.toJSON()).resolve(S(l.to)).toString(),!this.extract&&this.sourceMap){const m=D(s).modify($=>{$.file=void 0}).relative();this.sourceMap.transform&&m.modify(this.sourceMap.transform),s=m.toString(),c.css+=m.toCommentData()}const a=Se(m=>rt(m,I(this.id)),"saferId"),f=a("modules"),u=[`var ${P} = ${JSON.stringify(c.css)};`],h=[],b=[P];if(this.namedExports){this.dts&&h.push(`declare const ${P}: string;`);const m=typeof this.namedExports=="function"?this.namedExports:Xs;for(const $ in i){const g=m($);$!==g&&this.warn(`Exported \`${$}\` as \`${g}\` in ${Ce(this.cwd,this.id)}`);const j=JSON.stringify(i[$]);u.push(`var ${g} = ${j};`),this.dts&&h.push(`declare const ${g}: ${j};`),b.push(g)}}if(this.extract&&(t={css:c.css,id:this.id,map:s}),this.inject)if(typeof this.inject=="function")u.push(this.inject(P,this.id,u),`var ${f} = ${JSON.stringify(i)};`);else{const{treeshakeable:m,...$}=typeof this.inject=="object"?this.inject:{},g=a("injector"),j=`${g}(${P},${JSON.stringify($)});`;if(E||(E=F(["./runtime/inject-css"],{baseDirs:[pe(Ms,"..","..")]}),E=`"${x(E)}"`),u.unshift(`import ${g} from ${E};`),m||u.push(`var ${f} = ${JSON.stringify(i)};`,j),m){u.push("var injected = false;");const k=`if (!injected) { injected = true; ${j} }`;if(i.inject)throw new Error("`inject` keyword is reserved when using `inject.treeshakeable` option");let O="";for(const[je,Oe]of Object.entries(i)){const Pe=JSON.stringify(je),xe=JSON.stringify(Oe);O+=`get ${Pe}() { ${k} return ${xe}; },
7
- `}O+=`inject: function inject() { ${k} },`,u.push(`var ${f} = {${O}};`)}}!this.inject&&Object.keys(i).length>0&&u.push(`var ${f} = ${JSON.stringify(i)};`);const y=`
8
- export default ${o?f:P};
9
- `;if(u.push(y),this.dts&&(o&&h.push(`
6
+ ${l.params} specified in ${l.source?.input.file}`);!l&&f.stylesheet.charset&&(l=f.stylesheet.charset),c.splice(a,1,...f.stylesheet.statements),a--}}return{charset:l,statements:c}},"parseStyles");var ns=Object.defineProperty,is=d((e,t)=>ns(e,"name",{value:t,configurable:!0}),"r$1");const as=is(e=>Y(e)?Ft(e):le(e),"loadContent");var cs=Object.defineProperty,ps=d((e,t)=>cs(e,"name",{value:t,configurable:!0}),"i$1");const ls="css-import",us=[".css",".pcss",".postcss",".sss"],$e=ps(e=>{const t={alias:e?.alias??{},extensions:e?.extensions??us,load:as,plugins:[],resolve:e?.resolve??Ct,skipDuplicates:!1,...e};return{async Once(s,{atRule:n,postcss:o,result:r}){const i={hashFiles:{},importedFiles:{}};if(s.source?.input.file&&(i.importedFiles[s.source.input.file]={}),!Array.isArray(t.plugins))throw new TypeError("plugins option must be an array");const p=await ye(t,r,s,i,null,[],[],o);xt(p),jt(p,n),Et(p,s)},postcssPlugin:ls}},"plugin");$e.postcss=!0;var fs=Object.defineProperty,ms=d((e,t)=>fs(e,"name",{value:t,configurable:!0}),"p$1");let G;const ds=ms(async(e,t,s,n)=>{if(!n)return{file:"",options:{},plugins:[]};const{dir:o}=Z(e),r=n.path?Ne(n.path):o;let i;try{i=(await Ve(t)).path}catch{try{i=await ze(t)}catch{}}try{let p;G?p=G:(p=await Qe({cwd:t,env:s,...n.ctx},r,{stopDir:i}),G=p);const l={file:p.file,options:p.options,plugins:await De(p.plugins,t)};return l.options.parser&&(l.options.parser=await A(l.options.parser,"parser",t)),l.options.syntax&&(l.options.syntax=await A(l.options.syntax,"syntax",t)),l.options.stringifier&&(l.options.stringifier=await A(l.options.stringifier,"stringifier",t)),l}catch(p){if(p.message.includes("No PostCSS Config found in"))return{file:"",options:{},plugins:[]};throw p}},"loadConfig");var hs=Object.defineProperty,gs=d((e,t)=>hs(e,"name",{value:t,configurable:!0}),"n$1");const vs=gs((e="[name]_[local]_[hash:8]")=>(t,s,n)=>{const{base:o,dir:r,name:i}=Z(s),p=K(`${o}:${n}`),l=L.exec(e),c=l&&Number.parseInt(l[1],10);return q(e.replace("[dir]",I(r)).replace("[name]",i.replace(/\.module$/,"")).replace("[local]",t).replace(L,c?p.slice(0,c):p))},"generate");var ys=Object.defineProperty,$s=d((e,t)=>ys(e,"name",{value:t,configurable:!0}),"r");const bs=$s(e=>{const t={mode:"local",...e,generateScopedName:typeof e.generateScopedName=="function"?e.generateScopedName:vs(e.generateScopedName)};return[Ke(),qe({mode:t.mode}),Ye({failOnWrongOrder:t.failOnWrongOrder}),Ze({exportGlobals:t.exportGlobals,generateScopedName:t.generateScopedName})]},"default");var ws=Object.defineProperty,Ss=d((e,t)=>ws(e,"name",{value:t,configurable:!0}),"c$2");const js=Ss((e,t,s)=>{const{base:n,dir:o,ext:r,name:i}=Z(t),p=K(`${n}:${Buffer.from(s).toString()}`),l=L.exec(e),c=l&&Number.parseInt(l[1],10);return e.replace("[dir]",I(o)).replace("[name]",i).replace("[extname]",r).replace(".[ext]",r).replace("[ext]",r.slice(1)).replace(L,c?p.slice(0,c):p.slice(0,8))},"default");var Os=Object.defineProperty,Ps=d((e,t)=>Os(e,"name",{value:t,configurable:!0}),"a$1");const xs=Ps((e,t)=>{const s=et(e)||"application/octet-stream",n=Buffer.from(t).toString("base64");return`data:${s};base64,${n}`},"default");var ks=Object.defineProperty,Rs=d((e,t)=>ks(e,"name",{value:t,configurable:!0}),"a");const Es=Rs(async(e,t)=>{const s=new URL(e,"file://"),n=s.hash?s.hash.slice(1):"",o=e.split("?")[0]??"",r=[o];o.startsWith("/")&&r.push("."+o),!o.startsWith("/")&&!o.startsWith(".")&&r.push("./"+o);const i=F(r,{baseDirs:t,caller:"URL resolver"}),p=new URLSearchParams(s.search).toString();return{from:i,source:le(i,{buffer:!0}),urlQuery:(p?"?"+p:"")+(n?"#"+n:"")}},"urlResolve");var Ns=Object.defineProperty,be=d((e,t)=>Ns(e,"name",{value:t,configurable:!0}),"n");const ce=/^url$/i,Is=/^(?:-webkit-)?image-set$/i,Cs=be(e=>/(?:url|(?:-webkit-)?image-set)\(/i.test(e.value),"isDeclWithUrl"),Us=be((e,t)=>{e.walk(s=>{if(s.type==="function"){if(ce.test(s.value)){const{nodes:n}=s,[o]=n,r=o?.type==="string"?o.value:V.stringify(n);t(r.replaceAll(/^\s+|\s+$/g,""),o);return}if(Is.test(s.value))for(const n of s.nodes){if(n.type==="string"){t(n.value.replaceAll(/^\s+|\s+$/g,""),n);continue}if(n.type==="function"&&ce.test(n.value)){const{nodes:o}=n,[r]=o,i=r?.type==="string"?r.value:V.stringify(o);t(i.replaceAll(/^\s+|\s+$/g,""),r)}}}})},"walkUrls");var Ds=Object.defineProperty,Ls=d((e,t)=>Ds(e,"name",{value:t,configurable:!0}),"$");const J="packem-css-url",_s="assets/[name]-[hash][extname]",Fs="assets/[name][extname]",Ts="./assets/",Ws=".",we=Ls(e=>{const t={alias:{},assetDir:Ws,inline:!1,resolve:Es,...e},s=t.hash??!0?typeof t.hash=="string"?t.hash:_s:Fs;return{async Once(n,{result:o}){if(!n.source?.input.file)return;const{file:r}=n.source.input,i=D(n.source.input.map?.text??void 0).resolve(S(r)).toConsumer(),p=[],l=new Set(o.messages.filter(a=>a.type==="dependency").map(a=>a.file));n.walkDecls(a=>{if(!Cs(a))return;const f=V(a.value);Us(f,(u,h)=>{for(const[y,v]of Object.entries(t.alias))u!==y&&!u.startsWith(`${y}/`)||(u=x(v)+u.slice(y.length));if(!h||u.length===0){a.warn(o,`Empty URL in \`${a.toString()}\``);return}if(Le.test(u))return;if(!Ie(u))try{new URL(u);return}catch{}const b=new Set;if(a.source?.input.file&&l.has(a.source.input.file)&&b.add(S(a.source.input.file)),a.source?.start){const y=a.source.start,v=i?.originalPositionFor(y),w=v?.source&&S(v.source);w&&b.add(x(w))}b.add(S(r)),p.push({baseDirs:b,decl:a,node:h,parsed:f,url:u})})});const c=new Map;for await(const{baseDirs:a,decl:f,node:u,parsed:h,url:b}of p){let y;try{y||(y=await t.resolve(b,[...a]))}catch{}if(!y){f.warn(o,`Unresolved URL \`${b}\` in \`${f.toString()}\``);continue}const{from:v,source:w,urlQuery:m}=y;if(!(w instanceof Uint8Array)||typeof v!="string"){f.warn(o,`Incorrectly resolved URL \`${b}\` in \`${f.toString()}\``);continue}if(o.messages.push({file:v,plugin:J,type:"dependency"}),t.inline)u.type="string",u.value=xs(v,w);else{const $=x(js(s,v,w));let g=$;const j=se.test($);for(let O=1;c.has(g)&&c.get(g)!==v;O++)g=j?$.replace(se,`${String(O)}$1`):`${$}${String(O)}`;c.set(g,v);const R=typeof t.publicPath=="string"?t.publicPath+(/[/\\]$/.test(t.publicPath)?"":"/")+I(g):`${Ts}${I(g)}`;u.type="string",u.value=typeof t.publicPath=="function"?t.publicPath(u.value,R,r):R,m&&(u.value+=m),typeof t.assetDir=="string"?g=pe(t.assetDir,g):typeof t.assetDir=="function"&&(g=t.assetDir(v,g,r)),o.messages.push({plugin:J,source:w,to:g,type:"asset"})}f.value=h.toString()}},postcssPlugin:J}},"plugin");we.postcss=!0;var As=Object.defineProperty,Se=d((e,t)=>As(e,"name",{value:t,configurable:!0}),"j");const Ms=S(Re(import.meta.url));let N;const P="css",Bs=new Set([P]),Xs=Se(e=>{const t=q(e);return Bs.has(t)?`_${t}`:t},"getClassNameDefault"),mr={alwaysProcess:!0,name:"postcss",async process({code:e,extracted:t,map:s}){const n=await ds(this.id,this.cwd,this.environment,this.options.config),o=[];let r=!1;typeof this.options.modules=="boolean"?r=this.options.modules:typeof this.options.modules=="object"&&(r=re(this.options.modules.include,this.id)),this.autoModules&&this.options.modules===void 0&&(r=re(this.autoModules,this.id));const i={},p=[],l={...n.options,...this.options,from:this.id,map:{annotation:!1,inline:!1,prev:D(s).relative(S(this.id)).toObject(),sourcesContent:this.sourceMap?this.sourceMap.content:!0},plugins:[],to:this.options.to??this.id};if(this.options.import&&o.push($e({debug:this.debug,extensions:this.extensions,plugins:[],root:this.cwd,warnOnEmpty:!0,...this.options.import})),this.options.url&&o.push(we({inline:!!this.inject,...this.options.url})),this.options.plugins&&o.push(...this.options.plugins),o.push(...n.plugins),r){const m=typeof this.options.modules=="object"?this.options.modules:{};o.push(...bs({failOnWrongOrder:!0,...m}),ue({extensions:this.extensions}))}o.length===0&&o.push(ee),this.debug&&o.push(Ee({ignore:["css-noop"]}));const c=await Ue(o).process(e,l);for(const m of c.messages)switch(m.type){case"warning":{this.warn({message:m.text,plugin:m.plugin});break}case"icss":{Object.assign(i,m.export);break}case"icss-dependency":{p.push(m.import);break}case"dependency":{this.deps.add(x(m.file));break}case"asset":{this.assets.set(m.to,m.source);break}}if(s=D(c.map.toJSON()).resolve(S(l.to)).toString(),!this.extract&&this.sourceMap){const m=D(s).modify($=>{$.file=void 0}).relative();this.sourceMap.transform&&m.modify(this.sourceMap.transform),s=m.toString(),c.css+=m.toCommentData()}const a=Se(m=>rt(m,I(this.id)),"saferId"),f=a("modules"),u=[`var ${P} = ${JSON.stringify(c.css)};`],h=[],b=[P];if(this.namedExports){this.dts&&h.push(`declare const ${P}: string;`);const m=typeof this.namedExports=="function"?this.namedExports:Xs;for(const $ in i){const g=m($);$!==g&&this.warn(`Exported \`${$}\` as \`${g}\` in ${Ce(this.cwd,this.id)}`);const j=JSON.stringify(i[$]);u.push(`var ${g} = ${j};`),this.dts&&h.push(`declare const ${g}: ${j};`),b.push(g)}}if(this.extract&&(t={css:c.css,id:this.id,map:s}),this.inject)if(typeof this.inject=="function")u.push(this.inject(P,this.id,u),`var ${f} = ${JSON.stringify(i)};`);else{const{treeshakeable:m,...$}=typeof this.inject=="object"?this.inject:{},g=a("injector"),j=`${g}(${P},${JSON.stringify($)});`;if(N||(N=F(["./runtime/inject-css"],{baseDirs:[pe(Ms,"..","..")]}),N=`"${x(N)}"`),u.unshift(`import ${g} from ${N};`),m||u.push(`var ${f} = ${JSON.stringify(i)};`,j),m){u.push("var injected = false;");const R=`if (!injected) { injected = true; ${j} }`;if(i.inject)throw new Error("`inject` keyword is reserved when using `inject.treeshakeable` option");let O="";for(const[je,Oe]of Object.entries(i)){const Pe=JSON.stringify(je),xe=JSON.stringify(Oe);O+=`get ${Pe}() { ${R} return ${xe}; },
7
+ `}O+=`inject: function inject() { ${R} },`,u.push(`var ${f} = {${O}};`)}}!this.inject&&Object.keys(i).length>0&&u.push(`var ${f} = ${JSON.stringify(i)};`);const y=`
8
+ export default ${r?f:P};
9
+ `;if(u.push(y),this.dts&&(r&&h.push(`
10
10
  interface ModulesExports {
11
11
  ${Object.keys(i).map(m=>` '${m}': string;`).join(`
12
12
  `)}
@@ -16,4 +16,4 @@ ${Object.keys(i).map(m=>` '${m}': string;`).join(`
16
16
  `)}
17
17
  };`;u.push(m),this.dts&&h.push(m)}const v=u.filter(Boolean).join(`
18
18
  `),w=h.length>0?h.filter(Boolean).join(`
19
- `):void 0;return this.emit?{code:c.css,map:s,meta:{icssDependencies:p,moduleContents:v,types:w}}:{code:v,extracted:t,map:s,meta:{types:w}}}};export{mr as default};
19
+ `):void 0;return this.emit?{code:c.css,map:s,meta:{icssDependencies:p,moduleContents:v,types:w}}:{code:v,extracted:t,map:s,meta:{types:w},moduleSideEffects:r||typeof this.inject=="object"&&this.inject.treeshakeable?!1:"no-treeshake"}}};export{mr as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/packem",
3
- "version": "1.4.2",
3
+ "version": "1.5.1",
4
4
  "description": "A fast and modern bundler for Node.js and TypeScript.",
5
5
  "keywords": [
6
6
  "anolilab",