@visulima/packem 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE.md +29 -0
  3. package/dist/builder/typedoc/index.d.cts +1 -1
  4. package/dist/builder/typedoc/index.d.mts +1 -1
  5. package/dist/builder/typedoc/index.d.ts +1 -1
  6. package/dist/cli.mjs +116 -116
  7. package/dist/config.d.cts +2 -2
  8. package/dist/config.d.mts +2 -2
  9. package/dist/config.d.ts +2 -2
  10. package/dist/packem.cjs +82 -82
  11. package/dist/packem.d.cts +2 -2
  12. package/dist/packem.d.mts +2 -2
  13. package/dist/packem.d.ts +2 -2
  14. package/dist/packem.mjs +80 -80
  15. package/dist/packem_shared/Mime-D1OpZjrs.cjs +1 -0
  16. package/dist/packem_shared/Mime-cNdl4f-N.mjs +3 -0
  17. package/dist/packem_shared/constants-C98jAkyM.cjs +1 -0
  18. package/dist/packem_shared/constants-DSQIKVQe.mjs +1 -0
  19. package/dist/packem_shared/{types-CwzNHNx0.d.mts → types-CaDbpbAk.d.mts} +14 -2
  20. package/dist/packem_shared/{types-GPTFx90c.d.cts → types-DYhavt9g.d.cts} +14 -2
  21. package/dist/packem_shared/{types-D8jzF-eM.d.ts → types-lk8-9Jo6.d.ts} +14 -2
  22. package/dist/rollup/plugins/css/loaders/less/index.d.cts +1 -1
  23. package/dist/rollup/plugins/css/loaders/less/index.d.mts +1 -1
  24. package/dist/rollup/plugins/css/loaders/less/index.d.ts +1 -1
  25. package/dist/rollup/plugins/css/loaders/lightningcss.cjs +3 -3
  26. package/dist/rollup/plugins/css/loaders/lightningcss.d.cts +1 -1
  27. package/dist/rollup/plugins/css/loaders/lightningcss.d.mts +1 -1
  28. package/dist/rollup/plugins/css/loaders/lightningcss.d.ts +1 -1
  29. package/dist/rollup/plugins/css/loaders/lightningcss.mjs +3 -3
  30. package/dist/rollup/plugins/css/loaders/postcss/index.cjs +9 -9
  31. package/dist/rollup/plugins/css/loaders/postcss/index.d.cts +1 -1
  32. package/dist/rollup/plugins/css/loaders/postcss/index.d.mts +1 -1
  33. package/dist/rollup/plugins/css/loaders/postcss/index.d.ts +1 -1
  34. package/dist/rollup/plugins/css/loaders/postcss/index.mjs +10 -10
  35. package/dist/rollup/plugins/css/loaders/sass/index.d.cts +1 -1
  36. package/dist/rollup/plugins/css/loaders/sass/index.d.mts +1 -1
  37. package/dist/rollup/plugins/css/loaders/sass/index.d.ts +1 -1
  38. package/dist/rollup/plugins/css/loaders/sourcemap.d.cts +1 -1
  39. package/dist/rollup/plugins/css/loaders/sourcemap.d.mts +1 -1
  40. package/dist/rollup/plugins/css/loaders/sourcemap.d.ts +1 -1
  41. package/dist/rollup/plugins/css/loaders/stylus/index.d.cts +1 -1
  42. package/dist/rollup/plugins/css/loaders/stylus/index.d.mts +1 -1
  43. package/dist/rollup/plugins/css/loaders/stylus/index.d.ts +1 -1
  44. package/dist/rollup/plugins/css/minifiers/cssnano.d.cts +1 -1
  45. package/dist/rollup/plugins/css/minifiers/cssnano.d.mts +1 -1
  46. package/dist/rollup/plugins/css/minifiers/cssnano.d.ts +1 -1
  47. package/dist/rollup/plugins/css/minifiers/lightningcss.d.cts +1 -1
  48. package/dist/rollup/plugins/css/minifiers/lightningcss.d.mts +1 -1
  49. package/dist/rollup/plugins/css/minifiers/lightningcss.d.ts +1 -1
  50. package/dist/rollup/plugins/esbuild/index.cjs +1 -1
  51. package/dist/rollup/plugins/esbuild/index.mjs +1 -1
  52. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.cts +1 -1
  53. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.mts +1 -1
  54. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.ts +1 -1
  55. package/dist/rollup/plugins/sucrase/index.cjs +1 -1
  56. package/dist/rollup/plugins/sucrase/index.mjs +1 -1
  57. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.cts +1 -1
  58. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.mts +1 -1
  59. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.ts +1 -1
  60. package/dist/rollup/plugins/swc/swc-plugin.cjs +1 -1
  61. package/dist/rollup/plugins/swc/swc-plugin.mjs +1 -1
  62. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.cts +1 -1
  63. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.mts +1 -1
  64. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.ts +1 -1
  65. package/package.json +4 -5
  66. package/dist/packem_shared/constants-Bcej5NDs.cjs +0 -1
  67. package/dist/packem_shared/constants-ic_mxhvm.mjs +0 -1
  68. package/dist/packem_shared/get-hash-WS4xNEhC.mjs +0 -3
  69. package/dist/packem_shared/get-hash-n81THiHZ.cjs +0 -1
package/dist/cli.mjs CHANGED
@@ -1,45 +1,45 @@
1
1
  #!/usr/bin/env node
2
- var Gs=Object.defineProperty;var f=(e,t)=>Gs(e,"name",{value:t,configurable:!0});import Hs from"@visulima/cerebro";import{SimpleReporter as Ys}from"@visulima/pail/reporter";import Ve,{cwd as zt,env as Se,versions as Xs,exit as Qs}from"node:process";import{installPackage as Xe}from"@antfu/install-pkg";import{spinner as Qe,select as Z,multiselect as Ut,confirm as U,intro as Zs,log as ft,cancel as eo,outro as to}from"@clack/prompts";import{isAccessible as nt,readFile as rt,writeFile as qt,isAccessibleSync as R,readFileSync as Me,writeFileSync as se,writeJsonSync as Te,readJsonSync as it,walk as so,collectSync as oo,ensureDirSync as no,emptyDir as ro}from"@visulima/fs";import{join as x,resolve as j,normalize as J,relative as I,dirname as B,basename as pe,isAbsolute as Ae,parse as ze,toNamespacedPath as Oe,extname as Kt}from"@visulima/path";import G from"magic-string";import{readdirSync as Gt,existsSync as Ht}from"node:fs";import{stat as Yt,chmod as io,rm as ao}from"node:fs/promises";import mt from"node:module";import{cyan as D,bold as q,gray as X,green as lo,yellow as co,grey as po}from"@visulima/colorize";import{findCacheDirSync as uo}from"@visulima/find-cache-dir";import{formatBytes as Y,duration as gt}from"@visulima/humanizer";import{readTsConfig as fo,findTsConfig as mo}from"@visulima/tsconfig";import go from"browserslist";import{defu as ho}from"defu";import{createHooks as yo}from"hookable";import{createJiti as Xt}from"jiti";import{rollup as Qt,watch as ht,VERSION as vo}from"rollup";import{exec as bo}from"tinyexec";import Zt from"@rollup/plugin-alias";import wo from"@rollup/plugin-commonjs";import $o from"@rollup/plugin-dynamic-import-vars";import{nodeResolve as es}from"@rollup/plugin-node-resolve";import ts from"@rollup/plugin-replace";import{wasm as xo}from"@rollup/plugin-wasm";import{isRelative as ss,resolveAlias as jo}from"@visulima/path/utils";import ko from"rollup-plugin-polyfill-node";import{visualizer as Eo}from"rollup-plugin-visualizer";import{minVersion as os,valid as So,coerce as Oo}from"semver";import De from"node:assert/strict";import{extractAssignedNames as Do,createFilter as ne}from"@rollup/pluginutils";import Co from"glob-parent";import{glob as Po,isDynamicPattern as yt,globSync as No}from"tinyglobby";import{SourceMapConsumer as Io,SourceMapGenerator as _o}from"source-map-js";import{interopDefault as Mo,loadModule as To,findStaticImports as ns,fileURLToPath as Ao,resolveModuleExportNames as Ro,resolvePath as vt}from"mlly";import{fileURLToPath as rs}from"node:url";import{ResolverFactory as Fo}from"oxc-resolver";import{parseAsync as Lo}from"oxc-parser";import Jo from"@rollup/plugin-json";import Bo from"rollup-plugin-license";import{createHash as Wo}from"node:crypto";import{parse as Vo}from"@babel/parser";import zo from"child_process";import{parsePackageJson as is}from"@visulima/package/package-json";import{NotFoundError as Uo}from"@visulima/fs/error";import{distance as qo}from"fastest-levenshtein";import __cjs_url__ from "node:url"; // -- packem CommonJS __filename shim --
2
+ var to=Object.defineProperty;var u=(e,t)=>to(e,"name",{value:t,configurable:!0});import io from"@visulima/cerebro";import{SimpleReporter as oo}from"@visulima/pail/reporter";import Ge,{cwd as Xt,env as Pe,versions as no,exit as ao}from"node:process";import{installPackage as it}from"@antfu/install-pkg";import{spinner as ot,select as te,multiselect as Qt,confirm as U,intro as so,log as yt,cancel as ro,outro as lo}from"@clack/prompts";import{isAccessible as Fe,readFile as pt,writeFile as Zt,isAccessibleSync as R,readFileSync as Re,writeFileSync as re,writeJsonSync as Le,readJsonSync as ei,ensureDir as bt,walk as po,collectSync as co,emptyDir as mo,readJson as uo,ensureDirSync as fo}from"@visulima/fs";import{join as k,resolve as j,normalize as J,relative as N,dirname as I,basename as oe,isAbsolute as Je,parse as He,toNamespacedPath as Ne,extname as ct}from"@visulima/path";import H from"magic-string";import wt from"node:module";import{cyan as D,bold as K,gray as Z,green as go,yellow as vo,grey as ho}from"@visulima/colorize";import{findCacheDirSync as xo}from"@visulima/find-cache-dir";import{formatBytes as X,duration as kt}from"@visulima/humanizer";import{readTsConfig as yo,findTsConfig as bo}from"@visulima/tsconfig";import wo from"browserslist";import{defu as ko}from"defu";import{createHooks as jo}from"hookable";import{createJiti as ti}from"jiti";import{rollup as ii,watch as jt,VERSION as $o}from"rollup";import{exec as Eo}from"tinyexec";import{stat as dt,chmod as So,readFile as Oo,readdir as Do,rm as Co}from"node:fs/promises";import{createReadStream as Po,createWriteStream as No,readdirSync as _o,existsSync as oi}from"node:fs";import ni from"@rollup/plugin-alias";import Io from"@rollup/plugin-commonjs";import Mo from"@rollup/plugin-dynamic-import-vars";import{nodeResolve as ai}from"@rollup/plugin-node-resolve";import si from"@rollup/plugin-replace";import{wasm as To}from"@rollup/plugin-wasm";import{isRelative as ri,resolveAlias as Ao}from"@visulima/path/utils";import zo from"rollup-plugin-polyfill-node";import{visualizer as Fo}from"rollup-plugin-visualizer";import{minVersion as li,valid as Ro,coerce as Lo}from"semver";import _e from"node:assert/strict";import{extractAssignedNames as Jo,createFilter as ne}from"@rollup/pluginutils";import qo from"glob-parent";import{glob as Bo,isDynamicPattern as $t,globSync as Wo}from"tinyglobby";import{SourceMapConsumer as Vo,SourceMapGenerator as Uo}from"source-map-js";import{interopDefault as Ko,loadModule as Go,findStaticImports as pi,fileURLToPath as Ho,resolveModuleExportNames as Yo,resolvePath as Et}from"mlly";import{fileURLToPath as ci}from"node:url";import{ResolverFactory as Xo}from"oxc-resolver";import{parseAsync as Qo}from"oxc-parser";import Zo from"@rollup/plugin-json";import en from"rollup-plugin-license";import tn,{createHash as on}from"node:crypto";import{parse as nn}from"@babel/parser";import an from"child_process";import{parsePackageJson as di}from"@visulima/package/package-json";import{NotFoundError as sn}from"@visulima/fs/error";import{distance as rn}from"fastest-levenshtein";import __cjs_url__ from "node:url"; // -- packem CommonJS __filename shim --
3
3
  import __cjs_path__ from "node:path"; // -- packem CommonJS __dirname shim --
4
4
  import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
5
5
  const __filename = __cjs_url__.fileURLToPath(import.meta.url);
6
6
  const __dirname = __cjs_path__.dirname(__filename);
7
7
  const require = __cjs_mod__.createRequire(import.meta.url);
8
- const Ko="@visulima/packem",Go="1.4.2";var Ho=Object.defineProperty,Yo=f((e,t)=>Ho(e,"name",{value:t,configurable:!0}),"t$c");const as=Yo(async(e,t="")=>{let s=t;if(!s){const o=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const n of o)if(await nt(x(e,n))){s="./"+n;break}}if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(s))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return s},"findPackemFile"),ls={less:["less"],lightningcss:["lightningcss"],"node-sass":["node-sass"],postcss:["postcss","postcss-load-config","postcss-modules-extract-imports","postcss-modules-local-by-default","postcss-modules-scope","postcss-modules-values","postcss-value-parser","icss-utils"],sass:["sass"],"sass-embedded":["sass-embedded"],stylus:["stylus"]};var Xo=Object.defineProperty,bt=f((e,t)=>Xo(e,"name",{value:t,configurable:!0}),"f$f");const Qo=["typedoc","typedoc-plugin-markdown","typedoc-plugin-rename-defaults","@ckeditor/typedoc-plugins"],Zo=bt(e=>{e.addCommand({argument:{description:"Add a packem feature to your project",name:"feature",required:!0},description:"Add a optional packem feature to your project",execute:bt(async({argument:t,logger:s,options:o})=>{const n=Qe(),r=j(zt(),o.dir??".");let i;try{i=await as(r,o.config)}catch{s.error("Could not find a packem config file, please run `packem init` first.");return}const l=await rt(i,{buffer:!1});let c="cjs";l.includes("import")&&(c="esm");const a=new G(l);if(t.includes("typedoc")){if(l.includes("typedoc: typedocBuilder")||l.includes("@visulima/packem/builder/typedoc")){s.warn("Typedoc has already been added to the packem config.");return}c==="cjs"?a.prepend(`const typedocBuilder = require("@visulima/packem/builder/typedoc");
9
- `):a.prepend(`import typedocBuilder from "@visulima/packem/builder/typedoc";
10
- `),l.includes("builder: {")?a.replace("builder: {",`builder: {
8
+ const ln="@visulima/packem",pn="1.5.1";var cn=Object.defineProperty,dn=u((e,t)=>cn(e,"name",{value:t,configurable:!0}),"t$c");const mi=dn(async(e,t="")=>{let i=t;if(!i){const o=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const n of o)if(await Fe(k(e,n))){i="./"+n;break}}if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(i))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return i},"findPackemFile"),ui={less:["less"],lightningcss:["lightningcss"],"node-sass":["node-sass"],postcss:["postcss","postcss-load-config","postcss-modules-extract-imports","postcss-modules-local-by-default","postcss-modules-scope","postcss-modules-values","postcss-value-parser","icss-utils"],sass:["sass"],"sass-embedded":["sass-embedded"],stylus:["stylus"]};var mn=Object.defineProperty,St=u((e,t)=>mn(e,"name",{value:t,configurable:!0}),"f$f");const un=["typedoc","typedoc-plugin-markdown","typedoc-plugin-rename-defaults","@ckeditor/typedoc-plugins"],fn=St(e=>{e.addCommand({argument:{description:"Add a packem feature to your project",name:"feature",required:!0},description:"Add a optional packem feature to your project",execute:St(async({argument:t,logger:i,options:o})=>{const n=ot(),a=j(Xt(),o.dir??".");let s;try{s=await mi(a,o.config)}catch{i.error("Could not find a packem config file, please run `packem init` first.");return}const l=await pt(s,{buffer:!1});let p="cjs";l.includes("import")&&(p="esm");const r=new H(l);if(t.includes("typedoc")){if(l.includes("typedoc: typedocBuilder")||l.includes("@visulima/packem/builder/typedoc")){i.warn("Typedoc has already been added to the packem config.");return}p==="cjs"?r.prepend(`const typedocBuilder = require("@visulima/packem/builder/typedoc");
9
+ `):r.prepend(`import typedocBuilder from "@visulima/packem/builder/typedoc";
10
+ `),l.includes("builder: {")?r.replace("builder: {",`builder: {
11
11
  typedoc: typedocBuilder,
12
- `):a.replace("transformer,",`transformer,
12
+ `):r.replace("transformer,",`transformer,
13
13
  builder: {
14
14
  typedoc: typedocBuilder,
15
- },`),s.info("Adding typedoc dependencies..."),n.start("Installing packages"),await Xe(Qo,{cwd:r,dev:!0,silent:!0}),n.stop("Installed packages"),s.success(`
16
- Typedoc added!`)}if(t.includes("css")){if(l.includes("css: {")||l.includes("@visulima/packem/css")){s.warn("Css loaders have already been added to the packem config.");return}const p=[],d=await Z({message:"Pick a css loader",options:[{label:"PostCSS",value:"postcss"},{label:"Lightning CSS",value:"lightningcss"}]});p.push(d);let u=await Ut({message:"Pick extra loaders",options:[{label:"Sass",value:"sass"},{label:"Stylus",value:"stylus"},{label:"Less",value:"less"}],required:!1});if(u.includes("sass")){const y=await Z({message:"Pick a sass loader",options:[{hint:"recommended",label:"Sass embedded",value:"sass-embedded"},{label:"Sass",value:"sass"},{hint:"legacy",label:"Node Sass",value:"node-sass"}]});y!=="sass"&&(u=u.filter(w=>w!=="sass"),u.push(y))}p.push(...u);const m=[];for(const y of p)m.push(...ls[y]);p.push("sourceMap");for(let y of p)(y==="sass-embedded"||y==="node-sass")&&(y="sass"),c==="cjs"?a.prepend(`const ${y}Loader = require("@visulima/packem/css/loader/${y.toLowerCase()}");
17
- `):a.prepend(`import ${y}Loader from "@visulima/packem/css/loader/${y.toLowerCase()}";
18
- `);const v=await U({initialValue:!1,message:"Do you want to minify your css?"});let h;v&&(h=await Z({message:"Pick a css minifier",options:[{label:"CSSNano",value:"cssnano"},{label:"Lightning CSS",value:"lightningcss"}]}),p.includes("lightningcss")||m.push(h),c==="cjs"?a.prepend(`const ${h}Minifier = require("@visulima/packem/css/minifier/${h.toLowerCase()}");
19
- `):a.prepend(`import ${h}Minifier from "@visulima/packem/css/minifier/${h.toLowerCase()}";
20
- `));const g=p.map(y=>((y==="sass-embedded"||y==="node-sass")&&(y="sass"),`${y}Loader`)).join(", ");if(l.includes("rollup: {"))a.replace("rollup: {",`rollup: {
21
- css: {${h?`
22
- minifier: ${h}Minifier,`:""}
15
+ },`),i.info("Adding typedoc dependencies..."),n.start("Installing packages"),await it(un,{cwd:a,dev:!0,silent:!0}),n.stop("Installed packages"),i.success(`
16
+ Typedoc added!`)}if(t.includes("css")){if(l.includes("css: {")||l.includes("@visulima/packem/css")){i.warn("Css loaders have already been added to the packem config.");return}const c=[],m=await te({message:"Pick a css loader",options:[{label:"PostCSS",value:"postcss"},{hint:"experimental",label:"Lightning CSS",value:"lightningcss"}]});c.push(m);let d=await Qt({message:"Pick extra loaders",options:[{label:"Sass",value:"sass"},{label:"Stylus",value:"stylus"},{label:"Less",value:"less"}],required:!1});if(d.includes("sass")){const h=await te({message:"Pick a sass loader",options:[{hint:"recommended",label:"Sass embedded",value:"sass-embedded"},{label:"Sass",value:"sass"},{hint:"legacy",label:"Node Sass",value:"node-sass"}]});h!=="sass"&&(d=d.filter(y=>y!=="sass"),d.push(h))}c.push(...d);const f=[];for(const h of c)f.push(...ui[h]);c.push("sourceMap");for(let h of c)(h==="sass-embedded"||h==="node-sass")&&(h="sass"),p==="cjs"?r.prepend(`const ${h}Loader = require("@visulima/packem/css/loader/${h.toLowerCase()}");
17
+ `):r.prepend(`import ${h}Loader from "@visulima/packem/css/loader/${h.toLowerCase()}";
18
+ `);const x=await U({initialValue:!1,message:"Do you want to minify your css?"});let v;x&&(v=await te({message:"Pick a css minifier",options:[{label:"CSSNano",value:"cssnano"},{label:"Lightning CSS",value:"lightningcss"}]}),c.includes("lightningcss")||f.push(v),p==="cjs"?r.prepend(`const ${v}Minifier = require("@visulima/packem/css/minifier/${v.toLowerCase()}");
19
+ `):r.prepend(`import ${v}Minifier from "@visulima/packem/css/minifier/${v.toLowerCase()}";
20
+ `));const g=c.map(h=>((h==="sass-embedded"||h==="node-sass")&&(h="sass"),`${h}Loader`)).join(", ");if(l.includes("rollup: {"))r.replace("rollup: {",`rollup: {
21
+ css: {${v?`
22
+ minifier: ${v}Minifier,`:""}
23
23
  loaders: [${g}],
24
24
  },
25
- `);else{const y=l.includes(" transformer,")?" transformer,":" transformer";a.replace(y,` transformer,
25
+ `);else{const h=l.includes(" transformer,")?" transformer,":" transformer";r.replace(h,` transformer,
26
26
  rollup: {
27
- css: {${h?`
28
- minifier: ${h}Minifier,`:""}
27
+ css: {${v?`
28
+ minifier: ${v}Minifier,`:""}
29
29
  loaders: [${g}],
30
30
  },
31
- },`)}n.start("Installing packages"),await Xe(m,{cwd:r,dev:!0,silent:!0}),n.stop("Installed packages"),s.success(`
32
- CSS loaders added!`)}await qt(i,a.toString(),{overwrite:!0})},"execute"),name:"add",options:[{defaultValue:".",description:"The directory to build",name:"dir",type:String},{description:"Use a custom config file",name:"config",type:String}]})},"createAddCommand"),at=[".mjs",".js",".json",".node",".cjs",".ts",".cts",".mts",".tsx",".ctsx",".mtsx",".jsx"],K="production",ye="development",lt=new Set(["react-server","react-native","edge-light"]),Ce=new Set([ye,K,...lt]),le=/node_modules/,oe=/(?:\.d\.[mc]?tsx?|\.\w+)$/,en="packem_chunks",tn="packem_shared",fe=/\.(?:m|c)?(?:j|t)sx?$/;var sn=Object.defineProperty,on=f((e,t)=>sn(e,"name",{value:t,configurable:!0}),"a$n");const Ze=on((e,t)=>e.some(s=>s instanceof RegExp?s.test(t):s===t),"arrayIncludes");var nn=Object.defineProperty,rn=f((e,t)=>nn(e,"name",{value:t,configurable:!0}),"a$m");const he=rn(e=>e==null?[]:Array.isArray(e)?e:[e],"arrayify");var an=Object.defineProperty,ln=f((e,t)=>an(e,"name",{value:t,configurable:!0}),"a$l");const cs=ln((e="")=>{const t=e.split("/");return t[0].startsWith("@")?t[0]+"/"+t[1]:t[0]},"getPackageName");var cn=Object.defineProperty,ps=f((e,t)=>cn(e,"name",{value:t,configurable:!0}),"s$f");const pn=ps((e,t,s)=>{const o=s??new Map;return(...n)=>{const r=t?typeof t=="function"?t(...n):t:JSON.stringify({args:n}),i=o.get(r);if(i!==void 0)return i;const l=e(...n);return o.set(r,l),l}},"memoize"),un=ps(e=>{const t=new Map;return s=>pn(e,s,t)},"memoizeByKey");var dn=Object.defineProperty,ve=f((e,t)=>dn(e,"name",{value:t,configurable:!0}),"r$g");const fn=ve(function*(e){switch(e.declaration?.type){case"ClassDeclaration":case"FunctionDeclaration":{const{id:t}=e.declaration;De(t,"Expected class/function to have a name"),yield t.name;break}case"VariableDeclaration":{for(const t of e.declaration.declarations)for(const s of Do(t.id))yield s;break}}},"exportName"),mn=ve(function*(e){if(e.declaration)for(const t of fn(e))yield{exportedName:t,from:"self",type:"named"};else if(e.source)yield{bindings:e.specifiers.map(t=>({exportedName:t.exported.name,importedName:t.local.name})),from:"other",source:e.source.value,type:"named"};else for(const t of e.specifiers)yield{exportedName:t.exported.name,from:"self",type:"named"}},"parseExportNamed"),gn=ve(function*(e){e.exported?yield{exportedName:e.exported.name,from:"self",type:"named"}:yield{from:"other",source:e.source.value,type:"barrel"}},"parseExportAll"),hn=ve(function*(){yield{exportedName:"default",from:"self",type:"named"}},"parseExportDefault"),yn=ve(function*(e,t){De(t.code!=null,`Module ${t.id} doesn't have associated code`);const s=e.parse(t.code);for(const o of s.body)switch(o.type){case"ExportAllDeclaration":{yield*gn(o);break}case"ExportDefaultDeclaration":{yield*hn();break}case"ExportNamedDeclaration":{yield*mn(o);break}}},"parseExports");var vn=Object.defineProperty,be=f((e,t)=>vn(e,"name",{value:t,configurable:!0}),"n$d");const us=be(async function(e,t,s){const o=await e.resolve(t,s.id);if(De(o,`Rollup can't resolve ${t} from ${s.id}`),o.external)return null;const n=await e.load(o);return De(n,`Rollup doesn't have a module for id ${o.id}`),n},"getImportedModule"),bn=be(async function*(e,t,s){const o=await us(e,t.source,s);o&&(yield*ct(e,o))},"gatherBarrelReExports"),wn=be(async function*(e,t,s){const o=await us(e,t.source,s);if(!o)return;const n=new Map(t.bindings.map(r=>[r.importedName,r]));for await(const r of ct(e,o)){const i=n.get(r.exportedName);i&&(yield{...r,exportedName:i.exportedName})}},"gatherNamedReExports"),$n=be(async function*(e,t){yield{exportedName:t.exportedName,id:e.id,sourceName:t.exportedName}},"gatherNamedSelfExports"),ct=be(async function*(e,t){for(const s of yn(e,t))s.from==="self"?yield*$n(t,s):s.type==="barrel"?yield*bn(e,s,t):yield*wn(e,s,t)},"gatherExports");var xn=Object.defineProperty,jn=f((e,t)=>xn(e,"name",{value:t,configurable:!0}),"r$f");const kn=jn(()=>({moduleParsed:{async handler(e){if(e.isEntry)for await(const t of ct(this,e))t.id!==e.id&&this.emitFile({id:t.id,name:t.exportedName,preserveSignature:"exports-only",type:"chunk"})},order:"post"},name:"packem:chunk-splitter"}),"chunkSplitter");var En=Object.defineProperty,Sn=f((e,t)=>En(e,"name",{value:t,configurable:!0}),"r$e");const On=Sn((e,t)=>{const s=e,o=[];let n;for(;(n=s.exec(t))!==null;)n.index===s.lastIndex&&s.lastIndex++,n.forEach(r=>{o.push(r)});return o.filter(Boolean)},"getRegexMatches");var Dn=Object.defineProperty,Cn=f((e,t)=>Dn(e,"name",{value:t,configurable:!0}),"a$k");const ds=Cn(e=>{const t=On(/export\s(\{\s(.*)\s\}|default\s.*);/g,e);if(t.length===0)return null;const s=t.at(-1).split(", ");let o="";for(const n of s)if(!n.includes("type")&&(n.includes("default ")&&(o=n.split("default ")[1]),n.includes("as"))){const[r,i]=n.split(" as ");i==="default"&&(o=r)}if(o!==""){const n=new G(e);return n.replace(new RegExp(`(,s)?${o} as default(,)?`),""),n.replace(new RegExp(`export default ${o};
31
+ },`)}n.start("Installing packages"),await it(f,{cwd:a,dev:!0,silent:!0}),n.stop("Installed packages"),i.success(`
32
+ CSS loaders added!`)}await Zt(s,r.toString(),{overwrite:!0})},"execute"),name:"add",options:[{defaultValue:".",description:"The directory to build",name:"dir",type:String},{description:"Use a custom config file",name:"config",type:String}]})},"createAddCommand"),mt=[".mjs",".js",".json",".node",".cjs",".ts",".cts",".mts",".tsx",".ctsx",".mtsx",".jsx"],G="production",we="development",ut=new Set(["react-server","react-native","edge-light"]),Ie=new Set([we,G,...ut]),Q=/node_modules/,le=/(?:\.d\.[mc]?tsx?|\.\w+)$/,gn="packem_chunks",vn="packem_shared",ve=/\.(?:m|c)?(?:j|t)sx?$/;var hn=Object.defineProperty,xn=u((e,t)=>hn(e,"name",{value:t,configurable:!0}),"a$o");const nt=xn((e,t)=>e.some(i=>i instanceof RegExp?i.test(t):i===t),"arrayIncludes");var yn=Object.defineProperty,bn=u((e,t)=>yn(e,"name",{value:t,configurable:!0}),"a$n");const be=bn(e=>e==null?[]:Array.isArray(e)?e:[e],"arrayify");var wn=Object.defineProperty,kn=u((e,t)=>wn(e,"name",{value:t,configurable:!0}),"a$m");const fi=kn((e="")=>{const t=e.split("/");return t[0].startsWith("@")?t[0]+"/"+t[1]:t[0]},"getPackageName");var jn=Object.defineProperty,gi=u((e,t)=>jn(e,"name",{value:t,configurable:!0}),"s$g");const $n=gi((e,t,i)=>{const o=i??new Map;return(...n)=>{const a=t?typeof t=="function"?t(...n):t:JSON.stringify({args:n}),s=o.get(a);if(s!==void 0)return s;const l=e(...n);return o.set(a,l),l}},"memoize"),En=gi(e=>{const t=new Map;return i=>$n(e,i,t)},"memoizeByKey");var Sn=Object.defineProperty,ke=u((e,t)=>Sn(e,"name",{value:t,configurable:!0}),"r$g");const On=ke(function*(e){switch(e.declaration?.type){case"ClassDeclaration":case"FunctionDeclaration":{const{id:t}=e.declaration;_e(t,"Expected class/function to have a name"),yield t.name;break}case"VariableDeclaration":{for(const t of e.declaration.declarations)for(const i of Jo(t.id))yield i;break}}},"exportName"),Dn=ke(function*(e){if(e.declaration)for(const t of On(e))yield{exportedName:t,from:"self",type:"named"};else if(e.source)yield{bindings:e.specifiers.map(t=>({exportedName:t.exported.name,importedName:t.local.name})),from:"other",source:e.source.value,type:"named"};else for(const t of e.specifiers)yield{exportedName:t.exported.name,from:"self",type:"named"}},"parseExportNamed"),Cn=ke(function*(e){e.exported?yield{exportedName:e.exported.name,from:"self",type:"named"}:yield{from:"other",source:e.source.value,type:"barrel"}},"parseExportAll"),Pn=ke(function*(){yield{exportedName:"default",from:"self",type:"named"}},"parseExportDefault"),Nn=ke(function*(e,t){_e(t.code!=null,`Module ${t.id} doesn't have associated code`);const i=e.parse(t.code);for(const o of i.body)switch(o.type){case"ExportAllDeclaration":{yield*Cn(o);break}case"ExportDefaultDeclaration":{yield*Pn();break}case"ExportNamedDeclaration":{yield*Dn(o);break}}},"parseExports");var _n=Object.defineProperty,je=u((e,t)=>_n(e,"name",{value:t,configurable:!0}),"n$d");const vi=je(async function(e,t,i){const o=await e.resolve(t,i.id);if(_e(o,`Rollup can't resolve ${t} from ${i.id}`),o.external)return null;const n=await e.load(o);return _e(n,`Rollup doesn't have a module for id ${o.id}`),n},"getImportedModule"),In=je(async function*(e,t,i){const o=await vi(e,t.source,i);o&&(yield*ft(e,o))},"gatherBarrelReExports"),Mn=je(async function*(e,t,i){const o=await vi(e,t.source,i);if(!o)return;const n=new Map(t.bindings.map(a=>[a.importedName,a]));for await(const a of ft(e,o)){const s=n.get(a.exportedName);s&&(yield{...a,exportedName:s.exportedName})}},"gatherNamedReExports"),Tn=je(async function*(e,t){yield{exportedName:t.exportedName,id:e.id,sourceName:t.exportedName}},"gatherNamedSelfExports"),ft=je(async function*(e,t){for(const i of Nn(e,t))i.from==="self"?yield*Tn(t,i):i.type==="barrel"?yield*In(e,i,t):yield*Mn(e,i,t)},"gatherExports");var An=Object.defineProperty,zn=u((e,t)=>An(e,"name",{value:t,configurable:!0}),"r$f");const Fn=zn(()=>({moduleParsed:{async handler(e){if(e.isEntry)for await(const t of ft(this,e))t.id!==e.id&&this.emitFile({id:t.id,name:t.exportedName,preserveSignature:"exports-only",type:"chunk"})},order:"post"},name:"packem:chunk-splitter"}),"chunkSplitter");var Rn=Object.defineProperty,Ln=u((e,t)=>Rn(e,"name",{value:t,configurable:!0}),"r$e");const Jn=Ln((e,t)=>{const i=e,o=[];let n;for(;(n=i.exec(t))!==null;)n.index===i.lastIndex&&i.lastIndex++,n.forEach(a=>{o.push(a)});return o.filter(Boolean)},"getRegexMatches");var qn=Object.defineProperty,Bn=u((e,t)=>qn(e,"name",{value:t,configurable:!0}),"a$l");const hi=Bn(e=>{const t=Jn(/export\s(\{\s(.*)\s\}|default\s.*);/g,e);if(t.length===0)return null;const i=t.at(-1).split(", ");let o="";for(const n of i)if(!n.includes("type")&&(n.includes("default ")&&(o=n.split("default ")[1]),n.includes("as"))){const[a,s]=n.split(" as ");s==="default"&&(o=a)}if(o!==""){const n=new H(e);return n.replace(new RegExp(`(,s)?${o} as default(,)?`),""),n.replace(new RegExp(`export default ${o};
33
33
  ?`),""),n.append(`
34
34
 
35
- export = `+o+";"),{code:n.toString().replace(/export\s\{\s\s\};/,""),map:n.generateMap({hires:!0})}}return null},"patchCjsDefaultExport");var Pn=Object.defineProperty,wt=f((e,t)=>Pn(e,"name",{value:t,configurable:!0}),"i$c");const fs=wt(({addDefaultProperty:e=!1,logger:t,type:s})=>({name:"packem:cjs-interop",renderChunk:wt(async(o,n,r)=>{if(n.type!=="chunk"||!n.isEntry)return null;if(r.format==="cjs"&&r.exports==="auto"){const i=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(o);if(i===null||i.length<3)return null;const l=new G(o);l.replace("Object.defineProperty(exports, '__esModule', { value: true });",""),l.replaceAll(/exports\.(.*) = (.*);/g,"module.exports.$1 = $2;"),e&&l.append(`
36
- module.exports.default = `+i[2]+";");let c=l.toString();return c=c.replace(/(?:module\.)?exports(?:\['default'\]|\.default)/i,"module.exports"),t.debug({message:"Applied CommonJS interop to entry chunk "+n.fileName+".",prefix:"plugin:cjs-interop"}),{code:c,map:l.generateMap({hires:!0})}}return r.format==="es"&&/\.d\.(?:ts|cts)$/.test(n.fileName)?s!=="commonjs"&&n.fileName.endsWith(".d.mts")?null:ds(o):null},"renderChunk")}),"cjsInteropPlugin");var Nn=Object.defineProperty,In=f((e,t)=>Nn(e,"name",{value:t,configurable:!0}),"f$c");const _n=In((e,t)=>{const s=new Map,o={copyOnce:!0,exactFileNames:!0,flatten:!1,...e};let{targets:n}=o;return Array.isArray(n)?n=n.map(r=>{if(typeof r=="string")return{src:r};if(typeof r=="object"&&"src"in r)return r}).filter(Boolean):typeof n=="string"&&(n=[{src:n}]),{async buildStart(){const r=await Promise.all(n.flatMap(i=>Array.isArray(i.src)?i.src.map(l=>({...i,src:l})):i).map(async i=>await Po(he(i.src),{ignore:he(i.exclude).filter(Boolean)}).then(l=>({dest:i.dest??"",parent:Co(i.src),src:l}))));for(const i of r)for(const l of i.src){let c;s.has(l)?c=s.get(l):(c={copied:[],dest:[],timestamp:0},s.set(l,c));const a=o.flatten?J(i.dest):x(i.dest,I(i.parent,B(l)));c.dest.includes(a)||c.dest.push(a),this.addWatchFile(l)}t.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...s].map(async([i,l])=>{let c;try{const a=await Yt(i);if(!a.isFile())return;const p=a.mtime.getTime();p>l.timestamp&&(l.timestamp=p,l.copied=[]),c=await rt(i,{buffer:!0})}catch(a){t.error({context:[a],message:`error reading file ${i}`,prefix:"plugin:copy"});return}for(const a of l.dest){if(o.copyOnce&&l.copied.includes(a))continue;const p=pe(i),d=x(a,p);try{this.emitFile({[o.exactFileNames?"fileName":"name"]:d,source:c,type:"asset"}),t.debug({message:`copied ${i} → ${d}`,prefix:"plugin:copy"}),l.copied.push(a)}catch(u){t.error({context:[u],message:`error copying file ${i} → ${d}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");function ms(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}f(ms,"getDefaultExportFromCjs");var Ue={exports:{}},$t;function Mn(){return $t||($t=1,function(e){var t=Object.prototype.hasOwnProperty,s="~";function o(){}f(o,"Events"),Object.create&&(o.prototype=Object.create(null),new o().__proto__||(s=!1));function n(c,a,p){this.fn=c,this.context=a,this.once=p||!1}f(n,"EE");function r(c,a,p,d,u){if(typeof p!="function")throw new TypeError("The listener must be a function");var m=new n(p,d||c,u),v=s?s+a:a;return c._events[v]?c._events[v].fn?c._events[v]=[c._events[v],m]:c._events[v].push(m):(c._events[v]=m,c._eventsCount++),c}f(r,"addListener");function i(c,a){--c._eventsCount===0?c._events=new o:delete c._events[a]}f(i,"clearEvent");function l(){this._events=new o,this._eventsCount=0}f(l,"EventEmitter"),l.prototype.eventNames=f(function(){var a=[],p,d;if(this._eventsCount===0)return a;for(d in p=this._events)t.call(p,d)&&a.push(s?d.slice(1):d);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(p)):a},"eventNames"),l.prototype.listeners=f(function(a){var p=s?s+a:a,d=this._events[p];if(!d)return[];if(d.fn)return[d.fn];for(var u=0,m=d.length,v=new Array(m);u<m;u++)v[u]=d[u].fn;return v},"listeners"),l.prototype.listenerCount=f(function(a){var p=s?s+a:a,d=this._events[p];return d?d.fn?1:d.length:0},"listenerCount"),l.prototype.emit=f(function(a,p,d,u,m,v){var h=s?s+a:a;if(!this._events[h])return!1;var g=this._events[h],y=arguments.length,w,$;if(g.fn){switch(g.once&&this.removeListener(a,g.fn,void 0,!0),y){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,p),!0;case 3:return g.fn.call(g.context,p,d),!0;case 4:return g.fn.call(g.context,p,d,u),!0;case 5:return g.fn.call(g.context,p,d,u,m),!0;case 6:return g.fn.call(g.context,p,d,u,m,v),!0}for($=1,w=new Array(y-1);$<y;$++)w[$-1]=arguments[$];g.fn.apply(g.context,w)}else{var E=g.length,b;for($=0;$<E;$++)switch(g[$].once&&this.removeListener(a,g[$].fn,void 0,!0),y){case 1:g[$].fn.call(g[$].context);break;case 2:g[$].fn.call(g[$].context,p);break;case 3:g[$].fn.call(g[$].context,p,d);break;case 4:g[$].fn.call(g[$].context,p,d,u);break;default:if(!w)for(b=1,w=new Array(y-1);b<y;b++)w[b-1]=arguments[b];g[$].fn.apply(g[$].context,w)}}return!0},"emit"),l.prototype.on=f(function(a,p,d){return r(this,a,p,d,!1)},"on"),l.prototype.once=f(function(a,p,d){return r(this,a,p,d,!0)},"once"),l.prototype.removeListener=f(function(a,p,d,u){var m=s?s+a:a;if(!this._events[m])return this;if(!p)return i(this,m),this;var v=this._events[m];if(v.fn)v.fn===p&&(!u||v.once)&&(!d||v.context===d)&&i(this,m);else{for(var h=0,g=[],y=v.length;h<y;h++)(v[h].fn!==p||u&&!v[h].once||d&&v[h].context!==d)&&g.push(v[h]);g.length?this._events[m]=g.length===1?g[0]:g:i(this,m)}return this},"removeListener"),l.prototype.removeAllListeners=f(function(a){var p;return a?(p=s?s+a:a,this._events[p]&&i(this,p)):(this._events=new o,this._eventsCount=0),this},"removeAllListeners"),l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=s,l.EventEmitter=l,e.exports=l}(Ue)),Ue.exports}f(Mn,"requireEventemitter3");var Tn=Mn();const An=ms(Tn);class gs extends Error{static{f(this,"TimeoutError")}constructor(t){super(t),this.name="TimeoutError"}}class Rn extends Error{static{f(this,"AbortError")}constructor(t){super(),this.name="AbortError",this.message=t}}const xt=f(e=>globalThis.DOMException===void 0?new Rn(e):new DOMException(e),"getDOMException"),jt=f(e=>{const t=e.reason===void 0?xt("This operation was aborted."):e.reason;return t instanceof Error?t:xt(t)},"getAbortedReason");function Fn(e,t){const{milliseconds:s,fallback:o,message:n,customTimers:r={setTimeout,clearTimeout}}=t;let i;const c=new Promise((a,p)=>{if(typeof s!="number"||Math.sign(s)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${s}\``);if(t.signal){const{signal:u}=t;u.aborted&&p(jt(u));const m=f(()=>{p(jt(u))},"abortHandler");u.addEventListener("abort",m,{once:!0}),e.finally(()=>{u.removeEventListener("abort",m)})}if(s===Number.POSITIVE_INFINITY){e.then(a,p);return}const d=new gs;i=r.setTimeout.call(void 0,()=>{if(o){try{a(o())}catch(u){p(u)}return}typeof e.cancel=="function"&&e.cancel(),n===!1?a():n instanceof Error?p(n):(d.message=n??`Promise timed out after ${s} milliseconds`,p(d))},s),(async()=>{try{a(await e)}catch(u){p(u)}})()}).finally(()=>{c.clear()});return c.clear=()=>{r.clearTimeout.call(void 0,i),i=void 0},c}f(Fn,"pTimeout");function Ln(e,t,s){let o=0,n=e.length;for(;n>0;){const r=Math.trunc(n/2);let i=o+r;s(e[i],t)<=0?(o=++i,n-=r+1):n=r}return o}f(Ln,"lowerBound");class Jn{static{f(this,"PriorityQueue")}#e=[];enqueue(t,s){s={priority:0,...s};const o={priority:s.priority,run:t};if(this.size&&this.#e[this.size-1].priority>=s.priority){this.#e.push(o);return}const n=Ln(this.#e,o,(r,i)=>i.priority-r.priority);this.#e.splice(n,0,o)}dequeue(){return this.#e.shift()?.run}filter(t){return this.#e.filter(s=>s.priority===t.priority).map(s=>s.run)}get size(){return this.#e.length}}class Bn extends An{static{f(this,"PQueue")}#e;#s;#r=0;#a;#i;#m=0;#o;#c;#t;#g;#n=0;#p;#l;#h;timeout;constructor(t){if(super(),t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:Jn,...t},!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${t.intervalCap?.toString()??""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${t.interval?.toString()??""}\` (${typeof t.interval})`);this.#e=t.carryoverConcurrencyCount,this.#s=t.intervalCap===Number.POSITIVE_INFINITY||t.interval===0,this.#a=t.intervalCap,this.#i=t.interval,this.#t=new t.queueClass,this.#g=t.queueClass,this.concurrency=t.concurrency,this.timeout=t.timeout,this.#h=t.throwOnTimeout===!0,this.#l=t.autoStart===!1}get#b(){return this.#s||this.#r<this.#a}get#w(){return this.#n<this.#p}#$(){this.#n--,this.#u(),this.emit("next")}#x(){this.#v(),this.#y(),this.#c=void 0}get#j(){const t=Date.now();if(this.#o===void 0){const s=this.#m-t;if(s<0)this.#r=this.#e?this.#n:0;else return this.#c===void 0&&(this.#c=setTimeout(()=>{this.#x()},s)),!0}return!1}#u(){if(this.#t.size===0)return this.#o&&clearInterval(this.#o),this.#o=void 0,this.emit("empty"),this.#n===0&&this.emit("idle"),!1;if(!this.#l){const t=!this.#j;if(this.#b&&this.#w){const s=this.#t.dequeue();return s?(this.emit("active"),s(),t&&this.#y(),!0):!1}}return!1}#y(){this.#s||this.#o!==void 0||(this.#o=setInterval(()=>{this.#v()},this.#i),this.#m=Date.now()+this.#i)}#v(){this.#r===0&&this.#n===0&&this.#o&&(clearInterval(this.#o),this.#o=void 0),this.#r=this.#e?this.#n:0,this.#d()}#d(){for(;this.#u(););}get concurrency(){return this.#p}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this.#p=t,this.#d()}async#k(t){return new Promise((s,o)=>{t.addEventListener("abort",()=>{o(t.reason)},{once:!0})})}async add(t,s={}){return s={timeout:this.timeout,throwOnTimeout:this.#h,...s},new Promise((o,n)=>{this.#t.enqueue(async()=>{this.#n++,this.#r++;try{s.signal?.throwIfAborted();let r=t({signal:s.signal});s.timeout&&(r=Fn(Promise.resolve(r),{milliseconds:s.timeout})),s.signal&&(r=Promise.race([r,this.#k(s.signal)]));const i=await r;o(i),this.emit("completed",i)}catch(r){if(r instanceof gs&&!s.throwOnTimeout){o();return}n(r),this.emit("error",r)}finally{this.#$()}},s),this.emit("add"),this.#u()})}async addAll(t,s){return Promise.all(t.map(async o=>this.add(o,s)))}start(){return this.#l?(this.#l=!1,this.#d(),this):this}pause(){this.#l=!0}clear(){this.#t=new this.#g}async onEmpty(){this.#t.size!==0&&await this.#f("empty")}async onSizeLessThan(t){this.#t.size<t||await this.#f("next",()=>this.#t.size<t)}async onIdle(){this.#n===0&&this.#t.size===0||await this.#f("idle")}async#f(t,s){return new Promise(o=>{const n=f(()=>{s&&!s()||(this.off(t,n),o())},"listener");this.on(t,n)})}get size(){return this.#t.size}sizeBy(t){return this.#t.filter(t).length}get pending(){return this.#n}get isPaused(){return this.#l}}var Wn=Object.defineProperty,Vn=f((e,t)=>Wn(e,"name",{value:t,configurable:!0}),"r$d");const kt=Vn((e,t)=>{if(!t)return!1;if(typeof t=="function")return t(e);if(typeof t.test=="function")return t.test(e);throw new Error("Invalid condition type")},"matchFile");var zn=Object.defineProperty,Un=f((e,t)=>zn(e,"name",{value:t,configurable:!0}),"a$j");const qn=4,Kn=process.env.UV_THREADPOOL_SIZE?Number.parseInt(process.env.UV_THREADPOOL_SIZE,10):qn;let Gn=class{static{f(this,"f")}static{Un(this,"LoaderManager")}test;loaders=new Map;options;workQueue;logger;constructor({extensions:t,loaders:s,logger:o,options:n}){this.test=r=>t.some(i=>r.toLowerCase().endsWith(i)),s.length>0&&this.add(...s),this.options=n,this.logger=o}add(...t){for(const s of t)this.loaders.has(s.name)||this.loaders.set(s.name,s)}isSupported(t){if(this.test(t))return!0;for(const[,s]of this.loaders)if(kt(t,s.test))return!0;return!1}async process(t,s){this.workQueue||(this.workQueue=new Bn({concurrency:Kn-1}));for await(const[o,n]of this.loaders){const r={...s,options:this.options[o]??{}};if(n.alwaysProcess||kt(r.id,n.test)){this.logger.debug(`Processing ${o} loader for ${r.id}`);const i=await this.workQueue.add(n.process.bind(r,t));i&&(t=i)}}return t}};const Hn=/data:[^\n\r;]+(?:;charset=[^\n\r;]+)?;base64,([\d+/A-Za-z]+={0,2})/;var Yn=Object.defineProperty,Re=f((e,t)=>Yn(e,"name",{value:t,configurable:!0}),"i$b");const hs=/(?:\n|\r\n)?\/\*[#*@]+\s*sourceMappingURL\s*=\s*(\S+)\s*\*+\//g,ys=/(?:\n|\r\n)?\/\/[#@]+\s*sourceMappingURL\s*=\s*(\S+)\s*?$/gm;let Xn=class{static{f(this,"S")}static{Re(this,"MapModifier")}map;constructor(t){if(typeof t=="string")try{this.map=JSON.parse(t)}catch{}else this.map=t}modify(t){return this.map?(t(this.map),this):this}modifySources(t){return this.map?(this.map.sources&&(this.map.sources=this.map.sources.map(s=>t(s))),this):this}resolve(t=process.cwd()){return this.modifySources(s=>s==="<no source>"?s:j(t,s))}relative(t=process.cwd()){return this.modifySources(s=>s==="<no source>"?s:Ae(s)?I(t,s):J(s))}toObject(){return this.map}toString(){return this.map?JSON.stringify(this.map):this.map}toConsumer(){return this.map?new Io(this.map):this.map}toCommentData(){const t=this.toString();return t?`
35
+ export = `+o+";"),{code:n.toString().replace(/export\s\{\s\s\};/,""),map:n.generateMap({hires:!0})}}return null},"patchCjsDefaultExport");var Wn=Object.defineProperty,Ot=u((e,t)=>Wn(e,"name",{value:t,configurable:!0}),"i$c");const xi=Ot(({addDefaultProperty:e=!1,logger:t,type:i})=>({name:"packem:cjs-interop",renderChunk:Ot(async(o,n,a)=>{if(n.type!=="chunk"||!n.isEntry)return null;if(a.format==="cjs"&&a.exports==="auto"){const s=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(o);if(s===null||s.length<3)return null;const l=new H(o);l.replace("Object.defineProperty(exports, '__esModule', { value: true });",""),l.replaceAll(/exports\.(.*) = (.*);/g,"module.exports.$1 = $2;"),e&&l.append(`
36
+ module.exports.default = `+s[2]+";");let p=l.toString();return p=p.replace(/(?:module\.)?exports(?:\['default'\]|\.default)/i,"module.exports"),t.debug({message:"Applied CommonJS interop to entry chunk "+n.fileName+".",prefix:"plugin:cjs-interop"}),{code:p,map:l.generateMap({hires:!0})}}return a.format==="es"&&/\.d\.(?:ts|cts)$/.test(n.fileName)?i!=="commonjs"&&n.fileName.endsWith(".d.mts")?null:hi(o):null},"renderChunk")}),"cjsInteropPlugin");var Vn=Object.defineProperty,Un=u((e,t)=>Vn(e,"name",{value:t,configurable:!0}),"f$c");const Kn=Un((e,t)=>{const i=new Map,o={copyOnce:!0,exactFileNames:!0,flatten:!1,...e};let{targets:n}=o;return Array.isArray(n)?n=n.map(a=>{if(typeof a=="string")return{src:a};if(typeof a=="object"&&"src"in a)return a}).filter(Boolean):typeof n=="string"&&(n=[{src:n}]),{async buildStart(){const a=await Promise.all(n.flatMap(s=>Array.isArray(s.src)?s.src.map(l=>({...s,src:l})):s).map(async s=>await Bo(be(s.src),{ignore:be(s.exclude).filter(Boolean)}).then(l=>({dest:s.dest??"",parent:qo(s.src),src:l}))));for(const s of a)for(const l of s.src){let p;i.has(l)?p=i.get(l):(p={copied:[],dest:[],timestamp:0},i.set(l,p));const r=o.flatten?J(s.dest):k(s.dest,N(s.parent,I(l)));p.dest.includes(r)||p.dest.push(r),this.addWatchFile(l)}t.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...i].map(async([s,l])=>{let p;try{const r=await dt(s);if(!r.isFile())return;const c=r.mtime.getTime();c>l.timestamp&&(l.timestamp=c,l.copied=[]),p=await pt(s,{buffer:!0})}catch(r){t.error({context:[r],message:`error reading file ${s}`,prefix:"plugin:copy"});return}for(const r of l.dest){if(o.copyOnce&&l.copied.includes(r))continue;const c=oe(s),m=k(r,c);try{this.emitFile({[o.exactFileNames?"fileName":"name"]:m,source:p,type:"asset"}),t.debug({message:`copied ${s} → ${m}`,prefix:"plugin:copy"}),l.copied.push(r)}catch(d){t.error({context:[d],message:`error copying file ${s} → ${m}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");function yi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}u(yi,"getDefaultExportFromCjs");var Ye={exports:{}},Dt;function Gn(){return Dt||(Dt=1,function(e){var t=Object.prototype.hasOwnProperty,i="~";function o(){}u(o,"Events"),Object.create&&(o.prototype=Object.create(null),new o().__proto__||(i=!1));function n(p,r,c){this.fn=p,this.context=r,this.once=c||!1}u(n,"EE");function a(p,r,c,m,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new n(c,m||p,d),x=i?i+r:r;return p._events[x]?p._events[x].fn?p._events[x]=[p._events[x],f]:p._events[x].push(f):(p._events[x]=f,p._eventsCount++),p}u(a,"addListener");function s(p,r){--p._eventsCount===0?p._events=new o:delete p._events[r]}u(s,"clearEvent");function l(){this._events=new o,this._eventsCount=0}u(l,"EventEmitter"),l.prototype.eventNames=u(function(){var r=[],c,m;if(this._eventsCount===0)return r;for(m in c=this._events)t.call(c,m)&&r.push(i?m.slice(1):m);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(c)):r},"eventNames"),l.prototype.listeners=u(function(r){var c=i?i+r:r,m=this._events[c];if(!m)return[];if(m.fn)return[m.fn];for(var d=0,f=m.length,x=new Array(f);d<f;d++)x[d]=m[d].fn;return x},"listeners"),l.prototype.listenerCount=u(function(r){var c=i?i+r:r,m=this._events[c];return m?m.fn?1:m.length:0},"listenerCount"),l.prototype.emit=u(function(r,c,m,d,f,x){var v=i?i+r:r;if(!this._events[v])return!1;var g=this._events[v],h=arguments.length,y,w;if(g.fn){switch(g.once&&this.removeListener(r,g.fn,void 0,!0),h){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,c),!0;case 3:return g.fn.call(g.context,c,m),!0;case 4:return g.fn.call(g.context,c,m,d),!0;case 5:return g.fn.call(g.context,c,m,d,f),!0;case 6:return g.fn.call(g.context,c,m,d,f,x),!0}for(w=1,y=new Array(h-1);w<h;w++)y[w-1]=arguments[w];g.fn.apply(g.context,y)}else{var E=g.length,b;for(w=0;w<E;w++)switch(g[w].once&&this.removeListener(r,g[w].fn,void 0,!0),h){case 1:g[w].fn.call(g[w].context);break;case 2:g[w].fn.call(g[w].context,c);break;case 3:g[w].fn.call(g[w].context,c,m);break;case 4:g[w].fn.call(g[w].context,c,m,d);break;default:if(!y)for(b=1,y=new Array(h-1);b<h;b++)y[b-1]=arguments[b];g[w].fn.apply(g[w].context,y)}}return!0},"emit"),l.prototype.on=u(function(r,c,m){return a(this,r,c,m,!1)},"on"),l.prototype.once=u(function(r,c,m){return a(this,r,c,m,!0)},"once"),l.prototype.removeListener=u(function(r,c,m,d){var f=i?i+r:r;if(!this._events[f])return this;if(!c)return s(this,f),this;var x=this._events[f];if(x.fn)x.fn===c&&(!d||x.once)&&(!m||x.context===m)&&s(this,f);else{for(var v=0,g=[],h=x.length;v<h;v++)(x[v].fn!==c||d&&!x[v].once||m&&x[v].context!==m)&&g.push(x[v]);g.length?this._events[f]=g.length===1?g[0]:g:s(this,f)}return this},"removeListener"),l.prototype.removeAllListeners=u(function(r){var c;return r?(c=i?i+r:r,this._events[c]&&s(this,c)):(this._events=new o,this._eventsCount=0),this},"removeAllListeners"),l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=i,l.EventEmitter=l,e.exports=l}(Ye)),Ye.exports}u(Gn,"requireEventemitter3");var Hn=Gn();const Yn=yi(Hn);class bi extends Error{static{u(this,"TimeoutError")}constructor(t){super(t),this.name="TimeoutError"}}class Xn extends Error{static{u(this,"AbortError")}constructor(t){super(),this.name="AbortError",this.message=t}}const Ct=u(e=>globalThis.DOMException===void 0?new Xn(e):new DOMException(e),"getDOMException"),Pt=u(e=>{const t=e.reason===void 0?Ct("This operation was aborted."):e.reason;return t instanceof Error?t:Ct(t)},"getAbortedReason");function Qn(e,t){const{milliseconds:i,fallback:o,message:n,customTimers:a={setTimeout,clearTimeout}}=t;let s;const p=new Promise((r,c)=>{if(typeof i!="number"||Math.sign(i)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${i}\``);if(t.signal){const{signal:d}=t;d.aborted&&c(Pt(d));const f=u(()=>{c(Pt(d))},"abortHandler");d.addEventListener("abort",f,{once:!0}),e.finally(()=>{d.removeEventListener("abort",f)})}if(i===Number.POSITIVE_INFINITY){e.then(r,c);return}const m=new bi;s=a.setTimeout.call(void 0,()=>{if(o){try{r(o())}catch(d){c(d)}return}typeof e.cancel=="function"&&e.cancel(),n===!1?r():n instanceof Error?c(n):(m.message=n??`Promise timed out after ${i} milliseconds`,c(m))},i),(async()=>{try{r(await e)}catch(d){c(d)}})()}).finally(()=>{p.clear()});return p.clear=()=>{a.clearTimeout.call(void 0,s),s=void 0},p}u(Qn,"pTimeout");function Zn(e,t,i){let o=0,n=e.length;for(;n>0;){const a=Math.trunc(n/2);let s=o+a;i(e[s],t)<=0?(o=++s,n-=a+1):n=a}return o}u(Zn,"lowerBound");class ea{static{u(this,"PriorityQueue")}#e=[];enqueue(t,i){i={priority:0,...i};const o={priority:i.priority,run:t};if(this.size&&this.#e[this.size-1].priority>=i.priority){this.#e.push(o);return}const n=Zn(this.#e,o,(a,s)=>s.priority-a.priority);this.#e.splice(n,0,o)}dequeue(){return this.#e.shift()?.run}filter(t){return this.#e.filter(i=>i.priority===t.priority).map(i=>i.run)}get size(){return this.#e.length}}class ta extends Yn{static{u(this,"PQueue")}#e;#i;#a=0;#r;#s;#f=0;#o;#p;#t;#g;#n=0;#c;#l;#v;timeout;constructor(t){if(super(),t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:ea,...t},!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${t.intervalCap?.toString()??""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${t.interval?.toString()??""}\` (${typeof t.interval})`);this.#e=t.carryoverConcurrencyCount,this.#i=t.intervalCap===Number.POSITIVE_INFINITY||t.interval===0,this.#r=t.intervalCap,this.#s=t.interval,this.#t=new t.queueClass,this.#g=t.queueClass,this.concurrency=t.concurrency,this.timeout=t.timeout,this.#v=t.throwOnTimeout===!0,this.#l=t.autoStart===!1}get#y(){return this.#i||this.#a<this.#r}get#b(){return this.#n<this.#c}#w(){this.#n--,this.#d(),this.emit("next")}#k(){this.#x(),this.#h(),this.#p=void 0}get#j(){const t=Date.now();if(this.#o===void 0){const i=this.#f-t;if(i<0)this.#a=this.#e?this.#n:0;else return this.#p===void 0&&(this.#p=setTimeout(()=>{this.#k()},i)),!0}return!1}#d(){if(this.#t.size===0)return this.#o&&clearInterval(this.#o),this.#o=void 0,this.emit("empty"),this.#n===0&&this.emit("idle"),!1;if(!this.#l){const t=!this.#j;if(this.#y&&this.#b){const i=this.#t.dequeue();return i?(this.emit("active"),i(),t&&this.#h(),!0):!1}}return!1}#h(){this.#i||this.#o!==void 0||(this.#o=setInterval(()=>{this.#x()},this.#s),this.#f=Date.now()+this.#s)}#x(){this.#a===0&&this.#n===0&&this.#o&&(clearInterval(this.#o),this.#o=void 0),this.#a=this.#e?this.#n:0,this.#m()}#m(){for(;this.#d(););}get concurrency(){return this.#c}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this.#c=t,this.#m()}async#$(t){return new Promise((i,o)=>{t.addEventListener("abort",()=>{o(t.reason)},{once:!0})})}async add(t,i={}){return i={timeout:this.timeout,throwOnTimeout:this.#v,...i},new Promise((o,n)=>{this.#t.enqueue(async()=>{this.#n++,this.#a++;try{i.signal?.throwIfAborted();let a=t({signal:i.signal});i.timeout&&(a=Qn(Promise.resolve(a),{milliseconds:i.timeout})),i.signal&&(a=Promise.race([a,this.#$(i.signal)]));const s=await a;o(s),this.emit("completed",s)}catch(a){if(a instanceof bi&&!i.throwOnTimeout){o();return}n(a),this.emit("error",a)}finally{this.#w()}},i),this.emit("add"),this.#d()})}async addAll(t,i){return Promise.all(t.map(async o=>this.add(o,i)))}start(){return this.#l?(this.#l=!1,this.#m(),this):this}pause(){this.#l=!0}clear(){this.#t=new this.#g}async onEmpty(){this.#t.size!==0&&await this.#u("empty")}async onSizeLessThan(t){this.#t.size<t||await this.#u("next",()=>this.#t.size<t)}async onIdle(){this.#n===0&&this.#t.size===0||await this.#u("idle")}async#u(t,i){return new Promise(o=>{const n=u(()=>{i&&!i()||(this.off(t,n),o())},"listener");this.on(t,n)})}get size(){return this.#t.size}sizeBy(t){return this.#t.filter(t).length}get pending(){return this.#n}get isPaused(){return this.#l}}var ia=Object.defineProperty,oa=u((e,t)=>ia(e,"name",{value:t,configurable:!0}),"r$d");const Nt=oa((e,t)=>{if(!t)return!1;if(typeof t=="function")return t(e);if(typeof t.test=="function")return t.test(e);throw new Error("Invalid condition type")},"matchFile");var na=Object.defineProperty,aa=u((e,t)=>na(e,"name",{value:t,configurable:!0}),"a$k");const sa=4,ra=process.env.UV_THREADPOOL_SIZE?Number.parseInt(process.env.UV_THREADPOOL_SIZE,10):sa;let la=class{static{u(this,"f")}static{aa(this,"LoaderManager")}test;loaders=new Map;options;workQueue;logger;constructor({extensions:t,loaders:i,logger:o,options:n}){this.test=a=>t.some(s=>a.toLowerCase().endsWith(s)),i.length>0&&this.add(...i),this.options=n,this.logger=o}add(...t){for(const i of t)this.loaders.has(i.name)||this.loaders.set(i.name,i)}isSupported(t){if(this.test(t))return!0;for(const[,i]of this.loaders)if(Nt(t,i.test))return!0;return!1}async process(t,i){this.workQueue||(this.workQueue=new ta({concurrency:ra-1}));for await(const[o,n]of this.loaders){const a={...i,options:this.options[o]??{}};if(n.alwaysProcess||Nt(a.id,n.test)){this.logger.debug(`Processing ${o} loader for ${a.id}`);const s=await this.workQueue.add(n.process.bind(a,t));s&&(t=s)}}return t}};const pa=/data:[^\n\r;]+(?:;charset=[^\n\r;]+)?;base64,([\d+/A-Za-z]+={0,2})/;var ca=Object.defineProperty,qe=u((e,t)=>ca(e,"name",{value:t,configurable:!0}),"i$b");const wi=/(?:\n|\r\n)?\/\*[#*@]+\s*sourceMappingURL\s*=\s*(\S+)\s*\*+\//g,ki=/(?:\n|\r\n)?\/\/[#@]+\s*sourceMappingURL\s*=\s*(\S+)\s*?$/gm;let da=class{static{u(this,"S")}static{qe(this,"MapModifier")}map;constructor(t){if(typeof t=="string")try{this.map=JSON.parse(t)}catch{}else this.map=t}modify(t){return this.map?(t(this.map),this):this}modifySources(t){return this.map?(this.map.sources&&(this.map.sources=this.map.sources.map(i=>t(i))),this):this}resolve(t=process.cwd()){return this.modifySources(i=>i==="<no source>"?i:j(t,i))}relative(t=process.cwd()){return this.modifySources(i=>i==="<no source>"?i:Je(i)?N(t,i):J(i))}toObject(){return this.map}toString(){return this.map?JSON.stringify(this.map):this.map}toConsumer(){return this.map?new Vo(this.map):this.map}toCommentData(){const t=this.toString();return t?`
37
37
  /*# sourceMappingURL=data:application/json;base64,${Buffer.from(t).toString("base64")} */`:""}toCommentFile(t){return this.map?`
38
- /*# sourceMappingURL=${t} */`:""}};Re(async(e,t)=>{const[,s]=hs.exec(e)??ys.exec(e)??[];if(!s)return;const[,o]=Hn.exec(s)??[];if(o)return Buffer.from(o,"base64").toString();if(!t)throw new Error("Extracted map detected, but no ID is provided");const n=j(B(t),s);if(R(n))return Me(n)},"getMap");Re(e=>e.replaceAll(hs,"").replaceAll(ys,""),"stripMap");const et=Re(e=>new Xn(e),"mm");var Qn=Object.defineProperty,Zn=f((e,t)=>Qn(e,"name",{value:t,configurable:!0}),"u$c");const er=Zn(async e=>{const t=new _o({file:""}),s=[];let o=0;for await(const{css:n,map:r}of e){s.push(n);const i=et(r),l=i.toObject();if(!l)continue;const c=i.toConsumer();if(c){if(c.eachMapping(a=>{t.addMapping({generated:{column:a.generatedColumn,line:o+a.generatedLine},name:a.name,original:{column:a.originalColumn,line:a.originalLine},source:a.source})}),l.sourcesContent)for(const a of l.sources)t.setSourceContent(a,c.sourceContentFor(a,!0));o+=n.split(`
39
- `).length}}return{css:s.join(`
40
- `),map:t}},"concat");var tr=Object.defineProperty,sr=f((e,t)=>tr(e,"name",{value:t,configurable:!0}),"s$c");const vs=sr(e=>e.map((t,s,o)=>{const n=`\`${t}\``;switch(s){case o.length-1:return`or ${n}`;case o.length-2:return n;default:return`${n},`}}).join(" "),"default");var or=Object.defineProperty,nr=f((e,t)=>or(e,"name",{value:t,configurable:!0}),"l$9");const rr=B(rs(import.meta.url)),Et=nr((e,t)=>{const s={baseDirs:[rr],caller:"Resolver",extensions:[".mjs",".js",".cjs",".json"],symlinks:!0,...t},o=new Fo({extensions:s.extensions,symlinks:s.symlinks});for(const n of s.baseDirs)for(const r of e)try{const{error:i,path:l}=o.sync(n,r);if(l)return l;i&&console.debug(i,{context:{basedir:n,caller:t.caller,extensions:t.extensions,id:r}})}catch(i){console.debug(i.message,{context:{basedir:n,caller:t.caller,error:i,extensions:t.extensions,id:r}})}throw new Error(`${s.caller} could not resolve ${vs(e)}`)},"resolve");var ir=Object.defineProperty,ar=f((e,t)=>ir(e,"name",{value:t,configurable:!0}),"t$b");const te={},lr=[".js",".mjs",".cjs",".json"],cr=ar(async(e,t)=>{if(te[e])return te[e];if(te[e]===null)return;const s={baseDirs:[t],caller:"Module loader",extensions:lr,symlinks:!1};try{te[e]=require(Et([e,`./${e}`],s))}catch(o){if(o.code==="ERR_REQUIRE_ESM")try{te[e]=Mo(await To(Et([e,`./${e}`],s)))}catch{}else{te[e]=null;return}}return te[e]},"default");var pr=Object.defineProperty,ue=f((e,t)=>pr(e,"name",{value:t,configurable:!0}),"r$c");const bs=["inject","extract","emit"],ur=vs(bs),dr=ue(e=>{const t=Array.isArray(e)?e:[e];if(t[0]&&!bs.includes(t[0]))throw new Error(`Incorrect mode provided, allowed modes are ${ur}`);return{emit:t[0]==="emit",extract:t[0]==="extract"&&(t[1]??!0),inject:(!t[0]||t[0]==="inject")&&(t[1]??!0)}},"inferModeOption"),tt=ue((e,t)=>typeof e=="boolean"?e&&{}:typeof e=="object"?e:t,"inferOption"),fr=ue(e=>{const t=Array.isArray(e)?e:[e];return t[0]?{content:!0,...t[1],inline:t[0]==="inline"}:!1},"inferSourceMapOption"),St=ue((e,t)=>{const s=tt(e,{});return t&&typeof s=="object"&&!s.alias&&(s.alias=t),s},"inferHandlerOption"),ce=ue(async(e,t,s)=>{if(typeof e!="string")return e;const o=await cr(e,s);if(!o)throw new Error(`Unable to load PostCSS ${t} \`${e}\``);return o},"ensurePCSSOption"),mr=ue(async(e,t)=>{if(e===void 0)return[];if(e.length===0)return[];const s=[];for await(const o of e.filter(Boolean)){if(!Array.isArray(o)){s.push(await ce(o,"plugin",t));continue}const[n,r]=o;r?s.push((await ce(n,"plugin",t))(r)):s.push(await ce(n,"plugin",t))}return s},"ensurePCSSPlugins");var gr=Object.defineProperty,ge=f((e,t)=>gr(e,"name",{value:t,configurable:!0}),"b$3");const hr=ge(async(e,t)=>e.sort((s,o)=>t.indexOf(s.name)-t.indexOf(o.name)),"sortByNameOrder"),yr=ge(async(e,t,s,o,n,r,i,l,c,a)=>{const p={...a,...e.alias},d=ne(e.include,e.exclude),u=fr(e.sourceMap),m={...dr(e.mode),autoModules:e.autoModules??!1,dts:e.dts,extensions:e.extensions,namedExports:e.namedExports};typeof m.inject=="object"&&m.inject.treeshakeable&&(m.namedExports=!1,t.info({message:"Disabling named exports due to `inject.treeshakeable` option",prefix:"css"}));let v=!1;if(e.loaders)for(const w of e.loaders)w.name==="postcss"&&(v=!0);else e.loaders=[];v&&(m.postcss={...e.postcss,config:tt(e.postcss?.config,{}),import:St(e.postcss?.import,p),modules:tt(e.postcss?.modules,void 0),to:e.postcss?.to,url:St(e.postcss?.url,p)},e.postcss?.parser&&(m.postcss.parser=await ce(e.postcss.parser,"parser",o)),e.postcss?.syntax&&(m.postcss.syntax=await ce(e.postcss.syntax,"syntax",o)),e.postcss?.stringifier&&(m.postcss.stringifier=await ce(e.postcss.stringifier,"stringifier",o)),e.postcss?.plugins&&(m.postcss.plugins=await mr(e.postcss.plugins,o)));const h=new Gn({extensions:m.extensions,loaders:await hr(e.loaders,["sourcemap","stylus","less","sass","postcss"]),logger:t,options:{...e,...m,alias:p}});let g=[];const y=ge((w,$)=>{const E=[];for(const b of Object.keys(w)){const P=new Set;let _=[b];do{const W=[];for(const F of _){if(P.has(F))continue;if(h.isSupported(F)){d(F)&&W.push(F);continue}P.add(F);const ie=$(F);ie&&W.push(...ie.importedIds)}_=W}while(_.some(W=>!h.isSupported(W)));E.push(..._)}return E},"traverseImportedModules");return{augmentChunkHash(w){if(g.length===0)return null;const $=y(w.modules,this.getModuleInfo),E=g.filter(b=>$.includes(b.id)).sort((b,P)=>$.lastIndexOf(b.id)-$.lastIndexOf(P.id)).map(b=>`${pe(b.id)}:${b.css}`);return E.length===0?null:E.join(":")},async generateBundle(w,$){if(g.length===0||!(w.dir||w.file))return;const E=Object.values($),b=w.dir??B(w.file),P=E.filter(S=>S.type==="chunk"),_=P.filter(S=>!S.facadeModuleId),W=w.preserveModules?P:P.filter(S=>S.isEntry||S.isDynamicEntry),F=[],ie=ge(async(S,C)=>{const k=typeof m.extract=="string"?J(m.extract).replace(/^\.[/\\]/,""):J(`${S}.css`);Ae(k)&&this.error(["Extraction path must be relative to the output directory,",`which is ${I(o,b)}`].join(`
41
- `)),ss(k)&&this.error(["Extraction path must be nested inside output directory,",`which is ${I(o,b)}`].join(`
42
- `));const V=g.filter(z=>C.includes(z.id)).sort((z,ae)=>C.lastIndexOf(z.id)-C.lastIndexOf(ae.id)),we=await er(V);return{css:we.css,map:et(we.map.toString()).relative(B(j(b,k))).toString(),name:k}},"getExtractedData"),L=ge(S=>{if(w.file)return ze(w.file).name;if(w.preserveModules){const{dir:C,name:k}=ze(S.fileName);return C?x(C,k):k}return S.name},"getName"),H=[];if(typeof m.extract=="string"){t.debug({message:`Extracting to ${m.extract}`,prefix:"css"});const S=[];for(const k of _){const V=y(k.modules,this.getModuleInfo);H.push(...V),S.push(...V)}for(const k of W)S.push(...y(k.modules,this.getModuleInfo).filter(V=>!H.includes(V)));const C=L(P[0]);F.push([C,S])}else{t.debug({message:"Extracting to individual files",prefix:"css"});for(const S of _){const C=y(S.modules,this.getModuleInfo);if(C.length===0)continue;H.push(...C);const k=L(S);F.push([k,C])}for(const S of W){const C=y(S.modules,this.getModuleInfo).filter(V=>!H.includes(V));if(C.length===0)continue;const k=L(S);F.push([k,C])}}for await(const[S,C]of F){const k=await ie(S,C);if(typeof e.onExtract=="function"&&!e.onExtract(k))continue;if(c&&e.minifier){t.info({message:`Minifying ${k.name} with ${e.minifier.name}`,prefix:"css"});const{css:z,map:ae}=await e.minifier.handler.bind({browserTargets:s,warn:this.warn.bind(this)})(k,u,e[e.minifier.name]??{});k.css=z,k.map=ae}const V={fileName:k.name,name:k.name,names:[k.name],originalFileName:k.name,originalFileNames:[k.name],source:k.css,type:"asset"},we=this.emitFile(V);if(k.map&&u){const z=this.getFileName(we),ae=typeof w.assetFileNames=="string"?J(B(w.assetFileNames)):typeof w.assetFileNames=="function"?J(B(w.assetFileNames(V))):"assets",de=et(k.map).modify(N=>(N.file=pe(z),N)).modifySources(N=>{if(N==="<no source>"||ae.length<=1)return N;N=`../${N}`;for(const We of ae)We==="/"&&(N=`../${N}`);return N});if(u.inline)de.modify(N=>u.transform?.(N,J(x(b,z)))),$[z].source+=de.toCommentData();else{const N=`${z}.map`;de.modify(Ks=>u.transform?.(Ks,J(x(b,N)))),this.emitFile({fileName:N,source:de.toString(),type:"asset"});const{base:We}=ze(N);$[z].source+=de.toCommentFile(We)}}}},name:"packem:css",async transform(w,$){if(!d($)||!h.isSupported($)||w.replaceAll(/\s/g,"")==="")return null;try{return this.parse(w,{}),this.warn(`Skipping processed file ${I(o,$)}`),null}catch{}typeof e.onImport=="function"&&e.onImport(w,$);const E={alias:p,assets:new Map,autoModules:m.autoModules,browserTargets:s,cwd:o,debug:l,deps:new Set,dts:m.dts,emit:m.emit,environment:r,extensions:m.extensions,extract:m.extract,id:$,inject:m.inject,logger:t,namedExports:m.namedExports,options:{},plugin:this,sourceDir:n,sourceMap:u,useSourcemap:i,warn:this.warn.bind(this)},b=await h.process({code:w},E);for(const P of E.deps)this.addWatchFile(P);for(const[P,_]of E.assets)this.emitFile({fileName:P,source:_,type:"asset"});if(b.extracted){const{id:P}=b.extracted;g=g.filter(_=>_.id!==P),g.push(b.extracted)}return{code:b.code,map:u&&b.map?b.map:{mappings:""},meta:{styles:b.meta},moduleSideEffects:b.extracted?!0:null}}}},"default");var vr=Object.defineProperty,br=f((e,t)=>vr(e,"name",{value:t,configurable:!0}),"t$a");const wr=/\.module\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/,qe=br((e,t)=>e===void 0?!0:typeof e=="function"?e(t):e instanceof RegExp?e.test(t):e&&wr.test(t),"ensureAutoModules");var $r=Object.defineProperty,xr=f((e,t)=>$r(e,"name",{value:t,configurable:!0}),"u$9");const jr=`
38
+ /*# sourceMappingURL=${t} */`:""}};qe(async(e,t)=>{const[,i]=wi.exec(e)??ki.exec(e)??[];if(!i)return;const[,o]=pa.exec(i)??[];if(o)return Buffer.from(o,"base64").toString();if(!t)throw new Error("Extracted map detected, but no ID is provided");const n=j(I(t),i);if(R(n))return Re(n)},"getMap");qe(e=>e.replaceAll(wi,"").replaceAll(ki,""),"stripMap");const at=qe(e=>new da(e),"mm");var ma=Object.defineProperty,ua=u((e,t)=>ma(e,"name",{value:t,configurable:!0}),"u$d");const fa=ua(async e=>{const t=new Uo({file:""}),i=[];let o=0;for await(const{css:n,map:a}of e){i.push(n);const s=at(a),l=s.toObject();if(!l)continue;const p=s.toConsumer();if(p){if(p.eachMapping(r=>{t.addMapping({generated:{column:r.generatedColumn,line:o+r.generatedLine},name:r.name,original:{column:r.originalColumn,line:r.originalLine},source:r.source})}),l.sourcesContent)for(const r of l.sources)t.setSourceContent(r,p.sourceContentFor(r,!0));o+=n.split(`
39
+ `).length}}return{css:i.join(`
40
+ `),map:t}},"concat");var ga=Object.defineProperty,va=u((e,t)=>ga(e,"name",{value:t,configurable:!0}),"s$d");const ji=va(e=>e.map((t,i,o)=>{const n=`\`${t}\``;switch(i){case o.length-1:return`or ${n}`;case o.length-2:return n;default:return`${n},`}}).join(" "),"default");var ha=Object.defineProperty,xa=u((e,t)=>ha(e,"name",{value:t,configurable:!0}),"l$9");const ya=I(ci(import.meta.url)),_t=xa((e,t)=>{const i={baseDirs:[ya],caller:"Resolver",extensions:[".mjs",".js",".cjs",".json"],symlinks:!0,...t},o=new Xo({extensions:i.extensions,symlinks:i.symlinks});for(const n of i.baseDirs)for(const a of e)try{const{error:s,path:l}=o.sync(n,a);if(l)return l;s&&console.debug(s,{context:{basedir:n,caller:t.caller,extensions:t.extensions,id:a}})}catch(s){console.debug(s.message,{context:{basedir:n,caller:t.caller,error:s,extensions:t.extensions,id:a}})}throw new Error(`${i.caller} could not resolve ${ji(e)}`)},"resolve");var ba=Object.defineProperty,wa=u((e,t)=>ba(e,"name",{value:t,configurable:!0}),"t$b");const ae={},ka=[".js",".mjs",".cjs",".json"],ja=wa(async(e,t)=>{if(ae[e])return ae[e];if(ae[e]===null)return;const i={baseDirs:[t],caller:"Module loader",extensions:ka,symlinks:!1};try{ae[e]=require(_t([e,`./${e}`],i))}catch(o){if(o.code==="ERR_REQUIRE_ESM")try{ae[e]=Ko(await Go(_t([e,`./${e}`],i)))}catch{}else{ae[e]=null;return}}return ae[e]},"default");var $a=Object.defineProperty,fe=u((e,t)=>$a(e,"name",{value:t,configurable:!0}),"r$c");const $i=["inject","extract","emit"],Ea=ji($i),Sa=fe(e=>{const t=Array.isArray(e)?e:[e];if(t[0]&&!$i.includes(t[0]))throw new Error(`Incorrect mode provided, allowed modes are ${Ea}`);return{emit:t[0]==="emit",extract:t[0]==="extract"&&(t[1]??!0),inject:(!t[0]||t[0]==="inject")&&(t[1]??!0)}},"inferModeOption"),st=fe((e,t)=>typeof e=="boolean"?e&&{}:typeof e=="object"?e:t,"inferOption"),Oa=fe(e=>{const t=Array.isArray(e)?e:[e];return t[0]?{content:!0,...t[1],inline:t[0]==="inline"}:!1},"inferSourceMapOption"),It=fe((e,t)=>{const i=st(e,{});return t&&typeof i=="object"&&!i.alias&&(i.alias=t),i},"inferHandlerOption"),ue=fe(async(e,t,i)=>{if(typeof e!="string")return e;const o=await ja(e,i);if(!o)throw new Error(`Unable to load PostCSS ${t} \`${e}\``);return o},"ensurePCSSOption"),Da=fe(async(e,t)=>{if(e===void 0)return[];if(e.length===0)return[];const i=[];for await(const o of e.filter(Boolean)){if(!Array.isArray(o)){i.push(await ue(o,"plugin",t));continue}const[n,a]=o;a?i.push((await ue(n,"plugin",t))(a)):i.push(await ue(n,"plugin",t))}return i},"ensurePCSSPlugins");var Ca=Object.defineProperty,xe=u((e,t)=>Ca(e,"name",{value:t,configurable:!0}),"b$3");const Pa=xe(async(e,t)=>e.sort((i,o)=>t.indexOf(i.name)-t.indexOf(o.name)),"sortByNameOrder"),Na=xe(async(e,t,i,o,n,a,s,l,p,r)=>{const c={...r,...e.alias},m=ne(e.include,e.exclude),d=Oa(e.sourceMap),f={...Sa(e.mode),autoModules:e.autoModules??!1,dts:e.dts,extensions:e.extensions,namedExports:e.namedExports};typeof f.inject=="object"&&f.inject.treeshakeable&&(f.namedExports=!1,t.info({message:"Disabling named exports due to `inject.treeshakeable` option",prefix:"css"}));let x=!1;if(e.loaders)for(const y of e.loaders)y.name==="postcss"&&(x=!0);else e.loaders=[];x&&(f.postcss={...e.postcss,config:st(e.postcss?.config,{}),import:It(e.postcss?.import,c),modules:st(e.postcss?.modules,void 0),to:e.postcss?.to,url:It(e.postcss?.url,c)},e.postcss?.parser&&(f.postcss.parser=await ue(e.postcss.parser,"parser",o)),e.postcss?.syntax&&(f.postcss.syntax=await ue(e.postcss.syntax,"syntax",o)),e.postcss?.stringifier&&(f.postcss.stringifier=await ue(e.postcss.stringifier,"stringifier",o)),e.postcss?.plugins&&(f.postcss.plugins=await Da(e.postcss.plugins,o)));const v=new la({extensions:f.extensions,loaders:await Pa(e.loaders,["sourcemap","stylus","less","sass","postcss"]),logger:t,options:{...e,...f,alias:c}});let g=[];const h=xe((y,w)=>{const E=[];for(const b of Object.keys(y)){const P=new Set;let M=[b];do{const B=[];for(const z of M){if(P.has(z))continue;if(v.isSupported(z)){m(z)&&B.push(z);continue}P.add(z);const ce=w(z);ce&&B.push(...ce.importedIds)}M=B}while(M.some(B=>!v.isSupported(B)));E.push(...M)}return E},"traverseImportedModules");return{augmentChunkHash(y){if(g.length===0)return null;const w=h(y.modules,this.getModuleInfo),E=g.filter(b=>w.includes(b.id)).sort((b,P)=>w.lastIndexOf(b.id)-w.lastIndexOf(P.id)).map(b=>`${oe(b.id)}:${b.css}`);return E.length===0?null:E.join(":")},async generateBundle(y,w){if(g.length===0||!(y.dir||y.file))return;const E=Object.values(w),b=y.dir??I(y.file),P=E.filter(S=>S.type==="chunk"),M=P.filter(S=>!S.facadeModuleId),B=y.preserveModules?P:P.filter(S=>S.isEntry||S.isDynamicEntry),z=[],ce=xe(async(S,C)=>{const $=typeof f.extract=="string"?J(f.extract).replace(/^\.[/\\]/,""):J(`${S}.css`);Je($)&&this.error(["Extraction path must be relative to the output directory,",`which is ${N(o,b)}`].join(`
41
+ `)),ri($)&&this.error(["Extraction path must be nested inside output directory,",`which is ${N(o,b)}`].join(`
42
+ `));const W=g.filter(V=>C.includes(V.id)).sort((V,de)=>C.lastIndexOf(V.id)-C.lastIndexOf(de.id)),$e=await fa(W);return{css:$e.css,map:at($e.map.toString()).relative(I(j(b,$))).toString(),name:$}},"getExtractedData"),F=xe(S=>{if(y.file)return He(y.file).name;if(y.preserveModules){const{dir:C,name:$}=He(S.fileName);return C?k(C,$):$}return S.name},"getName"),Y=[];if(typeof f.extract=="string"){t.debug({message:`Extracting to ${f.extract}`,prefix:"css"});const S=[];for(const $ of M){const W=h($.modules,this.getModuleInfo);Y.push(...W),S.push(...W)}for(const $ of B)S.push(...h($.modules,this.getModuleInfo).filter(W=>!Y.includes(W)));const C=F(P[0]);z.push([C,S])}else{t.debug({message:"Extracting to individual files",prefix:"css"});for(const S of M){const C=h(S.modules,this.getModuleInfo);if(C.length===0)continue;Y.push(...C);const $=F(S);z.push([$,C])}for(const S of B){const C=h(S.modules,this.getModuleInfo).filter(W=>!Y.includes(W));if(C.length===0)continue;const $=F(S);z.push([$,C])}}for await(const[S,C]of z){const $=await ce(S,C);if(typeof e.onExtract=="function"&&!e.onExtract($))continue;if(p&&e.minifier){t.info({message:`Minifying ${$.name} with ${e.minifier.name}`,prefix:"css"});const{css:V,map:de}=await e.minifier.handler.bind({browserTargets:i,warn:this.warn.bind(this)})($,d,e[e.minifier.name]??{});$.css=V,$.map=de}const W={fileName:$.name,name:$.name,names:[$.name],originalFileName:$.name,originalFileNames:[$.name],source:$.css,type:"asset"},$e=this.emitFile(W);if($.map&&d){const V=this.getFileName($e),de=typeof y.assetFileNames=="string"?J(I(y.assetFileNames)):typeof y.assetFileNames=="function"?J(I(y.assetFileNames(W))):"assets",ge=at($.map).modify(_=>(_.file=oe(V),_)).modifySources(_=>{if(_==="<no source>"||de.length<=1)return _;_=`../${_}`;for(const Ke of de)Ke==="/"&&(_=`../${_}`);return _});if(d.inline)ge.modify(_=>d.transform?.(_,J(k(b,V)))),w[V].source+=ge.toCommentData();else{const _=`${V}.map`;ge.modify(eo=>d.transform?.(eo,J(k(b,_)))),this.emitFile({fileName:_,source:ge.toString(),type:"asset"});const{base:Ke}=He(_);w[V].source+=ge.toCommentFile(Ke)}}}},name:"packem:css",async transform(y,w){if(!m(w)||!v.isSupported(w)||y.replaceAll(/\s/g,"")==="")return null;try{return this.parse(y,{}),this.warn(`Skipping processed file ${N(o,w)}`),null}catch{}typeof e.onImport=="function"&&e.onImport(y,w);const E={alias:c,assets:new Map,autoModules:f.autoModules,browserTargets:i,cwd:o,debug:l,deps:new Set,dts:f.dts,emit:f.emit,environment:a,extensions:f.extensions,extract:f.extract,id:w,inject:f.inject,logger:t,namedExports:f.namedExports,options:{},plugin:this,sourceDir:n,sourceMap:d,useSourcemap:s,warn:this.warn.bind(this)},b=await v.process({code:y},E);for(const P of E.deps)this.addWatchFile(P);for(const[P,M]of E.assets)this.emitFile({fileName:P,source:M,type:"asset"});if(b.extracted){const{id:P}=b.extracted;g=g.filter(M=>M.id!==P),g.push(b.extracted)}return{code:b.code,map:d&&b.map?b.map:{mappings:""},meta:{styles:b.meta},moduleSideEffects:b.extracted?!0:null}}}},"default");var _a=Object.defineProperty,Ia=u((e,t)=>_a(e,"name",{value:t,configurable:!0}),"t$a");const Ma=/\.module\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/,Xe=Ia((e,t)=>e===void 0?!0:typeof e=="function"?e(t):e instanceof RegExp?e.test(t):e&&Ma.test(t),"ensureAutoModules");var Ta=Object.defineProperty,Aa=u((e,t)=>Ta(e,"name",{value:t,configurable:!0}),"u$a");const za=`
43
43
  /* eslint-disable */
44
44
  /* prettier-ignore */
45
45
  // @ts-nocheck
@@ -47,135 +47,135 @@ module.exports.default = `+i[2]+";");let c=l.toString();return c=c.replace(/(?:m
47
47
  * Generated by packem
48
48
  * @see https://npmjs.com/@visulima/packem
49
49
  */
50
- `.trim(),kr=xr((e,t,s)=>{let o;return e.postcss&&typeof e.postcss.modules=="boolean"?o=e.postcss.modules:e.lightningcss&&typeof e.lightningcss.modules=="boolean"&&(o=e.lightningcss.modules),{async transform(n,r){let i=o;if(e.postcss&&typeof e.postcss.modules=="object"?i=qe(e.postcss.modules.include,r):e.lightningcss&&typeof e.lightningcss.modules=="object"&&(i=qe(e.lightningcss.modules.include,r)),e.autoModules&&i===void 0&&(i=qe(e.autoModules,r)),!i)return null;const{types:l}=this.getModuleInfo(r)?.meta.styles??{};return l===void 0||await nt(r)&&(await qt(r+".d.ts",`${jr}
51
- ${l}`),s.info({message:`Generated types for ${J(r).replace(t+"/","")}`,prefix:"dts:css-modules"}),this.addWatchFile(r+".d.ts")),null}}},"cssModulesTypes");var Er=Object.defineProperty,Fe=f((e,t)=>Er(e,"name",{value:t,configurable:!0}),"t$9");const Sr=/\Wrequire(?:\.resolve)?\(/,Or=Fe((e,t)=>{if(Se.INTERNAL_PACKEM_BUILD!=="1"&&(e.includes("// -- packem CommonJS __filename shim")||e.includes("// -- packem CommonJS __dirname shim")||e.includes("// -- packem CommonJS require shim")))return null;let s=!1,o=!1,n=!1;if(e.includes("__filename")&&(s=!0),e.includes("__dirname")&&(o=!0),Sr.test(e)&&(n=!0),!s&&!o&&!n)return null;const r=ns(e).pop(),i=r?r.end:0,l=new G(e);return l.appendRight(i,t(s,o,n)),{code:l.toString(),map:l.generateMap()}},"CJSToESM"),Dr=Fe((e,t,s)=>{let o="";return(e||t)&&(o+=`import __cjs_url__ from "node:url"; // -- packem CommonJS __filename shim --
50
+ `.trim(),Fa=Aa((e,t,i)=>{let o;return e.postcss&&typeof e.postcss.modules=="boolean"?o=e.postcss.modules:e.lightningcss&&typeof e.lightningcss.modules=="boolean"&&(o=e.lightningcss.modules),{async transform(n,a){let s=o;if(e.postcss&&typeof e.postcss.modules=="object"?s=Xe(e.postcss.modules.include,a):e.lightningcss&&typeof e.lightningcss.modules=="object"&&(s=Xe(e.lightningcss.modules.include,a)),e.autoModules&&s===void 0&&(s=Xe(e.autoModules,a)),!s)return null;const{types:l}=this.getModuleInfo(a)?.meta.styles??{};return l===void 0||await Fe(a)&&(await Zt(a+".d.ts",`${za}
51
+ ${l}`),i.info({message:`Generated types for ${J(a).replace(t+"/","")}`,prefix:"dts:css-modules"}),this.addWatchFile(a+".d.ts")),null}}},"cssModulesTypes");var Ra=Object.defineProperty,Be=u((e,t)=>Ra(e,"name",{value:t,configurable:!0}),"t$9");const La=/\Wrequire(?:\.resolve)?\(/,Ja=Be((e,t)=>{if(Pe.INTERNAL_PACKEM_BUILD!=="1"&&(e.includes("// -- packem CommonJS __filename shim")||e.includes("// -- packem CommonJS __dirname shim")||e.includes("// -- packem CommonJS require shim")))return null;let i=!1,o=!1,n=!1;if(e.includes("__filename")&&(i=!0),e.includes("__dirname")&&(o=!0),La.test(e)&&(n=!0),!i&&!o&&!n)return null;const a=pi(e).pop(),s=a?a.end:0,l=new H(e);return l.appendRight(s,t(i,o,n)),{code:l.toString(),map:l.generateMap()}},"CJSToESM"),qa=Be((e,t,i)=>{let o="";return(e||t)&&(o+=`import __cjs_url__ from "node:url"; // -- packem CommonJS __filename shim --
52
52
  `),t&&(o+=`import __cjs_path__ from "node:path"; // -- packem CommonJS __dirname shim --
53
- `),s&&(o+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
53
+ `),i&&(o+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
54
54
  `),(e||t)&&(o+=`const __filename = __cjs_url__.fileURLToPath(import.meta.url);
55
55
  `),t&&(o+=`const __dirname = __cjs_path__.dirname(__filename);
56
- `),s&&(o+=`const require = __cjs_mod__.createRequire(import.meta.url);
57
- `),o},"generateCJSShim"),Cr=Fe((e,t,s)=>{let o="";return s&&(o+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
56
+ `),i&&(o+=`const require = __cjs_mod__.createRequire(import.meta.url);
57
+ `),o},"generateCJSShim"),Ba=Be((e,t,i)=>{let o="";return i&&(o+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
58
58
  `),e&&(o+=`const __filename = import.meta.filename; // -- packem CommonJS __filename shim --
59
59
  `),t&&(o+=`const __dirname = import.meta.dirname; // -- packem CommonJS __dirname shim --
60
- `),s&&(o+=`const require = __cjs_mod__.createRequire(import.meta.url);
61
- `),o},"generateCJSShimNode20_11"),Pr=Fe((e,t)=>{const s=ne(t.include,t.exclude);return{name:"packem:esm-shim-cjs-syntax",renderChunk(o,n,r){if(r.format==="es"&&s(n.fileName)){let i=Dr;if(e.engines?.node){const l=os(e.engines.node);l&&l.major>=20&&l.minor>=11&&(i=Cr)}return Or(o,i)}return null}}},"esmShimCjsSyntaxPlugin");var Nr=Object.defineProperty,Ir=f((e,t)=>Nr(e,"name",{value:t,configurable:!0}),"m$c");const _r=Ir(()=>({name:"packem:fix-dynamic-import-extension",renderChunk(e,t,s){return s.format==="es"||s.format==="cjs"?{code:e.replaceAll(/(import\(.*)(.ts)(['´"`]\))/g,"$1."+(s.format==="es"?"mjs":"cjs")+"$3"),map:null}:null}}),"fixDynamicImportExtension");var Mr=Object.defineProperty,Tr=f((e,t)=>Mr(e,"name",{value:t,configurable:!0}),"a$f");const Ar=Tr((e,t)=>{const s=e.replace(/^\.\//,""),o=t.replace(/^\.\//,"");if(o.startsWith(s))return e+o.slice(s.length);if(e.endsWith(t))return e;const n=e.split("/"),r=t.split("/");let i=n.length-1,l=r.length-1;for(;i>=0&&l>=0&&n[i]===r[l];)i--,l--;const c=n.slice(0,i).join("/"),a=r.slice(l).join("/");return c+(a?"/"+a:"")},"extendString");var Rr=Object.defineProperty,Fr=f((e,t)=>Rr(e,"name",{value:t,configurable:!0}),"s$b");const Lr=Fr((...e)=>{if(e.length===0)return"";if(e.length===1)return B(e[0]);e=e.map(n=>Oe(n));const[t,...s]=e;let o=t.split("/");for(const n of s){const r=n.split("/",o.length);let i=0;for(const l of r)if(l===o[i])i+=1;else{o=o.slice(0,i);break}o=o.slice(0,i)}return o.length<=1&&o[0]===""?`/${o[0]}`:o.join("/")},"lowestCommonAncestor");var Jr=Object.defineProperty,Ke=f((e,t)=>Jr(e,"name",{value:t,configurable:!0}),"m$a");const Br=Ke((e,t,s,o,n={})=>{const r=ne(n.include,n.exclude),i={},l=Ke((a,p)=>{i[a.replace(oe,"")]=p},"addOutput");async function c(a,p){if(!r(p))return;let d;try{const h=await Lo(a,{sourceFilename:p});d=JSON.parse(h.program)}catch{}if(d){const h=d.body.filter(g=>g.type==="ImportDeclaration"||g.type==="ExportAllDeclaration"||g.type==="ExportNamedDeclaration");for(const g of h){if(!g.source||pe(g.source.value).includes("."))continue;const y=await this.resolve(g.source.value,p);if(!(!y||y.external)&&(y.id.endsWith(".ts")||y.id.endsWith(".cts")||y.id.endsWith(".mts")||y.id.endsWith(".tsx")||y.id.endsWith(".ctsx")||y.id.endsWith(".mtsx"))){const w=y.id.replace(e+"/","");a=a.replaceAll('from "'+g.source.value+'"','from "'+Ar(g.source.value,w)+'"')}}}const{errors:u,sourceText:m}=await t(p,a);if(u.length>0){if(n.ignoreErrors){this.warn(u[0]);return}return this.error(u[0])}if(l(p,m),!d)return;const v=d.body.filter(h=>h.type==="ImportDeclaration"?h.importKind==="type"?!0:h.specifiers?.every(g=>g.type==="ImportSpecifier"&&g.importKind==="type"):h.type==="ExportNamedDeclaration"||h.type==="ExportAllDeclaration"?h.exportKind==="type"?!0:h.type==="ExportNamedDeclaration"&&h.specifiers?.every(g=>g.type==="ExportSpecifier"&&g.exportKind==="type"):!1);for await(const h of v){if(!h.source)continue;const g=await this.resolve(h.source.value,p);if(!g)return;const y=g.id;if(r(y)&&!i[y.replace(oe,"")])try{const w=await rt(y);await c.call(this,w,y)}catch{}}}return f(c,"h"),Ke(c,"transform"),{name:"packem:isolated-declarations",async renderStart(a,{input:p}){const d=Lr(...Array.isArray(p)?p:Object.values(p));typeof a.entryFileNames=="function"&&(a.entryFileNames=a.entryFileNames({name:a.name}));const u=a.entryFileNames.replace(/\.(.)?[jt]sx?$/,(m,v)=>`.d.${v||""}ts`);for await(let[m,v]of Object.entries(i)){if(o&&a.format==="cjs"){const g=ds(v);g!==null&&(v=g.code)}const h=v.includes("from '")?"'":'"';(s===!0||s==="compatible")&&a.format==="cjs"&&this.emitFile({fileName:u.replace("[name]",I(d,m)).replace(".cts",".ts"),source:v.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(g,y,w,$)=>y+h+($||w)+".d.ts"+h+";"),type:"asset"}),this.emitFile({fileName:u.replace("[name]",I(d,m)),source:v.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(g,y,w,$)=>y+h+($||w)+(a.format==="cjs"?".d.cts":".d.mts")+h+";"),type:"asset"})}},transform:c}},"isolatedDeclarationsPlugin");var Wr=Object.defineProperty,Vr=f((e,t)=>Wr(e,"name",{value:t,configurable:!0}),"n$9");const Ot="export default ",ws=Vr(e=>{const t=Jo(e);return{...t,name:"packem:json",transform(s,o){const n=t.transform?.call(this,s,o);return n&&typeof n!="string"&&"code"in n&&n.code?.startsWith(Ot)&&(n.code=n.code.replace(Ot,"module.exports = ")),n}}},"JSONPlugin");class zr{static{f(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:f(()=>this.should_skip=!0,"skip"),remove:f(()=>this.should_remove=!0,"remove"),replace:f(t=>this.replacement=t,"replace")}}replace(t,s,o,n){t&&s&&(o!=null?t[s][o]=n:t[s]=n)}remove(t,s,o){t&&s&&(o!=null?t[s].splice(o,1):delete t[s])}}class Ur extends zr{static{f(this,"SyncWalker")}constructor(t,s){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:f(()=>this.should_skip=!0,"skip"),remove:f(()=>this.should_remove=!0,"remove"),replace:f(o=>this.replacement=o,"replace")},this.enter=t,this.leave=s}visit(t,s,o,n){if(t){if(this.enter){const i=this.should_skip,l=this.should_remove,c=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,t,s,o,n),this.replacement&&(t=this.replacement,this.replace(s,o,n,t)),this.should_remove&&this.remove(s,o,n);const a=this.should_skip,p=this.should_remove;if(this.should_skip=i,this.should_remove=l,this.replacement=c,a)return t;if(p)return null}let r;for(r in t){const i=t[r];if(i&&typeof i=="object")if(Array.isArray(i)){const l=i;for(let c=0;c<l.length;c+=1){const a=l[c];Dt(a)&&(this.visit(a,t,r,c)||c--)}}else Dt(i)&&this.visit(i,t,r,null)}if(this.leave){const i=this.replacement,l=this.should_remove;this.replacement=null,this.should_remove=!1,this.leave.call(this.context,t,s,o,n),this.replacement&&(t=this.replacement,this.replace(s,o,n,t)),this.should_remove&&this.remove(s,o,n);const c=this.should_remove;if(this.replacement=i,this.should_remove=l,c)return null}}return t}}function Dt(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"}f(Dt,"isNode");function $s(e,{enter:t,leave:s}){return new Ur(t,s).visit(e,null)}f($s,"walk");var qr=Object.defineProperty,Kr=f((e,t)=>qr(e,"name",{value:t,configurable:!0}),"u$8");const Gr=Kr(({attributes:e,logger:t})=>{const s=ne([/\.[tj]sx$/],/node_modules/);if(!Array.isArray(e)||e.length===0)throw new Error("[packem:jsx-remove-attributes]: attributes must be a non-empty array of strings.");return{name:"packem:jsx-remove-attributes",transform(o,n){if(!s(n))return null;let r=null;try{r=this.parse(o,{allowReturnOutsideFunction:!0})}catch(c){return this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${n}" and remove the jsx attribute.`}),t.warn(c),null}let i=!1;const l=new G(o);return $s(r,{enter(c){if(c.type==="CallExpression"&&c.callee.type==="Identifier"&&c.callee.name==="jsx"){const a=c.arguments.filter(p=>p.type==="ObjectExpression"&&Array.isArray(p.properties));for(const p of a)for(const d of p.properties)d.type==="Property"&&d.key.type==="Literal"&&d.value.type==="Literal"&&e.includes(d.key.value)&&(l.overwrite(d.start-2,d.end,""),i=!0)}}}),i?{code:l.toString(),map:l.generateMap({hires:!0})}:null}}},"jsxRemoveAttributes");var Hr=Object.defineProperty,Yr=f((e,t)=>Hr(e,"name",{value:t,configurable:!0}),"r$a");const Xr=Yr((e,t,s)=>{const o=new RegExp(`(<!-- ${t} -->)[\\s\\S]*?(<!-- /${t} -->)`,"g");if(o.test(e))return e.replace(o,`$1
62
- ${s}
63
- $2`)},"replaceContentWithin");var Qr=Object.defineProperty,xs=f((e,t)=>Qr(e,"name",{value:t,configurable:!0}),"d$b");const Zr=xs(e=>{const t=[],s=[];return e.forEach(o=>{o.startsWith("(")?t.push(o):s.push(o)}),[...s.sort(),...t.sort()]},"sortLicenses"),js=xs(({dtsMarker:e,licenseFilePath:t,licenseTemplate:s,logger:o,marker:n,mode:r,packageName:i})=>Bo({thirdParty(l){const c=new Set,a=l.sort(({name:d},{name:u})=>(d||0)>(u||0)?1:(u||0)>(d||0)?-1:0).map(({author:d,contributors:u,license:m,licenseText:v,maintainers:h,name:g,repository:y})=>{let w="## "+g+`
64
- `;m&&(w+=`License: ${m}
65
- `);const $=new Set;for(const E of[d,...h,...u]){const b=typeof E=="string"?E:E?.name;b&&$.add(b)}return $.size>0&&(w+=`By: ${[...$].join(", ")}
66
- `),y&&(w+=`Repository: ${typeof y=="string"?y:y.url}
67
- `),v&&(w+=`
68
- `+v.trim().replaceAll(/\r\n|\r/g,`
60
+ `),i&&(o+=`const require = __cjs_mod__.createRequire(import.meta.url);
61
+ `),o},"generateCJSShimNode20_11"),Wa=Be((e,t)=>{const i=ne(t.include,t.exclude);return{name:"packem:esm-shim-cjs-syntax",renderChunk(o,n,a){if(a.format==="es"&&i(n.fileName)){let s=qa;if(e.engines?.node){const l=li(e.engines.node);l&&l.major>=20&&l.minor>=11&&(s=Ba)}return Ja(o,s)}return null}}},"esmShimCjsSyntaxPlugin");var Va=Object.defineProperty,Ua=u((e,t)=>Va(e,"name",{value:t,configurable:!0}),"m$c");const Ka=Ua(()=>({name:"packem:fix-dynamic-import-extension",renderChunk(e,t,i){return i.format==="es"||i.format==="cjs"?{code:e.replaceAll(/(import\(.*)(.ts)(['´"`]\))/g,"$1."+(i.format==="es"?"mjs":"cjs")+"$3"),map:null}:null}}),"fixDynamicImportExtension");var Ga=Object.defineProperty,Ha=u((e,t)=>Ga(e,"name",{value:t,configurable:!0}),"a$g");const Ya=Ha((e,t)=>{const i=e.replace(/^\.\//,""),o=t.replace(/^\.\//,"");if(o.startsWith(i))return e+o.slice(i.length);if(e.endsWith(t))return e;const n=e.split("/"),a=t.split("/");let s=n.length-1,l=a.length-1;for(;s>=0&&l>=0&&n[s]===a[l];)s--,l--;const p=n.slice(0,s).join("/"),r=a.slice(l).join("/");return p+(r?"/"+r:"")},"extendString");var Xa=Object.defineProperty,Qa=u((e,t)=>Xa(e,"name",{value:t,configurable:!0}),"s$c");const Za=Qa((...e)=>{if(e.length===0)return"";if(e.length===1)return I(e[0]);e=e.map(n=>Ne(n));const[t,...i]=e;let o=t.split("/");for(const n of i){const a=n.split("/",o.length);let s=0;for(const l of a)if(l===o[s])s+=1;else{o=o.slice(0,s);break}o=o.slice(0,s)}return o.length<=1&&o[0]===""?`/${o[0]}`:o.join("/")},"lowestCommonAncestor");var es=Object.defineProperty,Qe=u((e,t)=>es(e,"name",{value:t,configurable:!0}),"m$a");const ts=Qe((e,t,i,o,n={})=>{const a=ne(n.include,n.exclude),s={},l=Qe((r,c)=>{s[r.replace(le,"")]=c},"addOutput");async function p(r,c){if(!a(c))return;let m;try{const v=await Qo(r,{sourceFilename:c});m=JSON.parse(v.program)}catch{}if(m){const v=m.body.filter(g=>g.type==="ImportDeclaration"||g.type==="ExportAllDeclaration"||g.type==="ExportNamedDeclaration");for(const g of v){if(!g.source||oe(g.source.value).includes("."))continue;const h=await this.resolve(g.source.value,c);if(!(!h||h.external)&&(h.id.endsWith(".ts")||h.id.endsWith(".cts")||h.id.endsWith(".mts")||h.id.endsWith(".tsx")||h.id.endsWith(".ctsx")||h.id.endsWith(".mtsx"))){const y=h.id.replace(e+"/","");r=r.replaceAll('from "'+g.source.value+'"','from "'+Ya(g.source.value,y)+'"')}}}const{errors:d,sourceText:f}=await t(c,r);if(d.length>0){if(n.ignoreErrors){this.warn(d[0]);return}return this.error(d[0])}if(l(c,f),!m)return;const x=m.body.filter(v=>v.type==="ImportDeclaration"?v.importKind==="type"?!0:v.specifiers?.every(g=>g.type==="ImportSpecifier"&&g.importKind==="type"):v.type==="ExportNamedDeclaration"||v.type==="ExportAllDeclaration"?v.exportKind==="type"?!0:v.type==="ExportNamedDeclaration"&&v.specifiers?.every(g=>g.type==="ExportSpecifier"&&g.exportKind==="type"):!1);for await(const v of x){if(!v.source)continue;const g=await this.resolve(v.source.value,c);if(!g)return;const h=g.id;if(a(h)&&!s[h.replace(le,"")])try{const y=await pt(h);await p.call(this,y,h)}catch{}}}return u(p,"h"),Qe(p,"transform"),{name:"packem:isolated-declarations",async renderStart(r,{input:c}){const m=Za(...Array.isArray(c)?c:Object.values(c));typeof r.entryFileNames=="function"&&(r.entryFileNames=r.entryFileNames({name:r.name}));const d=r.entryFileNames.replace(/\.(.)?[jt]sx?$/,(f,x)=>`.d.${x||""}ts`);for await(let[f,x]of Object.entries(s)){if(o&&r.format==="cjs"){const g=hi(x);g!==null&&(x=g.code)}const v=x.includes("from '")?"'":'"';(i===!0||i==="compatible")&&r.format==="cjs"&&this.emitFile({fileName:d.replace("[name]",N(m,f)).replace(".cts",".ts"),source:x.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(g,h,y,w)=>h+v+(w||y)+".d.ts"+v+";"),type:"asset"}),this.emitFile({fileName:d.replace("[name]",N(m,f)),source:x.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(g,h,y,w)=>h+v+(w||y)+(r.format==="cjs"?".d.cts":".d.mts")+v+";"),type:"asset"})}},transform:p}},"isolatedDeclarationsPlugin");var is=Object.defineProperty,os=u((e,t)=>is(e,"name",{value:t,configurable:!0}),"n$9");const Mt="export default ",Ei=os(e=>{const t=Zo(e);return{...t,name:"packem:json",transform(i,o){const n=t.transform?.call(this,i,o);return n&&typeof n!="string"&&"code"in n&&n.code?.startsWith(Mt)&&(n.code=n.code.replace(Mt,"module.exports = ")),n}}},"JSONPlugin");class ns{static{u(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:u(()=>this.should_skip=!0,"skip"),remove:u(()=>this.should_remove=!0,"remove"),replace:u(t=>this.replacement=t,"replace")}}replace(t,i,o,n){t&&i&&(o!=null?t[i][o]=n:t[i]=n)}remove(t,i,o){t&&i&&(o!=null?t[i].splice(o,1):delete t[i])}}class as extends ns{static{u(this,"SyncWalker")}constructor(t,i){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:u(()=>this.should_skip=!0,"skip"),remove:u(()=>this.should_remove=!0,"remove"),replace:u(o=>this.replacement=o,"replace")},this.enter=t,this.leave=i}visit(t,i,o,n){if(t){if(this.enter){const s=this.should_skip,l=this.should_remove,p=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,t,i,o,n),this.replacement&&(t=this.replacement,this.replace(i,o,n,t)),this.should_remove&&this.remove(i,o,n);const r=this.should_skip,c=this.should_remove;if(this.should_skip=s,this.should_remove=l,this.replacement=p,r)return t;if(c)return null}let a;for(a in t){const s=t[a];if(s&&typeof s=="object")if(Array.isArray(s)){const l=s;for(let p=0;p<l.length;p+=1){const r=l[p];Tt(r)&&(this.visit(r,t,a,p)||p--)}}else Tt(s)&&this.visit(s,t,a,null)}if(this.leave){const s=this.replacement,l=this.should_remove;this.replacement=null,this.should_remove=!1,this.leave.call(this.context,t,i,o,n),this.replacement&&(t=this.replacement,this.replace(i,o,n,t)),this.should_remove&&this.remove(i,o,n);const p=this.should_remove;if(this.replacement=s,this.should_remove=l,p)return null}}return t}}function Tt(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"}u(Tt,"isNode");function Si(e,{enter:t,leave:i}){return new as(t,i).visit(e,null)}u(Si,"walk");var ss=Object.defineProperty,rs=u((e,t)=>ss(e,"name",{value:t,configurable:!0}),"u$9");const ls=rs(({attributes:e,logger:t})=>{const i=ne([/\.[tj]sx$/],/node_modules/);if(!Array.isArray(e)||e.length===0)throw new Error("[packem:jsx-remove-attributes]: attributes must be a non-empty array of strings.");return{name:"packem:jsx-remove-attributes",transform(o,n){if(!i(n))return null;let a=null;try{a=this.parse(o,{allowReturnOutsideFunction:!0})}catch(p){return this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${n}" and remove the jsx attribute.`}),t.warn(p),null}let s=!1;const l=new H(o);return Si(a,{enter(p){if(p.type==="CallExpression"&&p.callee.type==="Identifier"&&p.callee.name==="jsx"){const r=p.arguments.filter(c=>c.type==="ObjectExpression"&&Array.isArray(c.properties));for(const c of r)for(const m of c.properties)m.type==="Property"&&m.key.type==="Literal"&&m.value.type==="Literal"&&e.includes(m.key.value)&&(l.overwrite(m.start-2,m.end,""),s=!0)}}}),s?{code:l.toString(),map:l.generateMap({hires:!0})}:null}}},"jsxRemoveAttributes");var ps=Object.defineProperty,cs=u((e,t)=>ps(e,"name",{value:t,configurable:!0}),"r$a");const ds=cs((e,t,i)=>{const o=new RegExp(`(<!-- ${t} -->)[\\s\\S]*?(<!-- /${t} -->)`,"g");if(o.test(e))return e.replace(o,`$1
62
+ ${i}
63
+ $2`)},"replaceContentWithin");var ms=Object.defineProperty,Oi=u((e,t)=>ms(e,"name",{value:t,configurable:!0}),"d$b");const us=Oi(e=>{const t=[],i=[];return e.forEach(o=>{o.startsWith("(")?t.push(o):i.push(o)}),[...i.sort(),...t.sort()]},"sortLicenses"),Di=Oi(({dtsMarker:e,licenseFilePath:t,licenseTemplate:i,logger:o,marker:n,mode:a,packageName:s})=>en({thirdParty(l){const p=new Set,r=l.sort(({name:m},{name:d})=>(m||0)>(d||0)?1:(d||0)>(m||0)?-1:0).map(({author:m,contributors:d,license:f,licenseText:x,maintainers:v,name:g,repository:h})=>{let y="## "+g+`
64
+ `;f&&(y+=`License: ${f}
65
+ `);const w=new Set;for(const E of[m,...v,...d]){const b=typeof E=="string"?E:E?.name;b&&w.add(b)}return w.size>0&&(y+=`By: ${[...w].join(", ")}
66
+ `),h&&(y+=`Repository: ${typeof h=="string"?h:h.url}
67
+ `),x&&(y+=`
68
+ `+x.trim().replaceAll(/\r\n|\r/g,`
69
69
  `).replaceAll(`<!-- ${n} -->`,"").replaceAll(e?`<!-- ${e} -->`:"","").replaceAll(`<!-- /${n} -->`,"").replaceAll(e?`<!-- /${e} -->`:"","").trim().split(`
70
70
  `).map(E=>E?`> ${E}`:">").join(`
71
71
  `)+`
72
- `),m&&c.add(m),w}).join(`
72
+ `),f&&p.add(f),y}).join(`
73
73
  ---------------------------------------
74
74
 
75
- `);if(a===""){o.info({message:"No dependencies license information found.",prefix:"plugin:license:"+r});return}const p=s(Zr(c),a,i);try{const d=Me(t),u=Xr(d,n,p);if(!u){o.error({message:`Could not find the license marker: <!-- ${n} --><!-- /${n} --> in ${t}`,prefix:"plugin:license:"+r});return}d!==u&&(se(t,u),o.info({message:`${t} updated.`,prefix:"plugin:license:"+r}))}catch(d){o.error(d)}}}),"license");var ei=Object.defineProperty,ti=f((e,t)=>ei(e,"name",{value:t,configurable:!0}),"i$9");const si=ti(e=>({async buildEnd(){const t=[];for(const o of this.getModuleIds()){const n=this.getModuleInfo(o);if(n!=null&&!n.isExternal)for(const r of n.importedIds)t.push({source:o,target:r})}if(Array.isArray(t)&&t.length===0)return;const s=j(e.rootDir,e.outDir,"graph.json");Te(s,t)},name:"packem:metafile"}),"metafilePlugin");var oi=Object.defineProperty,ni=f((e,t)=>oi(e,"name",{value:t,configurable:!0}),"g$5");let Ct=!1;const ri=ni((e,t,s,o,n,r)=>{if(r!=="*"&&So(Oo(r))===null)throw new Error("Invalid typeScriptVersion option. It must be a valid semver range.");return{name:"packem:node10-compatibility",writeBundle(){Ct||(e.info({message:"Declaration node10 compatibility mode is enabled.",prefix:"plugin:node10-compatibility"}),Ct=!0);const i={};for(const a of t)for(const p of a.exportKey)p.includes("/*")?i[p]=["./"+x(s,B(a.name),"*.d.ts")]:i[p]=[...i[p]??[],"./"+x(s,a.name+".d.ts")];const l=x(o,"package.json"),c=it(l);n==="file"&&Object.keys(i).length>0?(Te(l,{...c,typesVersions:{...c.typesVersions,[r]:i}},{detectIndent:!0}),e.info({message:'Your package.json "typesVersions" field has been updated.',prefix:"plugin:node10-compatibility"})):Object.keys(i).length>0&&e.info({message:`Please add the following field into your package.json to enable node 10 compatibility:
75
+ `);if(r===""){o.info({message:"No dependencies license information found.",prefix:"plugin:license:"+a});return}const c=i(us(p),r,s);try{const m=Re(t),d=ds(m,n,c);if(!d){o.error({message:`Could not find the license marker: <!-- ${n} --><!-- /${n} --> in ${t}`,prefix:"plugin:license:"+a});return}m!==d&&(re(t,d),o.info({message:`${t} updated.`,prefix:"plugin:license:"+a}))}catch(m){o.error(m)}}}),"license");var fs=Object.defineProperty,gs=u((e,t)=>fs(e,"name",{value:t,configurable:!0}),"i$9");const vs=gs(e=>({async buildEnd(){const t=[];for(const o of this.getModuleIds()){const n=this.getModuleInfo(o);if(n!=null&&!n.isExternal)for(const a of n.importedIds)t.push({source:o,target:a})}if(Array.isArray(t)&&t.length===0)return;const i=j(e.rootDir,e.outDir,"graph.json");Le(i,t)},name:"packem:metafile"}),"metafilePlugin");var hs=Object.defineProperty,xs=u((e,t)=>hs(e,"name",{value:t,configurable:!0}),"g$5");let At=!1;const ys=xs((e,t,i,o,n,a)=>{if(a!=="*"&&Ro(Lo(a))===null)throw new Error("Invalid typeScriptVersion option. It must be a valid semver range.");return{name:"packem:node10-compatibility",writeBundle(){At||(e.info({message:"Declaration node10 compatibility mode is enabled.",prefix:"plugin:node10-compatibility"}),At=!0);const s={};for(const r of t)for(const c of r.exportKey)c.includes("/*")?s[c]=["./"+k(i,I(r.name),"*.d.ts")]:s[c]=[...s[c]??[],"./"+k(i,r.name+".d.ts")];const l=k(o,"package.json"),p=ei(l);n==="file"&&Object.keys(s).length>0?(Le(l,{...p,typesVersions:{...p.typesVersions,[a]:s}},{detectIndent:!0}),e.info({message:'Your package.json "typesVersions" field has been updated.',prefix:"plugin:node10-compatibility"})):Object.keys(s).length>0&&e.info({message:`Please add the following field into your package.json to enable node 10 compatibility:
76
76
 
77
- ${JSON.stringify({typesVersions:{"*":i}},null,4)}
78
- `,prefix:"plugin:node10-compatibility"})}}},"node10CompatibilityPlugin");var ii=Object.defineProperty,ai=f((e,t)=>ii(e,"name",{value:t,configurable:!0}),"t$7");const Q=ai(e=>Wo("sha256").update(e).digest("hex"),"getHash");var li=Object.defineProperty,ks=f((e,t)=>li(e,"name",{value:t,configurable:!0}),"d$a");const me=ks(e=>e.handler||e,"getHandler"),M=ks((e,t,s="")=>({...e,async buildEnd(o){e.buildEnd&&await me(e.buildEnd).call(this,o)},async buildStart(o){e.buildStart&&await me(e.buildStart).call(this,o)},async load(o){if(!e.load)return null;const n=x(s,e.name),r=x("load",Q(o));if(t.has(r,n))return await t.get(r,n);const i=await me(e.load).call(this,o);return t.set(r,i,n),i},name:`cached(${e.name})`,async resolveId(o,n,r){if(!e.resolveId)return null;const i=x(s,e.name),l=x("resolveId",Q(o),n?Q(n):"",Q(JSON.stringify(r)));if(t.has(l,i))return await t.get(l,i);const c=await me(e.resolveId).call(this,o,n,r);return t.set(l,c,i),c},async transform(o,n){if(!e.transform)return null;const r=x(s,e.name),i=x("transform",Q(n),Q(o));if(t.has(i,r))return await t.get(i,r);const l=await me(e.transform).call(this,o,n);return t.set(i,l,r),l}}),"cachingPlugin");var ci=Object.defineProperty,pi=f((e,t)=>ci(e,"name",{value:t,configurable:!0}),"n$8");const ui=pi(()=>({name:"packem:prepend-directive",transform:{handler(e,t){const s=this.getModuleInfo(t);if(s?.meta.preserveDirectives){const o=s.meta.preserveDirectives.directives[0];if(o)return`'${o.value}';
79
- `+e}return null},order:"post"}}),"prependDirectivePlugin");var di=Object.defineProperty,fi=f((e,t)=>di(e,"name",{value:t,configurable:!0}),"c$a");const mi=fi(({directiveRegex:e,exclude:t=[],include:s=[],logger:o})=>{const n={},r={},i=ne(s,t);return{name:"packem:preserve-directives",onLog(l,c){return c.code==="MODULE_LEVEL_DIRECTIVE"&&l==="warn"?!1:null},renderChunk:{handler(l,c,{sourcemap:a}){const p=c.moduleIds.map(m=>n[m]?n[m]:null).reduce((m,v)=>(v&&v.forEach(h=>{m.add(h)}),m),new Set),d=new G(l);p.size>0&&(o.debug({message:`directives for chunk "${c.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),d.prepend(`${[...p].map(m=>`'${m}';`).join(`
77
+ ${JSON.stringify({typesVersions:{"*":s}},null,4)}
78
+ `,prefix:"plugin:node10-compatibility"})}}},"node10CompatibilityPlugin");var bs=Object.defineProperty,ws=u((e,t)=>bs(e,"name",{value:t,configurable:!0}),"t$7");const ee=ws(e=>on("sha256").update(e).digest("hex"),"getHash");var ks=Object.defineProperty,Ci=u((e,t)=>ks(e,"name",{value:t,configurable:!0}),"d$a");const he=Ci(e=>e.handler||e,"getHandler"),T=Ci((e,t,i="")=>({...e,async buildEnd(o){e.buildEnd&&await he(e.buildEnd).call(this,o)},async buildStart(o){e.buildStart&&await he(e.buildStart).call(this,o)},async load(o){if(!e.load)return null;const n=k(i,e.name),a=k("load",ee(o));if(t.has(a,n))return await t.get(a,n);const s=await he(e.load).call(this,o);return t.set(a,s,n),s},name:`cached(${e.name})`,async resolveId(o,n,a){if(!e.resolveId)return null;const s=k(i,e.name),l=k("resolveId",ee(o),n?ee(n):"",ee(JSON.stringify(a)));if(t.has(l,s))return await t.get(l,s);const p=await he(e.resolveId).call(this,o,n,a);return t.set(l,p,s),p},async transform(o,n){if(!e.transform)return null;const a=k(i,e.name),s=k("transform",ee(n),ee(o));if(t.has(s,a))return await t.get(s,a);const l=await he(e.transform).call(this,o,n);return t.set(s,l,a),l}}),"cachingPlugin");var js=Object.defineProperty,$s=u((e,t)=>js(e,"name",{value:t,configurable:!0}),"n$8");const Es=$s(()=>({name:"packem:prepend-directive",transform:{handler(e,t){const i=this.getModuleInfo(t);if(i?.meta.preserveDirectives){const o=i.meta.preserveDirectives.directives[0];if(o)return`'${o.value}';
79
+ `+e}return null},order:"post"}}),"prependDirectivePlugin");var Ss=Object.defineProperty,Os=u((e,t)=>Ss(e,"name",{value:t,configurable:!0}),"c$c");const Ds=Os(({directiveRegex:e,exclude:t=[],include:i=[],logger:o})=>{const n={},a={},s=ne(i,t);return{name:"packem:preserve-directives",onLog(l,p){return p.code==="MODULE_LEVEL_DIRECTIVE"&&l==="warn"?!1:null},renderChunk:{handler(l,p,{sourcemap:r}){const c=p.moduleIds.map(f=>n[f]?n[f]:null).reduce((f,x)=>(x&&x.forEach(v=>{f.add(v)}),f),new Set),m=new H(l);c.size>0&&(o.debug({message:`directives for chunk "${p.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),m.prepend(`${[...c].map(f=>`'${f}';`).join(`
80
80
  `)}
81
- `));let u;return c.facadeModuleId&&typeof r[c.facadeModuleId]=="string"&&(u=r[c.facadeModuleId]),u&&(o.debug({message:`shebang for chunk "${c.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),d.prepend(`${u}
82
- `)),p.size===0&&u===void 0?null:{code:d.toString(),map:a?d.generateMap({hires:!0}):null}},order:"post"},transform(l,c){if(!i(c))return null;let a=!1;const p=new G(l);if(l.startsWith("#")&&l[1]==="!"){let u=0;for(let m=2,v=l.length;m<v;m++){const h=l.codePointAt(m);if(h===10||h===13||h===8232||h===8233){u=m;break}}u&&(r[c]=l.slice(0,u),p.remove(0,u+1),a=!0,o.debug({message:`shebang for module "${c}" is preserved.`,prefix:"plugin:preserve-directives"}))}let d=null;try{d=this.parse(p.toString(),{allowReturnOutsideFunction:!0})}catch(u){return this.warn({code:"PARSE_ERROR",message:`failed to parse "${c}" and extract the directives.`}),o.warn(u),null}if(d.type!=="Program")return null;for(const u of d.body.filter(Boolean)){if(u.type!=="ExpressionStatement")break;let m=null;"directive"in u?m=u.directive:u.expression.type==="Literal"&&typeof u.expression.value=="string"&&e.test(u.expression.value)&&(m=u.expression.value),m!=="use strict"&&m&&(n[c]||=new Set,n[c].add(m),"start"in u&&typeof u.start=="number"&&"end"in u&&typeof u.end=="number"&&(p.remove(u.start,u.end),a=!0),o.debug({message:`directive "${m}" for module "${c}" is preserved.`,prefix:"plugin:preserve-directives"}))}return a?{code:p.toString(),map:p.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...n[c]??[]],shebang:r[c]??null}}}:null}}},"preserveDirectives");var gi=Object.defineProperty,hi=f((e,t)=>gi(e,"name",{value:t,configurable:!0}),"n$7");const yi=hi(e=>{const t=ne(e.include,e.exclude);return{async load(s){return s.includes("?raw")?await this.load({id:s.replace(/\?raw$/,"")}):null},name:"packem:raw",transform(s,o){return!t(o)&&!o.includes("?raw")?null:(o.includes("?raw")||(s=`export default ${JSON.stringify(s)}`),{code:s,map:{mappings:""}})}}},"rawPlugin");var vi=Object.defineProperty,bi=f((e,t)=>vi(e,"name",{value:t,configurable:!0}),"r$9");const Es=bi(()=>({name:"packem:resolve-file-url",resolveId(e){if(e.startsWith("file://"))return rs(e)}}),"resolveFileUrl");var wi=Object.defineProperty,Le=f((e,t)=>wi(e,"name",{value:t,configurable:!0}),"i$6");const Pe=/^#![^\n]*/,st=Le(async e=>{await io(e,493).catch(()=>{})},"makeExecutable"),$i=Le((e,t)=>({name:"packem:shebang",renderChunk:{handler(s,o,n){if(!o.isEntry||!o.facadeModuleId)return null;const r=s.startsWith("#")&&s[1]==="!";if(r&&t.replace)return s.replace(Pe,t.shebang+`
83
- `);if(r)return null;if(e.includes(o.name)){const i=new G(s);return i.prepend(t.shebang+`
84
- `),{code:i.toString(),map:n.sourcemap?i.generateMap({hires:!0}):void 0}}return null},order:"post"},async writeBundle(s,o){for(const[n,r]of Object.entries(o))if(r.type==="chunk"&&Pe.test(r.code)&&s.dir){const i=j(s.dir,n);await st(i)}}}),"shebangPlugin"),xi=Le(()=>({name:"packem:remove-shebang",renderChunk(e){return e.replace(Pe,"")}}),"removeShebangPlugin"),ji=Le((e,t=`
85
- `)=>{const s=Pe.exec(e);return s?s+t:""},"getShebang");var ki=Object.defineProperty,re=f((e,t)=>ki(e,"name",{value:t,configurable:!0}),"r$8");const Ei=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,Si=/MIT License|MIT license|BSD license/,Oi=/\n{2,}/g,Di=/\b(\w+)\$\d+\b/g,Ci=/[-/\\^$*+?.()|[\]{}]/g,Pi=re(e=>e.replaceAll(Ci,"\\$&"),"escapeRegex"),Ni=re(e=>[...new Set(e)],"unique"),Ii=re(e=>e.replaceAll(Ei,t=>Si.test(t)?"":t).replaceAll(Oi,`
81
+ `));let d;return p.facadeModuleId&&typeof a[p.facadeModuleId]=="string"&&(d=a[p.facadeModuleId]),d&&(o.debug({message:`shebang for chunk "${p.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),m.prepend(`${d}
82
+ `)),c.size===0&&d===void 0?null:{code:m.toString(),map:r?m.generateMap({hires:!0}):null}},order:"post"},transform(l,p){if(!s(p))return null;let r=!1;const c=new H(l);if(l.startsWith("#")&&l[1]==="!"){let d=0;for(let f=2,x=l.length;f<x;f++){const v=l.codePointAt(f);if(v===10||v===13||v===8232||v===8233){d=f;break}}d&&(a[p]=l.slice(0,d),c.remove(0,d+1),r=!0,o.debug({message:`shebang for module "${p}" is preserved.`,prefix:"plugin:preserve-directives"}))}let m=null;try{m=this.parse(c.toString(),{allowReturnOutsideFunction:!0})}catch(d){return this.warn({code:"PARSE_ERROR",message:`failed to parse "${p}" and extract the directives.`}),o.warn(d),null}if(m.type!=="Program")return null;for(const d of m.body.filter(Boolean)){if(d.type!=="ExpressionStatement")break;let f=null;"directive"in d?f=d.directive:d.expression.type==="Literal"&&typeof d.expression.value=="string"&&e.test(d.expression.value)&&(f=d.expression.value),f!=="use strict"&&f&&(n[p]||=new Set,n[p].add(f),"start"in d&&typeof d.start=="number"&&"end"in d&&typeof d.end=="number"&&(c.remove(d.start,d.end),r=!0),o.debug({message:`directive "${f}" for module "${p}" is preserved.`,prefix:"plugin:preserve-directives"}))}return r?{code:c.toString(),map:c.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...n[p]??[]],shebang:a[p]??null}}}:null}}},"preserveDirectives");var Cs=Object.defineProperty,Ps=u((e,t)=>Cs(e,"name",{value:t,configurable:!0}),"n$7");const Ns=Ps(e=>{const t=ne(e.include,e.exclude);return{async load(i){return i.includes("?raw")?await this.load({id:i.replace(/\?raw$/,"")}):null},name:"packem:raw",transform(i,o){return!t(o)&&!o.includes("?raw")?null:(o.includes("?raw")||(i=`export default ${JSON.stringify(i)}`),{code:i,map:{mappings:""}})}}},"rawPlugin");var _s=Object.defineProperty,Is=u((e,t)=>_s(e,"name",{value:t,configurable:!0}),"r$9");const Pi=Is(()=>({name:"packem:resolve-file-url",resolveId(e){if(e.startsWith("file://"))return ci(e)}}),"resolveFileUrl");var Ms=Object.defineProperty,We=u((e,t)=>Ms(e,"name",{value:t,configurable:!0}),"i$6");const Me=/^#![^\n]*/,rt=We(async e=>{await So(e,493).catch(()=>{})},"makeExecutable"),Ts=We((e,t)=>({name:"packem:shebang",renderChunk:{handler(i,o,n){if(!o.isEntry||!o.facadeModuleId)return null;const a=i.startsWith("#")&&i[1]==="!";if(a&&t.replace)return i.replace(Me,t.shebang+`
83
+ `);if(a)return null;if(e.includes(o.name)){const s=new H(i);return s.prepend(t.shebang+`
84
+ `),{code:s.toString(),map:n.sourcemap?s.generateMap({hires:!0}):void 0}}return null},order:"post"},async writeBundle(i,o){for(const[n,a]of Object.entries(o))if(a.type==="chunk"&&Me.test(a.code)&&i.dir){const s=j(i.dir,n);await rt(s)}}}),"shebangPlugin"),As=We(()=>({name:"packem:remove-shebang",renderChunk(e){return e.replace(Me,"")}}),"removeShebangPlugin"),zs=We((e,t=`
85
+ `)=>{const i=Me.exec(e);return i?i+t:""},"getShebang");var Fs=Object.defineProperty,pe=u((e,t)=>Fs(e,"name",{value:t,configurable:!0}),"r$8");const Rs=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,Ls=/MIT License|MIT license|BSD license/,Js=/\n{2,}/g,qs=/\b(\w+)\$\d+\b/g,Bs=/[-/\\^$*+?.()|[\]{}]/g,Ws=pe(e=>e.replaceAll(Bs,"\\$&"),"escapeRegex"),Vs=pe(e=>[...new Set(e)],"unique"),Us=pe(e=>e.replaceAll(Rs,t=>Ls.test(t)?"":t).replaceAll(Js,`
86
86
 
87
- `),"cleanUnnecessaryComments"),Pt=new Map;function Ss(e,t,{identifierReplacements:s},o){const n=ns(e);for(const i in s){const l=n.find(a=>a.specifier===i&&a.imports.includes("{"));if(!l){this.warn(`${t.fileName} does not import "${i}" for replacement`),process.exitCode=1;continue}const c=s[i];for(const a in c){if(!l.imports.includes(a))throw new Error(`${t.fileName} does not import "${a}" from "${i}" for replacement`);const p=c[a],d=Pi(a);p.includes(".")&&(e=e.replace(new RegExp(`\\b\\w+\\b as ${d},?\\s?`),"")),e=e.replaceAll(new RegExp(`\\b${d}\\b`,"g"),p)}}const r=Ni(Array.from(e.matchAll(Di),i=>i[0]));if(r.length>0){const i=r.map(c=>`
88
- - ${c}`).join(""),l=t.fileName.replace(/\.[^/.]+$/,"");Pt.has(l)||o.warn({message:`${t.fileName} contains confusing identifier names${i}
87
+ `),"cleanUnnecessaryComments"),zt=new Map;function Ni(e,t,{identifierReplacements:i},o){const n=pi(e);for(const s in i){const l=n.find(r=>r.specifier===s&&r.imports.includes("{"));if(!l){this.warn(`${t.fileName} does not import "${s}" for replacement`),process.exitCode=1;continue}const p=i[s];for(const r in p){if(!l.imports.includes(r))throw new Error(`${t.fileName} does not import "${r}" from "${s}" for replacement`);const c=p[r],m=Ws(r);c.includes(".")&&(e=e.replace(new RegExp(`\\b\\w+\\b as ${m},?\\s?`),"")),e=e.replaceAll(new RegExp(`\\b${m}\\b`,"g"),c)}}const a=Vs(Array.from(e.matchAll(qs),s=>s[0]));if(a.length>0){const s=a.map(p=>`
88
+ - ${p}`).join(""),l=t.fileName.replace(/\.[^/.]+$/,"");zt.has(l)||o.warn({message:`${t.fileName} contains confusing identifier names${s}
89
89
 
90
- To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),Pt.set(l,!0)}return e}f(Ss,"I$1");re(Ss,"replaceConfusingTypeNames");const _i=re((e,t)=>{if(t.leadingComments?.some(s=>s.type==="CommentBlock"&&s.value.includes("@internal"))){const s=e.original[t.end]===","?t.end+1:t.end;return e.remove(t.leadingComments[0].start,s),!0}return!1},"removeInternal");function Os(e,t){if(e.includes("@internal")){const s=new G(e),o=Vo(e,{plugins:["typescript"],sourceType:"module"});if($s(o,{enter(n){_i(s,n)&&this.skip()}}),e=s.toString(),e.includes("@internal"))throw new Error(`${t.fileName} has unhandled @internal declarations`)}return e}f(Os,"S");re(Os,"stripInternalTypes");const Mi=re((e,t)=>({name:"packem:patch-types",renderChunk(s,o){return s=Ss.call(this,s,o,e,t),s=Os.call(this,s,o),s=Ii(s),s},resolveId(s){return s.startsWith("types/")?{external:!0,id:"../../"+(s.endsWith(".js")?s:s+".js")}:null}}),"patchTypescriptTypes");var Ti=Object.defineProperty,Ds=f((e,t)=>Ti(e,"name",{value:t,configurable:!0}),"m$9");const Cs=Ds((e,t=!0)=>{if(!e)return null;const{config:s,path:o}=e;if(!s.compilerOptions)return null;const{baseUrl:n,paths:r}=s.compilerOptions;if(!n)return null;const i=j(B(o),n),l=[];if(r)for(const[c,a]of Object.entries(r)){let p;c==="@"||c==="~"||c==="#"?p=new RegExp(`^${c}/(.+)$`):p=new RegExp(`^${[...c].map(u=>u==="*"?"(.+)":u.replace(/[\\^$*+?.()|[\]{}]/,"\\$&")).join("")}$`);let d=0;for(const u of a){const m=[...J(j(i,u))].map(v=>v==="*"?"$"+(++d+""):v==="$"?"$$":v).join("");l.push({find:p,replacement:m})}}return t&&l.push({find:/^(?!\.*\/|\.*$|\w:)(.+)$/,replacement:`${[...J(i)].map(c=>c==="$"?"$$":c).join("")}/$1`}),l},"getConfigAlias"),Ps=Ds((e,t)=>{const s=Cs(e);return{name:"packem:resolve-tsconfig-paths",async resolveId(o,n,r){if(!s||o.includes("\0"))return null;for(const{find:i,replacement:l}of s)if(i.test(o)){const c=o.replace(i,l),a=await this.resolve(c,n,{skipSelf:!0,...r});if(a)return t.debug({message:`Resolved ${o} to ${a.id} using paths from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-paths"}),a.id}return null}}},"resolveTsconfigPaths");var Ai=Object.defineProperty,Ns=f((e,t)=>Ai(e,"name",{value:t,configurable:!0}),"u$5");const Ri=Ns((e,t)=>{if(!t)return null;const{config:s,path:o}=t;if(!s.compilerOptions)return null;const{rootDirs:n}=s.compilerOptions;if(!n)return null;const r=[];for(const i of n){if(i.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${o}.`);if(i.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${o}.`);r.push(j(e,i))}return r},"getRootDirectories"),Is=Ns((e,t,s)=>{const o=Ri(e,s);return{name:"packem:resolve-tsconfig-root-dirs",async resolveId(n,r,i){if(o===null||o.length===0)return null;if(n.startsWith("."))for(const l of o){const c=x(l,n),a=await this.resolve(c,r,{skipSelf:!0,...i});if(a)return t.debug({message:`Resolved ${n} to ${a.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),a.id}return null}}},"resolveTsconfigRootDirectories");var Fi=Object.defineProperty,Li=f((e,t)=>Fi(e,"name",{value:t,configurable:!0}),"r$7");const _s=Li(()=>{const e=/\.(?:[mc]?js|jsx)$/;return{name:"packem:resolve-typescript-mjs-cjs",async resolveId(t,s,o){return e.test(t)&&s?await this.resolve(t.replace(/js(x?)$/,"ts$1"),s,o):null}}},"resolveTypescriptMjsCts");var Ji=Object.defineProperty,Bi=f((e,t)=>Ji(e,"name",{value:t,configurable:!0}),"s$7");const Wi=Bi(e=>{const t=pe(e).split(".");if(t.length>=2){const[s,o]=t.slice(-2),n=t[0],r=/^(\w+)-runtime$/.exec(s)?.[1];if(at.includes(o)&&r&&r.length>0)return n+"-"+r}},"getCustomModuleLayer");var Vi=Object.defineProperty,zi=f((e,t)=>Vi(e,"name",{value:t,configurable:!0}),"i$5");const Ge=zi(e=>(e.preserveDirectives||{directives:[]}).directives.map(t=>t.replace(/^use /,"")).find(t=>t!=="strict"),"getModuleLayer");var Ui=Object.defineProperty,Nt=f((e,t)=>Ui(e,"name",{value:t,configurable:!0}),"d$9");const qi=Nt((e,t)=>{const s=new Map;return Nt(function(o,n){const r=n.getModuleInfo(o);if(!r)return;const{isEntry:i}=r,l=r.meta,c=Ge(l);if(!i){const a=s.get(o);if(a)return a;const p=Wi(o);if(p)return s.set(o,p),p}if(i){const a=n.getModuleIds();for(const p of a)n.getModuleInfo(p)&&Ge(l)===c&&(e.has(p)||e.set(p,new Set),e.get(p).add([o,c]))}if(c&&!i&&e.has(o)){const a=[...e.get(o)];if(a.some(([d])=>{if(t.some(u=>u.path===d)){const u=n.getModuleInfo(d);return Ge(u?u.meta:{})===c}return!1}))return;if(a.every(([,d])=>d===c))return s.has(o)?s.get(o):void 0;const p=pe(o,Kt(o))+"-"+c;return s.set(o,p),p}},"splitChunks")},"createSplitChunks");var Ki=Object.defineProperty,Gi=f((e,t)=>Ki(e,"name",{value:t,configurable:!0}),"n$5");const ee=Gi((e,t)=>e.isDynamicEntry?`${en}/[name].${t}`:`${tn}/${e.name}-[hash].${t}`,"getChunkFilename");var Hi=Object.defineProperty,Yi=f((e,t)=>Hi(e,"name",{value:t,configurable:!0}),"o$4");const Xi=process.platform==="win32",It=Yi((e,t)=>{const s=Xi?"\\":"/";for(let o of Array.isArray(e.names)?e.names:[]){if(o.includes("node_modules"+s+".pnpm"))return o=o.replace("node_modules"+s+".pnpm","external")+"."+t,o.replace("node_modules"+s,"");if(o.includes("node_modules"))return o.replace("node_modules","external")+"."+t}return"[name]."+t},"getEntryFileNames");var Qi=Object.defineProperty,Zi=f((e,t)=>Qi(e,"name",{value:t,configurable:!0}),"p$1");const pt=Zi((e,t)=>{let s={};if(e.pkg.name&&(s[e.pkg.name]=e.options.rootDir),e.pkg.imports){const{imports:o}=e.pkg;for(const n in o){if(n.startsWith("#"))continue;const r=o[n];typeof r=="string"&&(s[n]=x(e.options.rootDir,r))}}return s={...s,...e.options.alias},e.options.rollup.alias&&(Array.isArray(e.options.rollup.alias.entries)?Object.assign(s,Object.fromEntries(e.options.rollup.alias.entries.map(o=>[o.find,o.replacement]))):Object.assign(s,e.options.rollup.alias.entries??e.options.rollup.alias)),e.logger.debug({message:"Resolved aliases: "+JSON.stringify(s),prefix:t}),s},"resolveAliases");var ea=Object.defineProperty,T=f((e,t)=>ea(e,"name",{value:t,configurable:!0}),"n$3");const Ms=T((e,t)=>{const s=[],o=[],n=[];return e&&e.filter(Boolean).filter(r=>r.type===t?!0:t==="build"&&r.type===void 0).forEach(r=>{r.enforce==="pre"?s.push(r.plugin):r.enforce==="post"?o.push(r.plugin):n.push(r.plugin)}),[s,n,o]},"sortUserPlugins"),ta=T((e,t)=>{if(e==="esbuild"){if(!t.options.rollup.esbuild)throw new Error("No esbuild options found in your configuration.");t.tsconfig?.config.compilerOptions?.target?.toLowerCase()==="es3"&&(t.logger.warn(["ES3 target is not supported by esbuild, so ES5 will be used instead..","Please set 'target' option in tsconfig to at least ES5 to disable this error"].join(" ")),t.tsconfig.config.compilerOptions.target="es5",t.options.rollup.esbuild.target="es5");let s="node"+Xs.node.split(".")[0];if(t.pkg.engines?.node){const o=os(t.pkg.engines.node);o&&(s="node"+o.major)}if(t.options.rollup.esbuild.target){const o=he(t.options.rollup.esbuild.target);o.some(n=>n.startsWith("node"))||(t.options.rollup.esbuild.target=[...new Set([...he(s),...o])])}else t.options.rollup.esbuild.target=he(s);return t.tsconfig?.config.compilerOptions?.target==="es5"&&(t.options.rollup.esbuild.keepNames=!1,t.logger.debug("Disabling keepNames because target is set to es5")),{logger:t.logger,minify:t.options.minify,minifyWhitespace:t.options.minify,sourceMap:t.options.sourcemap,...t.options.rollup.esbuild}}if(e==="swc"){if(!t.options.rollup.swc)throw new Error("No swc options found in your configuration.");return{minify:t.options.minify,...t.options.rollup.swc,jsc:{minify:{compress:{directives:!1},format:{comments:"some"},mangle:{topLevel:!0},sourceMap:t.options.sourcemap,toplevel:t.options.emitCJS??t.options.emitESM},...t.options.rollup.swc.jsc},sourceMaps:t.options.sourcemap}}if(e==="sucrase"){if(!t.options.rollup.sucrase)throw new Error("No sucrase options found in your configuration.");return t.options.rollup.sucrase}throw new Error("A Unknown transformer was provided")},"getTransformerConfig"),Ts=T((e,t)=>{if(e.code==="CIRCULAR_DEPENDENCY"&&/Circular dependency:[\s\S]*node_modules/.test(e.message))return!0;if(e.code==="UNRESOLVED_IMPORT")throw new Error(`Failed to resolve the module "${e.exporter}" imported by "${D(I(j(),e.id))}"
90
+ To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),zt.set(l,!0)}return e}u(Ni,"I$1");pe(Ni,"replaceConfusingTypeNames");const Ks=pe((e,t)=>{if(t.leadingComments?.some(i=>i.type==="CommentBlock"&&i.value.includes("@internal"))){const i=e.original[t.end]===","?t.end+1:t.end;return e.remove(t.leadingComments[0].start,i),!0}return!1},"removeInternal");function _i(e,t){if(e.includes("@internal")){const i=new H(e),o=nn(e,{plugins:["typescript"],sourceType:"module"});if(Si(o,{enter(n){Ks(i,n)&&this.skip()}}),e=i.toString(),e.includes("@internal"))throw new Error(`${t.fileName} has unhandled @internal declarations`)}return e}u(_i,"S$1");pe(_i,"stripInternalTypes");const Gs=pe((e,t)=>({name:"packem:patch-types",renderChunk(i,o){return i=Ni.call(this,i,o,e,t),i=_i.call(this,i,o),i=Us(i),i},resolveId(i){return i.startsWith("types/")?{external:!0,id:"../../"+(i.endsWith(".js")?i:i+".js")}:null}}),"patchTypescriptTypes");var Hs=Object.defineProperty,Ii=u((e,t)=>Hs(e,"name",{value:t,configurable:!0}),"m$9");const Mi=Ii((e,t=!0)=>{if(!e)return null;const{config:i,path:o}=e;if(!i.compilerOptions)return null;const{baseUrl:n,paths:a}=i.compilerOptions;if(!n)return null;const s=j(I(o),n),l=[];if(a)for(const[p,r]of Object.entries(a)){let c;p==="@"||p==="~"||p==="#"?c=new RegExp(`^${p}/(.+)$`):c=new RegExp(`^${[...p].map(d=>d==="*"?"(.+)":d.replace(/[\\^$*+?.()|[\]{}]/,"\\$&")).join("")}$`);let m=0;for(const d of r){const f=[...J(j(s,d))].map(x=>x==="*"?"$"+(++m+""):x==="$"?"$$":x).join("");l.push({find:c,replacement:f})}}return t&&l.push({find:/^(?!\.*\/|\.*$|\w:)(.+)$/,replacement:`${[...J(s)].map(p=>p==="$"?"$$":p).join("")}/$1`}),l},"getConfigAlias"),Ti=Ii((e,t)=>{const i=Mi(e);return{name:"packem:resolve-tsconfig-paths",async resolveId(o,n,a){if(!i||o.includes("\0"))return null;for(const{find:s,replacement:l}of i)if(s.test(o)){const p=o.replace(s,l),r=await this.resolve(p,n,{skipSelf:!0,...a});if(r)return t.debug({message:`Resolved ${o} to ${r.id} using paths from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-paths"}),r.id}return null}}},"resolveTsconfigPaths");var Ys=Object.defineProperty,Ai=u((e,t)=>Ys(e,"name",{value:t,configurable:!0}),"u$6");const Xs=Ai((e,t)=>{if(!t)return null;const{config:i,path:o}=t;if(!i.compilerOptions)return null;const{rootDirs:n}=i.compilerOptions;if(!n)return null;const a=[];for(const s of n){if(s.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${o}.`);if(s.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${o}.`);a.push(j(e,s))}return a},"getRootDirectories"),zi=Ai((e,t,i)=>{const o=Xs(e,i);return{name:"packem:resolve-tsconfig-root-dirs",async resolveId(n,a,s){if(o===null||o.length===0)return null;if(n.startsWith("."))for(const l of o){const p=k(l,n),r=await this.resolve(p,a,{skipSelf:!0,...s});if(r)return t.debug({message:`Resolved ${n} to ${r.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),r.id}return null}}},"resolveTsconfigRootDirectories");var Qs=Object.defineProperty,Zs=u((e,t)=>Qs(e,"name",{value:t,configurable:!0}),"r$7");const Fi=Zs(()=>{const e=/\.(?:[mc]?js|jsx)$/;return{name:"packem:resolve-typescript-mjs-cjs",async resolveId(t,i,o){return e.test(t)&&i?await this.resolve(t.replace(/js(x?)$/,"ts$1"),i,o):null}}},"resolveTypescriptMjsCts"),Ri={"application/prs.cww":["cww"],"application/prs.xsf+xml":["xsf"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["*xfdf"],"application/vnd.age":["age"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["*fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["*mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.pwg-xhtml-print+xml":["xhtm"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml","uo"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["*prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["*sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["*aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif","btf"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.cld":["cld"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.pytha.pyox":["pyo","pyox"],"model/vnd.sap.vds":["vds"],"model/vnd.usda":["usda"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.familysearch.gedcom":["ged"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]};Object.freeze(Ri);const Li={"application/andrew-inset":["ez"],"application/appinstaller":["appinstaller"],"application/applixware":["aw"],"application/appx":["appx"],"application/appxbundle":["appxbundle"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/automationml-aml+xml":["aml"],"application/automationml-amlx+zip":["amlx"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cpl+xml":["cpl"],"application/cu-seeme":["cu"],"application/cwl":["cwl"],"application/dash+xml":["mpd"],"application/dash-patch+xml":["mpp"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdf":["fdf"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["*js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/media-policy-dataset+xml":["mpf"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["*mp4","*mpg4","mp4s","m4p"],"application/msix":["msix"],"application/msixbundle":["msixbundle"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-keys":["asc"],"application/pgp-signature":["sig","*asc"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/sql":["sql"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/watcherinfo+xml":["wif"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xfdf":["xfdf"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/aac":["adts","aac"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avci":["avci"],"image/avcs":["avcs"],"image/avif":["avif"],"image/bmp":["bmp","dib"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/dpx":["dpx"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm","jpgm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/jt":["jt"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/prc":["prc"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/u3d":["u3d"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/javascript":["js","mjs"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["md","markdown"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/wgsl":["wgsl"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","*jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};Object.freeze(Li);var L=function(e,t,i,o){if(i==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?o:i==="a"?o.call(e):o?o.value:t.get(e)},me,ye,se;class er{static{u(this,"Mime")}constructor(...t){me.set(this,new Map),ye.set(this,new Map),se.set(this,new Map);for(const i of t)this.define(i)}define(t,i=!1){for(let[o,n]of Object.entries(t)){o=o.toLowerCase(),n=n.map(l=>l.toLowerCase()),L(this,se,"f").has(o)||L(this,se,"f").set(o,new Set);const a=L(this,se,"f").get(o);let s=!0;for(let l of n){const p=l.startsWith("*");if(l=p?l.slice(1):l,a?.add(l),s&&L(this,ye,"f").set(o,l),s=!1,p)continue;const r=L(this,me,"f").get(l);if(r&&r!=o&&!i)throw new Error(`"${o} -> ${l}" conflicts with "${r} -> ${l}". Pass \`force=true\` to override this definition.`);L(this,me,"f").set(l,o)}}return this}getType(t){if(typeof t!="string")return null;const i=t.replace(/^.*[/\\]/,"").toLowerCase(),o=i.replace(/^.*\./,"").toLowerCase(),n=i.length<t.length;return!(o.length<i.length-1)&&n?null:L(this,me,"f").get(o)??null}getExtension(t){return typeof t!="string"?null:(t=t?.split?.(";")[0],(t&&L(this,ye,"f").get(t.trim().toLowerCase()))??null)}getAllExtensions(t){return typeof t!="string"?null:L(this,se,"f").get(t.toLowerCase())??null}_freeze(){this.define=()=>{throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances")},Object.freeze(this);for(const t of L(this,se,"f").values())Object.freeze(t);return this}_getTestState(){return{types:L(this,me,"f"),extensions:L(this,ye,"f")}}}me=new WeakMap,ye=new WeakMap,se=new WeakMap;const tr=new er(Li,Ri)._freeze();var ir=Object.defineProperty,gt=u((e,t)=>ir(e,"name",{value:t,configurable:!0}),"u$5");const or=gt(async(e,t)=>{await new Promise((i,o)=>{const n=Po(e);n.on("error",o);const a=No(t);a.on("error",o),a.on("finish",i),n.pipe(a)})},"copy"),nr=gt(e=>{let t=e.toString("utf8").replaceAll(/[\n\r]/g,"").replaceAll(" "," "),i;do i=t,t=t.replaceAll(/<!--(.*(?=-->))-->/g,"");while(t!==i);return encodeURIComponent(t.replaceAll("'","\\i")).replaceAll("(","%28").replaceAll(")","%29")},"encodeSVG"),ar=gt(({destDir:e,emitFiles:t,exclude:i,fileName:o,include:n,limit:a,publicPath:s,sourceDir:l})=>{const p=ne(n,i),r={};return{async generateBundle(c){if(!t)return;const m=e??c.dir??I(c.file??"");await bt(m),await Promise.all(Object.keys(r).map(async d=>{const f=r[d],x=k(m,I(f));await bt(x),await or(d,k(m,f))}))},async load(c){if(!p(c))return null;this.addWatchFile(c);const[m,d]=await Promise.all([dt(c),Oo(c)]);let f;if(a&&m.size>a||a===0){const x=tn.createHash("sha1").update(d).digest("hex").slice(0,16),v=ct(c),g=oe(c,v),h=l?N(l,I(c)):oe(I(c)),y=o.replaceAll("[hash]",x).replaceAll("[extname]",v).replaceAll("[dirname]",h===""?"":`${h}/`).replaceAll("[name]",g);f=k(s??"",y),r[c]=y}else{const x=tr.getType(c);if(x===null)throw new Error(`Could not determine mimetype for ${c}`);const v=x==="image/svg+xml";f=v?nr(d):d.toString("base64"),f=`data:${x}${v?"":";base64"},${f}`}return`export default "${f}"`},name:"packem:url"}},"urlPlugin");var sr=Object.defineProperty,rr=u((e,t)=>sr(e,"name",{value:t,configurable:!0}),"s$8");const lr=rr(e=>{const t=oe(e).split(".");if(t.length>=2){const[i,o]=t.slice(-2),n=t[0],a=/^(\w+)-runtime$/.exec(i)?.[1];if(mt.includes(o)&&a&&a.length>0)return n+"-"+a}},"getCustomModuleLayer");var pr=Object.defineProperty,cr=u((e,t)=>pr(e,"name",{value:t,configurable:!0}),"i$5");const Ze=cr(e=>(e.preserveDirectives||{directives:[]}).directives.map(t=>t.replace(/^use /,"")).find(t=>t!=="strict"),"getModuleLayer");var dr=Object.defineProperty,Ft=u((e,t)=>dr(e,"name",{value:t,configurable:!0}),"d$9");const mr=Ft((e,t)=>{const i=new Map;return Ft(function(o,n){const a=n.getModuleInfo(o);if(!a)return;const{isEntry:s}=a,l=a.meta,p=Ze(l);if(!s){const r=i.get(o);if(r)return r;const c=lr(o);if(c)return i.set(o,c),c}if(s){const r=n.getModuleIds();for(const c of r)n.getModuleInfo(c)&&Ze(l)===p&&(e.has(c)||e.set(c,new Set),e.get(c).add([o,p]))}if(p&&!s&&e.has(o)){const r=[...e.get(o)];if(r.some(([m])=>{if(t.some(d=>d.path===m)){const d=n.getModuleInfo(m);return Ze(d?d.meta:{})===p}return!1}))return;if(r.every(([,m])=>m===p))return i.has(o)?i.get(o):void 0;const c=oe(o,ct(o))+"-"+p;return i.set(o,c),c}},"splitChunks")},"createSplitChunks");var ur=Object.defineProperty,fr=u((e,t)=>ur(e,"name",{value:t,configurable:!0}),"n$5");const ie=fr((e,t)=>e.isDynamicEntry?`${gn}/[name].${t}`:`${vn}/${e.name}-[hash].${t}`,"getChunkFilename");var gr=Object.defineProperty,vr=u((e,t)=>gr(e,"name",{value:t,configurable:!0}),"o$4");const hr=process.platform==="win32",Rt=vr((e,t)=>{const i=hr?"\\":"/";for(let o of Array.isArray(e.names)?e.names:[]){if(o.includes("node_modules"+i+".pnpm"))return o=o.replace("node_modules"+i+".pnpm","external")+"."+t,o.replace("node_modules"+i,"");if(o.includes("node_modules"))return o.replace("node_modules","external")+"."+t}return"[name]."+t},"getEntryFileNames");var xr=Object.defineProperty,yr=u((e,t)=>xr(e,"name",{value:t,configurable:!0}),"p$2");const vt=yr((e,t)=>{let i={};if(e.pkg.name&&(i[e.pkg.name]=e.options.rootDir),e.pkg.imports){const{imports:o}=e.pkg;for(const n in o){if(n.startsWith("#"))continue;const a=o[n];typeof a=="string"&&(i[n]=k(e.options.rootDir,a))}}return i={...i,...e.options.alias},e.options.rollup.alias&&(Array.isArray(e.options.rollup.alias.entries)?Object.assign(i,Object.fromEntries(e.options.rollup.alias.entries.map(o=>[o.find,o.replacement]))):Object.assign(i,e.options.rollup.alias.entries??e.options.rollup.alias)),e.logger.debug({message:"Resolved aliases: "+JSON.stringify(i),prefix:t}),i},"resolveAliases");var br=Object.defineProperty,A=u((e,t)=>br(e,"name",{value:t,configurable:!0}),"n$3");const Ji=A((e,t)=>{const i=[],o=[],n=[];return e&&e.filter(Boolean).filter(a=>a.type===t?!0:t==="build"&&a.type===void 0).forEach(a=>{a.enforce==="pre"?i.push(a.plugin):a.enforce==="post"?o.push(a.plugin):n.push(a.plugin)}),[i,n,o]},"sortUserPlugins"),wr=A((e,t)=>{if(e==="esbuild"){if(!t.options.rollup.esbuild)throw new Error("No esbuild options found in your configuration.");t.tsconfig?.config.compilerOptions?.target?.toLowerCase()==="es3"&&(t.logger.warn(["ES3 target is not supported by esbuild, so ES5 will be used instead..","Please set 'target' option in tsconfig to at least ES5 to disable this error"].join(" ")),t.tsconfig.config.compilerOptions.target="es5",t.options.rollup.esbuild.target="es5");let i="node"+no.node.split(".")[0];if(t.pkg.engines?.node){const o=li(t.pkg.engines.node);o&&(i="node"+o.major)}if(t.options.rollup.esbuild.target){const o=be(t.options.rollup.esbuild.target);o.some(n=>n.startsWith("node"))||(t.options.rollup.esbuild.target=[...new Set([...be(i),...o])])}else t.options.rollup.esbuild.target=be(i);return t.tsconfig?.config.compilerOptions?.target==="es5"&&(t.options.rollup.esbuild.keepNames=!1,t.logger.debug("Disabling keepNames because target is set to es5")),{logger:t.logger,minify:t.options.minify,minifyWhitespace:t.options.minify,sourceMap:t.options.sourcemap,...t.options.rollup.esbuild}}if(e==="swc"){if(!t.options.rollup.swc)throw new Error("No swc options found in your configuration.");return{minify:t.options.minify,...t.options.rollup.swc,jsc:{minify:{compress:{directives:!1},format:{comments:"some"},mangle:{topLevel:!0},sourceMap:t.options.sourcemap,toplevel:t.options.emitCJS??t.options.emitESM},...t.options.rollup.swc.jsc},sourceMaps:t.options.sourcemap}}if(e==="sucrase"){if(!t.options.rollup.sucrase)throw new Error("No sucrase options found in your configuration.");return t.options.rollup.sucrase}throw new Error("A Unknown transformer was provided")},"getTransformerConfig"),qi=A((e,t)=>{if(e.code==="CIRCULAR_DEPENDENCY"&&/Circular dependency:[\s\S]*node_modules/.test(e.message))return!0;if(e.code==="UNRESOLVED_IMPORT")throw new Error(`Failed to resolve the module "${e.exporter}" imported by "${D(N(j(),e.id))}"
91
91
  Is the module installed? Note:
92
92
  ↳ to inline a module into your bundle, install it to "devDependencies".
93
- ↳ to depend on a module via import/require, install it to "dependencies".`);return e.code==="MODULE_LEVEL_DIRECTIVE"?!0:e.code==="MIXED_EXPORTS"&&t.options.cjsInterop===!0},"sharedOnWarn"),_t=new Map,He=new Map,As=T((e,t,s)=>{const o=Cs(e.tsconfig,!1);return{external(n){n=jo(n,t);const r=cs(n);if(Ze(e.options.externals,r)||Ze(e.options.externals,n))return!0;const{pkg:i}=e;if(n.startsWith(".")||Ae(n)||/src[/\\]/.test(n)||i.name&&n.startsWith(i.name))return!1;if(i.imports)for(const[l,c]of Object.entries(i.imports)){if(l===n)return!1;if(l.includes("*")){let a;He.has(l)?a=He.get(l):(a=Gt(x(e.options.rootDir,c.replace("/*","")),{withFileTypes:!0}).filter(p=>p.isFile()).map(p=>p.name),He.set(l,a));for(const p of a)if(p.replace(oe,"")===n.replace(oe,"").replace("#",""))return!1}}if(o){for(const{find:l}of o)if(l.test(n))return e.logger.debug({message:`Resolved alias ${n} to ${l.source}`,prefix:s}),!1}return _t.has(n)||e.logger.info({message:'Inlined implicit external "'+D(n)+'". If this is incorrect, add it to the "externals" option.',prefix:s}),_t.set(n,!0),!1},input:Object.fromEntries(e.options.entries.map(n=>[n.name,j(e.options.rootDir,n.input)])),logLevel:e.options.debug?"debug":"info",onLog:T((n,r)=>{let i=r.message;switch(r.stack&&(i=`${i}
94
- ${r.stack}`),n){case"info":{e.logger.info({message:i,prefix:s+(r.plugin?":plugin:"+r.plugin:"")});return}case"warn":{e.logger.warn({message:i,prefix:s+(r.plugin?":plugin:"+r.plugin:"")});return}case"debug":e.logger.debug({message:i,prefix:s+(r.plugin?":plugin:"+r.plugin:"")})}},"onLog"),onwarn(n,r){Ts(n,e)||n.code||r(n)},watch:e.mode==="watch"?e.options.rollup.watch:!1}},"baseRollupOptions"),Rs=T(async(e,t)=>{const s=pt(e,"build");let o;e.options.rollup.resolve&&(o=M(es({...e.options.rollup.resolve}),t));const n=e.options.rollup.output?.preserveModules?{preserveModules:!0,preserveModulesRoot:e.options.rollup.output.preserveModulesRoot??"src"}:{manualChunks:qi(e.dependencyGraphMap,e.buildEntries),preserveModules:!1},[r,i,l]=Ms(e.options.rollup.plugins,"build");return{...As(e,s,"build"),output:[e.options.emitCJS&&{assetFileNames:"[name]-[hash][extname]",chunkFileNames:T(c=>ee(c,"cjs"),"chunkFileNames"),compact:e.options.minify,dir:j(e.options.rootDir,e.options.outDir),entryFileNames:T(c=>It(c,"cjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"cjs",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,interop:"compat",sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...n},e.options.emitESM&&{assetFileNames:"[name]-[hash][extname]",chunkFileNames:T(c=>ee(c,"mjs"),"chunkFileNames"),compact:e.options.minify,dir:j(e.options.rootDir,e.options.outDir),entryFileNames:T(c=>It(c,"mjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"esm",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...n}].filter(Boolean),plugins:[M(Es(),t),M(_s(),t),e.tsconfig&&M(Is(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&M(Ps(e.tsconfig,e.logger),t),e.options.rollup.replace&&ts({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&Zt({customResolver:o,...e.options.rollup.alias,entries:s}),...r,o,e.options.rollup.polyfillNode&&ko({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),e.options.rollup.json&&ws({...e.options.rollup.json}),kn(),e.options.rollup.wasm&&xo(e.options.rollup.wasm),e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer&&Br(x(e.options.rootDir,e.options.sourceDir),e.options.isolatedDeclarationTransformer,e.options.declaration,!!e.options.rollup.cjsInterop,e.options.rollup.isolatedDeclarations),e.options.rollup.css&&e.options.rollup.css.loaders&&e.options.rollup.css.loaders.length>0&&await yr({dts:!!e.options.declaration||e.options.isolatedDeclarationTransformer!==void 0,sourceMap:e.options.sourcemap,...e.options.rollup.css},e.logger,e.options.browserTargets,e.options.rootDir,e.options.sourceDir,e.environment,e.options.sourcemap,e.options.debug,e.options.minify??!1,s),e.options.rollup.css&&e.options.rollup.css.loaders&&e.options.rollup.css.loaders.length>0&&e.options.declaration&&kr(e.options.rollup.css,e.options.rootDir,e.logger),e.options.rollup.raw&&M(yi(e.options.rollup.raw),t),...i,e.options.transformer(ta(e.options.transformerName,e)),M(mi({directiveRegex:/^['|"](use (\w+))['|"]$/,...e.options.rollup.preserveDirectives,logger:e.logger}),t),e.options.rollup.shebang&&$i(e.options.entries.filter(c=>c.executable).map(c=>c.name).filter(Boolean),e.options.rollup.shebang),e.options.cjsInterop&&e.options.emitCJS&&fs({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.dynamicVars&&_r(),e.options.rollup.dynamicVars&&$o(e.options.rollup.dynamicVars),e.options.rollup.commonjs&&M(wo({sourceMap:e.options.sourcemap,...e.options.rollup.commonjs}),t),e.options.rollup.preserveDynamicImports&&{name:"packem:preserve-dynamic-imports",renderDynamicImport(){return{left:"import(",right:")"}}},e.options.cjsInterop&&e.options.rollup.shim&&Pr(e.pkg,e.options.rollup.shim),e.options.rollup.jsxRemoveAttributes&&M(Gr({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:e.logger}),t),...l,e.options.rollup.metafile&&si({outDir:j(e.options.rootDir,e.options.outDir),rootDir:e.options.rootDir}),e.options.rollup.copy&&_n(e.options.rollup.copy,e.logger),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&js({dtsMarker:e.options.rollup.license.dtsMarker??"TYPE_DEPENDENCIES",licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dependenciesTemplate,logger:e.logger,marker:e.options.rollup.license.dependenciesMarker??"DEPENDENCIES",mode:"dependencies",packageName:e.pkg.name}),ui(),e.options.emitCJS&&e.mode==="build"&&e.options.declaration==="compatible"&&e.options.rollup.node10Compatibility&&ri(e.logger,e.options.entries,e.options.outDir,e.options.rootDir,e.options.rollup.node10Compatibility.writeToPackageJson?"file":"console",e.options.rollup.node10Compatibility.typeScriptVersion??"*"),e.options.analyze&&e.options.rollup.visualizer!==!1&&Eo({brotliSize:!0,gzipSize:!0,projectRoot:e.options.rootDir,sourcemap:e.options.sourcemap,...e.options.rollup.visualizer,filename:"packem-bundle-analyze.html",title:"Packem Visualizer"})].filter(Boolean)}},"getRollupOptions"),sa=T(async e=>{const{dts:t}=require("rollup-plugin-dts");return t({compilerOptions:{...e.options.rollup.dts.compilerOptions,incremental:void 0,inlineSources:void 0,sourceMap:void 0,tsBuildInfoFile:void 0},respectExternal:e.options.rollup.dts.respectExternal,tsconfig:e.tsconfig?.path})},"createDtsPlugin"),oa=un(sa),Fs=T(async(e,t)=>{const s=pt(e,"types"),o=e.tsconfig?.config.compilerOptions;delete o?.lib;let n;e.options.rollup.resolve&&(n=M(es({...e.options.rollup.resolve}),t));const r="dts-plugin:"+process.pid+e.tsconfig.path,[i,l,c]=Ms(e.options.rollup.plugins,"dts");return{...As(e,s,"dts"),onwarn(a,p){Ts(a,e)||a.code!=="EMPTY_BUNDLE"&&p(a)},output:[e.options.emitCJS&&{chunkFileNames:T(a=>ee(a,"d.cts"),"chunkFileNames"),compact:e.options.minify,dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.emitESM&&{chunkFileNames:T(a=>ee(a,"d.mts"),"chunkFileNames"),compact:e.options.minify,dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts",format:"esm",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.declaration==="compatible"&&{chunkFileNames:T(a=>ee(a,"d.ts"),"chunkFileNames"),compact:e.options.minify,dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output}].filter(Boolean),plugins:[M(Es(),t),M(_s(),t),e.options.rollup.json&&ws({...e.options.rollup.json}),{load(a){return/\.(?:js|cjs|mjs|jsx|ts|tsx|ctsx|mtsx|mts|json)$/.test(a)?null:""},name:"packem:ignore-files"},e.tsconfig&&M(Is(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&M(Ps(e.tsconfig,e.logger),t),e.options.rollup.replace&&ts({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&Zt({customResolver:n,...e.options.rollup.alias,entries:s}),...i,n,...l,await oa(r)(e),e.options.cjsInterop&&e.options.emitCJS&&fs({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.patchTypes&&M(Mi(e.options.rollup.patchTypes,e.logger),t),xi(),...c,e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dtsTemplate=="function"&&js({licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dtsTemplate,logger:e.logger,marker:e.options.rollup.license.dtsMarker??"TYPE_DEPENDENCIES",mode:"types",packageName:e.pkg.name})].filter(Boolean)}},"getRollupDtsOptions");var na=Object.defineProperty,ra=f((e,t)=>na(e,"name",{value:t,configurable:!0}),"m$7");const Mt="rollup-build.json",ia=ra(async(e,t,s)=>{const o=await Rs(e,t);if(await e.hooks.callHook("rollup:options",e,o),Object.keys(o.input).length===0)return;let n=!0;(e.options.rollup.isolatedDeclarations||e.options.isolatedDeclarationTransformer||e.options.rollup.css)&&(n=!1),n&&(o.cache=t.get(Mt,s));const r=await Qt(o);n&&t.set(Mt,r.cache,s),await e.hooks.callHook("rollup:build",e,r);const i=new Map;for(const l of o.output){const{output:c}=await r.write(l),a=new Set,p=c.filter(u=>u.type==="chunk");for(const u of p){a.add(u.fileName);for(const m of u.imports)e.usedImports.add(m);u.isEntry&&e.buildEntries.push({bytes:Buffer.byteLength(u.code,"utf8"),chunks:u.imports.filter(m=>p.find(v=>v.fileName===m)),exports:u.exports,modules:Object.entries(u.modules).map(([m,v])=>({bytes:v.renderedLength,id:m})),path:u.fileName,type:"entry"})}const d=c.filter(u=>u.type==="asset");for(const u of d)i.has(u.fileName)||i.set(u.fileName,{bytes:Buffer.byteLength(u.source,"utf8"),path:u.fileName,type:"asset"});for(const u of a)e.usedImports.delete(u)}e.buildEntries.push(...i.values())},"build");var aa=Object.defineProperty,$e=f((e,t)=>aa(e,"name",{value:t,configurable:!0}),"a$8");const Tt="rollup-dts.json",la=$e(async(e,t,s)=>{if(e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer){e.logger.info({message:"Using isolated declaration transformer to generate declaration files...",prefix:"dts"});return}const o=await Fs(e,t);if(await e.hooks.callHook("rollup:dts:options",e,o),Object.keys(o.input).length===0)return;o.cache=t.get(Tt,s);const n=await Qt(o);t.set(Tt,n.cache,s),await e.hooks.callHook("rollup:dts:build",e,n),e.logger.info({message:"Building declaration files...",prefix:"dts"}),e.options.emitCJS&&await n.write({chunkFileNames:$e(r=>ee(r,"d.cts"),"chunkFileNames"),dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts"}),e.options.emitESM&&await n.write({chunkFileNames:$e(r=>ee(r,"d.mts"),"chunkFileNames"),dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts"}),e.options.declaration==="compatible"&&await n.write({chunkFileNames:$e(r=>ee(r,"d.mjs"),"chunkFileNames"),dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts"}),await e.hooks.callHook("rollup:dts:done",e)},"buildTypes");var ca=Object.defineProperty,pa=f((e,t)=>ca(e,"name",{value:t,configurable:!0}),"y$3");const ua=pa((e,t,s)=>e.reduce((o,n)=>{const r=n[t],i=n[s];return o[r]||(o[r]={}),o[r][i]||(o[r][i]=[]),o[r][i].push(n),o},{}),"groupByKeys");var da=Object.defineProperty,Ne=f((e,t)=>da(e,"name",{value:t,configurable:!0}),"j$1");const fa=Ne((e,t)=>{const s=Ne(i=>I(t.options.rootDir,j(t.options.outDir,i)),"rPath");let o=!1;const n=[],r=t.buildEntries.filter(i=>i.type==="entry");if(r.length>0){e.raw(`Entries:
95
- `);for(const i of r){let l=i.bytes??0;for(const a of i.chunks??[])l+=t.buildEntries.find(p=>p.path===a)?.bytes??0;let c=` ${q(s(i.path))} (${["total size: "+D(Y(l)),i.bytes&&"chunk size: "+D(Y(i.bytes))].filter(Boolean).join(", ")})`;if(c+=i.exports?.length?`
96
- exports: `+X(i.exports.join(", ")):"",i.chunks?.length&&(c+=`
97
- ${i.chunks.map(a=>{const p=t.buildEntries.find(d=>d.path===a)??{};return X(" └─ "+s(a)+q(p.bytes?" ("+Y(p?.bytes)+")":""))}).join(`
98
- `)}`),i.modules&&i.modules.length>0){const a=i.modules.filter(p=>p.id.includes("node_modules")).sort((p,d)=>(d.bytes||0)-(p.bytes||0)).map(p=>X(" 📦 "+s(p.id)+q(p.bytes?" ("+Y(p.bytes)+")":""))).join(`
99
- `);c+=a.length>0?`
93
+ ↳ to depend on a module via import/require, install it to "dependencies".`);return e.code==="MODULE_LEVEL_DIRECTIVE"?!0:e.code==="MIXED_EXPORTS"&&t.options.cjsInterop===!0},"sharedOnWarn"),Lt=new Map,et=new Map,Bi=A((e,t,i)=>{const o=Mi(e.tsconfig,!1);return{external(n){n=Ao(n,t);const a=fi(n);if(nt(e.options.externals,a)||nt(e.options.externals,n))return!0;const{pkg:s}=e;if(n.startsWith(".")||Je(n)||/src[/\\]/.test(n)||s.name&&n.startsWith(s.name))return!1;if(s.imports)for(const[l,p]of Object.entries(s.imports)){if(l===n)return!1;if(l.includes("*")){let r;et.has(l)?r=et.get(l):(r=_o(k(e.options.rootDir,p.replace("/*","")),{withFileTypes:!0}).filter(c=>c.isFile()).map(c=>c.name),et.set(l,r));for(const c of r)if(c.replace(le,"")===n.replace(le,"").replace("#",""))return!1}}if(o){for(const{find:l}of o)if(l.test(n))return e.logger.debug({message:`Resolved alias ${n} to ${l.source}`,prefix:i}),!1}return Lt.has(n)||e.logger.info({message:'Inlined implicit external "'+D(n)+'". If this is incorrect, add it to the "externals" option.',prefix:i}),Lt.set(n,!0),!1},input:Object.fromEntries(e.options.entries.map(n=>[n.name,j(e.options.rootDir,n.input)])),logLevel:e.options.debug?"debug":"info",onLog:A((n,a)=>{let s=a.message;switch(a.stack&&(s=`${s}
94
+ ${a.stack}`),n){case"info":{e.logger.info({message:s,prefix:i+(a.plugin?":plugin:"+a.plugin:"")});return}case"warn":{e.logger.warn({message:s,prefix:i+(a.plugin?":plugin:"+a.plugin:"")});return}case"debug":e.logger.debug({message:s,prefix:i+(a.plugin?":plugin:"+a.plugin:"")})}},"onLog"),onwarn(n,a){qi(n,e)||n.code||a(n)},watch:e.mode==="watch"?e.options.rollup.watch:!1}},"baseRollupOptions"),Wi=A(async(e,t)=>{const i=vt(e,"build");let o;e.options.rollup.resolve&&(o=T(ai({...e.options.rollup.resolve}),t));const n=e.options.rollup.output?.preserveModules?{preserveModules:!0,preserveModulesRoot:e.options.rollup.output.preserveModulesRoot??"src"}:{manualChunks:mr(e.dependencyGraphMap,e.buildEntries),preserveModules:!1},[a,s,l]=Ji(e.options.rollup.plugins,"build");return{...Bi(e,i,"build"),output:[e.options.emitCJS&&{assetFileNames:"[name]-[hash][extname]",chunkFileNames:A(p=>ie(p,"cjs"),"chunkFileNames"),compact:e.options.minify,dir:j(e.options.rootDir,e.options.outDir),entryFileNames:A(p=>Rt(p,"cjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"cjs",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,interop:"compat",sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...n},e.options.emitESM&&{assetFileNames:"[name]-[hash][extname]",chunkFileNames:A(p=>ie(p,"mjs"),"chunkFileNames"),compact:e.options.minify,dir:j(e.options.rootDir,e.options.outDir),entryFileNames:A(p=>Rt(p,"mjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"esm",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...n}].filter(Boolean),plugins:[T(Pi(),t),T(Fi(),t),e.tsconfig&&T(zi(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&T(Ti(e.tsconfig,e.logger),t),e.options.rollup.replace&&si({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&ni({customResolver:o,...e.options.rollup.alias,entries:i}),...a,o,e.options.rollup.polyfillNode&&zo({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),e.options.rollup.json&&Ei({...e.options.rollup.json}),Fn(),e.options.rollup.wasm&&To(e.options.rollup.wasm),e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer&&ts(k(e.options.rootDir,e.options.sourceDir),e.options.isolatedDeclarationTransformer,e.options.declaration,!!e.options.rollup.cjsInterop,e.options.rollup.isolatedDeclarations),e.options.rollup.url&&ar(e.options.rollup.url),e.options.rollup.css&&e.options.rollup.css.loaders&&e.options.rollup.css.loaders.length>0&&await Na({dts:!!e.options.declaration||e.options.isolatedDeclarationTransformer!==void 0,sourceMap:e.options.sourcemap,...e.options.rollup.css},e.logger,e.options.browserTargets,e.options.rootDir,e.options.sourceDir,e.environment,e.options.sourcemap,e.options.debug,e.options.minify??!1,i),e.options.rollup.css&&e.options.rollup.css.loaders&&e.options.rollup.css.loaders.length>0&&e.options.declaration&&Fa(e.options.rollup.css,e.options.rootDir,e.logger),e.options.rollup.raw&&T(Ns(e.options.rollup.raw),t),...s,e.options.transformer(wr(e.options.transformerName,e)),T(Ds({directiveRegex:/^['|"](use (\w+))['|"]$/,...e.options.rollup.preserveDirectives,logger:e.logger}),t),e.options.rollup.shebang&&Ts(e.options.entries.filter(p=>p.executable).map(p=>p.name).filter(Boolean),e.options.rollup.shebang),e.options.cjsInterop&&e.options.emitCJS&&xi({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.dynamicVars&&Ka(),e.options.rollup.dynamicVars&&Mo(e.options.rollup.dynamicVars),e.options.rollup.commonjs&&T(Io({sourceMap:e.options.sourcemap,...e.options.rollup.commonjs}),t),e.options.rollup.preserveDynamicImports&&{name:"packem:preserve-dynamic-imports",renderDynamicImport(){return{left:"import(",right:")"}}},e.options.cjsInterop&&e.options.rollup.shim&&Wa(e.pkg,e.options.rollup.shim),e.options.rollup.jsxRemoveAttributes&&T(ls({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:e.logger}),t),...l,e.options.rollup.metafile&&vs({outDir:j(e.options.rootDir,e.options.outDir),rootDir:e.options.rootDir}),e.options.rollup.copy&&Kn(e.options.rollup.copy,e.logger),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&Di({dtsMarker:e.options.rollup.license.dtsMarker??"TYPE_DEPENDENCIES",licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dependenciesTemplate,logger:e.logger,marker:e.options.rollup.license.dependenciesMarker??"DEPENDENCIES",mode:"dependencies",packageName:e.pkg.name}),Es(),e.options.emitCJS&&e.mode==="build"&&e.options.declaration==="compatible"&&e.options.rollup.node10Compatibility&&ys(e.logger,e.options.entries,e.options.outDir,e.options.rootDir,e.options.rollup.node10Compatibility.writeToPackageJson?"file":"console",e.options.rollup.node10Compatibility.typeScriptVersion??"*"),e.options.analyze&&e.options.rollup.visualizer!==!1&&Fo({brotliSize:!0,gzipSize:!0,projectRoot:e.options.rootDir,sourcemap:e.options.sourcemap,...e.options.rollup.visualizer,filename:"packem-bundle-analyze.html",title:"Packem Visualizer"})].filter(Boolean)}},"getRollupOptions"),kr=A(async e=>{const{dts:t}=require("rollup-plugin-dts");return t({compilerOptions:{...e.options.rollup.dts.compilerOptions,incremental:void 0,inlineSources:void 0,sourceMap:void 0,tsBuildInfoFile:void 0},respectExternal:e.options.rollup.dts.respectExternal,tsconfig:e.tsconfig?.path})},"createDtsPlugin"),jr=En(kr),Vi=A(async(e,t)=>{const i=vt(e,"types"),o=e.tsconfig?.config.compilerOptions;delete o?.lib;let n;e.options.rollup.resolve&&(n=T(ai({...e.options.rollup.resolve}),t));const a="dts-plugin:"+process.pid+e.tsconfig.path,[s,l,p]=Ji(e.options.rollup.plugins,"dts");return{...Bi(e,i,"dts"),onwarn(r,c){qi(r,e)||r.code!=="EMPTY_BUNDLE"&&c(r)},output:[e.options.emitCJS&&{chunkFileNames:A(r=>ie(r,"d.cts"),"chunkFileNames"),compact:e.options.minify,dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.emitESM&&{chunkFileNames:A(r=>ie(r,"d.mts"),"chunkFileNames"),compact:e.options.minify,dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts",format:"esm",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.declaration==="compatible"&&{chunkFileNames:A(r=>ie(r,"d.ts"),"chunkFileNames"),compact:e.options.minify,dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output}].filter(Boolean),plugins:[T(Pi(),t),T(Fi(),t),e.options.rollup.json&&Ei({...e.options.rollup.json}),{load(r){return/\.(?:js|cjs|mjs|jsx|ts|tsx|ctsx|mtsx|mts|json)$/.test(r)?null:""},name:"packem:ignore-files"},e.tsconfig&&T(zi(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&T(Ti(e.tsconfig,e.logger),t),e.options.rollup.replace&&si({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&ni({customResolver:n,...e.options.rollup.alias,entries:i}),...s,n,...l,await jr(a)(e),e.options.cjsInterop&&e.options.emitCJS&&xi({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.patchTypes&&T(Gs(e.options.rollup.patchTypes,e.logger),t),As(),...p,e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dtsTemplate=="function"&&Di({licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dtsTemplate,logger:e.logger,marker:e.options.rollup.license.dtsMarker??"TYPE_DEPENDENCIES",mode:"types",packageName:e.pkg.name})].filter(Boolean)}},"getRollupDtsOptions");var $r=Object.defineProperty,Er=u((e,t)=>$r(e,"name",{value:t,configurable:!0}),"m$7");const Jt="rollup-build.json",Sr=Er(async(e,t,i)=>{const o=await Wi(e,t);if(await e.hooks.callHook("rollup:options",e,o),Object.keys(o.input).length===0)return;let n=!0;(e.options.rollup.isolatedDeclarations||e.options.isolatedDeclarationTransformer||e.options.rollup.css)&&(n=!1),n&&(o.cache=t.get(Jt,i));const a=await ii(o);n&&t.set(Jt,a.cache,i),await e.hooks.callHook("rollup:build",e,a);const s=new Map;for(const l of o.output){const{output:p}=await a.write(l),r=new Set,c=p.filter(d=>d.type==="chunk");for(const d of c){r.add(d.fileName);for(const f of d.imports)e.usedImports.add(f);d.isEntry&&e.buildEntries.push({bytes:Buffer.byteLength(d.code,"utf8"),chunks:d.imports.filter(f=>c.find(x=>x.fileName===f)),exports:d.exports,modules:Object.entries(d.modules).map(([f,x])=>({bytes:x.renderedLength,id:f})),path:d.fileName,type:"entry"})}const m=p.filter(d=>d.type==="asset");for(const d of m)s.has(d.fileName)||s.set(d.fileName,{bytes:Buffer.byteLength(d.source,"utf8"),path:d.fileName,type:"asset"});for(const d of r)e.usedImports.delete(d)}e.buildEntries.push(...s.values())},"build");var Or=Object.defineProperty,Ee=u((e,t)=>Or(e,"name",{value:t,configurable:!0}),"a$9");const qt="rollup-dts.json",Dr=Ee(async(e,t,i)=>{if(e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer){e.logger.info({message:"Using isolated declaration transformer to generate declaration files...",prefix:"dts"});return}const o=await Vi(e,t);if(await e.hooks.callHook("rollup:dts:options",e,o),Object.keys(o.input).length===0)return;o.cache=t.get(qt,i);const n=await ii(o);t.set(qt,n.cache,i),await e.hooks.callHook("rollup:dts:build",e,n),e.logger.info({message:"Building declaration files...",prefix:"dts"}),e.options.emitCJS&&await n.write({chunkFileNames:Ee(a=>ie(a,"d.cts"),"chunkFileNames"),dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts"}),e.options.emitESM&&await n.write({chunkFileNames:Ee(a=>ie(a,"d.mts"),"chunkFileNames"),dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts"}),e.options.declaration==="compatible"&&await n.write({chunkFileNames:Ee(a=>ie(a,"d.mjs"),"chunkFileNames"),dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts"}),await e.hooks.callHook("rollup:dts:done",e)},"buildTypes");var Cr=Object.defineProperty,Pr=u((e,t)=>Cr(e,"name",{value:t,configurable:!0}),"y$3");const Nr=Pr((e,t,i)=>e.reduce((o,n)=>{const a=n[t],s=n[i];return o[a]||(o[a]={}),o[a][s]||(o[a][s]=[]),o[a][s].push(n),o},{}),"groupByKeys");var _r=Object.defineProperty,Te=u((e,t)=>_r(e,"name",{value:t,configurable:!0}),"j$1");const Ir=Te((e,t)=>{const i=Te(s=>N(t.options.rootDir,j(t.options.outDir,s)),"rPath");let o=!1;const n=[],a=t.buildEntries.filter(s=>s.type==="entry");if(a.length>0){e.raw(`Entries:
95
+ `);for(const s of a){let l=s.bytes??0;for(const r of s.chunks??[])l+=t.buildEntries.find(c=>c.path===r)?.bytes??0;let p=` ${K(i(s.path))} (${["total size: "+D(X(l)),s.bytes&&"chunk size: "+D(X(s.bytes))].filter(Boolean).join(", ")})`;if(p+=s.exports?.length?`
96
+ exports: `+Z(s.exports.join(", ")):"",s.chunks?.length&&(p+=`
97
+ ${s.chunks.map(r=>{const c=t.buildEntries.find(m=>m.path===r)??{};return Z(" └─ "+i(r)+K(c.bytes?" ("+X(c?.bytes)+")":""))}).join(`
98
+ `)}`),s.modules&&s.modules.length>0){const r=s.modules.filter(c=>c.id.includes("node_modules")).sort((c,m)=>(m.bytes||0)-(c.bytes||0)).map(c=>Z(" 📦 "+i(c.id)+K(c.bytes?" ("+X(c.bytes)+")":""))).join(`
99
+ `);p+=r.length>0?`
100
100
  inlined modules:
101
- `+a:""}if(t.options.declaration){let a=i.path.replace(/\.js$/,".d.ts"),p="commonjs";i.path.endsWith(".cjs")?a=i.path.replace(/\.cjs$/,".d.cts"):i.path.endsWith(".mjs")&&(p="module",a=i.path.replace(/\.mjs$/,".d.mts"));const d=t.buildEntries.find(u=>u.path.endsWith(a));if(d){n.push(d.path);let u;a.includes(".d.ts")||(a=a.replace(".d.c",".d."),u=t.buildEntries.find(m=>m.path.endsWith(a))),u&&(n.push(u.path),c+=p==="commonjs"?`
101
+ `+r:""}if(t.options.declaration){let r=s.path.replace(/\.js$/,".d.ts"),c="commonjs";s.path.endsWith(".cjs")?r=s.path.replace(/\.cjs$/,".d.cts"):s.path.endsWith(".mjs")&&(c="module",r=s.path.replace(/\.mjs$/,".d.mts"));const m=t.buildEntries.find(d=>d.path.endsWith(r));if(m){n.push(m.path);let d;r.includes(".d.ts")||(r=r.replace(".d.c",".d."),d=t.buildEntries.find(f=>f.path.endsWith(r))),d&&(n.push(d.path),p+=c==="commonjs"?`
102
102
  types:
103
- `+[d,u].map(m=>X(" └─ ")+q(s(m.path))+" (total size: "+D(Y(m.bytes??0))+")").join(`
103
+ `+[m,d].map(f=>Z(" └─ ")+K(i(f.path))+" (total size: "+D(X(f.bytes??0))+")").join(`
104
104
  `):`
105
- types: `+q(s(d.path))+" (total size: "+D(Y(d.bytes??0))+")")}}o=!0,c+=`
105
+ types: `+K(i(m.path))+" (total size: "+D(X(m.bytes??0))+")")}}o=!0,p+=`
106
106
 
107
- `,e.raw(i.chunk?X(c):c)}}if(t.buildEntries.filter(i=>i.type==="asset").length>0){let i="Assets:";for(const l of t.buildEntries.filter(c=>c.type==="asset"))n.includes(l.path)||(i+=X(`
108
- └─ `)+q(s(l.path))+" (total size: "+D(Y(l.bytes??0))+")");i+=`
107
+ `,e.raw(s.chunk?Z(p):p)}}if(t.buildEntries.filter(s=>s.type==="asset").length>0){let s="Assets:";for(const l of t.buildEntries.filter(p=>p.type==="asset"))n.includes(l.path)||(s+=Z(`
108
+ └─ `)+K(i(l.path))+" (total size: "+D(X(l.bytes??0))+")");s+=`
109
109
 
110
- `,e.raw(i)}return o&&e.raw("Σ Total dist size (byte size):",D(Y(t.buildEntries.reduce((i,l)=>i+(l.bytes??0),0),{decimals:2})),`
111
- `),o},"showSizeInformation"),ma=Ne((e,t)=>{const s=ua(e.options.entries,"environment","runtime"),o=new Set,n=new Set;for(const[r,i]of Object.entries(s))for(const[l,c]of Object.entries(i)){const a={...e};!e.options.dtsOnly&&(r!=="undefined"||l!=="undefined")&&e.logger.info("Preparing build for "+(r==="undefined"?"":D(r)+" environment"+(l==="undefined"?"":" with "))+(l==="undefined"?"":D(l)+" runtime"));const p={};a.options.rollup.replace?(a.options.rollup.replace.values===void 0&&(a.options.rollup.replace.values={}),r!=="undefined"&&(p[["process","env","NODE_ENV"].join(".")]=JSON.stringify(r)),p[["process","env","EdgeRuntime"].join(".")]=JSON.stringify(l==="edge-light"),Object.freeze(p)):e.logger.warn("'replace' plugin is disabled. You should enable it to replace 'process.env.*' environments.");let d="";r!=="undefined"&&(d+=r+"/"),l!=="undefined"&&(d+=l+"/");let u=!1;a.options.minify!==void 0&&(u=a.options.minify),r==="development"?u=!1:r==="production"&&(u=!0);const m=[],v=[],h=[],g=[];for(const y of c)y.cjs&&y.esm?m.push(y):y.cjs?h.push(y):y.esm?v.push(y):y.declaration&&g.push(y);if(m.length>0){const y={...a,options:{...a.options,emitCJS:!0,emitESM:!0,entries:m,minify:u,rollup:{...a.options.rollup,replace:a.options.rollup.replace?{...a.options.rollup.replace,values:{...a.options.rollup.replace.values,...p}}:!1}}};if(e.options.dtsOnly||o.add({context:y,fileCache:t,subDirectory:d}),e.options.declaration){const w=y.options.entries.filter($=>$.declaration);w.length>0&&n.add({context:{...y,options:{...y.options,entries:w}},fileCache:t,subDirectory:d})}}if(v.length>0){const y={...a,options:{...a.options,emitCJS:!1,emitESM:!0,entries:v,minify:u,rollup:{...a.options.rollup,replace:a.options.rollup.replace?{...a.options.rollup.replace,values:{...a.options.rollup.replace.values,...p}}:!1}}};if(e.options.dtsOnly||o.add({context:y,fileCache:t,subDirectory:d}),e.options.declaration){const w=y.options.entries.filter($=>$.declaration);w.length>0&&n.add({context:{...y,options:{...y.options,entries:w}},fileCache:t,subDirectory:d})}}if(h.length>0){const y={...a,options:{...a.options,emitCJS:!0,emitESM:!1,entries:h,minify:u,rollup:{...a.options.rollup,replace:a.options.rollup.replace?{...a.options.rollup.replace,values:{...a.options.rollup.replace.values,...p}}:!1}}};if(e.options.dtsOnly||o.add({context:y,fileCache:t,subDirectory:d}),e.options.declaration){const w=y.options.entries.filter($=>$.declaration);w.length>0&&n.add({context:{...y,options:{...y.options,entries:w}},fileCache:t,subDirectory:d})}}a.options.declaration&&g.length>0&&n.add({context:{...a,options:{...a.options,emitCJS:!1,emitESM:!1,entries:g,minify:u,rollup:{...a.options.rollup,replace:a.options.rollup.replace?{...a.options.rollup.replace,values:{...a.options.rollup.replace.values,...p}}:!1}}},fileCache:t,subDirectory:d})}return{builders:o,typeBuilders:n}},"prepareRollupConfig"),ga=Ne(async(e,t)=>{await e.hooks.callHook("build:before",e);const{builders:s,typeBuilders:o}=ma(e,t);await Promise.all([...s].map(async({context:n,fileCache:r,subDirectory:i})=>await ia(n,r,i))),await Promise.all([...o].map(async({context:n,fileCache:r,subDirectory:i})=>await la(n,r,i))),e.logger.success(lo(e.options.name?"Build succeeded for "+e.options.name:"Build succeeded"));for await(const n of so(x(e.options.rootDir,e.options.outDir))){let r=e.buildEntries.find(i=>x(e.options.rootDir,e.options.outDir,i.path)===n.path);if(r||(r={chunk:!0,path:n.path},e.buildEntries.push(r)),!r.bytes){const i=await Yt(j(e.options.rootDir,e.options.outDir,n.path));r.bytes=i.size}}return await e.hooks.callHook("build:done",e),fa(e.logger,e)},"build");var ha=Object.defineProperty,ya=f((e,t)=>ha(e,"name",{value:t,configurable:!0}),"r$5");const O=ya((e,t)=>{e.warnings.has(t)||e.warnings.add(t)},"warn");var va=Object.defineProperty,Ls=f((e,t)=>va(e,"name",{value:t,configurable:!0}),"t$3");const Ie=Ls(e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},"inferExportTypeFromFileName"),ot=Ls((e,t,s,o)=>{if(e==="module-sync")return"esm";if(o){const i=Ie(o);if(i)return i}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return s;const[n,...r]=t;return ot(n,r,s,o)},"inferExportType");var ba=Object.defineProperty,wa=f((e,t)=>ba(e,"name",{value:t,configurable:!0}),"y$2");const $a=new Set(["electron","import","require","node","node-addons","default","types","deno","browser","module-sync","bun","workerd",...lt,...Ce]),ut=wa((e,t,s,o=[])=>{if(!e)return[];if(typeof e=="string"){const n=Ie(e);if(n&&n!==t)throw new Error(`Exported file "${e}" has an extension that does not match the package.json type "${t==="esm"?"module":"commonjs"}".`);return[{file:e,key:"exports",type:n??t}]}if(typeof e=="object"){const n=Object.entries(e).filter(([i])=>!i.endsWith(".json"));let r=[];for(const[i,l]of n)if(typeof l=="string"){let c={};Number.isInteger(+i)?c={exportKey:"*"}:i.startsWith("./")?c={exportKey:i.replace("./","")}:c={exportKey:i==="."?".":"*",subKey:i},r.push({...c,file:l,key:"exports",type:ot(i,o,t,l)})}else if(typeof l=="object"&&l!==null)for(const[c,a]of Object.entries(l)){if(s===!1&&c==="types")continue;const p=Number.isInteger(+i)?c:i;typeof a=="string"?r.push({exportKey:p.replace("./",""),file:a,key:"exports",...$a.has(c)?{subKey:c}:{},type:ot(c,o,t,a)}):r=[...r,...ut({[p]:a},t,s,[...o,c])]}return r}return[]},"extractExportFilenames");var xa=Object.defineProperty,Je=f((e,t)=>xa(e,"name",{value:t,configurable:!0}),"c$4");const ja=Je((e,t)=>e.key==="exports"&&e.subKey===K?K:e.key==="exports"&&e.subKey===ye?ye:t,"getEnvironment"),xe=Je((e,t,s,o,n,r,i)=>{const l=ja(n,r.environment);let c="node";for(const d of lt)if(n.file.includes("."+d+".")||n.subKey===d){c=d;break}let a=e.find(d=>d.input===t&&d.environment===l&&d.runtime===c);a===void 0?a=e[e.push({environment:l,exportKey:new Set([n.exportKey].filter(Boolean)),input:t,runtime:c})-1]:a.exportKey&&n.exportKey&&a.exportKey.add(n.exportKey),i&&(a.isGlob=!0),s&&(a.outDir=o),n.isExecutable?(a.executable=!0,a.declaration=!1,n.type==="cjs"?a.cjs=!0:n.type==="esm"&&(a.esm=!0)):(/\.d\.[mc]?ts$/.test(n.file)&&r.options.declaration!==!1&&(a.declaration=r.options.declaration),n.type==="cjs"?a.cjs=!0:n.type==="esm"&&(a.esm=!0));const p=n.file.replace(Kt(n.file),"").replace(new RegExp(`^./${r.options.outDir.replace(/^\.\//,"")}/`),"");Ce.has(n.subKey)&&!t.includes(p)&&(a.fileAlias=p)},"createOrUpdateEntry");let At=!1;const Rt=Je(e=>{if(e.pkg?.dependencies?.typescript===void 0&&e.pkg?.devDependencies?.typescript===void 0)throw new Error("You tried to use a `.ts`, `.cts` or `.mts` file but `typescript` was not found in your package.json.")},"validateIfTypescriptIsInstalled"),ka=Je((e,t,s)=>{const o=[];t.sort((l,c)=>l.split("/").length-c.split("/").length);const n=e.type==="module"?"esm":"cjs";n==="esm"&&(s.options.emitESM=!0),n==="cjs"&&(s.options.emitCJS=!0);const r=ut(e.exports,n,s.options.declaration);if(e.bin){const l=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const c of l){const a=Ie(c);if(a&&a!==n)throw new Error(`Exported file "${c}" has an extension that does not match the package.json type "${e.type??"commonjs"}".`);r.push({file:c,isExecutable:!0,key:"bin",type:a??n})}}e.main&&r.push({file:e.main,key:"main",type:Ie(e.main)??n}),e.module&&r.push({file:e.module,key:"module",type:"esm"}),(e.types||e.typings)&&(Rt(s),s.options.declaration===void 0&&(s.options.declaration="compatible"),r.push({file:e.types??e.typings,key:"types"}));const i=[];for(const l of r){s.options.declaration===void 0&&(l.key==="types"||l.subKey==="types")&&(s.options.declaration=l.file.includes(".d.ts")?"compatible":!0),s.options.emitCJS===void 0&&l.type==="cjs"&&(s.options.emitCJS=!0),s.options.emitESM===void 0&&l.type==="esm"&&(s.options.emitESM=!0);const c=l.file.replace(/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,""),a=c.endsWith("/");if(a&&["./","/"].includes(c))continue;const p=c.replace(new RegExp("(./)?"+s.options.outDir),s.options.sourceDir).replace("./",""),d="(?<=/|$)",u=a?"":"\\.\\w+$";if(l.file.includes("/*")&&l.key==="exports"){At||(s.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),At=!0);const g=[],y=new RegExp(d+p.replace("*","(.*)")+u),w=new RegExp(d+p.replace(/(.*)\.[^.]*$/,"$1").replace("*","(.*)")+u);for(const $ of t)(y.test($)||Ce.has(l.subKey)&&w.test($))&&g.push($);if(g.length===0){o.push(`Could not find entrypoint for \`${l.file}\``);continue}for(const $ of g)xe(i,$,a,c,l,s,!0);continue}const m=new RegExp(d+p+u);let v=t.find(g=>m.test(g));if(Ce.has(l.subKey)&&v===void 0){const g=new RegExp(d+p.replace(/(.*)\.[^.]*$/,"$1")+u);v=t.find(y=>g.test(y))}if(v===void 0){R(j(s.options.rootDir,l.file))||o.push(`Could not find entrypoint for \`${l.file}\``);continue}(v.endsWith(".ts")||v.endsWith(".cts")||v.endsWith(".mts"))&&R(v)&&Rt(s);const h=Oe(v.replace(oe,""));R(h+".cts")&&R(h+".mts")?(xe(i,h+".cts",a,c,{...l,type:"cjs"},s,!1),xe(i,h+".mts",a,c,{...l,type:"esm"},s,!1)):xe(i,v,a,c,l,s,!1)}return{entries:i,warnings:o}},"inferEntries");var Ea=Object.defineProperty,Sa=f((e,t)=>Ea(e,"name",{value:t,configurable:!0}),"o$3");const Oa=Sa((e,t)=>{const{publishConfig:s}=e;return s&&(s.bin&&(typeof s.bin=="object"||typeof s.bin=="string")&&(e.bin=s.bin),s.type&&typeof s.type=="string"&&s.type!==""&&(e.type=s.type),s.main&&typeof s.main=="string"&&s.main!==""&&(e.main=s.main),s.module&&typeof s.module=="string"&&s.module!==""&&(e.module=s.module),t===void 0&&s.types&&typeof s.types=="string"&&s.types!==""?e.types=s.types:t===void 0&&s.typings&&typeof s.typings=="string"&&s.typings!==""&&(e.typings=s.typings),s.exports&&typeof s.exports=="object"&&(e.exports=s.exports)),e},"overwriteWithPublishConfig");var Da=Object.defineProperty,Ca=f((e,t)=>Da(e,"name",{value:t,configurable:!0}),"t$2");const Pa={hooks:{"build:prepare":Ca(function(e){if(e.options.entries.length>0)return;const t=x(e.options.rootDir,e.options.sourceDir);if(!Ht(t))throw new Error("No 'src' directory found. Please provide entries manually.");const s=oo(t,{extensions:[],includeDirs:!1,includeSymlinks:!1});if(s.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");let o={...e.pkg};o.publishConfig&&(e.logger.info('Using publishConfig found in package.json, to override the default key-value pairs of "'+Object.keys(o.publishConfig).join(", ")+'".'),e.logger.debug(o.publishConfig),o=Oa(o,e.options.declaration));const n=ka(o,s,e);for(const r of n.warnings)O(e,r);if(e.options.entries.push(...n.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");e.logger.info("Automatically detected entries:",D(e.options.entries.map(r=>r.fileAlias?q(r.fileAlias)+" => "+q(r.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*")):q(r.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),X([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(r=>`[${r}]`).join(" ")))},"build:prepare")}};var Na=Object.defineProperty,Ia=f((e,t)=>Na(e,"name",{value:t,configurable:!0}),"t$1");const _a=Ia(async(e,t)=>{if(e==="auto")e=Pa;else{if(e==="none")return{};typeof e=="string"&&(e=await t.import(e)||{})}return typeof e=="function"&&(e=e()),e},"resolvePreset");var Ma=Object.defineProperty,Ta=f((e,t)=>Ma(e,"name",{value:t,configurable:!0}),"j");const Aa=Ta(async e=>{const t=e.options.jiti.transformOptions?.babel?.plugins,s=[],o=JSON.stringify({...e.options.jiti,alias:{...pt(e,"jit"),...e.options.jiti.alias},transformOptions:{...e.options.jiti.transformOptions,babel:{...e.options.jiti.transformOptions?.babel,plugins:"__$BABEL_PLUGINS"}}},null,2).replace('"__$BABEL_PLUGINS"',Array.isArray(t)?"["+t.map((n,r)=>{if(Array.isArray(n)){const[i,...l]=n;return s.push(i),"["+["plugin"+r,...l.map(c=>JSON.stringify(c))].join(", ")+"]"}return s.push(n),"plugin"+r}).join(",")+"]":"[]");for(const n of e.options.entries){const r=j(e.options.rootDir,e.options.outDir,n.name),i=Ao(e.jiti.esmResolve(n.input,{try:!0})??n.input),l=i.replace(oe,""),c=Me(i),a=ji(c);let p=[];try{p=await Ro(i,{extensions:at})}catch(u){O(e,`Cannot analyze ${i} for exports: ${u.toString()}`);return}const d=p.includes("default")||p.length===0;if(e.options.emitESM){const u=I(B(r),await vt("jiti",{conditions:["node","import"],url:import.meta.url})),m=l+".d.mts";se(`${r}.mjs`,a+['import { createJiti } from "'+u+'";',...s.map((v,h)=>"import plugin"+h+' from "'+v+'";'),"","const jiti = createJiti(import.meta.url, "+o+");","",'/** @type {import("'+m+'")} */','const _module = await jiti.import("'+i+'");',d?`
112
- export default _module;`:"",...p.filter(v=>v!=="default").map(v=>`export const ${v} = _module.${v};`)].join(`
113
- `)),e.options.declaration&&se(`${r}.d.mts`,'export * from "'+m+`";
114
- `+(d?'export { default } from "'+m+'";':""))}if(e.options.emitCJS){const u=I(B(r),await vt("jiti",{conditions:["node","require"],url:import.meta.url})),m=l+".d.cts";se(`${r}.cjs`,a+['const { createJiti } = require("'+u+'");',...s.map((v,h)=>"const plugin"+h+" = require("+JSON.stringify(v)+")"),"","const jiti = createJiti(__filename, "+o+");","",'/** @type {import("'+m+'")} */','module.exports = jiti("'+i+'")'].join(`
115
- `)),e.options.declaration&&se(r+".d.cts",'export * from "'+m+`";
116
- `+(d?'export { default } from "'+m+'";':""))}a&&(await st(`${r}.cjs`),await st(`${r}.mjs`))}await e.hooks.callHook("rollup:done",e)},"createStub");var Ra=Object.defineProperty,dt=f((e,t)=>Ra(e,"name",{value:t,configurable:!0}),"i$3");const Fa=dt(e=>{const{message:t,name:s="Error",stack:o}=e;if(!o)return o;const n=`${s}: ${t}
117
- `;return o.startsWith(n)?o.slice(n.length):o},"extractStack"),La=dt(e=>`
110
+ `,e.raw(s)}return o&&e.raw("Σ Total dist size (byte size):",D(X(t.buildEntries.reduce((s,l)=>s+(l.bytes??0),0),{decimals:2})),`
111
+ `),o},"showSizeInformation"),Mr=Te((e,t)=>{const i=Nr(e.options.entries,"environment","runtime"),o=new Set,n=new Set;for(const[a,s]of Object.entries(i))for(const[l,p]of Object.entries(s)){const r={...e};!e.options.dtsOnly&&(a!=="undefined"||l!=="undefined")&&e.logger.info("Preparing build for "+(a==="undefined"?"":D(a)+" environment"+(l==="undefined"?"":" with "))+(l==="undefined"?"":D(l)+" runtime"));const c={};r.options.rollup.replace?(r.options.rollup.replace.values===void 0&&(r.options.rollup.replace.values={}),a!=="undefined"&&(c[["process","env","NODE_ENV"].join(".")]=JSON.stringify(a)),c[["process","env","EdgeRuntime"].join(".")]=JSON.stringify(l==="edge-light"),Object.freeze(c)):e.logger.warn("'replace' plugin is disabled. You should enable it to replace 'process.env.*' environments.");let m="";a!=="undefined"&&(m+=a+"/"),l!=="undefined"&&(m+=l+"/");let d=!1;r.options.minify!==void 0&&(d=r.options.minify),a==="development"?d=!1:a==="production"&&(d=!0);const f=[],x=[],v=[],g=[];for(const h of p)h.cjs&&h.esm?f.push(h):h.cjs?v.push(h):h.esm?x.push(h):h.declaration&&g.push(h);if(f.length>0){const h={...r,options:{...r.options,emitCJS:!0,emitESM:!0,entries:f,minify:d,rollup:{...r.options.rollup,replace:r.options.rollup.replace?{...r.options.rollup.replace,values:{...r.options.rollup.replace.values,...c}}:!1}}};if(e.options.dtsOnly||o.add({context:h,fileCache:t,subDirectory:m}),e.options.declaration){const y=h.options.entries.filter(w=>w.declaration);y.length>0&&n.add({context:{...h,options:{...h.options,entries:y}},fileCache:t,subDirectory:m})}}if(x.length>0){const h={...r,options:{...r.options,emitCJS:!1,emitESM:!0,entries:x,minify:d,rollup:{...r.options.rollup,replace:r.options.rollup.replace?{...r.options.rollup.replace,values:{...r.options.rollup.replace.values,...c}}:!1}}};if(e.options.dtsOnly||o.add({context:h,fileCache:t,subDirectory:m}),e.options.declaration){const y=h.options.entries.filter(w=>w.declaration);y.length>0&&n.add({context:{...h,options:{...h.options,entries:y}},fileCache:t,subDirectory:m})}}if(v.length>0){const h={...r,options:{...r.options,emitCJS:!0,emitESM:!1,entries:v,minify:d,rollup:{...r.options.rollup,replace:r.options.rollup.replace?{...r.options.rollup.replace,values:{...r.options.rollup.replace.values,...c}}:!1}}};if(e.options.dtsOnly||o.add({context:h,fileCache:t,subDirectory:m}),e.options.declaration){const y=h.options.entries.filter(w=>w.declaration);y.length>0&&n.add({context:{...h,options:{...h.options,entries:y}},fileCache:t,subDirectory:m})}}r.options.declaration&&g.length>0&&n.add({context:{...r,options:{...r.options,emitCJS:!1,emitESM:!1,entries:g,minify:d,rollup:{...r.options.rollup,replace:r.options.rollup.replace?{...r.options.rollup.replace,values:{...r.options.rollup.replace.values,...c}}:!1}}},fileCache:t,subDirectory:m})}return{builders:o,typeBuilders:n}},"prepareRollupConfig"),Tr=Te(async(e,t)=>{await e.hooks.callHook("build:before",e);const{builders:i,typeBuilders:o}=Mr(e,t);await Promise.all([...i].map(async({context:n,fileCache:a,subDirectory:s})=>await Sr(n,a,s))),await Promise.all([...o].map(async({context:n,fileCache:a,subDirectory:s})=>await Dr(n,a,s))),e.logger.success(go(e.options.name?"Build succeeded for "+e.options.name:"Build succeeded"));for await(const n of po(k(e.options.rootDir,e.options.outDir))){let a=e.buildEntries.find(s=>k(e.options.rootDir,e.options.outDir,s.path)===n.path);if(a||(a={chunk:!0,path:n.path},e.buildEntries.push(a)),!a.bytes){const s=await dt(j(e.options.rootDir,e.options.outDir,n.path));a.bytes=s.size}}return await e.hooks.callHook("build:done",e),Ir(e.logger,e)},"build");var Ar=Object.defineProperty,zr=u((e,t)=>Ar(e,"name",{value:t,configurable:!0}),"r$5");const O=zr((e,t)=>{e.warnings.has(t)||e.warnings.add(t)},"warn");var Fr=Object.defineProperty,Ui=u((e,t)=>Fr(e,"name",{value:t,configurable:!0}),"t$3");const Ae=Ui(e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},"inferExportTypeFromFileName"),lt=Ui((e,t,i,o)=>{if(e==="module-sync")return"esm";if(o){const s=Ae(o);if(s)return s}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return i;const[n,...a]=t;return lt(n,a,i,o)},"inferExportType");var Rr=Object.defineProperty,Lr=u((e,t)=>Rr(e,"name",{value:t,configurable:!0}),"y$2");const Jr=new Set(["electron","import","require","node","node-addons","default","types","deno","browser","module-sync","bun","workerd",...ut,...Ie]),ht=Lr((e,t,i,o=[])=>{if(!e)return[];if(typeof e=="string"){const n=Ae(e);if(n&&n!==t)throw new Error(`Exported file "${e}" has an extension that does not match the package.json type "${t==="esm"?"module":"commonjs"}".`);return[{file:e,key:"exports",type:n??t}]}if(typeof e=="object"){const n=Object.entries(e).filter(([s])=>!s.endsWith(".json"));let a=[];for(const[s,l]of n)if(typeof l=="string"){let p={};Number.isInteger(+s)?p={exportKey:"*"}:s.startsWith("./")?p={exportKey:s.replace("./","")}:p={exportKey:s==="."?".":"*",subKey:s},a.push({...p,file:l,key:"exports",type:lt(s,o,t,l)})}else if(typeof l=="object"&&l!==null)for(const[p,r]of Object.entries(l)){if(i===!1&&p==="types")continue;const c=Number.isInteger(+s)?p:s;typeof r=="string"?a.push({exportKey:c.replace("./",""),file:r,key:"exports",...Jr.has(p)?{subKey:p}:{},type:lt(p,o,t,r)}):a=[...a,...ht({[c]:r},t,i,[...o,p])]}return a}return[]},"extractExportFilenames");var qr=Object.defineProperty,Ve=u((e,t)=>qr(e,"name",{value:t,configurable:!0}),"c$6");const Br=Ve((e,t)=>e.key==="exports"&&e.subKey===G?G:e.key==="exports"&&e.subKey===we?we:t,"getEnvironment"),Se=Ve((e,t,i,o,n,a,s)=>{const l=Br(n,a.environment);let p="node";for(const m of ut)if(n.file.includes("."+m+".")||n.subKey===m){p=m;break}let r=e.find(m=>m.input===t&&m.environment===l&&m.runtime===p);r===void 0?r=e[e.push({environment:l,exportKey:new Set([n.exportKey].filter(Boolean)),input:t,runtime:p})-1]:r.exportKey&&n.exportKey&&r.exportKey.add(n.exportKey),s&&(r.isGlob=!0),i&&(r.outDir=o),n.isExecutable?(r.executable=!0,r.declaration=!1,n.type==="cjs"?r.cjs=!0:n.type==="esm"&&(r.esm=!0)):(/\.d\.[mc]?ts$/.test(n.file)&&a.options.declaration!==!1&&(r.declaration=a.options.declaration),n.type==="cjs"?r.cjs=!0:n.type==="esm"&&(r.esm=!0));const c=n.file.replace(ct(n.file),"").replace(new RegExp(`^./${a.options.outDir.replace(/^\.\//,"")}/`),"");Ie.has(n.subKey)&&!t.includes(c)&&(r.fileAlias=c)},"createOrUpdateEntry");let Bt=!1;const Wt=Ve(e=>{if(e.pkg?.dependencies?.typescript===void 0&&e.pkg?.devDependencies?.typescript===void 0)throw new Error("You tried to use a `.ts`, `.cts` or `.mts` file but `typescript` was not found in your package.json.")},"validateIfTypescriptIsInstalled"),Wr=Ve((e,t,i)=>{const o=[];t.sort((l,p)=>l.split("/").length-p.split("/").length);const n=e.type==="module"?"esm":"cjs";n==="esm"&&(i.options.emitESM=!0),n==="cjs"&&(i.options.emitCJS=!0);const a=ht(e.exports,n,i.options.declaration);if(e.bin){const l=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const p of l){const r=Ae(p);if(r&&r!==n)throw new Error(`Exported file "${p}" has an extension that does not match the package.json type "${e.type??"commonjs"}".`);a.push({file:p,isExecutable:!0,key:"bin",type:r??n})}}e.main&&a.push({file:e.main,key:"main",type:Ae(e.main)??n}),e.module&&a.push({file:e.module,key:"module",type:"esm"}),(e.types||e.typings)&&(Wt(i),i.options.declaration===void 0&&(i.options.declaration="compatible"),a.push({file:e.types??e.typings,key:"types"}));const s=[];for(const l of a){i.options.declaration===void 0&&(l.key==="types"||l.subKey==="types")&&(i.options.declaration=l.file.includes(".d.ts")?"compatible":!0),i.options.emitCJS===void 0&&l.type==="cjs"&&(i.options.emitCJS=!0),i.options.emitESM===void 0&&l.type==="esm"&&(i.options.emitESM=!0);const p=l.file.replace(/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,""),r=p.endsWith("/");if(r&&["./","/"].includes(p))continue;const c=p.replace(new RegExp("(./)?"+i.options.outDir),i.options.sourceDir).replace("./",""),m="(?<=/|$)",d=r?"":"\\.\\w+$";if(l.file.includes("/*")&&l.key==="exports"){Bt||(i.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),Bt=!0);const g=[],h=new RegExp(m+c.replace("*","(.*)")+d),y=new RegExp(m+c.replace(/(.*)\.[^.]*$/,"$1").replace("*","(.*)")+d);for(const w of t)(h.test(w)||Ie.has(l.subKey)&&y.test(w))&&g.push(w);if(g.length===0){o.push(`Could not find entrypoint for \`${l.file}\``);continue}for(const w of g)Se(s,w,r,p,l,i,!0);continue}const f=new RegExp(m+c+d);let x=t.find(g=>f.test(g));if(Ie.has(l.subKey)&&x===void 0){const g=new RegExp(m+c.replace(/(.*)\.[^.]*$/,"$1")+d);x=t.find(h=>g.test(h))}if(x===void 0){R(j(i.options.rootDir,l.file))||o.push(`Could not find entrypoint for \`${l.file}\``);continue}(x.endsWith(".ts")||x.endsWith(".cts")||x.endsWith(".mts"))&&R(x)&&Wt(i);const v=Ne(x.replace(le,""));R(v+".cts")&&R(v+".mts")?(Se(s,v+".cts",r,p,{...l,type:"cjs"},i,!1),Se(s,v+".mts",r,p,{...l,type:"esm"},i,!1)):Se(s,x,r,p,l,i,!1)}return{entries:s,warnings:o}},"inferEntries");var Vr=Object.defineProperty,Ur=u((e,t)=>Vr(e,"name",{value:t,configurable:!0}),"o$3");const Kr=Ur((e,t)=>{const{publishConfig:i}=e;return i&&(i.bin&&(typeof i.bin=="object"||typeof i.bin=="string")&&(e.bin=i.bin),i.type&&typeof i.type=="string"&&i.type!==""&&(e.type=i.type),i.main&&typeof i.main=="string"&&i.main!==""&&(e.main=i.main),i.module&&typeof i.module=="string"&&i.module!==""&&(e.module=i.module),t===void 0&&i.types&&typeof i.types=="string"&&i.types!==""?e.types=i.types:t===void 0&&i.typings&&typeof i.typings=="string"&&i.typings!==""&&(e.typings=i.typings),i.exports&&typeof i.exports=="object"&&(e.exports=i.exports)),e},"overwriteWithPublishConfig");var Gr=Object.defineProperty,Hr=u((e,t)=>Gr(e,"name",{value:t,configurable:!0}),"t$2");const Yr={hooks:{"build:prepare":Hr(function(e){if(e.options.entries.length>0)return;const t=k(e.options.rootDir,e.options.sourceDir);if(!oi(t))throw new Error("No 'src' directory found. Please provide entries manually.");const i=co(t,{extensions:[],includeDirs:!1,includeSymlinks:!1});if(i.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");let o={...e.pkg};o.publishConfig&&(e.logger.info('Using publishConfig found in package.json, to override the default key-value pairs of "'+Object.keys(o.publishConfig).join(", ")+'".'),e.logger.debug(o.publishConfig),o=Kr(o,e.options.declaration));const n=Wr(o,i,e);for(const a of n.warnings)O(e,a);if(e.options.entries.push(...n.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");e.logger.info("Automatically detected entries:",D(e.options.entries.map(a=>a.fileAlias?K(a.fileAlias)+" => "+K(a.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*")):K(a.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),Z([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(a=>`[${a}]`).join(" ")))},"build:prepare")}};var Xr=Object.defineProperty,Qr=u((e,t)=>Xr(e,"name",{value:t,configurable:!0}),"t$1");const Zr=Qr(async(e,t)=>{if(e==="auto")e=Yr;else{if(e==="none")return{};typeof e=="string"&&(e=await t.import(e)||{})}return typeof e=="function"&&(e=e()),e},"resolvePreset");var el=Object.defineProperty,tl=u((e,t)=>el(e,"name",{value:t,configurable:!0}),"j");const il=tl(async e=>{const t=e.options.jiti.transformOptions?.babel?.plugins,i=[],o=JSON.stringify({...e.options.jiti,alias:{...vt(e,"jit"),...e.options.jiti.alias},transformOptions:{...e.options.jiti.transformOptions,babel:{...e.options.jiti.transformOptions?.babel,plugins:"__$BABEL_PLUGINS"}}},null,2).replace('"__$BABEL_PLUGINS"',Array.isArray(t)?"["+t.map((n,a)=>{if(Array.isArray(n)){const[s,...l]=n;return i.push(s),"["+["plugin"+a,...l.map(p=>JSON.stringify(p))].join(", ")+"]"}return i.push(n),"plugin"+a}).join(",")+"]":"[]");for(const n of e.options.entries){const a=j(e.options.rootDir,e.options.outDir,n.name),s=Ho(e.jiti.esmResolve(n.input,{try:!0})??n.input),l=s.replace(le,""),p=Re(s),r=zs(p);let c=[];try{c=await Yo(s,{extensions:mt})}catch(d){O(e,`Cannot analyze ${s} for exports: ${d.toString()}`);return}const m=c.includes("default")||c.length===0;if(e.options.emitESM){const d=N(I(a),await Et("jiti",{conditions:["node","import"],url:import.meta.url})),f=l+".d.mts";re(`${a}.mjs`,r+['import { createJiti } from "'+d+'";',...i.map((x,v)=>"import plugin"+v+' from "'+x+'";'),"","const jiti = createJiti(import.meta.url, "+o+");","",'/** @type {import("'+f+'")} */','const _module = await jiti.import("'+s+'");',m?`
112
+ export default _module;`:"",...c.filter(x=>x!=="default").map(x=>`export const ${x} = _module.${x};`)].join(`
113
+ `)),e.options.declaration&&re(`${a}.d.mts`,'export * from "'+f+`";
114
+ `+(m?'export { default } from "'+f+'";':""))}if(e.options.emitCJS){const d=N(I(a),await Et("jiti",{conditions:["node","require"],url:import.meta.url})),f=l+".d.cts";re(`${a}.cjs`,r+['const { createJiti } = require("'+d+'");',...i.map((x,v)=>"const plugin"+v+" = require("+JSON.stringify(x)+")"),"","const jiti = createJiti(__filename, "+o+");","",'/** @type {import("'+f+'")} */','module.exports = jiti("'+s+'")'].join(`
115
+ `)),e.options.declaration&&re(a+".d.cts",'export * from "'+f+`";
116
+ `+(m?'export { default } from "'+f+'";':""))}r&&(await rt(`${a}.cjs`),await rt(`${a}.mjs`))}await e.hooks.callHook("rollup:done",e)},"createStub");var ol=Object.defineProperty,xt=u((e,t)=>ol(e,"name",{value:t,configurable:!0}),"i$3");const nl=xt(e=>{const{message:t,name:i="Error",stack:o}=e;if(!o)return o;const n=`${i}: ${t}
117
+ `;return o.startsWith(n)?o.slice(n.length):o},"extractStack"),al=xt(e=>`
118
118
  ${e.replaceAll(/^\n|\n$/g,"")}
119
- `,"normalizeCodeFrame"),Js=dt(e=>{const t=Fa(e);let s=(e.plugin?`[${e.plugin}] `:"")+e.message;e.id&&(s+=`
120
- file: ${D(e.id+(e.loc?":"+e.loc.line+":"+e.loc.column:""))}`),e.frame&&(s+=`
121
- `+co(La(e.frame))),e.message=s,t!==void 0&&(e.stack=`${e.message}
122
- ${t}`)},"enhanceRollupError");var Ja=Object.defineProperty,Bs=f((e,t)=>Ja(e,"name",{value:t,configurable:!0}),"d$4");const _e="rollup-watch.json",Ft=Bs(({context:e,doOnSuccessCleanup:t,fileCache:s,mode:o,runBuilder:n,runOnsuccess:r,useCache:i,watcher:l})=>{const c="watcher:"+o;l.on("change",async(a,{event:p})=>{await t?.(),e.logger.info({message:`${D(I(".",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&&s.set(o==="bundle"?_e:"dts-"+_e,a.result.cache),e.logger.raw(`
123
- ⚡️ Build run in `+a.duration+`ms
119
+ `,"normalizeCodeFrame"),Ki=xt(e=>{const t=nl(e);let i=(e.plugin?`[${e.plugin}] `:"")+e.message;e.id&&(i+=`
120
+ file: ${D(e.id+(e.loc?":"+e.loc.line+":"+e.loc.column:""))}`),e.frame&&(i+=`
121
+ `+vo(al(e.frame))),e.message=i,t!==void 0&&(e.stack=`${e.message}
122
+ ${t}`)},"enhanceRollupError");var sl=Object.defineProperty,Gi=u((e,t)=>sl(e,"name",{value:t,configurable:!0}),"d$4");const ze="rollup-watch.json",Vt=Gi(({context:e,doOnSuccessCleanup:t,fileCache:i,mode:o,runBuilder:n,runOnsuccess:a,useCache:s,watcher:l})=>{const p="watcher:"+o;l.on("change",async(r,{event:c})=>{await t?.(),e.logger.info({message:`${D(N(".",r))} was ${c}d`,prefix:p})}),l.on("restart",()=>{e.logger.info({message:"Rebuilding ...",prefix:p})}),l.on("event",async r=>{switch(r.code){case"END":{e.logger.success({message:"Rebuild finished",prefix:p}),await a?.();break}case"BUNDLE_START":{e.logger.info({message:D("build started..."),prefix:p});break}case"BUNDLE_END":{await r.result.close(),s&&i.set(o==="bundle"?ze:"dts-"+ze,r.result.cache),e.logger.raw(`
123
+ ⚡️ Build run in `+r.duration+`ms
124
124
 
125
- `),await n?.(!0);break}case"ERROR":{Js(a.error),e.logger.error({context:[a.error],message:"Rebuild failed: "+a.error.message,prefix:c});break}}})},"watchHandler"),Ba=Bs(async(e,t,s,o,n)=>{const r=await Rs(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(_e)),e.options.rollup.watch&&typeof r.watch=="object"&&r.watch.include===void 0&&(r.watch={...r.watch,...e.options.rollup.watch},r.watch.include=[x(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=ht(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+=X(`
126
- └─ ${I(process.cwd(),p)}`);if(e.logger.info(a),Ft({context:e,doOnSuccessCleanup:n,fileCache:t,mode:"bundle",runBuilder:s,runOnsuccess:o,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 Fs(e,t);i&&(p.cache=t.get("dts-"+_e)),await e.hooks.callHook("rollup:dts:options",e,p);const d=ht(p);await e.hooks.callHook("rollup:watch",e,d),Ft({context:e,fileCache:t,mode:"types",useCache:i,watcher:d})}},"watch");var Wa=Object.defineProperty,Va=f((e,t)=>Wa(e,"name",{value:t,configurable:!0}),"i$2");const za=Va((e,t,s,o)=>{try{let n={};const r=x(t,"keystore.json");o&&R(r)&&(n=it(r)),n[e]===void 0&&(n[e]=new Date().toISOString()),Te(r,n,{overwrite:!0})}catch(n){s.debug({context:n,message:n.message,prefix:"cache-key-store"})}},"createOrUpdateKeyStorage");var Ua=Object.defineProperty,Ws=f((e,t)=>Ua(e,"name",{value:t,configurable:!0}),"s$4");const qa=Ws(e=>{try{JSON.parse(e)}catch{return!1}return!0},"isJson");let Ka=class{static{f(this,"g")}static{Ws(this,"FileCache")}#e;#s;#r;#a=!0;#i=new Map;constructor(t,s,o,n){this.#e=t,this.#r=o,s===void 0?n.debug({message:"Could not create cache directory.",prefix:"file-cache"}):(this.#s=s,n.debug({message:"Cache path is: "+this.#s,prefix:"file-cache"}))}set isEnabled(t){this.#a=t}has(t,s){return!this.#a||this.#s===void 0?!1:R(this.getFilePath(t,s))}get(t,s){if(!this.#a||this.#s===void 0)return;const o=this.getFilePath(t,s);if(this.#i.has(o))return this.#i.get(o);if(!R(o))return;const n=Me(o);if(qa(n)){const r=JSON.parse(n);return this.#i.set(o,r),r}return this.#i.set(o,n),n}set(t,s,o){if(!this.#a||this.#s===void 0||s===void 0)return;const n=this.getFilePath(t,o);typeof s=="object"&&(s=JSON.stringify(s)),se(n,s,{overwrite:!0})}getFilePath(t,s){let o=t.replaceAll(Oe(this.#e),"");return o=o.replaceAll(":","-"),x(this.#s,this.#r,s?.replaceAll(":","-")??"",Oe(o))}};var Ga=Object.defineProperty,je=f((e,t)=>Ga(e,"name",{value:t,configurable:!0}),"l$4");const Ha=ne,Ya=je((e,t)=>{const{sideEffects:s}=t;let o;if(typeof s=="boolean")o=je(()=>s,"hasSideEffects");else if(Array.isArray(s))if(s.length<=0)o=je(()=>!1,"hasSideEffects");else{const n=s.map(r=>r.includes("/")?r:`**/${r}`);o=Ha(n,null,{resolve:e})}else o=je(()=>null,"hasSideEffects");return o},"getPackageSideEffect");var Ye,Lt;function Xa(){if(Lt)return Ye;Lt=1;var e=zo,t=e.spawn,s=e.exec;Ye=f(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":s("taskkill /pid "+i+" /T /F",c);break;case"darwin":r(i,a,p,function(d){return t("pgrep",["-P",d])},function(){o(a,l,c)});break;default:r(i,a,p,function(d){return t("ps",["-o","pid","--no-headers","--ppid",d])},function(){o(a,l,c)});break}},"treeKill");function o(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()}f(o,"killAll");function n(i,l){try{process.kill(parseInt(i,10),l)}catch(c){if(c.code!=="ESRCH")throw c}}f(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 m=f(function(v){if(delete c[i],v!=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",m)}return f(r,"buildProcessTree"),Ye}f(Xa,"requireTreeKill");var Qa=Xa();const Za=ms(Qa);var el=Object.defineProperty,Vs=f((e,t)=>el(e,"name",{value:t,configurable:!0}),"l$3");const tl=Vs(e=>process.platform==="win32"&&"cmd"in e&&"code"in e&&typeof e.cmd=="string"&&e.cmd.startsWith("taskkill")&&e.code===128,"isTaskKillCmdProcessNotFoundError"),sl=Vs(async({pid:e,signal:t})=>await new Promise((s,o)=>{if(!Number.isInteger(e)||e<=0){o(new Error("Invalid process ID"));return}Za(e,t,n=>{if(n&&!tl(n)){o(n);return}s()})}),"killProcess");var ol=Object.defineProperty,nl=f((e,t)=>ol(e,"name",{value:t,configurable:!0}),"n");const zs=nl(e=>{const t=x(e,"package.json");if(!R(t))throw new Error("package.json not found at "+t);return{packageJson:is(t),packageJsonPath:t}},"loadPackageJson");var rl=Object.defineProperty,il=f((e,t)=>rl(e,"name",{value:t,configurable:!0}),"r$3");const Jt=il((e,t)=>{if(e.warnings.size>0&&(t&&e.logger.raw(`
125
+ `),await n?.(!0);break}case"ERROR":{Ki(r.error),e.logger.error({context:[r.error],message:"Rebuild failed: "+r.error.message,prefix:p});break}}})},"watchHandler"),rl=Gi(async(e,t,i,o,n)=>{const a=await Wi(e,t);if(await e.hooks.callHook("rollup:options",e,a),Object.keys(a.input).length===0)return;let s=!0;(e.options.rollup.isolatedDeclarations||e.options.isolatedDeclarationTransformer||e.options.rollup.css)&&(s=!1),s&&(a.cache=t.get(ze)),e.options.rollup.watch&&typeof a.watch=="object"&&a.watch.include===void 0&&(a.watch={...a.watch,...e.options.rollup.watch},a.watch.include=[k(e.options.sourceDir,"**","*"),"package.json","packem.config.*"],Array.isArray(e.options.rollup.watch.include)?a.watch.include=[...a.watch.include,...e.options.rollup.watch.include]:e.options.rollup.watch.include&&a.watch.include.push(e.options.rollup.watch.include),a.watch.chokidar={cwd:e.options.rootDir,...a.watch.chokidar,ignored:["**/.git/**","**/node_modules/**","**/test-results/**",...a.watch.chokidar?.ignored??[]]});const l=jt(a);await e.hooks.callHook("rollup:watch",e,l);const p=[...Array.isArray(a.input)?a.input:typeof a.input=="string"?[a.input]:Object.keys(a.input??{})];let r="Starting watcher for entries:";for(const c of p)r+=Z(`
126
+ └─ ${N(process.cwd(),c)}`);if(e.logger.info(r),Vt({context:e,doOnSuccessCleanup:n,fileCache:t,mode:"bundle",runBuilder:i,runOnsuccess:o,useCache:s,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 c=await Vi(e,t);s&&(c.cache=t.get("dts-"+ze)),await e.hooks.callHook("rollup:dts:options",e,c);const m=jt(c);await e.hooks.callHook("rollup:watch",e,m),Vt({context:e,fileCache:t,mode:"types",useCache:s,watcher:m})}},"watch");var ll=Object.defineProperty,pl=u((e,t)=>ll(e,"name",{value:t,configurable:!0}),"s$5");const cl=pl(async e=>{const t=[];if(e.options.clean)for(const i of new Set(e.options.entries.map(o=>o.outDir).filter(Boolean).sort()))i===e.options.rootDir||i===e.options.sourceDir||e.options.rootDir.startsWith(i.endsWith("/")?i:`${i}/`)||t.some(o=>i.startsWith(o))||(t.push(i),e.logger.info(`Cleaning dist directory: \`./${N(e.options.rootDir,i)}\``),await mo(i))},"cleanDistributionDirectories");var dl=Object.defineProperty,ml=u((e,t)=>dl(e,"name",{value:t,configurable:!0}),"i$2");const ul=ml((e,t,i,o)=>{try{let n={};const a=k(t,"keystore.json");o&&R(a)&&(n=ei(a)),n[e]===void 0&&(n[e]=new Date().toISOString()),Le(a,n,{overwrite:!0})}catch(n){i.debug({context:n,message:n.message,prefix:"cache-key-store"})}},"createOrUpdateKeyStorage");var fl=Object.defineProperty,Hi=u((e,t)=>fl(e,"name",{value:t,configurable:!0}),"s$4");const gl=Hi(e=>{try{JSON.parse(e)}catch{return!1}return!0},"isJson");let vl=class{static{u(this,"g")}static{Hi(this,"FileCache")}#e;#i;#a;#r=!0;#s=new Map;constructor(t,i,o,n){this.#e=t,this.#a=o,i===void 0?n.debug({message:"Could not create cache directory.",prefix:"file-cache"}):(this.#i=i,n.debug({message:"Cache path is: "+this.#i,prefix:"file-cache"}))}set isEnabled(t){this.#r=t}has(t,i){return!this.#r||this.#i===void 0?!1:R(this.getFilePath(t,i))}get(t,i){if(!this.#r||this.#i===void 0)return;const o=this.getFilePath(t,i);if(this.#s.has(o))return this.#s.get(o);if(!R(o))return;const n=Re(o);if(gl(n)){const a=JSON.parse(n);return this.#s.set(o,a),a}return this.#s.set(o,n),n}set(t,i,o){if(!this.#r||this.#i===void 0||i===void 0)return;const n=this.getFilePath(t,o);typeof i=="object"&&(i=JSON.stringify(i)),re(n,i,{overwrite:!0})}getFilePath(t,i){let o=t.replaceAll(Ne(this.#e),"");return o=o.replaceAll(":","-"),k(this.#i,this.#a,i?.replaceAll(":","-")??"",Ne(o))}};var hl=Object.defineProperty,Oe=u((e,t)=>hl(e,"name",{value:t,configurable:!0}),"l$4");const xl=ne,yl=Oe((e,t)=>{const{sideEffects:i}=t;let o;if(typeof i=="boolean")o=Oe(()=>i,"hasSideEffects");else if(Array.isArray(i))if(i.length<=0)o=Oe(()=>!1,"hasSideEffects");else{const n=i.map(a=>a.includes("/")?a:`**/${a}`);o=xl(n,null,{resolve:e})}else o=Oe(()=>null,"hasSideEffects");return o},"getPackageSideEffect");var tt,Ut;function bl(){if(Ut)return tt;Ut=1;var e=an,t=e.spawn,i=e.exec;tt=u(function(s,l,p){if(typeof l=="function"&&p===void 0&&(p=l,l=void 0),s=parseInt(s),Number.isNaN(s)){if(p)return p(new Error("pid must be a number"));throw new Error("pid must be a number")}var r={},c={};switch(r[s]=[],c[s]=1,process.platform){case"win32":i("taskkill /pid "+s+" /T /F",p);break;case"darwin":a(s,r,c,function(m){return t("pgrep",["-P",m])},function(){o(r,l,p)});break;default:a(s,r,c,function(m){return t("ps",["-o","pid","--no-headers","--ppid",m])},function(){o(r,l,p)});break}},"treeKill");function o(s,l,p){var r={};try{Object.keys(s).forEach(function(c){s[c].forEach(function(m){r[m]||(n(m,l),r[m]=1)}),r[c]||(n(c,l),r[c]=1)})}catch(c){if(p)return p(c);throw c}if(p)return p()}u(o,"killAll");function n(s,l){try{process.kill(parseInt(s,10),l)}catch(p){if(p.code!=="ESRCH")throw p}}u(n,"killPid");function a(s,l,p,r,c){var m=r(s),d="";m.stdout.on("data",function(v){var v=v.toString("ascii");d+=v});var f=u(function(x){if(delete p[s],x!=0){Object.keys(p).length==0&&c();return}d.match(/\d+/g).forEach(function(v){v=parseInt(v,10),l[s].push(v),l[v]=[],p[v]=1,a(v,l,p,r,c)})},"onClose");m.on("close",f)}return u(a,"buildProcessTree"),tt}u(bl,"requireTreeKill");var wl=bl();const kl=yi(wl);var jl=Object.defineProperty,Yi=u((e,t)=>jl(e,"name",{value:t,configurable:!0}),"l$3");const $l=Yi(e=>process.platform==="win32"&&"cmd"in e&&"code"in e&&typeof e.cmd=="string"&&e.cmd.startsWith("taskkill")&&e.code===128,"isTaskKillCmdProcessNotFoundError"),El=Yi(async({pid:e,signal:t})=>await new Promise((i,o)=>{if(!Number.isInteger(e)||e<=0){o(new Error("Invalid process ID"));return}kl(e,t,n=>{if(n&&!$l(n)){o(n);return}i()})}),"killProcess");var Sl=Object.defineProperty,Ol=u((e,t)=>Sl(e,"name",{value:t,configurable:!0}),"n");const Xi=Ol(e=>{const t=k(e,"package.json");if(!R(t))throw new Error("package.json not found at "+t);return{packageJson:di(t),packageJsonPath:t}},"loadPackageJson");var Dl=Object.defineProperty,Cl=u((e,t)=>Dl(e,"name",{value:t,configurable:!0}),"r$3");const Kt=Cl((e,t)=>{if(e.warnings.size>0&&(t&&e.logger.raw(`
127
127
  `),e.logger.warn(`Build is done with some warnings:
128
128
 
129
- ${[...e.warnings].map(s=>`- ${s}`).join(`
130
- `)}`),e.options.failOnWarn))throw new Error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`.")},"logBuildErrors");var al=Object.defineProperty,Us=f((e,t)=>al(e,"name",{value:t,configurable:!0}),"r$2");const Bt=Us(async(e,t)=>{if(typeof e.name!="string"){let s=Ae(e.input)?I(t.options.rootDir,e.input):J(e.input);s.startsWith("./")&&(s=s.slice(2)),e.name=s.replace(new RegExp(`^${t.options.sourceDir}/`),"").replace(oe,"")}if(!e.input)throw new Error(`Missing entry input: ${JSON.stringify(e)}`);ss(e.input)&&(e.input=j(t.options.rootDir,e.input)),t.options.declaration&&e.declaration===void 0&&(e.declaration=t.options.declaration),e.executable&&(e.cjs===void 0||e.esm===void 0)?t.pkg.type==="commonjs"&&e.cjs===void 0&&t.options.emitCJS!==void 0?(e.cjs=t.options.emitCJS,e.esm=!1):t.pkg.type==="module"&&e.esm===void 0&&t.options.emitESM!==void 0&&(e.esm=t.options.emitESM,e.cjs=!1):e.cjs===void 0&&e.esm===void 0&&(t.options.emitCJS!==void 0&&(e.cjs=t.options.emitCJS),t.options.emitESM!==void 0&&(e.esm=t.options.emitESM)),e.outDir=j(t.options.rootDir,e.outDir??t.options.outDir)},"extendEntry"),ll=Us(async e=>{e.options.entries=e.options.entries.map(t=>typeof t=="string"?{input:t,isGlob:yt(t)}:{...t,exportKey:t.exportKey??new Set,isGlob:yt(t.input)});for(const t of e.options.entries.filter(s=>s.isGlob)){const{isGlob:s,...o}=t,n=["**/.git/**","**/node_modules/**","**/test-results/**"];if(e.options.rollup.watch){if(typeof e.options.rollup.watch.exclude=="string")n.push(e.options.rollup.watch.exclude);else if(Array.isArray(e.options.rollup.watch.exclude))for(const i of e.options.rollup.watch.exclude)typeof i=="string"&&n.push(i)}const r=No([o.input],{cwd:e.options.rootDir,dot:!1,ignore:n,onlyFiles:!0});if(r.length===0)throw new Uo("No files found in the glob pattern: "+D(x(e.options.rootDir,o.input)));for(const i of r)e.options.entries.push({...o,input:j(e.options.rootDir,i)});e.options.entries.splice(e.options.entries.indexOf(t),1)}for(const t of e.options.entries.filter(s=>s.fileAlias===void 0))await Bt(t,e);for(const t of e.options.entries.filter(s=>s.fileAlias!==void 0))t.name=t.fileAlias,t.fileAlias=void 0,await Bt(t,e)},"prepareEntries");var cl=Object.defineProperty,pl=f((e,t)=>cl(e,"name",{value:t,configurable:!0}),"o$1");const ul=pl(e=>{if(e.options.validation?.packageJson?.dependencies===!1)return;const t=new Set,s=new Set(Object.keys(e.pkg?.dependencies??{})),o=new Set;for(const n of e.usedImports)s.delete(n),t.add(n);if(e.pkg?.dependencies)for(const n of Object.keys(e.pkg?.dependencies))s.delete(n);for(const n of t){const r=cs(n);!Ze(e.options.externals,n)&&!n.startsWith("chunks/")&&e.pkg?.dependencies?.[r]===void 0&&e.pkg?.peerDependencies?.[r]===void 0&&o.add(n)}s.size>0&&O(e,`Potential unused dependencies found: ${[...s].map(n=>D(n)).join(", ")}`),o.size>0&&O(e,`Potential implicit dependencies found: ${[...o].map(n=>D(n)).join(", ")}`)},"validateDependencies");var dl=Object.defineProperty,qs=f((e,t)=>dl(e,"name",{value:t,configurable:!0}),"i$1");const fl=qs((e,t)=>qo(e,t)<=e.length/3||t.includes(e),"isSimilar"),ml=qs((e,t)=>{const s=e.toLowerCase();return t.filter(o=>fl(o.toLowerCase(),s))},"findAlternatives");var gl=Object.defineProperty,Wt=f((e,t)=>gl(e,"name",{value:t,configurable:!0}),"r$1");const hl=Wt(e=>{const{options:t}=e;if(t.validation?.packageJson?.exports===!1)return;const s=t.validation?.packageJson,o=new Set([t.declaration&&s?.types?e.pkg.types:"",t.declaration&&s?.types?e.pkg.typings:"",...t.dtsOnly||s?.bin===!1?[""]:typeof e.pkg.bin=="string"?[e.pkg.bin]:Object.values(e.pkg.bin??{}),t.dtsOnly&&s?.main===!1?"":e.pkg.main,t.dtsOnly&&s?.module===!1?"":e.pkg.module,...s?.exports===!1?[]:ut(e.pkg.exports,e.pkg.type==="module"?"esm":"cjs",t.declaration).map(l=>t.dtsOnly?l.subKey==="types"?l.file:void 0:l.file)].filter(Boolean).map(l=>l&&j(t.rootDir,l.replace(/\/[^*/]*\*[^\n\r/\u2028\u2029]*(?:[\n\r\u2028\u2029][^*/]*\*[^\n\r/\u2028\u2029]*)*(?:\/.*)?$/,"")))),n=[];for(const l of o)l&&!l.includes("*")&&!Ht(l)&&n.push(l.replace(`${t.rootDir}/`,""));const r=Wt(l=>I(t.rootDir,j(t.outDir,l)),"rPath"),i=e.buildEntries.filter(l=>!l.chunk).map(l=>r(l.path));if(n.length>0){let l="Potential missing or wrong package.json files:";for(const c of n){const a=ml(c,i);l+=`
131
- - `+D(c)+(a.length>0?po` (did you mean ${a.map(p=>`"${p}"`).join(", ")}?)`:"")}O(e,l)}},"validatePackageEntries");var yl=Object.defineProperty,vl=f((e,t)=>yl(e,"name",{value:t,configurable:!0}),"l$1");const bl=vl(e=>{const{options:{validation:t},pkg:s}=e;s.name===void 0&&t?.packageJson?.name!==!1&&O(e,"The 'name' field is missing in your package.json. Please provide a valid package name."),t?.packageJson?.files!==!1&&(s.files===void 0?O(e,"The 'files' field is missing in your package.json. Add the files to be included in the package."):s.files.length===0?O(e,"The 'files' field in your package.json is empty. Please specify the files to be included in the package."):s.files.some(r=>r.includes(e.options.outDir))||O(e,`The 'files' field in your package.json is missing the '${e.options.outDir}' directory. Ensure the output directory is included.`));const o=s.type==="commonjs"||s.type===void 0,n=s.type==="module";if(o?(t?.packageJson?.main!==!1&&(s.main===void 0&&O(e,"The 'main' field is missing in your package.json. This field should point to your main entry file."),s.main?.includes(".mjs")&&O(e,"The 'main' field in your package.json should not use a '.mjs' extension for CommonJS modules.")),t?.packageJson?.module!==!1&&(s.module===void 0&&e.options.emitESM&&O(e,"The 'module' field is missing in your package.json, but you are emitting ES modules."),s.module&&s.main&&s.module===s.main&&O(e,`Conflict detected: The 'module' and 'main' fields both point to '${s.module}'. Please ensure they refer to different module types.`),e.options.emitESM&&s.module?.includes(".cjs")&&O(e,"The 'module' field in your package.json should not use a '.cjs' extension for ES modules."))):n&&(s.exports===void 0&&!e.options.emitCJS?t?.packageJson?.exports!==!1&&O(e,"The 'exports' field is missing in your package.json. Define module exports explicitly."):e.options.emitCJS&&(t?.packageJson?.main!==!1&&s.main===void 0&&O(e,"The 'main' field is missing in your package.json. This field is needed when emitting CommonJS modules."),t?.packageJson?.module!==!1&&(s.module===void 0&&O(e,"The 'module' field is missing in your package.json. This field is necessary when emitting ES modules."),s.module?.includes(".cjs")&&O(e,"The 'module' field should not use a '.cjs' extension for ES modules."),s.module&&s.main&&s.module===s.main&&O(e,`Conflict detected: The 'module' and 'main' fields both point to '${s.module}'. Please ensure they refer to different module types.`)),t?.packageJson?.exports!==!1&&s.exports===void 0&&O(e,"The 'exports' field is missing in your package.json. This field is required for defining explicit exports."))),s.exports,t?.packageJson?.bin!==!1){if(typeof s.bin=="string"&&s.bin.includes(o?".mjs":".cjs"))O(e,`The 'bin' field in your package.json should not use a ${o?".mjs":".cjs"} extension for ${o?"CommonJS":"ES modules"} binaries.`);else if(typeof s.bin=="object")for(const[r,i]of Object.entries(s.bin))i&&i.includes(o?".mjs":".cjs")&&O(e,`The 'bin.${r}' field in your package.json should not use a ${o?".mjs":".cjs"} extension for ${o?"CommonJS":"ES modules"} binaries.`)}if(e.options.declaration){let r=!0;s.type==="module"&&(r=!!s.main?.endsWith(".cjs")),s.types===void 0&&s.typings===void 0&&r&&t?.packageJson?.types!==!1&&O(e,"The 'types' field is missing in your package.json. This field should point to your type definitions file."),(e.options.declaration===!0||e.options.declaration==="compatible")&&r&&t?.packageJson?.typesVersions!==!1&&(s.typesVersions===void 0||Object.keys(s.typesVersions).length===0)&&O(e,"No 'typesVersions' field found in your package.json. Consider adding this field, or change the declaration option to 'node16' or 'false'.")}},"validatePackageFields");var wl=Object.defineProperty,$l=f((e,t)=>wl(e,"name",{value:t,configurable:!0}),"i");const xl=$l(e=>{const{packageJson:t}=zs(e.options.rootDir);e.pkg=t,ul(e),bl(e),hl(e)},"validator");var jl=Object.defineProperty,kl=f((e,t)=>jl(e,"name",{value:t,configurable:!0}),"a");const El=/^[^a-z_@#~]|[^\w/@#~-]|@\/|#\/|~\//i,Sl=new Set(["abstract","await","boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","let","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with","yield"]),Vt=kl(e=>{if(!Array.isArray(e)&&e!==null)for(const[t,s]of Object.entries(e)){if(typeof t!="string"||t.trim()==="")throw new Error(`Alias name "${t}" is invalid. Alias names should be non-empty strings.`);if(El.test(t))throw new Error(`Alias name "${t}" is invalid. Alias names should start with a letter or underscore and only contain letters, numbers, underscores, and dashes.`);if(Sl.has(t))throw new Error(`Alias name "${t}" is a reserved keyword and cannot be used.`);const o=j(s);if(!R(o))throw new Error(`Target path "${o}" for alias "${t}" does not exist.`)}},"validateAliasEntries");var Ol=Object.defineProperty,A=f((e,t)=>Ol(e,"name",{value:t,configurable:!0}),"u$1");const Dl=A(e=>{switch(e){case"preserve":case"react-native":return"preserve";case"react":return"transform";case"react-jsx":case"react-jsxdev":return"automatic";default:return}},"resolveTsconfigJsxToJsxRuntime"),Cl=A((e,t,s,o,n,r,i,l,c)=>{const a=Dl(c?.config.compilerOptions?.jsx),p=ho(r,n,i,{alias:{},browserTargets:go(),cjsInterop:!1,clean:!0,debug:o,declaration:void 0,emitCJS:void 0,emitESM:void 0,entries:[],externals:[...mt.builtinModules,...mt.builtinModules.map(d=>`node:${d}`)],failOnWarn:!0,fileCache:!0,jiti:{alias:{},debug:o,interopDefault:!0},minify:s===K,name:(l.name??"").split("/").pop()??"default",outDir:c?.config.compilerOptions?.outDir??"dist",rollup:{alias:{},cjsInterop:{addDefaultProperty:!1},commonjs:{extensions:[".mjs",".js",".json",".node",".cjs"],ignoreTryCatch:!0,preserveSymlinks:!0,transformMixedEsModules:!1},css:{autoModules:!0,extensions:[".css",".pcss",".postcss",".sss"],namedExports:!0},dts:{compilerOptions:{baseUrl:c?.config.compilerOptions?.baseUrl??".",checkJs:!1,composite:!1,declaration:!0,declarationMap:!1,emitDeclarationOnly:!0,incremental:!1,moduleResolution:100,noEmit:!1,noEmitOnError:!0,preserveSymlinks:!1,skipLibCheck:!0,target:99},respectExternal:!0},dynamicVars:{errorWhenNoFilesFound:!0,include:/\bimport\s*[(/]/},esbuild:{charset:"utf8",exclude:le,jsx:a,jsxDev:c?.config.compilerOptions?.jsx==="react-jsxdev",jsxFactory:c?.config.compilerOptions?.jsxFactory,jsxFragment:c?.config.compilerOptions?.jsxFragmentFactory,jsxImportSource:c?.config.compilerOptions?.jsxImportSource,jsxSideEffects:!0,keepNames:!0,sourcesContent:!1,target:c?.config.compilerOptions?.target,treeShaking:!0,tsconfigRaw:c?.config},isolatedDeclarations:{exclude:le,ignoreErrors:!1,include:fe},json:{preferConst:!0},license:{dependenciesTemplate:A((d,u,m)=>`
129
+ ${[...e.warnings].map(i=>`- ${i}`).join(`
130
+ `)}`),e.options.failOnWarn))throw new Error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`.")},"logBuildErrors");var Pl=Object.defineProperty,Qi=u((e,t)=>Pl(e,"name",{value:t,configurable:!0}),"r$2");const Gt=Qi(async(e,t)=>{if(typeof e.name!="string"){let i=Je(e.input)?N(t.options.rootDir,e.input):J(e.input);i.startsWith("./")&&(i=i.slice(2)),e.name=i.replace(new RegExp(`^${t.options.sourceDir}/`),"").replace(le,"")}if(!e.input)throw new Error(`Missing entry input: ${JSON.stringify(e)}`);ri(e.input)&&(e.input=j(t.options.rootDir,e.input)),t.options.declaration&&e.declaration===void 0&&(e.declaration=t.options.declaration),e.executable&&(e.cjs===void 0||e.esm===void 0)?t.pkg.type==="commonjs"&&e.cjs===void 0&&t.options.emitCJS!==void 0?(e.cjs=t.options.emitCJS,e.esm=!1):t.pkg.type==="module"&&e.esm===void 0&&t.options.emitESM!==void 0&&(e.esm=t.options.emitESM,e.cjs=!1):e.cjs===void 0&&e.esm===void 0&&(t.options.emitCJS!==void 0&&(e.cjs=t.options.emitCJS),t.options.emitESM!==void 0&&(e.esm=t.options.emitESM)),e.outDir=j(t.options.rootDir,e.outDir??t.options.outDir)},"extendEntry"),Nl=Qi(async e=>{e.options.entries=e.options.entries.map(t=>typeof t=="string"?{input:t,isGlob:$t(t)}:{...t,exportKey:t.exportKey??new Set,isGlob:$t(t.input)});for(const t of e.options.entries.filter(i=>i.isGlob)){const{isGlob:i,...o}=t,n=["**/.git/**","**/node_modules/**","**/test-results/**"];if(e.options.rollup.watch){if(typeof e.options.rollup.watch.exclude=="string")n.push(e.options.rollup.watch.exclude);else if(Array.isArray(e.options.rollup.watch.exclude))for(const s of e.options.rollup.watch.exclude)typeof s=="string"&&n.push(s)}const a=Wo([o.input],{cwd:e.options.rootDir,dot:!1,ignore:n,onlyFiles:!0});if(a.length===0)throw new sn("No files found in the glob pattern: "+D(k(e.options.rootDir,o.input)));for(const s of a)e.options.entries.push({...o,input:j(e.options.rootDir,s)});e.options.entries.splice(e.options.entries.indexOf(t),1)}for(const t of e.options.entries.filter(i=>i.fileAlias===void 0))await Gt(t,e);for(const t of e.options.entries.filter(i=>i.fileAlias!==void 0))t.name=t.fileAlias,t.fileAlias=void 0,await Gt(t,e)},"prepareEntries");var _l=Object.defineProperty,Il=u((e,t)=>_l(e,"name",{value:t,configurable:!0}),"a$3");const Ml=Il(async(e,t,i)=>{if(e&&await Fe(k(e,"keystore.json"))){const o=await uo(k(e,"keystore.json"));let n=await Do(e,{withFileTypes:!0});n=n.filter(s=>s.isDirectory());let a=i;for(const s of n)if(!o[s.name]){try{await Co(k(e,s.name),{force:!0,recursive:!0})}catch(l){t.error({message:`Failed to remove cache directory ${s.name}: ${l instanceof Error?l.message:String(l)}`,prefix:"file-cache"});continue}a&&t.raw(`
131
+
132
+ `),t.info({message:"Removing "+s.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),a=!1}}},"removeOldCacheFolders");var Tl=Object.defineProperty,Al=u((e,t)=>Tl(e,"name",{value:t,configurable:!0}),"o$1");const zl=Al(e=>{if(e.options.validation?.packageJson?.dependencies===!1)return;const t=new Set,i=new Set(Object.keys(e.pkg?.dependencies??{})),o=new Set;for(const n of e.usedImports)i.delete(n),t.add(n);if(e.pkg?.dependencies)for(const n of Object.keys(e.pkg?.dependencies))i.delete(n);for(const n of t){const a=fi(n);!nt(e.options.externals,n)&&!n.startsWith("chunks/")&&e.pkg?.dependencies?.[a]===void 0&&e.pkg?.peerDependencies?.[a]===void 0&&o.add(n)}i.size>0&&O(e,`Potential unused dependencies found: ${[...i].map(n=>D(n)).join(", ")}`),o.size>0&&O(e,`Potential implicit dependencies found: ${[...o].map(n=>D(n)).join(", ")}`)},"validateDependencies");var Fl=Object.defineProperty,Zi=u((e,t)=>Fl(e,"name",{value:t,configurable:!0}),"i$1");const Rl=Zi((e,t)=>rn(e,t)<=e.length/3||t.includes(e),"isSimilar"),Ll=Zi((e,t)=>{const i=e.toLowerCase();return t.filter(o=>Rl(o.toLowerCase(),i))},"findAlternatives");var Jl=Object.defineProperty,Ht=u((e,t)=>Jl(e,"name",{value:t,configurable:!0}),"r$1");const ql=Ht(e=>{const{options:t}=e;if(t.validation?.packageJson?.exports===!1)return;const i=t.validation?.packageJson,o=new Set([t.declaration&&i?.types?e.pkg.types:"",t.declaration&&i?.types?e.pkg.typings:"",...t.dtsOnly||i?.bin===!1?[""]:typeof e.pkg.bin=="string"?[e.pkg.bin]:Object.values(e.pkg.bin??{}),t.dtsOnly&&i?.main===!1?"":e.pkg.main,t.dtsOnly&&i?.module===!1?"":e.pkg.module,...i?.exports===!1?[]:ht(e.pkg.exports,e.pkg.type==="module"?"esm":"cjs",t.declaration).map(l=>t.dtsOnly?l.subKey==="types"?l.file:void 0:l.file)].filter(Boolean).map(l=>l&&j(t.rootDir,l.replace(/\/[^*/]*\*[^\n\r/\u2028\u2029]*(?:[\n\r\u2028\u2029][^*/]*\*[^\n\r/\u2028\u2029]*)*(?:\/.*)?$/,"")))),n=[];for(const l of o)l&&!l.includes("*")&&!oi(l)&&n.push(l.replace(`${t.rootDir}/`,""));const a=Ht(l=>N(t.rootDir,j(t.outDir,l)),"rPath"),s=e.buildEntries.filter(l=>!l.chunk).map(l=>a(l.path));if(n.length>0){let l="Potential missing or wrong package.json files:";for(const p of n){const r=Ll(p,s);l+=`
133
+ - `+D(p)+(r.length>0?ho` (did you mean ${r.map(c=>`"${c}"`).join(", ")}?)`:"")}O(e,l)}},"validatePackageEntries");var Bl=Object.defineProperty,Wl=u((e,t)=>Bl(e,"name",{value:t,configurable:!0}),"l$1");const Vl=Wl(e=>{const{options:{validation:t},pkg:i}=e;i.name===void 0&&t?.packageJson?.name!==!1&&O(e,"The 'name' field is missing in your package.json. Please provide a valid package name."),t?.packageJson?.files!==!1&&(i.files===void 0?O(e,"The 'files' field is missing in your package.json. Add the files to be included in the package."):i.files.length===0?O(e,"The 'files' field in your package.json is empty. Please specify the files to be included in the package."):i.files.some(a=>a.includes(e.options.outDir))||O(e,`The 'files' field in your package.json is missing the '${e.options.outDir}' directory. Ensure the output directory is included.`));const o=i.type==="commonjs"||i.type===void 0,n=i.type==="module";if(o?(t?.packageJson?.main!==!1&&(i.main===void 0&&O(e,"The 'main' field is missing in your package.json. This field should point to your main entry file."),i.main?.includes(".mjs")&&O(e,"The 'main' field in your package.json should not use a '.mjs' extension for CommonJS modules.")),t?.packageJson?.module!==!1&&(i.module===void 0&&e.options.emitESM&&O(e,"The 'module' field is missing in your package.json, but you are emitting ES modules."),i.module&&i.main&&i.module===i.main&&O(e,`Conflict detected: The 'module' and 'main' fields both point to '${i.module}'. Please ensure they refer to different module types.`),e.options.emitESM&&i.module?.includes(".cjs")&&O(e,"The 'module' field in your package.json should not use a '.cjs' extension for ES modules."))):n&&(i.exports===void 0&&!e.options.emitCJS?t?.packageJson?.exports!==!1&&O(e,"The 'exports' field is missing in your package.json. Define module exports explicitly."):e.options.emitCJS&&(t?.packageJson?.main!==!1&&i.main===void 0&&O(e,"The 'main' field is missing in your package.json. This field is needed when emitting CommonJS modules."),t?.packageJson?.module!==!1&&(i.module===void 0&&O(e,"The 'module' field is missing in your package.json. This field is necessary when emitting ES modules."),i.module?.includes(".cjs")&&O(e,"The 'module' field should not use a '.cjs' extension for ES modules."),i.module&&i.main&&i.module===i.main&&O(e,`Conflict detected: The 'module' and 'main' fields both point to '${i.module}'. Please ensure they refer to different module types.`)),t?.packageJson?.exports!==!1&&i.exports===void 0&&O(e,"The 'exports' field is missing in your package.json. This field is required for defining explicit exports."))),i.exports,t?.packageJson?.bin!==!1){if(typeof i.bin=="string"&&i.bin.includes(o?".mjs":".cjs"))O(e,`The 'bin' field in your package.json should not use a ${o?".mjs":".cjs"} extension for ${o?"CommonJS":"ES modules"} binaries.`);else if(typeof i.bin=="object")for(const[a,s]of Object.entries(i.bin))s&&s.includes(o?".mjs":".cjs")&&O(e,`The 'bin.${a}' field in your package.json should not use a ${o?".mjs":".cjs"} extension for ${o?"CommonJS":"ES modules"} binaries.`)}if(e.options.declaration){let a=!0;i.type==="module"&&(a=!!i.main?.endsWith(".cjs")),i.types===void 0&&i.typings===void 0&&a&&t?.packageJson?.types!==!1&&O(e,"The 'types' field is missing in your package.json. This field should point to your type definitions file."),(e.options.declaration===!0||e.options.declaration==="compatible")&&a&&t?.packageJson?.typesVersions!==!1&&(i.typesVersions===void 0||Object.keys(i.typesVersions).length===0)&&O(e,"No 'typesVersions' field found in your package.json. Consider adding this field, or change the declaration option to 'node16' or 'false'.")}},"validatePackageFields");var Ul=Object.defineProperty,Kl=u((e,t)=>Ul(e,"name",{value:t,configurable:!0}),"i");const Gl=Kl(e=>{const{packageJson:t}=Xi(e.options.rootDir);e.pkg=t,zl(e),Vl(e),ql(e)},"validator");var Hl=Object.defineProperty,Yl=u((e,t)=>Hl(e,"name",{value:t,configurable:!0}),"a");const Xl=/^[^a-z_@#~]|[^\w/@#~-]|@\/|#\/|~\//i,Ql=new Set(["abstract","await","boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","let","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with","yield"]),Yt=Yl(e=>{if(!Array.isArray(e)&&e!==null)for(const[t,i]of Object.entries(e)){if(typeof t!="string"||t.trim()==="")throw new Error(`Alias name "${t}" is invalid. Alias names should be non-empty strings.`);if(Xl.test(t))throw new Error(`Alias name "${t}" is invalid. Alias names should start with a letter or underscore and only contain letters, numbers, underscores, and dashes.`);if(Ql.has(t))throw new Error(`Alias name "${t}" is a reserved keyword and cannot be used.`);const o=j(i);if(!R(o))throw new Error(`Target path "${o}" for alias "${t}" does not exist.`)}},"validateAliasEntries");var Zl=Object.defineProperty,q=u((e,t)=>Zl(e,"name",{value:t,configurable:!0}),"c");const ep=q(e=>{switch(e){case"preserve":case"react-native":return"preserve";case"react":return"transform";case"react-jsx":case"react-jsxdev":return"automatic";default:return}},"resolveTsconfigJsxToJsxRuntime"),tp=q((e,t,i,o,n,a,s,l,p)=>{const r=ep(p?.config.compilerOptions?.jsx),c=ko(a,n,s,{alias:{},browserTargets:wo(),cjsInterop:!1,clean:!0,debug:o,declaration:void 0,emitCJS:void 0,emitESM:void 0,entries:[],externals:[...wt.builtinModules,...wt.builtinModules.map(m=>`node:${m}`)],failOnWarn:!0,fileCache:!0,jiti:{alias:{},debug:o,interopDefault:!0},minify:i===G,name:(l.name??"").split("/").pop()??"default",outDir:p?.config.compilerOptions?.outDir??"dist",rollup:{alias:{},cjsInterop:{addDefaultProperty:!1},commonjs:{extensions:[".mjs",".js",".json",".node",".cjs"],ignoreTryCatch:!0,preserveSymlinks:!0,transformMixedEsModules:!1},css:{autoModules:!0,extensions:[".css",".pcss",".postcss",".sss"],namedExports:!0},dts:{compilerOptions:{baseUrl:p?.config.compilerOptions?.baseUrl??".",checkJs:!1,composite:!1,declaration:!0,declarationMap:!1,emitDeclarationOnly:!0,incremental:!1,moduleResolution:100,noEmit:!1,noEmitOnError:!0,preserveSymlinks:!1,skipLibCheck:!0,target:99},respectExternal:!0},dynamicVars:{errorWhenNoFilesFound:!0,exclude:Q,include:/\bimport\s*[(/]/},esbuild:{charset:"utf8",exclude:Q,jsx:r,jsxDev:p?.config.compilerOptions?.jsx==="react-jsxdev",jsxFactory:p?.config.compilerOptions?.jsxFactory,jsxFragment:p?.config.compilerOptions?.jsxFragmentFactory,jsxImportSource:p?.config.compilerOptions?.jsxImportSource,jsxSideEffects:!0,keepNames:!0,sourcesContent:!1,target:p?.config.compilerOptions?.target,treeShaking:!0,tsconfigRaw:p?.config},isolatedDeclarations:{exclude:Q,ignoreErrors:!1,include:ve},json:{preferConst:!0},license:{dependenciesTemplate:q((m,d,f)=>`
132
134
  # Licenses of bundled dependencies
133
- The published ${m} artifact additionally contains code with the following licenses:
134
- `+(d.length>0?`${d.join(", ")}
135
+ The published ${f} artifact additionally contains code with the following licenses:
136
+ `+(m.length>0?`${m.join(", ")}
135
137
 
136
138
  `:`
137
139
  `)+`# Bundled dependencies:
138
- `+u,"dependenciesTemplate"),dtsTemplate:A((d,u,m)=>`
140
+ `+d,"dependenciesTemplate"),dtsTemplate:q((m,d,f)=>`
139
141
  # Licenses of bundled types
140
- The published ${m} artifact additionally contains code with the following licenses:
141
- `+(d.length>0?`${d.join(", ")}
142
+ The published ${f} artifact additionally contains code with the following licenses:
143
+ `+(m.length>0?`${m.join(", ")}
142
144
 
143
145
  `:`
144
146
  `)+`# Bundled types:
145
- `+u,"dtsTemplate")},node10Compatibility:{},patchTypes:{},polyfillNode:{},preserveDirectives:{exclude:le,include:fe},preserveDynamicImports:!0,raw:{exclude:le,include:[/\.(md|txt|htm|html|data)$/]},replace:{objectGuards:!0,preventAssignment:!0},resolve:{allowExportsFolderMapping:!1,exportConditions:["module-sync"],extensions:at,preferBuiltins:!1},shebang:{replace:!1,shebang:"#!/usr/bin/env node"},shim:{exclude:le,include:fe},sucrase:{disableESTransforms:!0,enableLegacyBabel5ModuleInterop:!1,enableLegacyTypeScriptModuleInterop:c?.config.compilerOptions?.esModuleInterop===!1,include:fe,injectCreateRequireForImportRequire:!1,preserveDynamicImport:!0,production:s===K,...c?.config.compilerOptions?.jsx&&["react","react-jsx","react-jsxdev"].includes(c.config.compilerOptions.jsx)?{jsxFragmentPragma:c.config.compilerOptions.jsxFragmentFactory,jsxImportSource:c.config.compilerOptions.jsxImportSource,jsxPragma:c.config.compilerOptions.jsxFactory,jsxRuntime:a,transforms:["typescript","jsx",...c.config.compilerOptions.esModuleInterop?["imports"]:[]]}:{transforms:["typescript",...c?.config.compilerOptions?.esModuleInterop?["imports"]:[]]}},swc:{include:fe,inlineSourcesContent:!1,inputSourceMap:!1,isModule:!0,jsc:{experimental:{keepImportAttributes:!0},externalHelpers:!1,keepClassNames:!0,loose:!0,parser:{decorators:c?.config.compilerOptions?.experimentalDecorators,syntax:c?"typescript":"ecmascript",[c?"tsx":"jsx"]:!0},target:c?.config.compilerOptions?.target?.toLowerCase(),transform:{decoratorMetadata:c?.config.compilerOptions?.emitDecoratorMetadata,decoratorVersion:"2022-03",legacyDecorator:c?.config.compilerOptions?.experimentalDecorators,react:{development:s!==K,pragma:c?.config.compilerOptions?.jsxFactory,pragmaFrag:c?.config.compilerOptions?.jsxFragmentFactory,runtime:a,throwIfNamespace:!0},treatConstEnumAsEnum:c?.config.compilerOptions?.preserveConstEnums,useDefineForClassFields:c?.config.compilerOptions?.useDefineForClassFields}},module:{ignoreDynamic:!0,importInterop:"none",preserveImportMeta:!0,strict:!1,strictMode:!1,type:"es6"}},treeshake:{moduleSideEffects:Ya(t,l),preset:"recommended",propertyReadSideEffects:!0},visualizer:{},watch:{chokidar:{ignoreInitial:!0,ignorePermissionErrors:!0},clearScreen:!0,exclude:le}},rootDir:t,sourceDir:"src",sourcemap:!1,transformerName:void 0,typedoc:{excludePrivate:!0,groupOrder:["Classes","Constructors","Accessors","Methods","Functions","Namespaces","Variables","Enumerations","Interfaces","Type Aliases","*"],kindSortOrder:["Project","Module","Class","Interface","Function","Namespace","Variable","Enum","EnumMember","TypeAlias","Reference","Constructor","Property","Accessor","Method","Parameter","TypeParameter","TypeLiteral","CallSignature","ConstructorSignature","IndexSignature","GetSignature","SetSignature"],marker:"TYPEDOC",name:l.name??"unknown",pretty:!0,readme:"none",showConfig:o,tsconfig:c?.path}});if(!p.transformerName){const d=new Map([...Object.entries(l.dependencies??{}),...Object.entries(l.devDependencies??{})]);let u="0.0.0";if(d.has("esbuild"))p.transformerName="esbuild",u=d.get("esbuild");else if(d.has("@swc/core"))p.transformerName="swc",u=d.get("@swc/core");else if(d.has("sucrase"))p.transformerName="sucrase",u=d.get("sucrase");else throw new Error("Unknown transformer, check your transformer options or install one of the supported transformers: esbuild, swc, sucrase");e.info("Using "+D("rollup ")+vo),e.info({message:"Using "+D(p.transformerName)+" "+u,prefix:"transformer"})}return p.rollup.resolve&&p.rollup.resolve.preferBuiltins===!0&&(p.rollup.polyfillNode=!1,e.debug("Disabling polyfillNode because preferBuiltins is set to true")),p.browserTargets&&p.browserTargets.length>0&&e.debug("Using browser targets: "+p.browserTargets.join(", ")),l.dependencies&&p.externals.push(...Object.keys(l.dependencies)),l.peerDependencies&&p.externals.push(...Object.keys(l.peerDependencies)),l.optionalDependencies&&p.externals.push(...Object.keys(l.optionalDependencies)),Vt(p.alias),p.rollup.alias&&p.rollup.alias.entries&&Vt(p.rollup.alias.entries),p},"generateOptions"),Pl=A(async(e,t,s,o,n,r,i,l,c,a)=>{const p=await _a(i.preset??r.preset??"auto",a),d=Cl(e,t,o,n,r,i,p,l,c);no(x(d.rootDir,d.outDir));const u={buildEntries:[],dependencyGraphMap:new Map,environment:o,hooks:yo(),jiti:Xt(d.rootDir,d.jiti),logger:e,mode:s,options:d,pkg:l,tsconfig:c,usedImports:new Set,warnings:new Set};p.hooks&&u.hooks.addHooks(p.hooks),r.hooks&&u.hooks.addHooks(r.hooks),i.hooks&&u.hooks.addHooks(i.hooks),await u.hooks.callHook("build:prepare",u),u.options.emitESM===void 0&&u.logger.info("Emitting of ESM bundles, is disabled."),u.options.emitCJS===void 0&&u.logger.info("Emitting of CJS bundles, is disabled."),u.options.minify&&u.logger.info("Minification is enabled, the output will be minified");const m=l.dependencies?.typescript!==void 0||l.devDependencies?.typescript!==void 0;if(u.options.declaration&&u.tsconfig===void 0&&m)throw new Error("Cannot build declaration files without a tsconfig.json");return m?u.options.declaration===!1&&u.logger.info({message:"Generation of declaration files are disabled.",prefix:"dts"}):(u.options.declaration=!1,u.logger.info({message:"Typescript is not installed. Generation of declaration files are disabled.",prefix:"dts"})),u.options.declaration&&u.logger.info("Using typescript version: "+D(l.devDependencies?.typescript??l.dependencies?.typescript??"unknown")),u.options.declaration&&(l.dependencies?.typescript||l.devDependencies?.typescript)&&!u.tsconfig?.config.compilerOptions?.isolatedModules&&u.logger.warn(`'compilerOptions.isolatedModules' is not enabled in tsconfig.
147
+ `+d,"dtsTemplate")},node10Compatibility:{},patchTypes:{},polyfillNode:{},preserveDirectives:{exclude:Q,include:ve},preserveDynamicImports:!0,raw:{exclude:Q,include:[/\.(md|txt|htm|html|data)$/]},replace:{objectGuards:!0,preventAssignment:!0},resolve:{allowExportsFolderMapping:!1,exportConditions:["module-sync"],extensions:mt,preferBuiltins:!1},shebang:{replace:!1,shebang:"#!/usr/bin/env node"},shim:{exclude:Q,include:ve},sucrase:{disableESTransforms:!0,enableLegacyBabel5ModuleInterop:!1,enableLegacyTypeScriptModuleInterop:p?.config.compilerOptions?.esModuleInterop===!1,include:ve,injectCreateRequireForImportRequire:!1,preserveDynamicImport:!0,production:i===G,...p?.config.compilerOptions?.jsx&&["react","react-jsx","react-jsxdev"].includes(p.config.compilerOptions.jsx)?{jsxFragmentPragma:p.config.compilerOptions.jsxFragmentFactory,jsxImportSource:p.config.compilerOptions.jsxImportSource,jsxPragma:p.config.compilerOptions.jsxFactory,jsxRuntime:r,transforms:["typescript","jsx",...p.config.compilerOptions.esModuleInterop?["imports"]:[]]}:{transforms:["typescript",...p?.config.compilerOptions?.esModuleInterop?["imports"]:[]]}},swc:{include:ve,inlineSourcesContent:!1,inputSourceMap:!1,isModule:!0,jsc:{experimental:{keepImportAttributes:!0},externalHelpers:!1,keepClassNames:!0,loose:!0,parser:{decorators:p?.config.compilerOptions?.experimentalDecorators,syntax:p?"typescript":"ecmascript",[p?"tsx":"jsx"]:!0},target:p?.config.compilerOptions?.target?.toLowerCase(),transform:{decoratorMetadata:p?.config.compilerOptions?.emitDecoratorMetadata,decoratorVersion:"2022-03",legacyDecorator:p?.config.compilerOptions?.experimentalDecorators,react:{development:i!==G,pragma:p?.config.compilerOptions?.jsxFactory,pragmaFrag:p?.config.compilerOptions?.jsxFragmentFactory,runtime:r,throwIfNamespace:!0},treatConstEnumAsEnum:p?.config.compilerOptions?.preserveConstEnums,useDefineForClassFields:p?.config.compilerOptions?.useDefineForClassFields}},module:{ignoreDynamic:!0,importInterop:"none",preserveImportMeta:!0,strict:!1,strictMode:!1,type:"es6"}},treeshake:{moduleSideEffects:yl(t,l),preset:"recommended",propertyReadSideEffects:!0},url:{emitFiles:!0,exclude:Q,fileName:"[hash][extname]",include:["**/*.svg","**/*.png","**/*.jp(e)?g","**/*.gif","**/*.webp"],limit:14*1024},visualizer:{},watch:{chokidar:{ignoreInitial:!0,ignorePermissionErrors:!0},clearScreen:!0,exclude:Q}},rootDir:t,sourceDir:"src",sourcemap:!1,transformerName:void 0,typedoc:{excludePrivate:!0,groupOrder:["Classes","Constructors","Accessors","Methods","Functions","Namespaces","Variables","Enumerations","Interfaces","Type Aliases","*"],kindSortOrder:["Project","Module","Class","Interface","Function","Namespace","Variable","Enum","EnumMember","TypeAlias","Reference","Constructor","Property","Accessor","Method","Parameter","TypeParameter","TypeLiteral","CallSignature","ConstructorSignature","IndexSignature","GetSignature","SetSignature"],marker:"TYPEDOC",name:l.name??"unknown",pretty:!0,readme:"none",showConfig:o,tsconfig:p?.path}});if(!c.transformerName){const m=new Map([...Object.entries(l.dependencies??{}),...Object.entries(l.devDependencies??{})]);let d="0.0.0";if(m.has("esbuild"))c.transformerName="esbuild",d=m.get("esbuild");else if(m.has("@swc/core"))c.transformerName="swc",d=m.get("@swc/core");else if(m.has("sucrase"))c.transformerName="sucrase",d=m.get("sucrase");else throw new Error("Unknown transformer, check your transformer options or install one of the supported transformers: esbuild, swc, sucrase");e.info("Using "+D("rollup ")+$o),e.info({message:"Using "+D(c.transformerName)+" "+d,prefix:"transformer"})}return c.rollup.resolve&&c.rollup.resolve.preferBuiltins===!0&&(c.rollup.polyfillNode=!1,e.debug("Disabling polyfillNode because preferBuiltins is set to true")),c.browserTargets&&c.browserTargets.length>0&&e.debug("Using browser targets: "+c.browserTargets.join(", ")),l.dependencies&&c.externals.push(...Object.keys(l.dependencies)),l.peerDependencies&&c.externals.push(...Object.keys(l.peerDependencies)),l.optionalDependencies&&c.externals.push(...Object.keys(l.optionalDependencies)),Yt(c.alias),c.rollup.alias&&c.rollup.alias.entries&&Yt(c.rollup.alias.entries),c},"generateOptions"),ip=q(async(e,t,i,o,n,a,s,l,p,r)=>{const c=await Zr(s.preset??a.preset??"auto",r),m=tp(e,t,o,n,a,s,c,l,p);fo(k(m.rootDir,m.outDir));const d={buildEntries:[],dependencyGraphMap:new Map,environment:o,hooks:jo(),jiti:ti(m.rootDir,m.jiti),logger:e,mode:i,options:m,pkg:l,tsconfig:p,usedImports:new Set,warnings:new Set};c.hooks&&d.hooks.addHooks(c.hooks),a.hooks&&d.hooks.addHooks(a.hooks),s.hooks&&d.hooks.addHooks(s.hooks),await d.hooks.callHook("build:prepare",d),d.options.emitESM===void 0&&d.logger.info("Emitting of ESM bundles, is disabled."),d.options.emitCJS===void 0&&d.logger.info("Emitting of CJS bundles, is disabled."),d.options.minify&&d.logger.info("Minification is enabled, the output will be minified");const f=l.dependencies?.typescript!==void 0||l.devDependencies?.typescript!==void 0;if(d.options.declaration&&d.tsconfig===void 0&&f)throw new Error("Cannot build declaration files without a tsconfig.json");return f?d.options.declaration===!1&&d.logger.info({message:"Generation of declaration files are disabled.",prefix:"dts"}):(d.options.declaration=!1,d.logger.info({message:"Typescript is not installed. Generation of declaration files are disabled.",prefix:"dts"})),d.options.declaration&&d.logger.info("Using typescript version: "+D(l.devDependencies?.typescript??l.dependencies?.typescript??"unknown")),d.options.declaration&&(l.dependencies?.typescript||l.devDependencies?.typescript)&&!d.tsconfig?.config.compilerOptions?.isolatedModules&&d.logger.warn(`'compilerOptions.isolatedModules' is not enabled in tsconfig.
146
148
  Because none of the third-party transpiler, packem uses under the hood is type-aware, some techniques or features often used in TypeScript are not properly checked and can cause mis-compilation or even runtime errors.
147
- To mitigate this, you should set the isolatedModules option to true in tsconfig and let your IDE warn you when such incompatible constructs are used.`),await ll(u),u},"createContext"),Nl=A(async e=>{const t=[];if(e.options.clean)for(const s of new Set(e.options.entries.map(o=>o.outDir).filter(Boolean).sort()))s===e.options.rootDir||s===e.options.sourceDir||e.options.rootDir.startsWith(s.endsWith("/")?s:`${s}/`)||t.some(o=>s.startsWith(o))||(t.push(s),e.logger.info(`Cleaning dist directory: \`./${I(e.options.rootDir,s)}\``),await ro(s))},"cleanDistributionDirectories"),Il=A(async(e,t,s)=>{if(e&&R(x(e,"keystore1.json"))){const o=it(x(e,"keystore.json")),n=Gt(e,{withFileTypes:!0}).filter(i=>i.isDirectory());let r=s;for(const i of n)o[i.name]||(await ao(x(e,i.name),{force:!0,recursive:!0}),r&&t.raw(`
148
-
149
- `),t.info({message:"Removing "+i.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),r=!1)}},"removeOldCacheFolders"),_l=A(e=>{switch(e){case"jit":return"Stubbing";case"watch":return"Watching";case"tsdoc":return"Generating TSDoc";default:return"Building"}},"getMode"),Ml=A(async(e,t,s,o,n={})=>{const{configPath:r,debug:i,tsconfigPath:l,...c}=n;o.wrapAll(),e=j(Ve.cwd(),e),o.debug("Root directory:",e);const{packageJson:a,packageJsonPath:p}=zs(e);o.debug("Using package.json found at",p);let d;if(l){const g=x(e,l);if(!await nt(g))throw new Error("tsconfig.json not found at "+g);d={config:fo(g),path:g},o.info("Using tsconfig settings at",g)}else if(a.dependencies?.typescript||a.devDependencies?.typescript)try{d=await mo(e),o.debug("Using tsconfig settings found at",d.path)}catch{o.info("No tsconfig.json or jsconfig.json found.")}const u=uo("@visulima/packem",{cwd:e});let m=!1,v,h;try{const g=await as(e,r??""),y=Xt(e,{debug:i});let w=await y.import(g,{default:!0,try:!0})||{};typeof w=="function"&&(w=await w(s,t)),o.debug("Using packem config found at",x(e,g));const $=Q(JSON.stringify({version:a.version,...a.dependencies,...a.devDependencies,...a.peerDependencies,...a.peerDependenciesMeta,browser:a.browser,eNode:a.engines?.node,exports:a.exports,main:a.main,module:a.module,type:a.type,types:a.types}))+Q(JSON.stringify(w));u&&za($,u,o);const E=new Ka(e,u,$,o),b=await Pl(o,e,t,s,i??!1,c,w,a,d,y);E.isEnabled=b.options.fileCache,b.logger.info(D(_l(t)+" "+b.options.name)),b.logger.debug({context:b.options.entries,message:`${q("Root dir:")} ${b.options.rootDir}
150
- ${q("Entries:")}`}),await Nl(b);const P=A(async L=>{for await(const[H,S]of Object.entries(b.options.builder??{})){b.logger.raw(`
151
- `),await b.hooks.callHook("builder:before",H,b);const C=Date.now(),k=A(()=>gt(Math.floor(Date.now()-C)),"getBuilderDuration");await S(b,u,E,m),await b.hooks.callHook("builder:done",H,b),b.logger.raw(`
152
- ⚡️ `+H+" run in "+k()),L&&b.logger.raw(`
149
+ To mitigate this, you should set the isolatedModules option to true in tsconfig and let your IDE warn you when such incompatible constructs are used.`),await Nl(d),d},"createContext"),op=q(e=>{switch(e){case"jit":return"Stubbing";case"watch":return"Watching";case"tsdoc":return"Generating TSDoc";default:return"Building"}},"getMode"),np=q(async(e,t,i,o,n={})=>{const{configPath:a,debug:s,tsconfigPath:l,...p}=n;o.wrapAll(),e=j(Ge.cwd(),e),o.debug("Root directory:",e);const{packageJson:r,packageJsonPath:c}=Xi(e);o.debug("Using package.json found at",c);let m;if(l){const g=k(e,l);if(!await Fe(g))throw new Error("tsconfig.json not found at "+g);m={config:yo(g),path:g},o.info("Using tsconfig settings at",g)}else if(r.dependencies?.typescript||r.devDependencies?.typescript)try{m=await bo(e),o.debug("Using tsconfig settings found at",m.path)}catch{o.info("No tsconfig.json or jsconfig.json found.")}const d=xo("@visulima/packem",{cwd:e});let f=!1,x,v;try{const g=await mi(e,a??""),h=ti(e,{debug:s});let y=await h.import(g,{default:!0,try:!0})||{};typeof y=="function"&&(y=await y(i,t)),o.debug("Using packem config found at",k(e,g));const w=ee(JSON.stringify({version:r.version,...r.dependencies,...r.devDependencies,...r.peerDependencies,...r.peerDependenciesMeta,browser:r.browser,eNode:r.engines?.node,exports:r.exports,main:r.main,module:r.module,type:r.type,types:r.types}))+ee(JSON.stringify(y));d&&ul(w,d,o);const E=new vl(e,d,w,o),b=await ip(o,e,t,i,s??!1,p,y,r,m,h);E.isEnabled=b.options.fileCache,b.logger.info(D(op(t)+" "+b.options.name)),b.logger.debug({context:b.options.entries,message:`${K("Root dir:")} ${b.options.rootDir}
150
+ ${K("Entries:")}`}),await cl(b);const P=q(async F=>{for await(const[Y,S]of Object.entries(b.options.builder??{})){b.logger.raw(`
151
+ `),await b.hooks.callHook("builder:before",Y,b);const C=Date.now(),$=q(()=>kt(Math.floor(Date.now()-C)),"getBuilderDuration");await S(b,d,E,f),await b.hooks.callHook("builder:done",Y,b),b.logger.raw(`
152
+ ⚡️ `+Y+" run in "+$()),F&&b.logger.raw(`
153
153
 
154
- `)}},"runBuilder"),_=A(async()=>{if(v!==void 0)await sl({pid:v.pid,signal:c.killSignal??w.killSignal??"SIGTERM"});else if(h!==void 0)try{await h()}catch(L){throw new Error("onSuccess function cleanup failed: "+L.message,{cause:L})}v=void 0,h=void 0},"doOnSuccessCleanup"),W=A(async()=>{if(typeof b.options.onSuccess=="function")try{h=await b.options.onSuccess()}catch(L){throw new Error("onSuccess function failed: "+L.message,{cause:L})}else if(typeof b.options.onSuccess=="string"){const L=b.options.onSuccessTimeout??3e4;if(v=bo(b.options.onSuccess,[],{nodeOptions:{shell:!0,stdio:"inherit",timeout:L}}),await v,v.exitCode&&v.exitCode!==0)throw new Error("onSuccess script failed with exit code "+v.exitCode+". Check the output above for details.")}},"runOnsuccess"),F=Date.now(),ie=A(()=>gt(Math.floor(Date.now()-F)),"getDuration");if(t==="watch"){if(b.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await Ba(b,E,P,W,_),Jt(b,!1);return}t==="jit"?(await Aa(b),await b.hooks.callHook("build:done",b)):(m=await ga(b,E),await b.hooks.callHook("validate:before",b),xl(b),await b.hooks.callHook("validate:done",b),Jt(b,m)),b.logger.raw(`
155
- ⚡️ Build run in `+ie()),await P(),await W(),Ve.on("SIGINT",async()=>{await _()}),Ve.on("SIGTERM",async()=>{await _()})}catch(g){throw o.raw(`
156
- `),Js(g),g}finally{o.restoreAll(),await Il(u,o,m)}},"packem");var Tl=Object.defineProperty,ke=f((e,t)=>Tl(e,"name",{value:t,configurable:!0}),"o");const Al=ke(e=>{e.addCommand({description:"Demonstrate options required",execute:ke(async({logger:t,options:s})=>{let o="build";s.watch?o="watch":s.jit&&(o="jit");const n={};let r;if(Se.NODE_ENV&&[ye,K].includes(Se.NODE_ENV)&&(r=Se.NODE_ENV),s.env)for(const i of s.env)if(i.key==="NODE_ENV"){if(r)throw new Error("NODE_ENV was already set, this can't be overridden.");r=i.value}else n["process.env."+i.key]=JSON.stringify(i.value);r===void 0&&(s.production?r=K:s.development&&(r=ye));try{await Ml(s.dir,o,r,t,{analyze:s.analyze,cjsInterop:s.cjsInterop,clean:s.clean,configPath:s.config??void 0,debug:s.debug,dtsOnly:s.dtsOnly,killSignal:s.killSignal,minify:s.minify===void 0?r===K:s.minify,onSuccess:s.onSuccess,rollup:{esbuild:{target:s.target},license:{path:s.license},metafile:s.metafile,replace:{values:n}},sourcemap:s.analyze||s.sourcemap,tsconfigPath:s.tsconfig??void 0,validation:s.validation===!1?{packageJson:{bin:!1,dependencies:!1,exports:!1,files:!1,main:!1,module:!1,name:!1,types:!1,typesVersions:!1}}:{},...s.typedoc?{typedoc:{format:"html"}}:{}})}catch(i){t.error(i),Qs(1)}},"execute"),name:"build",options:[{defaultValue:".",description:"The directory to build",name:"dir",type:String},{alias:"t",description:"Environments to support. `target` in tsconfig.json is automatically added. Defaults to the current Node.js version.",name:"target"},{description:"Use a custom config file",name:"config",type:String},{description:"Path to the tsconfig.json file",name:"tsconfig",type:String},{description:"Minify the output",name:"minify",type:Boolean},{description:"Generate sourcemaps (experimental)",name:"sourcemap",type:Boolean},{conflicts:"jit",description:"Watch for changes",name:"watch",type:Boolean},{conflicts:"watch",description:"Stub the package for JIT compilation",name:"jit",type:Boolean},{description:"Compile-time environment variables (eg. --env.NODE_ENV=production)",multiple:!0,name:"env",type:ke(t=>{const[s,o]=t.split("=");return{key:s,value:o}},"type")},{defaultValue:!1,description:"Generate meta file (experimental)",name:"metafile",type:Boolean},{description:"Path to the license file",name:"license",type:String},{conflicts:"watch",description:"Visualize and analyze the bundle",name:"analyze",type:Boolean},{description:"CJS interop mode, can export default and named export, (experimental).",name:"cjsInterop",type:Boolean},{conflicts:"development",description:"Run code in production environment",name:"production",type:Boolean},{conflicts:"production",description:"Run code in development environment",name:"development",type:Boolean},{description:"Do not clean the dist directory before building",name:"no-clean",type:Boolean},{description:"Only generate .d.ts files",name:"dts-only",type:Boolean},{description:"Enable or disable the output validation",name:"no-validation",type:Boolean},{description:"Generate type documentation",name:"typedoc",type:Boolean},{description:"Execute command after successful build, specially useful for watch mode",name:"onSuccess",type:String},{description:'Signal to kill child process, "SIGTERM" or "SIGKILL"',name:"killSignal",type:ke(t=>{if(t==="SIGTERM"||t==="SIGKILL")return t;throw new Error("Invalid kill signal. Use 'SIGTERM' or 'SIGKILL'.")},"type")}]})},"createBuildCommand");var Rl=Object.defineProperty,Ee=f((e,t)=>Rl(e,"name",{value:t,configurable:!0}),"m");const Fl=Ee(e=>{e.addCommand({description:"Initialize packem configuration",execute:Ee(async({logger:t,options:s})=>{if(Zs("Welcome to packem setup"),R(x(s.dir,"packem.config.ts"))){t.info("Packem project already initialized, you can use `packem build` to build your project");return}const o=j(zt(),s.dir??"."),n=x(o,"package.json");if(!R(n))throw new Error("No package.json found in the directory");const r=is(n),i=[];r.dependencies&&i.push(...Object.keys(r.dependencies)),r.devDependencies&&i.push(...Object.keys(r.devDependencies));const l=!!(r.devDependencies?.typescript??r.dependencies?.typescript),c=[];if(s.typescript===void 0&&!l?(s.typescript=await U({message:"Do you want to install TypeScript?"}),s.typescript&&c.push("typescript@latest")):ft.message("TypeScript version "+(r.devDependencies?.typescript??r.dependencies?.typescript)+" is already installed"),!R(x(o,"tsconfig.json"))){const h=await U({message:"Do you want to use generate a tsconfig.json?"}),g=await U({message:"Do you want to run your code in the DOM?"});if(h){const y=Qe();y.start("Generating tsconfig.json"),Te(x(o,"tsconfig.json"),{compilerOptions:{esModuleInterop:!0,skipLibCheck:!0,target:"es2022",allowJs:!0,resolveJsonModule:!0,moduleDetection:"force",isolatedModules:!0,verbatimModuleSyntax:!0,strict:!0,noUncheckedIndexedAccess:!0,noImplicitOverride:!0,module:"NodeNext",outDir:"dist",sourceMap:!0,declaration:!0,lib:g?["es2022","dom","dom.iterable"]:["es2022"]}}),y.stop("")}}if(i.includes("esbuild")?s.transformer="esbuild":i.includes("@swc/core")?s.transformer="swc":i.includes("sucrase")&&(s.transformer="sucrase"),s.transformer===void 0?(s.transformer=await Z({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"}]}),s.transformer&&!i.includes(s.transformer)&&await U({message:"Do you want to install "+s.transformer+"?"})&&c.push(s.transformer==="swc"?"@swc/core":s.transformer)):ft.message("Transformer "+s.transformer+" is already installed."),s.isolatedDeclarationTransformer===void 0&&(s.isolatedDeclarationTransformer=await U({message:"Do you want to use an isolated declaration types?",initialValue:!1})),s.isolatedDeclarationTransformer===void 0&&(s.isolatedDeclarationTransformer=await Z({message:"Pick a isolated declaration transformer",options:[{label:"Typescript",value:"typescript"},{label:"swc",value:"swc"},{label:"OXC",value:"oxc"},{label:"None",value:null}]}),s.isolatedDeclarationTransformer!==null)){let h;switch(s.isolatedDeclarationTransformer){case"typescript":{h="typescript";break}case"swc":{h="@swc/core";break}case"oxc":{h="oxc-transform";break}default:eo("Invalid isolated declaration transformer")}h!==void 0&&!i.includes(h)&&await U({message:"Do you want to install "+h+"?"})&&c.push(h)}s.css===void 0&&(s.css=await U({message:"Do you want to use css in your project?",initialValue:!1}));const a=[];if(s.css){const h=await Z({message:"Pick a css loader",options:[{label:"PostCSS",value:"postcss"},{label:"Lightning CSS",value:"lightningcss"}]});a.push(h);let g=await Ut({message:"Pick your loaders",options:[{label:"Sass",value:"sass"},{label:"Stylus",value:"stylus"},{label:"Less",value:"less"}],required:!1});if(g.includes("sass")){const y=await Z({message:"Pick a sass loader",options:[{label:"Sass embedded",value:"sass-embedded",hint:"recommended"},{label:"Sass",value:"sass"},{label:"Node Sass",value:"node-sass",hint:"legacy"}]});y!=="sass"&&(g=g.filter(w=>w!=="sass"),g.push(y))}if(a.push(...g),await U({message:'Do you want to install "'+a.join('", "')+'"?'}))for(const y of a)c.push(...ls[y]);a.push("sourceMap")}s.cssMinifier===void 0&&(s.cssMinifier=await U({message:"Do you want to minify your css?",initialValue:!1}));let p;s.cssMinifier&&(p=await Z({message:"Pick a css minifier",options:[{label:"CSSNano",value:"cssnano"},{label:"Lightning CSS",value:"lightningcss"}]}),a.includes("lightningcss")||await U({message:'Do you want to install "'+p+'"?'})&&c.push(p));let d="",u="";if(s.isolatedDeclarationTransformer&&(u+=`,
157
- isolatedDeclarationTransformer`),(s.css||s.cssMinifier)&&(u+=`,
154
+ `)}},"runBuilder"),M=q(async()=>{if(x!==void 0)await El({pid:x.pid,signal:p.killSignal??y.killSignal??"SIGTERM"});else if(v!==void 0)try{await v()}catch(F){throw new Error("onSuccess function cleanup failed: "+F.message,{cause:F})}x=void 0,v=void 0},"doOnSuccessCleanup"),B=q(async()=>{if(typeof b.options.onSuccess=="function")try{v=await b.options.onSuccess()}catch(F){throw new Error("onSuccess function failed: "+F.message,{cause:F})}else if(typeof b.options.onSuccess=="string"){const F=b.options.onSuccessTimeout??3e4;if(x=Eo(b.options.onSuccess,[],{nodeOptions:{shell:!0,stdio:"inherit",timeout:F}}),await x,x.exitCode&&x.exitCode!==0)throw new Error("onSuccess script failed with exit code "+x.exitCode+". Check the output above for details.")}},"runOnsuccess"),z=Date.now(),ce=q(()=>kt(Math.floor(Date.now()-z)),"getDuration");if(t==="watch"){if(b.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await rl(b,E,P,B,M),Kt(b,!1);return}t==="jit"?(await il(b),await b.hooks.callHook("build:done",b)):(f=await Tr(b,E),await b.hooks.callHook("validate:before",b),Gl(b),await b.hooks.callHook("validate:done",b),Kt(b,f)),b.logger.raw(`
155
+ ⚡️ Build run in `+ce()),await P(),await B(),Ge.on("SIGINT",async()=>{await M()}),Ge.on("SIGTERM",async()=>{await M()})}catch(g){throw o.raw(`
156
+ `),Ki(g),g}finally{o.restoreAll(),await Ml(d,o,f)}},"packem");var ap=Object.defineProperty,De=u((e,t)=>ap(e,"name",{value:t,configurable:!0}),"o");const sp=De(e=>{e.addCommand({description:"Demonstrate options required",execute:De(async({logger:t,options:i})=>{let o="build";i.watch?o="watch":i.jit&&(o="jit");const n={};let a;if(Pe.NODE_ENV&&[we,G].includes(Pe.NODE_ENV)&&(a=Pe.NODE_ENV),i.env)for(const s of i.env)if(s.key==="NODE_ENV"){if(a)throw new Error("NODE_ENV was already set, this can't be overridden.");a=s.value}else n["process.env."+s.key]=JSON.stringify(s.value);a===void 0&&(i.production?a=G:i.development&&(a=we));try{await np(i.dir,o,a,t,{analyze:i.analyze,cjsInterop:i.cjsInterop,clean:i.clean,configPath:i.config??void 0,debug:i.debug,dtsOnly:i.dtsOnly,killSignal:i.killSignal,minify:i.minify===void 0?a===G:i.minify,onSuccess:i.onSuccess,rollup:{esbuild:{target:i.target},license:{path:i.license},metafile:i.metafile,replace:{values:n}},sourcemap:i.analyze||i.sourcemap,tsconfigPath:i.tsconfig??void 0,validation:i.validation===!1?{packageJson:{bin:!1,dependencies:!1,exports:!1,files:!1,main:!1,module:!1,name:!1,types:!1,typesVersions:!1}}:{},...i.typedoc?{typedoc:{format:"html"}}:{}})}catch(s){t.error(s),ao(1)}},"execute"),name:"build",options:[{defaultValue:".",description:"The directory to build",name:"dir",type:String},{alias:"t",description:"Environments to support. `target` in tsconfig.json is automatically added. Defaults to the current Node.js version.",name:"target"},{description:"Use a custom config file",name:"config",type:String},{description:"Path to the tsconfig.json file",name:"tsconfig",type:String},{description:"Minify the output",name:"minify",type:Boolean},{description:"Generate sourcemaps (experimental)",name:"sourcemap",type:Boolean},{conflicts:"jit",description:"Watch for changes",name:"watch",type:Boolean},{conflicts:"watch",description:"Stub the package for JIT compilation",name:"jit",type:Boolean},{description:"Compile-time environment variables (eg. --env.NODE_ENV=production)",multiple:!0,name:"env",type:De(t=>{const[i,o]=t.split("=");return{key:i,value:o}},"type")},{defaultValue:!1,description:"Generate meta file (experimental)",name:"metafile",type:Boolean},{description:"Path to the license file",name:"license",type:String},{conflicts:"watch",description:"Visualize and analyze the bundle",name:"analyze",type:Boolean},{description:"CJS interop mode, can export default and named export, (experimental).",name:"cjsInterop",type:Boolean},{conflicts:"development",description:"Run code in production environment",name:"production",type:Boolean},{conflicts:"production",description:"Run code in development environment",name:"development",type:Boolean},{description:"Do not clean the dist directory before building",name:"no-clean",type:Boolean},{description:"Only generate .d.ts files",name:"dts-only",type:Boolean},{description:"Enable or disable the output validation",name:"no-validation",type:Boolean},{description:"Generate type documentation",name:"typedoc",type:Boolean},{description:"Execute command after successful build, specially useful for watch mode",name:"onSuccess",type:String},{description:'Signal to kill child process, "SIGTERM" or "SIGKILL"',name:"killSignal",type:De(t=>{if(t==="SIGTERM"||t==="SIGKILL")return t;throw new Error("Invalid kill signal. Use 'SIGTERM' or 'SIGKILL'.")},"type")}]})},"createBuildCommand");var rp=Object.defineProperty,Ce=u((e,t)=>rp(e,"name",{value:t,configurable:!0}),"m");const lp=Ce(e=>{e.addCommand({description:"Initialize packem configuration",execute:Ce(async({logger:t,options:i})=>{if(so("Welcome to packem setup"),R(k(i.dir,"packem.config.ts"))){t.info("Packem project already initialized, you can use `packem build` to build your project");return}const o=j(Xt(),i.dir??"."),n=k(o,"package.json");if(!R(n))throw new Error("No package.json found in the directory");const a=di(n),s=[];a.dependencies&&s.push(...Object.keys(a.dependencies)),a.devDependencies&&s.push(...Object.keys(a.devDependencies));const l=!!(a.devDependencies?.typescript??a.dependencies?.typescript),p=[];if(i.typescript===void 0&&!l?(i.typescript=await U({message:"Do you want to install TypeScript?"}),i.typescript&&p.push("typescript@latest")):yt.message("TypeScript version "+(a.devDependencies?.typescript??a.dependencies?.typescript)+" is already installed"),!R(k(o,"tsconfig.json"))){const v=await U({message:"Do you want to use generate a tsconfig.json?"}),g=await U({message:"Do you want to run your code in the DOM?"});if(v){const h=ot();h.start("Generating tsconfig.json"),Le(k(o,"tsconfig.json"),{compilerOptions:{esModuleInterop:!0,skipLibCheck:!0,target:"es2022",allowJs:!0,resolveJsonModule:!0,moduleDetection:"force",isolatedModules:!0,verbatimModuleSyntax:!0,strict:!0,noUncheckedIndexedAccess:!0,noImplicitOverride:!0,module:"NodeNext",outDir:"dist",sourceMap:!0,declaration:!0,lib:g?["es2022","dom","dom.iterable"]:["es2022"]}}),h.stop("")}}if(s.includes("esbuild")?i.transformer="esbuild":s.includes("@swc/core")?i.transformer="swc":s.includes("sucrase")&&(i.transformer="sucrase"),i.transformer===void 0?(i.transformer=await te({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"}]}),i.transformer&&!s.includes(i.transformer)&&await U({message:"Do you want to install "+i.transformer+"?"})&&p.push(i.transformer==="swc"?"@swc/core":i.transformer)):yt.message("Transformer "+i.transformer+" is already installed."),i.isolatedDeclarationTransformer===void 0&&(i.isolatedDeclarationTransformer=await U({message:"Do you want to use an isolated declaration types?",initialValue:!1})),i.isolatedDeclarationTransformer===void 0&&(i.isolatedDeclarationTransformer=await te({message:"Pick a isolated declaration transformer",options:[{label:"Typescript",value:"typescript"},{label:"swc",value:"swc"},{label:"OXC",value:"oxc"},{label:"None",value:null}]}),i.isolatedDeclarationTransformer!==null)){let v;switch(i.isolatedDeclarationTransformer){case"typescript":{v="typescript";break}case"swc":{v="@swc/core";break}case"oxc":{v="oxc-transform";break}default:ro("Invalid isolated declaration transformer")}v!==void 0&&!s.includes(v)&&await U({message:"Do you want to install "+v+"?"})&&p.push(v)}i.css===void 0&&(i.css=await U({message:"Do you want to use css in your project?",initialValue:!1}));const r=[];if(i.css){const v=await te({message:"Pick a css loader",options:[{label:"PostCSS",value:"postcss"},{hint:"experimental",label:"Lightning CSS",value:"lightningcss"}]});r.push(v);let g=await Qt({message:"Pick your loaders",options:[{label:"Sass",value:"sass"},{label:"Stylus",value:"stylus"},{label:"Less",value:"less"}],required:!1});if(g.includes("sass")){const h=await te({message:"Pick a sass loader",options:[{label:"Sass embedded",value:"sass-embedded",hint:"recommended"},{label:"Sass",value:"sass"},{label:"Node Sass",value:"node-sass",hint:"legacy"}]});h!=="sass"&&(g=g.filter(y=>y!=="sass"),g.push(h))}if(r.push(...g),await U({message:'Do you want to install "'+r.join('", "')+'"?'}))for(const h of r)p.push(...ui[h]);r.push("sourceMap")}i.cssMinifier===void 0&&(i.cssMinifier=await U({message:"Do you want to minify your css?",initialValue:!1}));let c;i.cssMinifier&&(c=await te({message:"Pick a css minifier",options:[{label:"CSSNano",value:"cssnano"},{label:"Lightning CSS",value:"lightningcss"}]}),r.includes("lightningcss")||await U({message:'Do you want to install "'+c+'"?'})&&p.push(c));let m="",d="";if(i.isolatedDeclarationTransformer&&(d+=`,
157
+ isolatedDeclarationTransformer`),(i.css||i.cssMinifier)&&(d+=`,
158
158
  rollup: {
159
- css: {`),s.css){const h=a.map(g=>((g==="sass-embedded"||g==="node-sass")&&(g="sass"),`${g}Loader`)).join(", ");u+=`
160
- loaders: [${h}],`}if(s.cssMinifier&&p&&(u+=`
161
- minifier: `+p+"Minifier,"),(s.css||s.cssMinifier)&&(u+=`
159
+ css: {`),i.css){const v=r.map(g=>((g==="sass-embedded"||g==="node-sass")&&(g="sass"),`${g}Loader`)).join(", ");d+=`
160
+ loaders: [${v}],`}if(i.cssMinifier&&c&&(d+=`
161
+ minifier: `+c+"Minifier,"),(i.css||i.cssMinifier)&&(d+=`
162
162
  }
163
- }`),l||r.type==="module"){let h="";if(s.isolatedDeclarationTransformer&&(h+=`import isolatedDeclarationTransformer from "@visulima/packem/dts/isolated/transformer/${s.isolatedDeclarationTransformer}";
164
- `),s.css)for(let g of a)(g==="sass-embedded"||g==="node-sass")&&(g="sass"),h+=`import ${g}Loader from "@visulima/packem/css/loader/${g.toLowerCase()}";
165
- `;s.cssMinifier&&p&&(h+=`import ${p}Minifier from "@visulima/packem/css/minifier/${p.toLowerCase()}";
166
- `),d=`import { defineConfig } from "@visulima/packem/config";
167
- import transformer from "@visulima/packem/transformer/${s.transformer}";
168
- ${h}
163
+ }`),l||a.type==="module"){let v="";if(i.isolatedDeclarationTransformer&&(v+=`import isolatedDeclarationTransformer from "@visulima/packem/dts/isolated/transformer/${i.isolatedDeclarationTransformer}";
164
+ `),i.css)for(let g of r)(g==="sass-embedded"||g==="node-sass")&&(g="sass"),v+=`import ${g}Loader from "@visulima/packem/css/loader/${g.toLowerCase()}";
165
+ `;i.cssMinifier&&c&&(v+=`import ${c}Minifier from "@visulima/packem/css/minifier/${c.toLowerCase()}";
166
+ `),m=`import { defineConfig } from "@visulima/packem/config";
167
+ import transformer from "@visulima/packem/transformer/${i.transformer}";
168
+ ${v}
169
169
  export default defineConfig({
170
- transformer${u}
170
+ transformer${d}
171
171
  });
172
- `}else{let h="";if(s.isolatedDeclarationTransformer&&(h+=`const isolatedDeclarationTransformer = require("@visulima/packem/dts/isolated/transformer/${s.isolatedDeclarationTransformer}");
173
- `),s.css)for(let g of a)(g==="sass-embedded"||g==="node-sass")&&(g="sass"),h+=`const ${g}Loader = require("@visulima/packem/css/loader/${g.toLowerCase()}");
174
- `;s.cssMinifier&&p&&(h+=`const ${p}Minifier = require("@visulima/packem/css/minifier/${p.toLowerCase()}");
175
- `),d=`const { defineConfig } = require("@visulima/packem/config");
176
- const transformer = require("@visulima/packem/transformer/${s.transformer}");
177
- ${h}
172
+ `}else{let v="";if(i.isolatedDeclarationTransformer&&(v+=`const isolatedDeclarationTransformer = require("@visulima/packem/dts/isolated/transformer/${i.isolatedDeclarationTransformer}");
173
+ `),i.css)for(let g of r)(g==="sass-embedded"||g==="node-sass")&&(g="sass"),v+=`const ${g}Loader = require("@visulima/packem/css/loader/${g.toLowerCase()}");
174
+ `;i.cssMinifier&&c&&(v+=`const ${c}Minifier = require("@visulima/packem/css/minifier/${c.toLowerCase()}");
175
+ `),m=`const { defineConfig } = require("@visulima/packem/config");
176
+ const transformer = require("@visulima/packem/transformer/${i.transformer}");
177
+ ${v}
178
178
  module.exports = defineConfig({
179
- transformer${u}
179
+ transformer${d}
180
180
  });
181
- `}const m=Qe(),v=l?"ts":"js";c.length>0&&(m.start("Installing packages"),await Xe(c,{cwd:o,dev:!0,silent:!0}),m.stop("Installed packages")),m.start("Creating packem.config."+v),se(x(o,"packem.config."+v),d),m.stop("Created packem.config."+v),to("Now you can run `packem build` to build your project")},"execute"),name:"init",options:[{defaultValue:".",description:"The directory to initialize",name:"dir",type:String},{description:"Choose a transformer",name:"transformer",type:Ee(t=>{if(typeof t=="string"&&["esbuild","sucrase","swc"].includes(t))return t;throw new Error("Invalid transformer, please choose one of 'swc', 'sucrase' or 'esbuild'")},"type")},{description:"Choose a isolated declaration transformer",name:"isolated-declaration-transformer",type:Ee(t=>{if(typeof t=="string"&&["none","oxc","swc","typescript"].includes(t))return t;throw new Error("Invalid isolated declaration isolated declaration, please choose one of 'none', 'oxc', 'swc' or 'typescript'")},"type")},{description:"Use CSS",name:"css",type:Boolean},{description:"Use CSS minifier",name:"css-minifier",type:Boolean},{Description:"Use TypeScript",name:"typescript",type:Boolean}]})},"createInitCommand"),Be=new Hs("packem",{logger:{reporters:[new Ys({error:{hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0}})],scope:"packem"},packageName:Ko,packageVersion:Go});Fl(Be);Al(Be);Zo(Be);Be.run({shouldExitProcess:!1});
181
+ `}const f=ot(),x=l?"ts":"js";p.length>0&&(f.start("Installing packages"),await it(p,{cwd:o,dev:!0,silent:!0}),f.stop("Installed packages")),f.start("Creating packem.config."+x),re(k(o,"packem.config."+x),m),f.stop("Created packem.config."+x),lo("Now you can run `packem build` to build your project")},"execute"),name:"init",options:[{defaultValue:".",description:"The directory to initialize",name:"dir",type:String},{description:"Choose a transformer",name:"transformer",type:Ce(t=>{if(typeof t=="string"&&["esbuild","sucrase","swc"].includes(t))return t;throw new Error("Invalid transformer, please choose one of 'swc', 'sucrase' or 'esbuild'")},"type")},{description:"Choose a isolated declaration transformer",name:"isolated-declaration-transformer",type:Ce(t=>{if(typeof t=="string"&&["none","oxc","swc","typescript"].includes(t))return t;throw new Error("Invalid isolated declaration isolated declaration, please choose one of 'none', 'oxc', 'swc' or 'typescript'")},"type")},{description:"Use CSS",name:"css",type:Boolean},{description:"Use CSS minifier",name:"css-minifier",type:Boolean},{Description:"Use TypeScript",name:"typescript",type:Boolean}]})},"createInitCommand"),Ue=new io("packem",{logger:{reporters:[new oo({error:{hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0}})],scope:"packem"},packageName:ln,packageVersion:pn});lp(Ue);sp(Ue);fn(Ue);Ue.run({shouldExitProcess:!1});