@visulima/packem 1.2.0-alpha.2 → 1.2.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 (358) hide show
  1. package/CHANGELOG.md +7 -13
  2. package/LICENSE.md +30 -63
  3. package/README.md +3 -255
  4. package/dist/build.d.cts +6 -0
  5. package/dist/build.d.mts +4 -0
  6. package/dist/build.d.ts +6 -0
  7. package/dist/builder/typedoc/generate-reference-documentation.d.cts +6 -0
  8. package/dist/builder/typedoc/generate-reference-documentation.d.mts +4 -0
  9. package/dist/builder/typedoc/generate-reference-documentation.d.ts +6 -0
  10. package/dist/builder/typedoc/index.cjs +3 -3
  11. package/dist/builder/typedoc/index.d.cts +3 -34
  12. package/dist/builder/typedoc/index.d.mts +2 -35
  13. package/dist/builder/typedoc/index.d.ts +3 -34
  14. package/dist/cli.d.mts +1 -0
  15. package/dist/cli.mjs +86 -110
  16. package/dist/commands/add.d.mts +3 -0
  17. package/dist/commands/build.d.mts +3 -0
  18. package/dist/commands/init.d.mts +3 -0
  19. package/dist/config.d.cts +17 -40
  20. package/dist/config.d.mts +17 -40
  21. package/dist/config.d.ts +17 -40
  22. package/dist/constants.d.cts +12 -0
  23. package/dist/constants.d.mts +12 -0
  24. package/dist/constants.d.ts +12 -0
  25. package/dist/create-bundler.cjs +72 -85
  26. package/dist/create-bundler.d.cts +4 -36
  27. package/dist/create-bundler.d.mts +4 -36
  28. package/dist/create-bundler.d.ts +4 -36
  29. package/dist/create-bundler.mjs +73 -86
  30. package/dist/hooks/preset/auto.d.cts +5 -0
  31. package/dist/hooks/preset/auto.d.mts +3 -0
  32. package/dist/hooks/preset/auto.d.ts +5 -0
  33. package/dist/hooks/preset/utils/infer-entries.d.cts +14 -0
  34. package/dist/hooks/preset/utils/infer-entries.d.mts +12 -0
  35. package/dist/hooks/preset/utils/infer-entries.d.ts +14 -0
  36. package/dist/hooks/preset/utils/overwrite-with-publish-config.d.cts +6 -0
  37. package/dist/hooks/preset/utils/overwrite-with-publish-config.d.mts +4 -0
  38. package/dist/hooks/preset/utils/overwrite-with-publish-config.d.ts +6 -0
  39. package/dist/hooks/preset/utils/resolve-preset.d.cts +6 -0
  40. package/dist/hooks/preset/utils/resolve-preset.d.mts +4 -0
  41. package/dist/hooks/preset/utils/resolve-preset.d.ts +6 -0
  42. package/dist/jit/create-stub.d.cts +5 -0
  43. package/dist/jit/create-stub.d.mts +3 -0
  44. package/dist/jit/create-stub.d.ts +5 -0
  45. package/dist/packem_shared/constants-CWqse9ko.mjs +1 -0
  46. package/dist/packem_shared/constants-ISPLmXDX.cjs +1 -0
  47. package/dist/packem_shared/create-or-update-key-storage-DslhcsTU.cjs +3 -0
  48. package/dist/packem_shared/{resolve-file-BffLoYJG.cjs → resolve-file-C9LytYzE.cjs} +1 -1
  49. package/dist/rollup/build-types.d.cts +6 -0
  50. package/dist/rollup/build-types.d.mts +4 -0
  51. package/dist/rollup/build-types.d.ts +6 -0
  52. package/dist/rollup/build.d.cts +6 -0
  53. package/dist/rollup/build.d.mts +4 -0
  54. package/dist/rollup/build.d.ts +6 -0
  55. package/dist/rollup/get-rollup-options.d.cts +5 -0
  56. package/dist/rollup/get-rollup-options.d.mts +5 -0
  57. package/dist/rollup/get-rollup-options.d.ts +5 -0
  58. package/dist/rollup/plugins/chunk-splitter/gather.d.cts +10 -0
  59. package/dist/rollup/plugins/chunk-splitter/gather.d.mts +8 -0
  60. package/dist/rollup/plugins/chunk-splitter/gather.d.ts +10 -0
  61. package/dist/rollup/plugins/chunk-splitter/index.d.cts +8 -0
  62. package/dist/rollup/plugins/chunk-splitter/index.d.mts +6 -0
  63. package/dist/rollup/plugins/chunk-splitter/index.d.ts +8 -0
  64. package/dist/rollup/plugins/chunk-splitter/parse/index.d.cts +6 -0
  65. package/dist/rollup/plugins/chunk-splitter/parse/index.d.mts +4 -0
  66. package/dist/rollup/plugins/chunk-splitter/parse/index.d.ts +6 -0
  67. package/dist/rollup/plugins/chunk-splitter/parse/types.d.cts +24 -0
  68. package/dist/rollup/plugins/chunk-splitter/parse/types.d.mts +24 -0
  69. package/dist/rollup/plugins/chunk-splitter/parse/types.d.ts +24 -0
  70. package/dist/rollup/plugins/cjs-interop.d.cts +9 -0
  71. package/dist/rollup/plugins/cjs-interop.d.mts +9 -0
  72. package/dist/rollup/plugins/cjs-interop.d.ts +9 -0
  73. package/dist/rollup/plugins/copy.d.cts +26 -0
  74. package/dist/rollup/plugins/copy.d.mts +26 -0
  75. package/dist/rollup/plugins/copy.d.ts +26 -0
  76. package/dist/rollup/plugins/esbuild/get-render-chunk.d.cts +16 -0
  77. package/dist/rollup/plugins/esbuild/get-render-chunk.d.mts +14 -0
  78. package/dist/rollup/plugins/esbuild/get-render-chunk.d.ts +16 -0
  79. package/dist/rollup/plugins/esbuild/index.cjs +1 -1
  80. package/dist/rollup/plugins/esbuild/index.d.cts +4 -7
  81. package/dist/rollup/plugins/esbuild/index.d.mts +4 -9
  82. package/dist/rollup/plugins/esbuild/index.d.ts +4 -7
  83. package/dist/rollup/plugins/esbuild/index.mjs +1 -1
  84. package/dist/rollup/plugins/esbuild/optmize-deps.d.cts +5 -0
  85. package/dist/rollup/plugins/esbuild/optmize-deps.d.mts +3 -0
  86. package/dist/rollup/plugins/esbuild/optmize-deps.d.ts +5 -0
  87. package/dist/rollup/plugins/esbuild/types.d.cts +40 -0
  88. package/dist/rollup/plugins/esbuild/types.d.mts +40 -0
  89. package/dist/rollup/plugins/esbuild/types.d.ts +40 -0
  90. package/dist/rollup/plugins/esbuild/warn.d.cts +6 -0
  91. package/dist/rollup/plugins/esbuild/warn.d.mts +4 -0
  92. package/dist/rollup/plugins/esbuild/warn.d.ts +6 -0
  93. package/dist/rollup/plugins/esm-shim-cjs-syntax.d.cts +8 -0
  94. package/dist/rollup/plugins/esm-shim-cjs-syntax.d.mts +8 -0
  95. package/dist/rollup/plugins/esm-shim-cjs-syntax.d.ts +8 -0
  96. package/dist/rollup/plugins/fix-dynamic-import-extension.d.cts +5 -0
  97. package/dist/rollup/plugins/fix-dynamic-import-extension.d.mts +3 -0
  98. package/dist/rollup/plugins/fix-dynamic-import-extension.d.ts +5 -0
  99. package/dist/rollup/plugins/isolated-declarations/extend-string.d.cts +4 -0
  100. package/dist/rollup/plugins/isolated-declarations/extend-string.d.mts +2 -0
  101. package/dist/rollup/plugins/isolated-declarations/extend-string.d.ts +4 -0
  102. package/dist/rollup/plugins/isolated-declarations/index.d.cts +16 -0
  103. package/dist/rollup/plugins/isolated-declarations/index.d.mts +16 -0
  104. package/dist/rollup/plugins/isolated-declarations/index.d.ts +16 -0
  105. package/dist/rollup/plugins/isolated-declarations/lowest-common-ancestor.d.cts +4 -0
  106. package/dist/rollup/plugins/isolated-declarations/lowest-common-ancestor.d.mts +2 -0
  107. package/dist/rollup/plugins/isolated-declarations/lowest-common-ancestor.d.ts +4 -0
  108. package/dist/rollup/plugins/json.d.cts +6 -0
  109. package/dist/rollup/plugins/json.d.mts +4 -0
  110. package/dist/rollup/plugins/json.d.ts +6 -0
  111. package/dist/rollup/plugins/jsx-remove-attributes.d.cts +8 -0
  112. package/dist/rollup/plugins/jsx-remove-attributes.d.mts +8 -0
  113. package/dist/rollup/plugins/jsx-remove-attributes.d.ts +8 -0
  114. package/dist/rollup/plugins/license.d.cts +18 -0
  115. package/dist/rollup/plugins/license.d.mts +18 -0
  116. package/dist/rollup/plugins/license.d.ts +18 -0
  117. package/dist/rollup/plugins/metafile.d.cts +9 -0
  118. package/dist/rollup/plugins/metafile.d.mts +7 -0
  119. package/dist/rollup/plugins/metafile.d.ts +9 -0
  120. package/dist/rollup/plugins/node10-compatibility-plugin.d.cts +7 -0
  121. package/dist/rollup/plugins/node10-compatibility-plugin.d.mts +7 -0
  122. package/dist/rollup/plugins/node10-compatibility-plugin.d.ts +7 -0
  123. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.cts +3 -34
  124. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.mts +2 -35
  125. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.ts +3 -34
  126. package/dist/rollup/plugins/plugin-cache.d.cts +14 -0
  127. package/dist/rollup/plugins/plugin-cache.d.mts +12 -0
  128. package/dist/rollup/plugins/plugin-cache.d.ts +14 -0
  129. package/dist/rollup/plugins/prepend-directives.d.cts +5 -0
  130. package/dist/rollup/plugins/prepend-directives.d.mts +3 -0
  131. package/dist/rollup/plugins/prepend-directives.d.ts +5 -0
  132. package/dist/rollup/plugins/preserve-directives.d.cts +19 -0
  133. package/dist/rollup/plugins/preserve-directives.d.mts +17 -0
  134. package/dist/rollup/plugins/preserve-directives.d.ts +19 -0
  135. package/dist/rollup/plugins/raw.d.cts +7 -0
  136. package/dist/rollup/plugins/raw.d.mts +7 -0
  137. package/dist/rollup/plugins/raw.d.ts +7 -0
  138. package/dist/rollup/plugins/resolve-file-url.d.cts +5 -0
  139. package/dist/rollup/plugins/resolve-file-url.d.mts +3 -0
  140. package/dist/rollup/plugins/resolve-file-url.d.ts +5 -0
  141. package/dist/rollup/plugins/shebang.d.cts +9 -0
  142. package/dist/rollup/plugins/shebang.d.mts +9 -0
  143. package/dist/rollup/plugins/shebang.d.ts +9 -0
  144. package/dist/rollup/plugins/sucrase/index.cjs +1 -1
  145. package/dist/rollup/plugins/sucrase/index.d.cts +4 -6
  146. package/dist/rollup/plugins/sucrase/index.d.mts +3 -7
  147. package/dist/rollup/plugins/sucrase/index.d.ts +4 -6
  148. package/dist/rollup/plugins/sucrase/index.mjs +1 -1
  149. package/dist/rollup/plugins/sucrase/types.d.cts +7 -0
  150. package/dist/rollup/plugins/sucrase/types.d.mts +7 -0
  151. package/dist/rollup/plugins/sucrase/types.d.ts +7 -0
  152. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.cts +3 -34
  153. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.mts +2 -35
  154. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.ts +3 -34
  155. package/dist/rollup/plugins/swc/swc-plugin.cjs +1 -1
  156. package/dist/rollup/plugins/swc/swc-plugin.d.cts +4 -5
  157. package/dist/rollup/plugins/swc/swc-plugin.d.mts +3 -6
  158. package/dist/rollup/plugins/swc/swc-plugin.d.ts +4 -5
  159. package/dist/rollup/plugins/swc/swc-plugin.mjs +1 -1
  160. package/dist/rollup/plugins/swc/types.d.cts +7 -0
  161. package/dist/rollup/plugins/swc/types.d.mts +7 -0
  162. package/dist/rollup/plugins/swc/types.d.ts +7 -0
  163. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.cts +4 -35
  164. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.mts +3 -36
  165. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.ts +4 -35
  166. package/dist/rollup/plugins/typescript/patch-typescript-types.d.cts +14 -0
  167. package/dist/rollup/plugins/typescript/patch-typescript-types.d.mts +14 -0
  168. package/dist/rollup/plugins/typescript/patch-typescript-types.d.ts +14 -0
  169. package/dist/rollup/plugins/typescript/resolve-tsconfig-paths.d.cts +36 -0
  170. package/dist/rollup/plugins/typescript/resolve-tsconfig-paths.d.mts +36 -0
  171. package/dist/rollup/plugins/typescript/resolve-tsconfig-paths.d.ts +36 -0
  172. package/dist/rollup/plugins/typescript/resolve-tsconfig-root-dirs.d.cts +28 -0
  173. package/dist/rollup/plugins/typescript/resolve-tsconfig-root-dirs.d.mts +26 -0
  174. package/dist/rollup/plugins/typescript/resolve-tsconfig-root-dirs.d.ts +28 -0
  175. package/dist/rollup/plugins/typescript/resolve-typescript-mjs-cjs.d.cts +12 -0
  176. package/dist/rollup/plugins/typescript/resolve-typescript-mjs-cjs.d.mts +10 -0
  177. package/dist/rollup/plugins/typescript/resolve-typescript-mjs-cjs.d.ts +12 -0
  178. package/dist/rollup/plugins/typescript/utils/patch-cjs-default-export.d.cts +8 -0
  179. package/dist/rollup/plugins/typescript/utils/patch-cjs-default-export.d.mts +6 -0
  180. package/dist/rollup/plugins/typescript/utils/patch-cjs-default-export.d.ts +8 -0
  181. package/dist/rollup/utils/append-plugins.d.cts +6 -0
  182. package/dist/rollup/utils/append-plugins.d.mts +4 -0
  183. package/dist/rollup/utils/append-plugins.d.ts +6 -0
  184. package/dist/rollup/utils/chunks/create-split-chunks.d.cts +6 -0
  185. package/dist/rollup/utils/chunks/create-split-chunks.d.mts +4 -0
  186. package/dist/rollup/utils/chunks/create-split-chunks.d.ts +6 -0
  187. package/dist/rollup/utils/chunks/get-custom-module-layer.d.cts +4 -0
  188. package/dist/rollup/utils/chunks/get-custom-module-layer.d.mts +2 -0
  189. package/dist/rollup/utils/chunks/get-custom-module-layer.d.ts +4 -0
  190. package/dist/rollup/utils/chunks/get-module-layer.d.cts +12 -0
  191. package/dist/rollup/utils/chunks/get-module-layer.d.mts +10 -0
  192. package/dist/rollup/utils/chunks/get-module-layer.d.ts +12 -0
  193. package/dist/rollup/utils/get-chunk-filename.d.cts +5 -0
  194. package/dist/rollup/utils/get-chunk-filename.d.mts +3 -0
  195. package/dist/rollup/utils/get-chunk-filename.d.ts +5 -0
  196. package/dist/rollup/utils/get-entry-file-names.d.cts +5 -0
  197. package/dist/rollup/utils/get-entry-file-names.d.mts +3 -0
  198. package/dist/rollup/utils/get-entry-file-names.d.ts +5 -0
  199. package/dist/rollup/utils/get-hash.d.cts +4 -0
  200. package/dist/rollup/utils/get-hash.d.mts +2 -0
  201. package/dist/rollup/utils/get-hash.d.ts +4 -0
  202. package/dist/rollup/utils/resolve-aliases.d.cts +5 -0
  203. package/dist/rollup/utils/resolve-aliases.d.mts +3 -0
  204. package/dist/rollup/utils/resolve-aliases.d.ts +5 -0
  205. package/dist/rollup/utils/resolve-file.d.cts +4 -0
  206. package/dist/rollup/utils/resolve-file.d.mts +2 -0
  207. package/dist/rollup/utils/resolve-file.d.ts +4 -0
  208. package/dist/rollup/watch.d.cts +6 -0
  209. package/dist/rollup/watch.d.mts +4 -0
  210. package/dist/rollup/watch.d.ts +6 -0
  211. package/dist/types.d.cts +276 -0
  212. package/dist/types.d.mts +276 -0
  213. package/dist/types.d.ts +276 -0
  214. package/dist/utils/array-includes.d.cts +4 -0
  215. package/dist/utils/array-includes.d.mts +2 -0
  216. package/dist/utils/array-includes.d.ts +4 -0
  217. package/dist/utils/arrayify.d.cts +4 -0
  218. package/dist/utils/arrayify.d.mts +2 -0
  219. package/dist/utils/arrayify.d.ts +4 -0
  220. package/dist/utils/create-or-update-key-storage.d.cts +5 -0
  221. package/dist/utils/create-or-update-key-storage.d.mts +3 -0
  222. package/dist/utils/create-or-update-key-storage.d.ts +5 -0
  223. package/dist/utils/enhance-rollup-error.d.cts +5 -0
  224. package/dist/utils/enhance-rollup-error.d.mts +3 -0
  225. package/dist/utils/enhance-rollup-error.d.ts +5 -0
  226. package/dist/utils/extract-export-filenames.d.cts +14 -0
  227. package/dist/utils/extract-export-filenames.d.mts +14 -0
  228. package/dist/utils/extract-export-filenames.d.ts +14 -0
  229. package/dist/utils/file-cache.d.cts +13 -0
  230. package/dist/utils/file-cache.d.mts +11 -0
  231. package/dist/utils/file-cache.d.ts +13 -0
  232. package/dist/utils/find-packem-file.d.cts +4 -0
  233. package/dist/utils/find-packem-file.d.mts +2 -0
  234. package/dist/utils/find-packem-file.d.ts +4 -0
  235. package/dist/utils/get-package-name.d.cts +4 -0
  236. package/dist/utils/get-package-name.d.mts +2 -0
  237. package/dist/utils/get-package-name.d.ts +4 -0
  238. package/dist/utils/get-package-side-effect.d.cts +5 -0
  239. package/dist/utils/get-package-side-effect.d.mts +3 -0
  240. package/dist/utils/get-package-side-effect.d.ts +5 -0
  241. package/dist/utils/get-regex-matches.d.cts +4 -0
  242. package/dist/utils/get-regex-matches.d.mts +2 -0
  243. package/dist/utils/get-regex-matches.d.ts +4 -0
  244. package/dist/utils/group-by-keys.d.cts +5 -0
  245. package/dist/utils/group-by-keys.d.mts +3 -0
  246. package/dist/utils/group-by-keys.d.ts +5 -0
  247. package/dist/utils/infer-export-type.d.cts +2 -0
  248. package/dist/utils/infer-export-type.d.mts +2 -0
  249. package/dist/utils/infer-export-type.d.ts +2 -0
  250. package/dist/utils/levenstein.d.cts +4 -0
  251. package/dist/utils/levenstein.d.mts +2 -0
  252. package/dist/utils/levenstein.d.ts +4 -0
  253. package/dist/utils/load-package-json.d.cts +8 -0
  254. package/dist/utils/load-package-json.d.mts +6 -0
  255. package/dist/utils/load-package-json.d.ts +8 -0
  256. package/dist/utils/log-build-errors.d.cts +5 -0
  257. package/dist/utils/log-build-errors.d.mts +3 -0
  258. package/dist/utils/log-build-errors.d.ts +5 -0
  259. package/dist/utils/memoize.d.cts +12 -0
  260. package/dist/utils/memoize.d.mts +10 -0
  261. package/dist/utils/memoize.d.ts +12 -0
  262. package/dist/utils/prepare-entries.d.cts +5 -0
  263. package/dist/utils/prepare-entries.d.mts +3 -0
  264. package/dist/utils/prepare-entries.d.ts +5 -0
  265. package/dist/utils/replace-content-within-marker.d.cts +4 -0
  266. package/dist/utils/replace-content-within-marker.d.mts +2 -0
  267. package/dist/utils/replace-content-within-marker.d.ts +4 -0
  268. package/dist/utils/warn.d.cts +5 -0
  269. package/dist/utils/warn.d.mts +3 -0
  270. package/dist/utils/warn.d.ts +5 -0
  271. package/dist/validator/package-json/index.d.cts +5 -0
  272. package/dist/validator/package-json/index.d.mts +3 -0
  273. package/dist/validator/package-json/index.d.ts +5 -0
  274. package/dist/validator/package-json/validate-dependencies.d.cts +5 -0
  275. package/dist/validator/package-json/validate-dependencies.d.mts +3 -0
  276. package/dist/validator/package-json/validate-dependencies.d.ts +5 -0
  277. package/dist/validator/package-json/validate-package-entries.d.cts +5 -0
  278. package/dist/validator/package-json/validate-package-entries.d.mts +3 -0
  279. package/dist/validator/package-json/validate-package-entries.d.ts +5 -0
  280. package/dist/validator/package-json/validate-package-fields.d.cts +5 -0
  281. package/dist/validator/package-json/validate-package-fields.d.mts +3 -0
  282. package/dist/validator/package-json/validate-package-fields.d.ts +5 -0
  283. package/dist/validator/validate-alias-entries.d.cts +5 -0
  284. package/dist/validator/validate-alias-entries.d.mts +3 -0
  285. package/dist/validator/validate-alias-entries.d.ts +5 -0
  286. package/package.json +19 -251
  287. package/dist/packem_shared/constants-Bcej5NDs.cjs +0 -1
  288. package/dist/packem_shared/constants-ic_mxhvm.mjs +0 -1
  289. package/dist/packem_shared/create-or-update-key-storage-DOolYH4A.cjs +0 -3
  290. package/dist/packem_shared/ensure-auto-modules-9cmxx7iZ.mjs +0 -1
  291. package/dist/packem_shared/ensure-auto-modules-DBW-5Idh.cjs +0 -1
  292. package/dist/packem_shared/get-hash-WS4xNEhC.mjs +0 -3
  293. package/dist/packem_shared/get-hash-n81THiHZ.cjs +0 -1
  294. package/dist/packem_shared/index-C3MxExtD.cjs +0 -1
  295. package/dist/packem_shared/index-lNbR1ToZ.mjs +0 -1
  296. package/dist/packem_shared/resolve-CisvRjnr.cjs +0 -1
  297. package/dist/packem_shared/resolve-aYsRgS8e.mjs +0 -1
  298. package/dist/packem_shared/sourcemap-CXAd1Jcz.cjs +0 -3
  299. package/dist/packem_shared/sourcemap-DDVjvayf.mjs +0 -3
  300. package/dist/packem_shared/types-BLR6WWv2.d.cts +0 -24
  301. package/dist/packem_shared/types-BLR6WWv2.d.mts +0 -24
  302. package/dist/packem_shared/types-BLR6WWv2.d.ts +0 -24
  303. package/dist/packem_shared/types-CjP-nwfQ.d.mts +0 -462
  304. package/dist/packem_shared/types-CzGE8V_d.d.cts +0 -1951
  305. package/dist/packem_shared/types-CzGE8V_d.d.mts +0 -1951
  306. package/dist/packem_shared/types-CzGE8V_d.d.ts +0 -1951
  307. package/dist/packem_shared/types-D-EHd72y.d.ts +0 -462
  308. package/dist/packem_shared/types-DvWhOdt5.d.cts +0 -10
  309. package/dist/packem_shared/types-DvWhOdt5.d.mts +0 -10
  310. package/dist/packem_shared/types-DvWhOdt5.d.ts +0 -10
  311. package/dist/packem_shared/types-WYeicvrQ.d.cts +0 -462
  312. package/dist/packem_shared/url-DFE8cAA0.cjs +0 -1
  313. package/dist/packem_shared/url-I6Jx3crl.mjs +0 -1
  314. package/dist/rollup/plugins/css/loaders/less/index.cjs +0 -1
  315. package/dist/rollup/plugins/css/loaders/less/index.d.cts +0 -36
  316. package/dist/rollup/plugins/css/loaders/less/index.d.mts +0 -36
  317. package/dist/rollup/plugins/css/loaders/less/index.d.ts +0 -36
  318. package/dist/rollup/plugins/css/loaders/less/index.mjs +0 -1
  319. package/dist/rollup/plugins/css/loaders/lightningcss.cjs +0 -3
  320. package/dist/rollup/plugins/css/loaders/lightningcss.d.cts +0 -36
  321. package/dist/rollup/plugins/css/loaders/lightningcss.d.mts +0 -36
  322. package/dist/rollup/plugins/css/loaders/lightningcss.d.ts +0 -36
  323. package/dist/rollup/plugins/css/loaders/lightningcss.mjs +0 -3
  324. package/dist/rollup/plugins/css/loaders/postcss/index.cjs +0 -19
  325. package/dist/rollup/plugins/css/loaders/postcss/index.d.cts +0 -36
  326. package/dist/rollup/plugins/css/loaders/postcss/index.d.mts +0 -36
  327. package/dist/rollup/plugins/css/loaders/postcss/index.d.ts +0 -36
  328. package/dist/rollup/plugins/css/loaders/postcss/index.mjs +0 -19
  329. package/dist/rollup/plugins/css/loaders/sass/index.cjs +0 -8
  330. package/dist/rollup/plugins/css/loaders/sass/index.d.cts +0 -36
  331. package/dist/rollup/plugins/css/loaders/sass/index.d.mts +0 -36
  332. package/dist/rollup/plugins/css/loaders/sass/index.d.ts +0 -36
  333. package/dist/rollup/plugins/css/loaders/sass/index.mjs +0 -10
  334. package/dist/rollup/plugins/css/loaders/sourcemap.cjs +0 -1
  335. package/dist/rollup/plugins/css/loaders/sourcemap.d.cts +0 -36
  336. package/dist/rollup/plugins/css/loaders/sourcemap.d.mts +0 -36
  337. package/dist/rollup/plugins/css/loaders/sourcemap.d.ts +0 -36
  338. package/dist/rollup/plugins/css/loaders/sourcemap.mjs +0 -1
  339. package/dist/rollup/plugins/css/loaders/stylus/index.cjs +0 -1
  340. package/dist/rollup/plugins/css/loaders/stylus/index.d.cts +0 -36
  341. package/dist/rollup/plugins/css/loaders/stylus/index.d.mts +0 -36
  342. package/dist/rollup/plugins/css/loaders/stylus/index.d.ts +0 -36
  343. package/dist/rollup/plugins/css/loaders/stylus/index.mjs +0 -1
  344. package/dist/rollup/plugins/css/minifiers/cssnano.cjs +0 -1
  345. package/dist/rollup/plugins/css/minifiers/cssnano.d.cts +0 -36
  346. package/dist/rollup/plugins/css/minifiers/cssnano.d.mts +0 -36
  347. package/dist/rollup/plugins/css/minifiers/cssnano.d.ts +0 -36
  348. package/dist/rollup/plugins/css/minifiers/cssnano.mjs +0 -1
  349. package/dist/rollup/plugins/css/minifiers/lightningcss.cjs +0 -3
  350. package/dist/rollup/plugins/css/minifiers/lightningcss.d.cts +0 -36
  351. package/dist/rollup/plugins/css/minifiers/lightningcss.d.mts +0 -36
  352. package/dist/rollup/plugins/css/minifiers/lightningcss.d.ts +0 -36
  353. package/dist/rollup/plugins/css/minifiers/lightningcss.mjs +0 -3
  354. package/dist/rollup/plugins/css/runtime/inject-css.cjs +0 -1
  355. package/dist/rollup/plugins/css/runtime/inject-css.d.cts +0 -8
  356. package/dist/rollup/plugins/css/runtime/inject-css.d.mts +0 -8
  357. package/dist/rollup/plugins/css/runtime/inject-css.d.ts +0 -8
  358. package/dist/rollup/plugins/css/runtime/inject-css.mjs +0 -1
package/dist/cli.mjs CHANGED
@@ -1,158 +1,134 @@
1
1
  #!/usr/bin/env node
2
- var Vo=Object.defineProperty;var m=(e,t)=>Vo(e,"name",{value:t,configurable:!0});import Uo from"@visulima/cerebro";import{SimpleReporter as qo}from"@visulima/pail/reporter";import{cwd as Wt,env as Se,versions as Ho,exit as Ko}from"node:process";import{installPackage as ie}from"@antfu/install-pkg";import{isAccessible as ot,readFile as st,writeFile as zt,isAccessibleSync as T,readFileSync as Me,writeFileSync as ee,writeJsonSync as Te,readJsonSync as rt,walk as Go,collectSync as Yo,ensureDirSync as Xo,emptyDir as Qo}from"@visulima/fs";import{join as $,resolve as j,normalize as F,relative as _,dirname as J,basename as le,isAbsolute as Ae,parse as Ve,toNamespacedPath as Oe,extname as Vt}from"@visulima/path";import H from"magic-string";import{readdirSync as Ut,existsSync as qt}from"node:fs";import{stat as Ht,chmod as Zo,rm as es}from"node:fs/promises";import ut from"node:module";import{cyan as O,bold as W,gray as G,green as ts,yellow as os,grey as ss}from"@visulima/colorize";import{findCacheDirSync as rs}from"@visulima/find-cache-dir";import{formatBytes as K,duration as dt}from"@visulima/humanizer";import{readTsConfig as ns,findTsConfig as is}from"@visulima/tsconfig";import as from"browserslist";import{defu as ls}from"defu";import{createHooks as cs}from"hookable";import{createJiti as Kt}from"jiti";import{rollup as Gt,watch as ft,VERSION as ps}from"rollup";import Yt from"@rollup/plugin-alias";import us from"@rollup/plugin-commonjs";import ds from"@rollup/plugin-dynamic-import-vars";import{nodeResolve as Xt}from"@rollup/plugin-node-resolve";import Qt from"@rollup/plugin-replace";import{wasm as fs}from"@rollup/plugin-wasm";import{isRelative as Zt,resolveAlias as ms}from"@visulima/path/utils";import gs from"rollup-plugin-polyfill-node";import{visualizer as hs}from"rollup-plugin-visualizer";import{minVersion as eo,valid as ys,coerce as vs}from"semver";import De from"node:assert/strict";import{extractAssignedNames as bs,createFilter as oe}from"@rollup/pluginutils";import ws from"glob-parent";import{glob as $s,isDynamicPattern as mt,globSync as xs}from"tinyglobby";import{SourceMapConsumer as js,SourceMapGenerator as ks}from"source-map-js";import{interopDefault as Es,loadModule as Ss,findStaticImports as to,fileURLToPath as Os,resolveModuleExportNames as Ds,resolvePath as gt}from"mlly";import{fileURLToPath as oo}from"node:url";import{ResolverFactory as Ps}from"oxc-resolver";import{parseAsync as Ns}from"oxc-parser";import Cs from"@rollup/plugin-json";import _s from"rollup-plugin-license";import{createHash as Is}from"node:crypto";import{parse as Ms}from"@babel/parser";import{parsePackageJson as so}from"@visulima/package/package-json";import{NotFoundError as Ts}from"@visulima/fs/error";import{distance as As}from"fastest-levenshtein";import{intro as Rs,confirm as U,spinner as Q,log as ht,select as $e,cancel as Fs,multiselect as Js,outro as Ls}from"@clack/prompts";import __cjs_url__ from "node:url"; // -- packem CommonJS __filename shim --
2
+ var lo=Object.defineProperty;var m=(e,t)=>lo(e,"name",{value:t,configurable:!0});import co from"@visulima/cerebro";import{SimpleReporter as po}from"@visulima/pail/reporter";import{cwd as pt,env as ne,versions as uo,exit as mo}from"node:process";import{installPackage as ie}from"@antfu/install-pkg";import{isAccessible as ut,readFile as Oe,writeFile as fo,readFileSync as Ne,writeFileSync as F,writeJsonSync as me,readJsonSync as Pe,walk as go,isAccessibleSync as S,collectSync as yo,ensureDirSync as ho,emptyDir as vo}from"@visulima/fs";import{join as w,resolve as $,normalize as dt,relative as O,dirname as V,basename as fe,toNamespacedPath as se,extname as mt,isAbsolute as ft}from"@visulima/path";import _ from"magic-string";import{readdirSync as gt,existsSync as yt}from"node:fs";import{stat as ht,chmod as bo,rm as wo}from"node:fs/promises";import Re from"node:module";import{cyan as k,bold as N,gray as M,green as $o,yellow as jo,grey as ko}from"@visulima/colorize";import{findCacheDirSync as xo}from"@visulima/find-cache-dir";import{formatBytes as I,duration as Fe}from"@visulima/humanizer";import{readTsConfig as Eo,findTsConfig as Do}from"@visulima/tsconfig";import{defu as So}from"defu";import{createHooks as Oo}from"hookable";import{createJiti as vt}from"jiti";import{rollup as bt,watch as Je,VERSION as No}from"rollup";import wt from"@rollup/plugin-alias";import Po from"@rollup/plugin-commonjs";import Co from"@rollup/plugin-dynamic-import-vars";import{nodeResolve as $t}from"@rollup/plugin-node-resolve";import jt from"@rollup/plugin-replace";import{wasm as _o}from"@rollup/plugin-wasm";import To from"rollup-plugin-polyfill-node";import{visualizer as Io}from"rollup-plugin-visualizer";import{minVersion as kt,valid as Mo,coerce as Ao}from"semver";import ae from"node:assert/strict";import{extractAssignedNames as Ro,createFilter as z,normalizePath as Be}from"@rollup/pluginutils";import Fo from"glob-parent";import{glob as Jo,isDynamicPattern as We,globSync as Bo}from"tinyglobby";import{findStaticImports as xt,fileURLToPath as Wo,resolveModuleExportNames as Lo,resolvePath as Le}from"mlly";import{parseAsync as Vo}from"oxc-parser";import zo from"@rollup/plugin-json";import Uo from"rollup-plugin-license";import{createHash as Ko}from"node:crypto";import{fileURLToPath as Ho}from"node:url";import{parse as qo}from"@babel/parser";import{parsePackageJson as Et}from"@visulima/package/package-json";import{NotFoundError as Go}from"@visulima/fs/error";import{isRelative as Xo}from"@visulima/path/utils";import{distance as Yo}from"fastest-levenshtein";import{intro as Qo,confirm as W,spinner as U,log as Ve,select as ze,cancel as Zo,outro as er}from"@clack/prompts";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 Bs="@visulima/packem",Ws="1.2.0-alpha.1";var zs=Object.defineProperty,Vs=m((e,t)=>zs(e,"name",{value:t,configurable:!0}),"t$d");const ro=Vs(async(e,t="")=>{let o=t;if(!o){const s=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for await(const r of s)if(await ot($(e,r))){o="./"+r;break}}if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(o))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return o},"findPackemFile");var Us=Object.defineProperty,yt=m((e,t)=>Us(e,"name",{value:t,configurable:!0}),"d$j");const qs=["typedoc","typedoc-plugin-markdown","typedoc-plugin-rename-defaults","@ckeditor/typedoc-plugins"],Hs=yt(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:yt(async({argument:t,logger:o,options:s})=>{const r=j(Wt(),s.dir??"."),n=await ro(r,s.config??""),i=await st(n,{buffer:!1}),a=new H(i);if(t.includes("typedoc")){if(i.includes("typedoc: typedocBuilder")||i.includes("@visulima/packem/builder/typedoc")){o.warn("Typedoc has already been added to the packem config.");return}o.info("Adding typedoc dependencies..."),await ie(qs,{cwd:process.cwd(),dev:!0,silent:!0}),a.prepend(`import typedocBuilder from "@visulima/packem/builder/typedoc";
9
- `),i.includes("builder: {")?a.replace("builder: {",`builder: {
8
+ const tr="@visulima/packem",or="1.1.1";var rr=Object.defineProperty,nr=m((e,t)=>rr(e,"name",{value:t,configurable:!0}),"t$a");const Dt=nr(async(e,t="")=>{let o=t;if(!o){const r=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for await(const n of r)if(await ut(w(e,n))){o="./"+n;break}}if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(o))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return o},"findPackemFile");var ir=Object.defineProperty,Ue=m((e,t)=>ir(e,"name",{value:t,configurable:!0}),"d$g");const sr=["typedoc","typedoc-plugin-markdown","typedoc-plugin-rename-defaults","@ckeditor/typedoc-plugins"],ar=Ue(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:Ue(async({argument:t,logger:o,options:r})=>{const n=$(pt(),r.dir??"."),i=await Dt(n,r.config??""),s=await Oe(i,{buffer:!1}),a=new _(s);if(t.includes("typedoc")){if(s.includes("typedoc: typedocBuilder")||s.includes("@visulima/packem/builder/typedoc")){o.warn("Typedoc has already been added to the packem config.");return}o.info("Adding typedoc dependencies..."),await ie(sr,{cwd:process.cwd(),dev:!0,silent:!0}),a.prepend(`import typedocBuilder from "@visulima/packem/builder/typedoc";
9
+ `),s.includes("builder: {")?a.replace("builder: {",`builder: {
10
10
  typedoc: typedocBuilder,
11
11
  `):a.replace("transformer,",`transformer,
12
12
  builder: {
13
13
  typedoc: typedocBuilder,
14
- },`),o.success("Typedoc added!")}await zt(n,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"),nt=[".mjs",".js",".json",".node",".cjs",".ts",".cts",".mts",".tsx",".ctsx",".mtsx",".jsx"],q="production",ge="development",it=new Set(["react-server","react-native","edge-light"]),Pe=new Set([ge,q,...it]),ne=/node_modules/,te=/(?:\.d\.[mc]?tsx?|\.\w+)$/,Ks="packem_chunks",Gs="packem_shared",ue=/\.(?:m|c)?(?:j|t)sx?$/;var Ys=Object.defineProperty,Xs=m((e,t)=>Ys(e,"name",{value:t,configurable:!0}),"a$l");const Xe=Xs((e,t)=>e.some(o=>o instanceof RegExp?o.test(t):o===t),"arrayIncludes");var Qs=Object.defineProperty,Zs=m((e,t)=>Qs(e,"name",{value:t,configurable:!0}),"a$k");const me=Zs(e=>e==null?[]:Array.isArray(e)?e:[e],"arrayify");var er=Object.defineProperty,tr=m((e,t)=>er(e,"name",{value:t,configurable:!0}),"a$j");const no=tr((e="")=>{const t=e.split("/");return t[0].startsWith("@")?t[0]+"/"+t[1]:t[0]},"getPackageName");var or=Object.defineProperty,io=m((e,t)=>or(e,"name",{value:t,configurable:!0}),"s$f");const sr=io((e,t,o)=>{const s=o??new Map;return(...r)=>{const n=t?typeof t=="function"?t(...r):t:JSON.stringify({args:r}),i=s.get(n);if(i!==void 0)return i;const a=e(...r);return s.set(n,a),a}},"memoize"),rr=io(e=>{const t=new Map;return o=>sr(e,o,t)},"memoizeByKey");var nr=Object.defineProperty,he=m((e,t)=>nr(e,"name",{value:t,configurable:!0}),"r$g");const ir=he(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 o of bs(t.id))yield o;break}}},"exportName"),ar=he(function*(e){if(e.declaration)for(const t of ir(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"),lr=he(function*(e){e.exported?yield{exportedName:e.exported.name,from:"self",type:"named"}:yield{from:"other",source:e.source.value,type:"barrel"}},"parseExportAll"),cr=he(function*(){yield{exportedName:"default",from:"self",type:"named"}},"parseExportDefault"),pr=he(function*(e,t){De(t.code!=null,`Module ${t.id} doesn't have associated code`);const o=e.parse(t.code);for(const s of o.body)switch(s.type){case"ExportAllDeclaration":{yield*lr(s);break}case"ExportDefaultDeclaration":{yield*cr();break}case"ExportNamedDeclaration":{yield*ar(s);break}}},"parseExports");var ur=Object.defineProperty,ye=m((e,t)=>ur(e,"name",{value:t,configurable:!0}),"n$b");const ao=ye(async function(e,t,o){const s=await e.resolve(t,o.id);if(De(s,`Rollup can't resolve ${t} from ${o.id}`),s.external)return null;const r=await e.load(s);return De(r,`Rollup doesn't have a module for id ${s.id}`),r},"getImportedModule"),dr=ye(async function*(e,t,o){const s=await ao(e,t.source,o);s&&(yield*at(e,s))},"gatherBarrelReExports"),fr=ye(async function*(e,t,o){const s=await ao(e,t.source,o);if(!s)return;const r=new Map(t.bindings.map(n=>[n.importedName,n]));for await(const n of at(e,s)){const i=r.get(n.exportedName);i&&(yield{...n,exportedName:i.exportedName})}},"gatherNamedReExports"),mr=ye(async function*(e,t){yield{exportedName:t.exportedName,id:e.id,sourceName:t.exportedName}},"gatherNamedSelfExports"),at=ye(async function*(e,t){for(const o of pr(e,t))o.from==="self"?yield*mr(t,o):o.type==="barrel"?yield*dr(e,o,t):yield*fr(e,o,t)},"gatherExports");var gr=Object.defineProperty,hr=m((e,t)=>gr(e,"name",{value:t,configurable:!0}),"r$f");const yr=hr(()=>({moduleParsed:{async handler(e){if(e.isEntry)for await(const t of at(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 vr=Object.defineProperty,br=m((e,t)=>vr(e,"name",{value:t,configurable:!0}),"r$e");const wr=br((e,t)=>{const o=e,s=[];let r;for(;(r=o.exec(t))!==null;)r.index===o.lastIndex&&o.lastIndex++,r.forEach(n=>{s.push(n)});return s.filter(Boolean)},"getRegexMatches");var $r=Object.defineProperty,xr=m((e,t)=>$r(e,"name",{value:t,configurable:!0}),"a$i");const lo=xr(e=>{const t=wr(/export\s(\{\s(.*)\s\}|default\s.*);/g,e);if(t.length===0)return null;const o=t.at(-1).split(", ");let s="";for(const r of o)if(!r.includes("type")&&(r.includes("default ")&&(s=r.split("default ")[1]),r.includes("as"))){const[n,i]=r.split(" as ");i==="default"&&(s=n)}if(s!==""){const r=new H(e);return r.replace(new RegExp(`(,s)?${s} as default(,)?`),""),r.replace(new RegExp(`export default ${s};
15
- ?`),""),r.append(`
14
+ },`),o.success("Typedoc added!")}await fo(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"),Ce=[".mjs",".js",".json",".node",".cjs",".ts",".cts",".mts",".tsx",".ctsx",".mtsx",".jsx"],C="production",G="development",_e=new Set(["react-server","react-native","edge-light"]),le=new Set([G,C,..._e]),L=/node_modules/,J=/(?:\.d\.[mc]?tsx?|\.\w+)$/,lr="packem_chunks",cr="packem_shared",K=/\.(?:m|c)?(?:j|t)sx?$/;var pr=Object.defineProperty,ur=m((e,t)=>pr(e,"name",{value:t,configurable:!0}),"a$h");const Ee=ur((e,t)=>e.some(o=>o instanceof RegExp?o.test(t):o===t),"arrayIncludes");var dr=Object.defineProperty,mr=m((e,t)=>dr(e,"name",{value:t,configurable:!0}),"a$g");const q=mr(e=>e==null?[]:Array.isArray(e)?e:[e],"arrayify");var fr=Object.defineProperty,gr=m((e,t)=>fr(e,"name",{value:t,configurable:!0}),"a$f");const St=gr((e="")=>{const t=e.split("/");return t[0].startsWith("@")?t[0]+"/"+t[1]:t[0]},"getPackageName");var yr=Object.defineProperty,Ot=m((e,t)=>yr(e,"name",{value:t,configurable:!0}),"s$f");const hr=Ot((e,t,o)=>{const r=o??new Map;return(...n)=>{const i=t?typeof t=="function"?t(...n):t:JSON.stringify({args:n}),s=r.get(i);if(s!==void 0)return s;const a=e(...n);return r.set(i,a),a}},"memoize"),vr=Ot(e=>{const t=new Map;return o=>hr(e,o,t)},"memoizeByKey");var br=Object.defineProperty,X=m((e,t)=>br(e,"name",{value:t,configurable:!0}),"r$f");const wr=X(function*(e){switch(e.declaration?.type){case"ClassDeclaration":case"FunctionDeclaration":{const{id:t}=e.declaration;ae(t,"Expected class/function to have a name"),yield t.name;break}case"VariableDeclaration":{for(const t of e.declaration.declarations)for(const o of Ro(t.id))yield o;break}}},"exportName"),$r=X(function*(e){if(e.declaration)for(const t of wr(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"),jr=X(function*(e){e.exported?yield{exportedName:e.exported.name,from:"self",type:"named"}:yield{from:"other",source:e.source.value,type:"barrel"}},"parseExportAll"),kr=X(function*(){yield{exportedName:"default",from:"self",type:"named"}},"parseExportDefault"),xr=X(function*(e,t){ae(t.code!=null,`Module ${t.id} doesn't have associated code`);const o=e.parse(t.code);for(const r of o.body)switch(r.type){case"ExportAllDeclaration":{yield*jr(r);break}case"ExportDefaultDeclaration":{yield*kr();break}case"ExportNamedDeclaration":{yield*$r(r);break}}},"parseExports");var Er=Object.defineProperty,Y=m((e,t)=>Er(e,"name",{value:t,configurable:!0}),"n$a");const Nt=Y(async function(e,t,o){const r=await e.resolve(t,o.id);if(ae(r,`Rollup can't resolve ${t} from ${o.id}`),r.external)return null;const n=await e.load(r);return ae(n,`Rollup doesn't have a module for id ${r.id}`),n},"getImportedModule"),Dr=Y(async function*(e,t,o){const r=await Nt(e,t.source,o);r&&(yield*Te(e,r))},"gatherBarrelReExports"),Sr=Y(async function*(e,t,o){const r=await Nt(e,t.source,o);if(!r)return;const n=new Map(t.bindings.map(i=>[i.importedName,i]));for await(const i of Te(e,r)){const s=n.get(i.exportedName);s&&(yield{...i,exportedName:s.exportedName})}},"gatherNamedReExports"),Or=Y(async function*(e,t){yield{exportedName:t.exportedName,id:e.id,sourceName:t.exportedName}},"gatherNamedSelfExports"),Te=Y(async function*(e,t){for(const o of xr(e,t))o.from==="self"?yield*Or(t,o):o.type==="barrel"?yield*Dr(e,o,t):yield*Sr(e,o,t)},"gatherExports");var Nr=Object.defineProperty,Pr=m((e,t)=>Nr(e,"name",{value:t,configurable:!0}),"r$e");const Cr=Pr(()=>({moduleParsed:{async handler(e){if(e.isEntry)for await(const t of Te(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 _r=Object.defineProperty,Tr=m((e,t)=>_r(e,"name",{value:t,configurable:!0}),"r$d");const Ir=Tr((e,t)=>{const o=e,r=[];let n;for(;(n=o.exec(t))!==null;)n.index===o.lastIndex&&o.lastIndex++,n.forEach(i=>{r.push(i)});return r.filter(Boolean)},"getRegexMatches");var Mr=Object.defineProperty,Ar=m((e,t)=>Mr(e,"name",{value:t,configurable:!0}),"a$e");const Pt=Ar(e=>{const t=Ir(/export\s(\{\s(.*)\s\}|default\s.*);/g,e);if(t.length===0)return null;const o=t.at(-1).split(", ");let r="";for(const n of o)if(!n.includes("type")&&(n.includes("default ")&&(r=n.split("default ")[1]),n.includes("as"))){const[i,s]=n.split(" as ");s==="default"&&(r=i)}if(r!==""){const n=new _(e);return n.replace(new RegExp(`(,s)?${r} as default(,)?`),""),n.replace(new RegExp(`export default ${r};
15
+ ?`),""),n.append(`
16
16
 
17
- export = `+s+";"),{code:r.toString().replace(/export\s\{\s\s\};/,""),map:r.generateMap({hires:!0})}}return null},"patchCjsDefaultExport");var jr=Object.defineProperty,vt=m((e,t)=>jr(e,"name",{value:t,configurable:!0}),"i$d");const co=vt(({addDefaultProperty:e=!1,logger:t,type:o})=>({name:"packem:cjs-interop",renderChunk:vt(async(s,r,n)=>{if(r.type!=="chunk"||!r.isEntry)return null;if(n.format==="cjs"&&n.exports==="auto"){const i=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(s);if(i===null||i.length<3)return null;const a=new H(s);a.replace("Object.defineProperty(exports, '__esModule', { value: true });",""),a.replaceAll(/exports\.(.*) = (.*);/g,"module.exports.$1 = $2;"),e&&a.append(`
18
- module.exports.default = `+i[2]+";");let c=a.toString();return c=c.replace(/(?:module\.)?exports(?:\['default'\]|\.default)/i,"module.exports"),t.debug({message:"Applied CommonJS interop to entry chunk "+r.fileName+".",prefix:"plugin:cjs-interop"}),{code:c,map:a.generateMap({hires:!0})}}return n.format==="es"&&/\.d\.(?:ts|cts)$/.test(r.fileName)?o!=="commonjs"&&r.fileName.endsWith(".d.mts")?null:lo(s):null},"renderChunk")}),"cjsInteropPlugin");var kr=Object.defineProperty,Er=m((e,t)=>kr(e,"name",{value:t,configurable:!0}),"f$c");const Sr=Er((e,t)=>{const o=new Map,s={copyOnce:!0,exactFileNames:!0,flatten:!1,...e};let{targets:r}=s;return Array.isArray(r)?r=r.map(n=>{if(typeof n=="string")return{src:n};if(typeof n=="object"&&"src"in n)return n}).filter(Boolean):typeof r=="string"&&(r=[{src:r}]),{async buildStart(){const n=await Promise.all(r.flatMap(i=>Array.isArray(i.src)?i.src.map(a=>({...i,src:a})):i).map(async i=>await $s(me(i.src),{ignore:me(i.exclude).filter(Boolean)}).then(a=>({dest:i.dest??"",parent:ws(i.src),src:a}))));for(const i of n)for(const a of i.src){let c;o.has(a)?c=o.get(a):(c={copied:[],dest:[],timestamp:0},o.set(a,c));const l=s.flatten?F(i.dest):$(i.dest,_(i.parent,J(a)));c.dest.includes(l)||c.dest.push(l),this.addWatchFile(a)}t.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...o].map(async([i,a])=>{let c;try{const l=await Ht(i);if(!l.isFile())return;const p=l.mtime.getTime();p>a.timestamp&&(a.timestamp=p,a.copied=[]),c=await st(i,{buffer:!0})}catch(l){t.error({context:[l],message:`error reading file ${i}`,prefix:"plugin:copy"});return}for(const l of a.dest){if(s.copyOnce&&a.copied.includes(l))continue;const p=le(i),d=$(l,p);try{this.emitFile({[s.exactFileNames?"fileName":"name"]:d,source:c,type:"asset"}),t.debug({message:`copied ${i} → ${d}`,prefix:"plugin:copy"}),a.copied.push(l)}catch(u){t.error({context:[u],message:`error copying file ${i} → ${d}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");function Or(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}m(Or,"getDefaultExportFromCjs");var Ue={exports:{}},bt;function Dr(){return bt||(bt=1,function(e){var t=Object.prototype.hasOwnProperty,o="~";function s(){}m(s,"Events"),Object.create&&(s.prototype=Object.create(null),new s().__proto__||(o=!1));function r(c,l,p){this.fn=c,this.context=l,this.once=p||!1}m(r,"EE");function n(c,l,p,d,u){if(typeof p!="function")throw new TypeError("The listener must be a function");var f=new r(p,d||c,u),g=o?o+l:l;return c._events[g]?c._events[g].fn?c._events[g]=[c._events[g],f]:c._events[g].push(f):(c._events[g]=f,c._eventsCount++),c}m(n,"addListener");function i(c,l){--c._eventsCount===0?c._events=new s:delete c._events[l]}m(i,"clearEvent");function a(){this._events=new s,this._eventsCount=0}m(a,"EventEmitter"),a.prototype.eventNames=m(function(){var l=[],p,d;if(this._eventsCount===0)return l;for(d in p=this._events)t.call(p,d)&&l.push(o?d.slice(1):d);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(p)):l},"eventNames"),a.prototype.listeners=m(function(l){var p=o?o+l:l,d=this._events[p];if(!d)return[];if(d.fn)return[d.fn];for(var u=0,f=d.length,g=new Array(f);u<f;u++)g[u]=d[u].fn;return g},"listeners"),a.prototype.listenerCount=m(function(l){var p=o?o+l:l,d=this._events[p];return d?d.fn?1:d.length:0},"listenerCount"),a.prototype.emit=m(function(l,p,d,u,f,g){var b=o?o+l:l;if(!this._events[b])return!1;var h=this._events[b],v=arguments.length,w,y;if(h.fn){switch(h.once&&this.removeListener(l,h.fn,void 0,!0),v){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,p),!0;case 3:return h.fn.call(h.context,p,d),!0;case 4:return h.fn.call(h.context,p,d,u),!0;case 5:return h.fn.call(h.context,p,d,u,f),!0;case 6:return h.fn.call(h.context,p,d,u,f,g),!0}for(y=1,w=new Array(v-1);y<v;y++)w[y-1]=arguments[y];h.fn.apply(h.context,w)}else{var D=h.length,x;for(y=0;y<D;y++)switch(h[y].once&&this.removeListener(l,h[y].fn,void 0,!0),v){case 1:h[y].fn.call(h[y].context);break;case 2:h[y].fn.call(h[y].context,p);break;case 3:h[y].fn.call(h[y].context,p,d);break;case 4:h[y].fn.call(h[y].context,p,d,u);break;default:if(!w)for(x=1,w=new Array(v-1);x<v;x++)w[x-1]=arguments[x];h[y].fn.apply(h[y].context,w)}}return!0},"emit"),a.prototype.on=m(function(l,p,d){return n(this,l,p,d,!1)},"on"),a.prototype.once=m(function(l,p,d){return n(this,l,p,d,!0)},"once"),a.prototype.removeListener=m(function(l,p,d,u){var f=o?o+l:l;if(!this._events[f])return this;if(!p)return i(this,f),this;var g=this._events[f];if(g.fn)g.fn===p&&(!u||g.once)&&(!d||g.context===d)&&i(this,f);else{for(var b=0,h=[],v=g.length;b<v;b++)(g[b].fn!==p||u&&!g[b].once||d&&g[b].context!==d)&&h.push(g[b]);h.length?this._events[f]=h.length===1?h[0]:h:i(this,f)}return this},"removeListener"),a.prototype.removeAllListeners=m(function(l){var p;return l?(p=o?o+l:l,this._events[p]&&i(this,p)):(this._events=new s,this._eventsCount=0),this},"removeAllListeners"),a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=o,a.EventEmitter=a,e.exports=a}(Ue)),Ue.exports}m(Dr,"requireEventemitter3");var Pr=Dr();const Nr=Or(Pr);class po extends Error{static{m(this,"TimeoutError")}constructor(t){super(t),this.name="TimeoutError"}}class Cr extends Error{static{m(this,"AbortError")}constructor(t){super(),this.name="AbortError",this.message=t}}const wt=m(e=>globalThis.DOMException===void 0?new Cr(e):new DOMException(e),"getDOMException"),$t=m(e=>{const t=e.reason===void 0?wt("This operation was aborted."):e.reason;return t instanceof Error?t:wt(t)},"getAbortedReason");function _r(e,t){const{milliseconds:o,fallback:s,message:r,customTimers:n={setTimeout,clearTimeout}}=t;let i;const c=new Promise((l,p)=>{if(typeof o!="number"||Math.sign(o)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${o}\``);if(t.signal){const{signal:u}=t;u.aborted&&p($t(u));const f=m(()=>{p($t(u))},"abortHandler");u.addEventListener("abort",f,{once:!0}),e.finally(()=>{u.removeEventListener("abort",f)})}if(o===Number.POSITIVE_INFINITY){e.then(l,p);return}const d=new po;i=n.setTimeout.call(void 0,()=>{if(s){try{l(s())}catch(u){p(u)}return}typeof e.cancel=="function"&&e.cancel(),r===!1?l():r instanceof Error?p(r):(d.message=r??`Promise timed out after ${o} milliseconds`,p(d))},o),(async()=>{try{l(await e)}catch(u){p(u)}})()}).finally(()=>{c.clear()});return c.clear=()=>{n.clearTimeout.call(void 0,i),i=void 0},c}m(_r,"pTimeout");function Ir(e,t,o){let s=0,r=e.length;for(;r>0;){const n=Math.trunc(r/2);let i=s+n;o(e[i],t)<=0?(s=++i,r-=n+1):r=n}return s}m(Ir,"lowerBound");class Mr{static{m(this,"PriorityQueue")}#e=[];enqueue(t,o){o={priority:0,...o};const s={priority:o.priority,run:t};if(this.size&&this.#e[this.size-1].priority>=o.priority){this.#e.push(s);return}const r=Ir(this.#e,s,(n,i)=>i.priority-n.priority);this.#e.splice(r,0,s)}dequeue(){return this.#e.shift()?.run}filter(t){return this.#e.filter(o=>o.priority===t.priority).map(o=>o.run)}get size(){return this.#e.length}}class Tr extends Nr{static{m(this,"PQueue")}#e;#o;#n=0;#a;#i;#m=0;#s;#c;#t;#g;#r=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:Mr,...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.#o=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.#o||this.#n<this.#a}get#w(){return this.#r<this.#p}#$(){this.#r--,this.#u(),this.emit("next")}#x(){this.#v(),this.#y(),this.#c=void 0}get#j(){const t=Date.now();if(this.#s===void 0){const o=this.#m-t;if(o<0)this.#n=this.#e?this.#r:0;else return this.#c===void 0&&(this.#c=setTimeout(()=>{this.#x()},o)),!0}return!1}#u(){if(this.#t.size===0)return this.#s&&clearInterval(this.#s),this.#s=void 0,this.emit("empty"),this.#r===0&&this.emit("idle"),!1;if(!this.#l){const t=!this.#j;if(this.#b&&this.#w){const o=this.#t.dequeue();return o?(this.emit("active"),o(),t&&this.#y(),!0):!1}}return!1}#y(){this.#o||this.#s!==void 0||(this.#s=setInterval(()=>{this.#v()},this.#i),this.#m=Date.now()+this.#i)}#v(){this.#n===0&&this.#r===0&&this.#s&&(clearInterval(this.#s),this.#s=void 0),this.#n=this.#e?this.#r: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((o,s)=>{t.addEventListener("abort",()=>{s(t.reason)},{once:!0})})}async add(t,o={}){return o={timeout:this.timeout,throwOnTimeout:this.#h,...o},new Promise((s,r)=>{this.#t.enqueue(async()=>{this.#r++,this.#n++;try{o.signal?.throwIfAborted();let n=t({signal:o.signal});o.timeout&&(n=_r(Promise.resolve(n),{milliseconds:o.timeout})),o.signal&&(n=Promise.race([n,this.#k(o.signal)]));const i=await n;s(i),this.emit("completed",i)}catch(n){if(n instanceof po&&!o.throwOnTimeout){s();return}r(n),this.emit("error",n)}finally{this.#$()}},o),this.emit("add"),this.#u()})}async addAll(t,o){return Promise.all(t.map(async s=>this.add(s,o)))}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.#r===0&&this.#t.size===0||await this.#f("idle")}async#f(t,o){return new Promise(s=>{const r=m(()=>{o&&!o()||(this.off(t,r),s())},"listener");this.on(t,r)})}get size(){return this.#t.size}sizeBy(t){return this.#t.filter(t).length}get pending(){return this.#r}get isPaused(){return this.#l}}var Ar=Object.defineProperty,Rr=m((e,t)=>Ar(e,"name",{value:t,configurable:!0}),"r$d");const xt=Rr((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 Fr=Object.defineProperty,Jr=m((e,t)=>Fr(e,"name",{value:t,configurable:!0}),"a$h");const Lr=4,Br=process.env.UV_THREADPOOL_SIZE?Number.parseInt(process.env.UV_THREADPOOL_SIZE,10):Lr;let Wr=class{static{m(this,"f")}static{Jr(this,"LoaderManager")}test;loaders=new Map;options;workQueue;logger;constructor({extensions:t,loaders:o,logger:s,options:r}){this.test=n=>t.some(i=>n.toLowerCase().endsWith(i)),o.length>0&&this.add(...o),this.options=r,this.logger=s}add(...t){for(const o of t)this.loaders.has(o.name)||this.loaders.set(o.name,o)}isSupported(t){if(this.test(t))return!0;for(const[,o]of this.loaders)if(xt(t,o.test))return!0;return!1}async process(t,o){this.workQueue||(this.workQueue=new Tr({concurrency:Br-1}));for await(const[s,r]of this.loaders){const n={...o,options:this.options[s]??{}};if(r.alwaysProcess||xt(n.id,r.test)){this.logger.debug(`Processing ${s} loader for ${n.id}`);const i=await this.workQueue.add(r.process.bind(n,t));i&&(t=i)}}return t}};const zr=/data:[^\n\r;]+(?:;charset=[^\n\r;]+)?;base64,([\d+/A-Za-z]+={0,2})/;var Vr=Object.defineProperty,Re=m((e,t)=>Vr(e,"name",{value:t,configurable:!0}),"i$c");const uo=/(?:\n|\r\n)?\/\*[#*@]+\s*sourceMappingURL\s*=\s*(\S+)\s*\*+\//g,fo=/(?:\n|\r\n)?\/\/[#@]+\s*sourceMappingURL\s*=\s*(\S+)\s*?$/gm;let Ur=class{static{m(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(o=>t(o))),this):this}resolve(t=process.cwd()){return this.modifySources(o=>o==="<no source>"?o:j(t,o))}relative(t=process.cwd()){return this.modifySources(o=>o==="<no source>"?o:Ae(o)?_(t,o):F(o))}toObject(){return this.map}toString(){return this.map?JSON.stringify(this.map):this.map}toConsumer(){return this.map?new js(this.map):this.map}toCommentData(){const t=this.toString();return t?`
19
- /*# sourceMappingURL=data:application/json;base64,${Buffer.from(t).toString("base64")} */`:""}toCommentFile(t){return this.map?`
20
- /*# sourceMappingURL=${t} */`:""}};Re(async(e,t)=>{const[,o]=uo.exec(e)??fo.exec(e)??[];if(!o)return;const[,s]=zr.exec(o)??[];if(s)return Buffer.from(s,"base64").toString();if(!t)throw new Error("Extracted map detected, but no ID is provided");const r=j(J(t),o);if(T(r))return Me(r)},"getMap");Re(e=>e.replaceAll(uo,"").replaceAll(fo,""),"stripMap");const Qe=Re(e=>new Ur(e),"mm");var qr=Object.defineProperty,Hr=m((e,t)=>qr(e,"name",{value:t,configurable:!0}),"u$f");const Kr=Hr(async e=>{const t=new ks({file:""}),o=[];let s=0;for await(const{css:r,map:n}of e){o.push(r);const i=Qe(n),a=i.toObject();if(!a)continue;const c=i.toConsumer();if(c){if(c.eachMapping(l=>{t.addMapping({generated:{column:l.generatedColumn,line:s+l.generatedLine},name:l.name,original:{column:l.originalColumn,line:l.originalLine},source:l.source})}),a.sourcesContent)for(const l of a.sources)t.setSourceContent(l,c.sourceContentFor(l,!0));s+=r.split(`
21
- `).length}}return{css:o.join(`
22
- `),map:t}},"concat");var Gr=Object.defineProperty,Yr=m((e,t)=>Gr(e,"name",{value:t,configurable:!0}),"s$c");const mo=Yr(e=>e.map((t,o,s)=>{const r=`\`${t}\``;switch(o){case s.length-1:return`or ${r}`;case s.length-2:return r;default:return`${r},`}}).join(" "),"default");var Xr=Object.defineProperty,Qr=m((e,t)=>Xr(e,"name",{value:t,configurable:!0}),"l$a");const Zr=J(oo(import.meta.url)),jt=Qr((e,t)=>{const o={baseDirs:[Zr],caller:"Resolver",extensions:[".mjs",".js",".cjs",".json"],symlinks:!0,...t},s=new Ps({extensions:o.extensions,symlinks:o.symlinks});for(const r of o.baseDirs)for(const n of e)try{const{error:i,path:a}=s.sync(r,n);if(a)return a;i&&console.debug(i,{context:{basedir:r,caller:t.caller,extensions:t.extensions,id:n}})}catch(i){console.debug(i.message,{context:{basedir:r,caller:t.caller,error:i,extensions:t.extensions,id:n}})}throw new Error(`${o.caller} could not resolve ${mo(e)}`)},"resolve");var en=Object.defineProperty,tn=m((e,t)=>en(e,"name",{value:t,configurable:!0}),"t$c");const Z={},on=[".js",".mjs",".cjs",".json"],sn=tn(async(e,t)=>{if(Z[e])return Z[e];if(Z[e]===null)return;const o={baseDirs:[t],caller:"Module loader",extensions:on,symlinks:!1};try{Z[e]=require(jt([e,`./${e}`],o))}catch(s){if(s.code==="ERR_REQUIRE_ESM")try{Z[e]=Es(await Ss(jt([e,`./${e}`],o)))}catch{}else{Z[e]=null;return}}return Z[e]},"default");var rn=Object.defineProperty,ce=m((e,t)=>rn(e,"name",{value:t,configurable:!0}),"r$c");const go=["inject","extract","emit"],nn=mo(go),an=ce(e=>{const t=Array.isArray(e)?e:[e];if(t[0]&&!go.includes(t[0]))throw new Error(`Incorrect mode provided, allowed modes are ${nn}`);return{emit:t[0]==="emit",extract:t[0]==="extract"&&(t[1]??!0),inject:(!t[0]||t[0]==="inject")&&(t[1]??!0)}},"inferModeOption"),Ze=ce((e,t)=>typeof e=="boolean"?e&&{}:typeof e=="object"?e:t,"inferOption"),ln=ce(e=>{const t=Array.isArray(e)?e:[e];return t[0]?{content:!0,...t[1],inline:t[0]==="inline"}:!1},"inferSourceMapOption"),kt=ce((e,t)=>{const o=Ze(e,{});return t&&typeof o=="object"&&!o.alias&&(o.alias=t),o},"inferHandlerOption"),ae=ce(async(e,t,o)=>{if(typeof e!="string")return e;const s=await sn(e,o);if(!s)throw new Error(`Unable to load PostCSS ${t} \`${e}\``);return s},"ensurePCSSOption"),cn=ce(async(e,t)=>{if(e===void 0)return[];if(e.length===0)return[];const o=[];for await(const s of e.filter(Boolean)){if(!Array.isArray(s)){o.push(await ae(s,"plugin",t));continue}const[r,n]=s;n?o.push((await ae(r,"plugin",t))(n)):o.push(await ae(r,"plugin",t))}return o},"ensurePCSSPlugins");var pn=Object.defineProperty,fe=m((e,t)=>pn(e,"name",{value:t,configurable:!0}),"b$4");const un=fe(async(e,t)=>e.sort((o,s)=>t.indexOf(o.name)-t.indexOf(s.name)),"sortByNameOrder"),dn=fe(async(e,t,o,s,r,n,i,a,c,l)=>{const p={...l,...e.alias},d=oe(e.include,e.exclude),u=ln(e.sourceMap),f={...an(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 g=!1;if(e.loaders)for(const w of e.loaders)w.name==="postcss"&&(g=!0);else e.loaders=[];g&&(f.postcss={...e.postcss,config:Ze(e.postcss?.config,{}),import:kt(e.postcss?.import,p),modules:Ze(e.postcss?.modules,void 0),to:e.postcss?.to,url:kt(e.postcss?.url,p)},e.postcss?.parser&&(f.postcss.parser=await ae(e.postcss.parser,"parser",s)),e.postcss?.syntax&&(f.postcss.syntax=await ae(e.postcss.syntax,"syntax",s)),e.postcss?.stringifier&&(f.postcss.stringifier=await ae(e.postcss.stringifier,"stringifier",s)),e.postcss?.plugins&&(f.postcss.plugins=await cn(e.postcss.plugins,s)));const b=new Wr({extensions:f.extensions,loaders:await un(e.loaders,["sourcemap","stylus","less","sass","postcss"]),logger:t,options:{...e,...f,alias:p}});let h=[];const v=fe((w,y)=>{const D=[];for(const x of Object.keys(w)){const P=new Set;let A=[x];do{const V=[];for(const R of A){if(P.has(R))continue;if(b.isSupported(R)){d(R)&&V.push(R);continue}P.add(R);const ve=y(R);ve&&V.push(...ve.importedIds)}A=V}while(A.some(V=>!b.isSupported(V)));D.push(...A)}return D},"traverseImportedModules");return{augmentChunkHash(w){if(h.length===0)return null;const y=v(w.modules,this.getModuleInfo),D=h.filter(x=>y.includes(x.id)).sort((x,P)=>y.lastIndexOf(x.id)-y.lastIndexOf(P.id)).map(x=>`${le(x.id)}:${x.css}`);return D.length===0?null:D.join(":")},async generateBundle(w,y){if(h.length===0||!(w.dir||w.file))return;const D=Object.values(y),x=w.dir??J(w.file),P=D.filter(S=>S.type==="chunk"),A=P.filter(S=>!S.facadeModuleId),V=w.preserveModules?P:P.filter(S=>S.isEntry||S.isDynamicEntry),R=[],ve=fe(async(S,N)=>{const k=typeof f.extract=="string"?F(f.extract).replace(/^\.[/\\]/,""):F(`${S}.css`);Ae(k)&&this.error(["Extraction path must be relative to the output directory,",`which is ${_(s,x)}`].join(`
23
- `)),Zt(k)&&this.error(["Extraction path must be nested inside output directory,",`which is ${_(s,x)}`].join(`
24
- `));const L=h.filter(B=>N.includes(B.id)).sort((B,re)=>N.lastIndexOf(B.id)-N.lastIndexOf(re.id)),we=await Kr(L);return{css:we.css,map:Qe(we.map.toString()).relative(J(j(x,k))).toString(),name:k}},"getExtractedData"),We=fe(S=>{if(w.file)return Ve(w.file).name;if(w.preserveModules){const{dir:N,name:k}=Ve(S.fileName);return N?$(N,k):k}return S.name},"getName"),be=[];if(typeof f.extract=="string"){t.debug({message:`Extracting to ${f.extract}`,prefix:"css"});const S=[];for(const k of A){const L=v(k.modules,this.getModuleInfo);be.push(...L),S.push(...L)}for(const k of V)S.push(...v(k.modules,this.getModuleInfo).filter(L=>!be.includes(L)));const N=We(P[0]);R.push([N,S])}else{t.debug({message:"Extracting to individual files",prefix:"css"});for(const S of A){const N=v(S.modules,this.getModuleInfo);if(N.length===0)continue;be.push(...N);const k=We(S);R.push([k,N])}for(const S of V){const N=v(S.modules,this.getModuleInfo).filter(L=>!be.includes(L));if(N.length===0)continue;const k=We(S);R.push([k,N])}}for await(const[S,N]of R){const k=await ve(S,N);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:B,map:re}=await e.minifier.handler.bind({browserTargets:o,warn:this.warn.bind(this)})(k,u,e[e.minifier.name]??{});k.css=B,k.map=re}const L={fileName:k.name,name:k.name,names:[k.name],originalFileName:k.name,originalFileNames:[k.name],source:k.css,type:"asset"},we=this.emitFile(L);if(k.map&&u){const B=this.getFileName(we),re=typeof w.assetFileNames=="string"?F(J(w.assetFileNames)):typeof w.assetFileNames=="function"?F(J(w.assetFileNames(L))):"assets",pe=Qe(k.map).modify(C=>(C.file=le(B),C)).modifySources(C=>{if(C==="<no source>"||re.length<=1)return C;C=`../${C}`;for(const ze of re)ze==="/"&&(C=`../${C}`);return C});if(u.inline)pe.modify(C=>u.transform?.(C,F($(x,B)))),y[B].source+=pe.toCommentData();else{const C=`${B}.map`;pe.modify(zo=>u.transform?.(zo,F($(x,C)))),this.emitFile({fileName:C,source:pe.toString(),type:"asset"});const{base:ze}=Ve(C);y[B].source+=pe.toCommentFile(ze)}}}},name:"packem:css",async transform(w,y){if(!d(y)||!b.isSupported(y)||w.replaceAll(/\s/g,"")==="")return null;try{return this.parse(w,{}),this.warn(`Skipping processed file ${_(s,y)}`),null}catch{}typeof e.onImport=="function"&&e.onImport(w,y);const D={alias:p,assets:new Map,autoModules:f.autoModules,browserTargets:o,cwd:s,debug:a,deps:new Set,dts:f.dts,emit:f.emit,environment:n,extensions:f.extensions,extract:f.extract,id:y,inject:f.inject,logger:t,namedExports:f.namedExports,options:{},plugin:this,sourceDir:r,sourceMap:u,useSourcemap:i,warn:this.warn.bind(this)},x=await b.process({code:w},D);for(const P of D.deps)this.addWatchFile(P);for(const[P,A]of D.assets)this.emitFile({fileName:P,source:A,type:"asset"});if(x.extracted){const{id:P}=x.extracted;h=h.filter(A=>A.id!==P),h.push(x.extracted)}return{code:x.code,map:u&&x.map?x.map:{mappings:""},meta:{styles:x.meta},moduleSideEffects:x.extracted?!0:null}}}},"default");var fn=Object.defineProperty,mn=m((e,t)=>fn(e,"name",{value:t,configurable:!0}),"t$b");const gn=/\.module\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/,qe=mn((e,t)=>e===void 0?!0:typeof e=="function"?e(t):e instanceof RegExp?e.test(t):e&&gn.test(t),"ensureAutoModules");var hn=Object.defineProperty,yn=m((e,t)=>hn(e,"name",{value:t,configurable:!0}),"u$c");const vn=`
25
- /* eslint-disable */
26
- /* prettier-ignore */
27
- // @ts-nocheck
28
- /**
29
- * Generated by packem
30
- * @see https://npmjs.com/@visulima/packem
31
- */
32
- `.trim(),bn=yn((e,t,o)=>{let s;return e.postcss&&typeof e.postcss.modules=="boolean"?s=e.postcss.modules:e.lightningcss&&typeof e.lightningcss.modules=="boolean"&&(s=e.lightningcss.modules),{async transform(r,n){let i=s;if(e.postcss&&typeof e.postcss.modules=="object"?i=qe(e.postcss.modules.include,n):e.lightningcss&&typeof e.lightningcss.modules=="object"&&(i=qe(e.lightningcss.modules.include,n)),e.autoModules&&i===void 0&&(i=qe(e.autoModules,n)),!i)return null;const{types:a}=this.getModuleInfo(n)?.meta.styles??{};return a===void 0||await ot(n)&&(await zt(n+".d.ts",`${vn}
33
- ${a}`),o.info({message:`Generated types for ${F(n).replace(t+"/","")}`,prefix:"dts:css-modules"}),this.addWatchFile(n+".d.ts")),null}}},"cssModulesTypes");var wn=Object.defineProperty,Fe=m((e,t)=>wn(e,"name",{value:t,configurable:!0}),"t$a");const $n=/\Wrequire(?:\.resolve)?\(/,xn=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 o=!1,s=!1,r=!1;if(e.includes("__filename")&&(o=!0),e.includes("__dirname")&&(s=!0),$n.test(e)&&(r=!0),!o&&!s&&!r)return null;const n=to(e).pop(),i=n?n.end:0,a=new H(e);return a.appendRight(i,t(o,s,r)),{code:a.toString(),map:a.generateMap()}},"CJSToESM"),jn=Fe((e,t,o)=>{let s="";return(e||t)&&(s+=`import __cjs_url__ from "node:url"; // -- packem CommonJS __filename shim --
34
- `),t&&(s+=`import __cjs_path__ from "node:path"; // -- packem CommonJS __dirname shim --
35
- `),o&&(s+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
36
- `),(e||t)&&(s+=`const __filename = __cjs_url__.fileURLToPath(import.meta.url);
37
- `),t&&(s+=`const __dirname = __cjs_path__.dirname(__filename);
38
- `),o&&(s+=`const require = __cjs_mod__.createRequire(import.meta.url);
39
- `),s},"generateCJSShim"),kn=Fe((e,t,o)=>{let s="";return o&&(s+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
40
- `),e&&(s+=`const __filename = import.meta.filename; // -- packem CommonJS __filename shim --
41
- `),t&&(s+=`const __dirname = import.meta.dirname; // -- packem CommonJS __dirname shim --
42
- `),o&&(s+=`const require = __cjs_mod__.createRequire(import.meta.url);
43
- `),s},"generateCJSShimNode20_11"),En=Fe((e,t)=>{const o=oe(t.include,t.exclude);return{name:"packem:esm-shim-cjs-syntax",renderChunk(s,r,n){if(n.format==="es"&&o(r.fileName)){let i=jn;if(e.engines?.node){const a=eo(e.engines.node);a&&a.major>=20&&a.minor>=11&&(i=kn)}return xn(s,i)}return null}}},"esmShimCjsSyntaxPlugin");var Sn=Object.defineProperty,On=m((e,t)=>Sn(e,"name",{value:t,configurable:!0}),"m$a");const Dn=On(()=>({name:"packem:fix-dynamic-import-extension",renderChunk(e,t,o){return o.format==="es"||o.format==="cjs"?{code:e.replaceAll(/(import\(.*)(.ts)(['´"`]\))/g,"$1."+(o.format==="es"?"mjs":"cjs")+"$3"),map:null}:null}}),"fixDynamicImportExtension");var Pn=Object.defineProperty,Nn=m((e,t)=>Pn(e,"name",{value:t,configurable:!0}),"a$d");const Cn=Nn((e,t)=>{const o=e.replace(/^\.\//,""),s=t.replace(/^\.\//,"");if(s.startsWith(o))return e+s.slice(o.length);if(e.endsWith(t))return e;const r=e.split("/"),n=t.split("/");let i=r.length-1,a=n.length-1;for(;i>=0&&a>=0&&r[i]===n[a];)i--,a--;const c=r.slice(0,i).join("/"),l=n.slice(a).join("/");return c+(l?"/"+l:"")},"extendString");var _n=Object.defineProperty,In=m((e,t)=>_n(e,"name",{value:t,configurable:!0}),"s$b");const Mn=In((...e)=>{if(e.length===0)return"";if(e.length===1)return J(e[0]);e=e.map(r=>Oe(r));const[t,...o]=e;let s=t.split("/");for(const r of o){const n=r.split("/",s.length);let i=0;for(const a of n)if(a===s[i])i+=1;else{s=s.slice(0,i);break}s=s.slice(0,i)}return s.length<=1&&s[0]===""?`/${s[0]}`:s.join("/")},"lowestCommonAncestor");var Tn=Object.defineProperty,He=m((e,t)=>Tn(e,"name",{value:t,configurable:!0}),"m$8");const An=He((e,t,o,s,r={})=>{const n=oe(r.include,r.exclude),i={},a=He((l,p)=>{i[l.replace(te,"")]=p},"addOutput");async function c(l,p){if(!n(p))return;let d;try{const b=await Ns(l,{sourceFilename:p});d=JSON.parse(b.program)}catch{}if(d){const b=d.body.filter(h=>h.type==="ImportDeclaration"||h.type==="ExportAllDeclaration"||h.type==="ExportNamedDeclaration");for(const h of b){if(!h.source||le(h.source.value).includes("."))continue;const v=await this.resolve(h.source.value,p);if(!(!v||v.external)&&(v.id.endsWith(".ts")||v.id.endsWith(".cts")||v.id.endsWith(".mts")||v.id.endsWith(".tsx")||v.id.endsWith(".ctsx")||v.id.endsWith(".mtsx"))){const w=v.id.replace(e+"/","");l=l.replaceAll('from "'+h.source.value+'"','from "'+Cn(h.source.value,w)+'"')}}}const{errors:u,sourceText:f}=await t(p,l);if(u.length>0){if(r.ignoreErrors){this.warn(u[0]);return}return this.error(u[0])}if(a(p,f),!d)return;const g=d.body.filter(b=>b.type==="ImportDeclaration"?b.importKind==="type"?!0:b.specifiers?.every(h=>h.type==="ImportSpecifier"&&h.importKind==="type"):b.type==="ExportNamedDeclaration"||b.type==="ExportAllDeclaration"?b.exportKind==="type"?!0:b.type==="ExportNamedDeclaration"&&b.specifiers?.every(h=>h.type==="ExportSpecifier"&&h.exportKind==="type"):!1);for await(const b of g){if(!b.source)continue;const h=await this.resolve(b.source.value,p);if(!h)return;const v=h.id;if(n(v)&&!i[v.replace(te,"")])try{const w=await st(v);await c.call(this,w,v)}catch{}}}return m(c,"h"),He(c,"transform"),{name:"packem:isolated-declarations",async renderStart(l,{input:p}){const d=Mn(...Array.isArray(p)?p:Object.values(p));typeof l.entryFileNames=="function"&&(l.entryFileNames=l.entryFileNames({name:l.name}));const u=l.entryFileNames.replace(/\.(.)?[jt]sx?$/,(f,g)=>`.d.${g||""}ts`);for await(let[f,g]of Object.entries(i)){if(s&&l.format==="cjs"){const h=lo(g);h!==null&&(g=h.code)}const b=g.includes("from '")?"'":'"';(o===!0||o==="compatible")&&l.format==="cjs"&&this.emitFile({fileName:u.replace("[name]",_(d,f)).replace(".cts",".ts"),source:g.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(h,v,w,y)=>v+b+(y||w)+".d.ts"+b+";"),type:"asset"}),this.emitFile({fileName:u.replace("[name]",_(d,f)),source:g.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(h,v,w,y)=>v+b+(y||w)+(l.format==="cjs"?".d.cts":".d.mts")+b+";"),type:"asset"})}},transform:c}},"isolatedDeclarationsPlugin");var Rn=Object.defineProperty,Fn=m((e,t)=>Rn(e,"name",{value:t,configurable:!0}),"n$7");const Et="export default ",ho=Fn(e=>{const t=Cs(e);return{...t,name:"packem:json",transform(o,s){const r=t.transform?.call(this,o,s);return r&&typeof r!="string"&&"code"in r&&r.code?.startsWith(Et)&&(r.code=r.code.replace(Et,"module.exports = ")),r}}},"JSONPlugin");class Jn{static{m(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:m(()=>this.should_skip=!0,"skip"),remove:m(()=>this.should_remove=!0,"remove"),replace:m(t=>this.replacement=t,"replace")}}replace(t,o,s,r){t&&o&&(s!=null?t[o][s]=r:t[o]=r)}remove(t,o,s){t&&o&&(s!=null?t[o].splice(s,1):delete t[o])}}class Ln extends Jn{static{m(this,"SyncWalker")}constructor(t,o){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:m(()=>this.should_skip=!0,"skip"),remove:m(()=>this.should_remove=!0,"remove"),replace:m(s=>this.replacement=s,"replace")},this.enter=t,this.leave=o}visit(t,o,s,r){if(t){if(this.enter){const i=this.should_skip,a=this.should_remove,c=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,t,o,s,r),this.replacement&&(t=this.replacement,this.replace(o,s,r,t)),this.should_remove&&this.remove(o,s,r);const l=this.should_skip,p=this.should_remove;if(this.should_skip=i,this.should_remove=a,this.replacement=c,l)return t;if(p)return null}let n;for(n in t){const i=t[n];if(i&&typeof i=="object")if(Array.isArray(i)){const a=i;for(let c=0;c<a.length;c+=1){const l=a[c];St(l)&&(this.visit(l,t,n,c)||c--)}}else St(i)&&this.visit(i,t,n,null)}if(this.leave){const i=this.replacement,a=this.should_remove;this.replacement=null,this.should_remove=!1,this.leave.call(this.context,t,o,s,r),this.replacement&&(t=this.replacement,this.replace(o,s,r,t)),this.should_remove&&this.remove(o,s,r);const c=this.should_remove;if(this.replacement=i,this.should_remove=a,c)return null}}return t}}function St(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"}m(St,"isNode");function yo(e,{enter:t,leave:o}){return new Ln(t,o).visit(e,null)}m(yo,"walk");var Bn=Object.defineProperty,Wn=m((e,t)=>Bn(e,"name",{value:t,configurable:!0}),"u$b");const zn=Wn(({attributes:e,logger:t})=>{const o=oe([/\.[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(s,r){if(!o(r))return null;let n=null;try{n=this.parse(s,{allowReturnOutsideFunction:!0})}catch(c){return this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${r}" and remove the jsx attribute.`}),t.warn(c),null}let i=!1;const a=new H(s);return yo(n,{enter(c){if(c.type==="CallExpression"&&c.callee.type==="Identifier"&&c.callee.name==="jsx"){const l=c.arguments.filter(p=>p.type==="ObjectExpression"&&Array.isArray(p.properties));for(const p of l)for(const d of p.properties)d.type==="Property"&&d.key.type==="Literal"&&d.value.type==="Literal"&&e.includes(d.key.value)&&(a.overwrite(d.start-2,d.end,""),i=!0)}}}),i?{code:a.toString(),map:a.generateMap({hires:!0})}:null}}},"jsxRemoveAttributes");var Vn=Object.defineProperty,Un=m((e,t)=>Vn(e,"name",{value:t,configurable:!0}),"r$a");const qn=Un((e,t,o)=>{const s=new RegExp(`(<!-- ${t} -->)[\\s\\S]*?(<!-- /${t} -->)`,"g");if(s.test(e))return e.replace(s,`$1
17
+ export = `+r+";"),{code:n.toString().replace(/export\s\{\s\s\};/,""),map:n.generateMap({hires:!0})}}return null},"patchCjsDefaultExport");var Rr=Object.defineProperty,Ke=m((e,t)=>Rr(e,"name",{value:t,configurable:!0}),"i$a");const Ct=Ke(({addDefaultProperty:e=!1,logger:t,type:o})=>({name:"packem:cjs-interop",renderChunk:Ke(async(r,n,i)=>{if(n.type!=="chunk"||!n.isEntry)return null;if(i.format==="cjs"&&i.exports==="auto"){const s=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(r);if(s===null||s.length<3)return null;const a=new _(r);a.replace("Object.defineProperty(exports, '__esModule', { value: true });",""),a.replaceAll(/exports\.(.*) = (.*);/g,"module.exports.$1 = $2;"),e&&a.append(`
18
+ module.exports.default = `+s[2]+";");let l=a.toString();return l=l.replace(/(?:module\.)?exports(?:\['default'\]|\.default)/i,"module.exports"),t.debug({message:"Applied CommonJS interop to entry chunk "+n.fileName+".",prefix:"plugin:cjs-interop"}),{code:l,map:a.generateMap({hires:!0})}}return i.format==="es"&&/\.d\.(?:ts|cts)$/.test(n.fileName)?o!=="commonjs"&&n.fileName.endsWith(".d.mts")?null:Pt(r):null},"renderChunk")}),"cjsInteropPlugin");var Fr=Object.defineProperty,Jr=m((e,t)=>Fr(e,"name",{value:t,configurable:!0}),"f$9");const Br=Jr((e,t)=>{const o=new Map,r={copyOnce:!0,exactFileNames:!0,flatten:!1,...e};let{targets:n}=r;return Array.isArray(n)?n=n.map(i=>{if(typeof i=="string")return{src:i};if(typeof i=="object"&&"src"in i)return i}).filter(Boolean):typeof n=="string"&&(n=[{src:n}]),{async buildStart(){const i=await Promise.all(n.flatMap(s=>Array.isArray(s.src)?s.src.map(a=>({...s,src:a})):s).map(async s=>await Jo(q(s.src),{ignore:q(s.exclude).filter(Boolean)}).then(a=>({dest:s.dest??"",parent:Fo(s.src),src:a}))));for(const s of i)for(const a of s.src){let l;o.has(a)?l=o.get(a):(l={copied:[],dest:[],timestamp:0},o.set(a,l));const c=r.flatten?dt(s.dest):w(s.dest,O(s.parent,V(a)));l.dest.includes(c)||l.dest.push(c),this.addWatchFile(a)}t.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...o].map(async([s,a])=>{let l;try{const c=await ht(s);if(!c.isFile())return;const u=c.mtime.getTime();u>a.timestamp&&(a.timestamp=u,a.copied=[]),l=await Oe(s,{buffer:!0})}catch(c){t.error({context:[c],message:`error reading file ${s}`,prefix:"plugin:copy"});return}for(const c of a.dest){if(r.copyOnce&&a.copied.includes(c))continue;const u=fe(s),p=w(c,u);try{this.emitFile({[r.exactFileNames?"fileName":"name"]:p,source:l,type:"asset"}),t.debug({message:`copied ${s} → ${p}`,prefix:"plugin:copy"}),a.copied.push(c)}catch(d){t.error({context:[d],message:`error copying file ${s} → ${p}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");var Wr=Object.defineProperty,ge=m((e,t)=>Wr(e,"name",{value:t,configurable:!0}),"t$9");const Lr=/\Wrequire(?:\.resolve)?\(/,Vr=ge((e,t)=>{if(ne.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 o=!1,r=!1,n=!1;if(e.includes("__filename")&&(o=!0),e.includes("__dirname")&&(r=!0),Lr.test(e)&&(n=!0),!o&&!r&&!n)return null;const i=xt(e).pop(),s=i?i.end:0,a=new _(e);return a.appendRight(s,t(o,r,n)),{code:a.toString(),map:a.generateMap()}},"CJSToESM"),zr=ge((e,t,o)=>{let r="";return(e||t)&&(r+=`import __cjs_url__ from "node:url"; // -- packem CommonJS __filename shim --
19
+ `),t&&(r+=`import __cjs_path__ from "node:path"; // -- packem CommonJS __dirname shim --
20
+ `),o&&(r+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
21
+ `),(e||t)&&(r+=`const __filename = __cjs_url__.fileURLToPath(import.meta.url);
22
+ `),t&&(r+=`const __dirname = __cjs_path__.dirname(__filename);
23
+ `),o&&(r+=`const require = __cjs_mod__.createRequire(import.meta.url);
24
+ `),r},"generateCJSShim"),Ur=ge((e,t,o)=>{let r="";return o&&(r+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
25
+ `),e&&(r+=`const __filename = import.meta.filename; // -- packem CommonJS __filename shim --
26
+ `),t&&(r+=`const __dirname = import.meta.dirname; // -- packem CommonJS __dirname shim --
27
+ `),o&&(r+=`const require = __cjs_mod__.createRequire(import.meta.url);
28
+ `),r},"generateCJSShimNode20_11"),Kr=ge((e,t)=>{const o=z(t.include,t.exclude);return{name:"packem:esm-shim-cjs-syntax",renderChunk(r,n,i){if(i.format==="es"&&o(n.fileName)){let s=zr;if(e.engines?.node){const a=kt(e.engines.node);a&&a.major>=20&&a.minor>=11&&(s=Ur)}return Vr(r,s)}return null}}},"esmShimCjsSyntaxPlugin");var Hr=Object.defineProperty,qr=m((e,t)=>Hr(e,"name",{value:t,configurable:!0}),"m$a");const Gr=qr(()=>({name:"packem:fix-dynamic-import-extension",renderChunk(e,t,o){return o.format==="es"||o.format==="cjs"?{code:e.replaceAll(/(import\(.*)(.ts)(['´"`]\))/g,"$1."+(o.format==="es"?"mjs":"cjs")+"$3"),map:null}:null}}),"fixDynamicImportExtension");var Xr=Object.defineProperty,Yr=m((e,t)=>Xr(e,"name",{value:t,configurable:!0}),"a$d");const Qr=Yr((e,t)=>{const o=e.replace(/^\.\//,""),r=t.replace(/^\.\//,"");if(r.startsWith(o))return e+r.slice(o.length);if(e.endsWith(t))return e;const n=e.split("/"),i=t.split("/");let s=n.length-1,a=i.length-1;for(;s>=0&&a>=0&&n[s]===i[a];)s--,a--;const l=n.slice(0,s).join("/"),c=i.slice(a).join("/");return l+(c?"/"+c:"")},"extendString");var Zr=Object.defineProperty,en=m((e,t)=>Zr(e,"name",{value:t,configurable:!0}),"s$c");const tn=en((...e)=>{if(e.length===0)return"";if(e.length===1)return V(e[0]);e=e.map(n=>se(n));const[t,...o]=e;let r=t.split("/");for(const n of o){const i=n.split("/",r.length);let s=0;for(const a of i)if(a===r[s])s+=1;else{r=r.slice(0,s);break}r=r.slice(0,s)}return r.length<=1&&r[0]===""?`/${r[0]}`:r.join("/")},"lowestCommonAncestor");var on=Object.defineProperty,we=m((e,t)=>on(e,"name",{value:t,configurable:!0}),"m$8");const rn=we((e,t,o,r,n={})=>{const i=z(n.include,n.exclude),s={},a=we((c,u)=>{s[c.replace(J,"")]=u},"addOutput");async function l(c,u){if(!i(u))return;let p;try{const g=await Vo(c,{sourceFilename:u});p=JSON.parse(g.program)}catch{}if(p){const g=p.body.filter(h=>h.type==="ImportDeclaration"||h.type==="ExportAllDeclaration"||h.type==="ExportNamedDeclaration");for(const h of g){if(!h.source||fe(h.source.value).includes("."))continue;const b=await this.resolve(h.source.value,u);if(!(!b||b.external)&&(b.id.endsWith(".ts")||b.id.endsWith(".cts")||b.id.endsWith(".mts")||b.id.endsWith(".tsx")||b.id.endsWith(".ctsx")||b.id.endsWith(".mtsx"))){const x=b.id.replace(e+"/","");c=c.replaceAll('from "'+h.source.value+'"','from "'+Qr(h.source.value,x)+'"')}}}const{errors:d,sourceText:f}=await t(u,c);if(d.length>0){if(n.ignoreErrors){this.warn(d[0]);return}return this.error(d[0])}if(a(u,f),!p)return;const y=p.body.filter(g=>g.type==="ImportDeclaration"?g.importKind==="type"?!0:g.specifiers?.every(h=>h.type==="ImportSpecifier"&&h.importKind==="type"):g.type==="ExportNamedDeclaration"||g.type==="ExportAllDeclaration"?g.exportKind==="type"?!0:g.type==="ExportNamedDeclaration"&&g.specifiers?.every(h=>h.type==="ExportSpecifier"&&h.exportKind==="type"):!1);for await(const g of y){if(!g.source)continue;const h=await this.resolve(g.source.value,u);if(!h)return;const b=h.id;if(i(b)&&!s[b.replace(J,"")])try{const x=await Oe(b);await l.call(this,x,b)}catch{}}}return m(l,"h"),we(l,"transform"),{name:"packem:isolated-declarations",async renderStart(c,{input:u}){const p=tn(...Array.isArray(u)?u:Object.values(u));typeof c.entryFileNames=="function"&&(c.entryFileNames=c.entryFileNames({name:c.name}));const d=c.entryFileNames.replace(/\.(.)?[jt]sx?$/,(f,y)=>`.d.${y||""}ts`);for await(let[f,y]of Object.entries(s)){if(r&&c.format==="cjs"){const h=Pt(y);h!==null&&(y=h.code)}const g=y.includes("from '")?"'":'"';(o===!0||o==="compatible")&&c.format==="cjs"&&this.emitFile({fileName:d.replace("[name]",O(p,f)).replace(".cts",".ts"),source:y.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(h,b,x,v)=>b+g+(v||x)+".d.ts"+g+";"),type:"asset"}),this.emitFile({fileName:d.replace("[name]",O(p,f)),source:y.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(h,b,x,v)=>b+g+(v||x)+(c.format==="cjs"?".d.cts":".d.mts")+g+";"),type:"asset"})}},transform:l}},"isolatedDeclarationsPlugin");var nn=Object.defineProperty,sn=m((e,t)=>nn(e,"name",{value:t,configurable:!0}),"n$8");const He="export default ",_t=sn(e=>{const t=zo(e);return{...t,name:"packem:json",transform(o,r){const n=t.transform?.call(this,o,r);return n&&typeof n!="string"&&"code"in n&&n.code?.startsWith(He)&&(n.code=n.code.replace(He,"module.exports = ")),n}}},"JSONPlugin");class an{static{m(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:m(()=>this.should_skip=!0,"skip"),remove:m(()=>this.should_remove=!0,"remove"),replace:m(t=>this.replacement=t,"replace")}}replace(t,o,r,n){t&&o&&(r!=null?t[o][r]=n:t[o]=n)}remove(t,o,r){t&&o&&(r!=null?t[o].splice(r,1):delete t[o])}}class ln extends an{static{m(this,"SyncWalker")}constructor(t,o){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:m(()=>this.should_skip=!0,"skip"),remove:m(()=>this.should_remove=!0,"remove"),replace:m(r=>this.replacement=r,"replace")},this.enter=t,this.leave=o}visit(t,o,r,n){if(t){if(this.enter){const s=this.should_skip,a=this.should_remove,l=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,t,o,r,n),this.replacement&&(t=this.replacement,this.replace(o,r,n,t)),this.should_remove&&this.remove(o,r,n);const c=this.should_skip,u=this.should_remove;if(this.should_skip=s,this.should_remove=a,this.replacement=l,c)return t;if(u)return null}let i;for(i in t){const s=t[i];if(s&&typeof s=="object")if(Array.isArray(s)){const a=s;for(let l=0;l<a.length;l+=1){const c=a[l];qe(c)&&(this.visit(c,t,i,l)||l--)}}else qe(s)&&this.visit(s,t,i,null)}if(this.leave){const s=this.replacement,a=this.should_remove;this.replacement=null,this.should_remove=!1,this.leave.call(this.context,t,o,r,n),this.replacement&&(t=this.replacement,this.replace(o,r,n,t)),this.should_remove&&this.remove(o,r,n);const l=this.should_remove;if(this.replacement=s,this.should_remove=a,l)return null}}return t}}function qe(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"}m(qe,"isNode");function Tt(e,{enter:t,leave:o}){return new ln(t,o).visit(e,null)}m(Tt,"walk");var cn=Object.defineProperty,pn=m((e,t)=>cn(e,"name",{value:t,configurable:!0}),"u$9");const un=pn(({attributes:e,logger:t})=>{const o=z([/\.[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(r,n){if(!o(n))return null;let i=null;try{i=this.parse(r,{allowReturnOutsideFunction:!0})}catch(l){return this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${n}" and remove the jsx attribute.`}),t.warn(l),null}let s=!1;const a=new _(r);return Tt(i,{enter(l){if(l.type==="CallExpression"&&l.callee.type==="Identifier"&&l.callee.name==="jsx"){const c=l.arguments.filter(u=>u.type==="ObjectExpression"&&Array.isArray(u.properties));for(const u of c)for(const p of u.properties)p.type==="Property"&&p.key.type==="Literal"&&p.value.type==="Literal"&&e.includes(p.key.value)&&(a.overwrite(p.start-2,p.end,""),s=!0)}}}),s?{code:a.toString(),map:a.generateMap({hires:!0})}:null}}},"jsxRemoveAttributes");var dn=Object.defineProperty,mn=m((e,t)=>dn(e,"name",{value:t,configurable:!0}),"r$b");const fn=mn((e,t,o)=>{const r=new RegExp(`(<!-- ${t} -->)[\\s\\S]*?(<!-- /${t} -->)`,"g");if(r.test(e))return e.replace(r,`$1
44
29
  ${o}
45
- $2`)},"replaceContentWithin");var Hn=Object.defineProperty,vo=m((e,t)=>Hn(e,"name",{value:t,configurable:!0}),"d$c");const Kn=vo(e=>{const t=[],o=[];return e.forEach(s=>{s.startsWith("(")?t.push(s):o.push(s)}),[...o.sort(),...t.sort()]},"sortLicenses"),bo=vo(({dtsMarker:e,licenseFilePath:t,licenseTemplate:o,logger:s,marker:r,mode:n,packageName:i})=>_s({thirdParty(a){const c=new Set,l=a.sort(({name:d},{name:u})=>(d||0)>(u||0)?1:(u||0)>(d||0)?-1:0).map(({author:d,contributors:u,license:f,licenseText:g,maintainers:b,name:h,repository:v})=>{let w="## "+h+`
46
- `;f&&(w+=`License: ${f}
47
- `);const y=new Set;for(const D of[d,...b,...u]){const x=typeof D=="string"?D:D?.name;x&&y.add(x)}return y.size>0&&(w+=`By: ${[...y].join(", ")}
48
- `),v&&(w+=`Repository: ${typeof v=="string"?v:v.url}
49
- `),g&&(w+=`
50
- `+g.trim().replaceAll(/\r\n|\r/g,`
51
- `).replaceAll(`<!-- ${r} -->`,"").replaceAll(e?`<!-- ${e} -->`:"","").replaceAll(`<!-- /${r} -->`,"").replaceAll(e?`<!-- /${e} -->`:"","").trim().split(`
52
- `).map(D=>D?`> ${D}`:">").join(`
30
+ $2`)},"replaceContentWithin");var gn=Object.defineProperty,It=m((e,t)=>gn(e,"name",{value:t,configurable:!0}),"d$b");const yn=It(e=>{const t=[],o=[];return e.forEach(r=>{r.startsWith("(")?t.push(r):o.push(r)}),[...o.sort(),...t.sort()]},"sortLicenses"),Mt=It(({dtsMarker:e,licenseFilePath:t,licenseTemplate:o,logger:r,marker:n,mode:i,packageName:s})=>Uo({thirdParty(a){const l=new Set,c=a.sort(({name:p},{name:d})=>(p||0)>(d||0)?1:(d||0)>(p||0)?-1:0).map(({author:p,contributors:d,license:f,licenseText:y,maintainers:g,name:h,repository:b})=>{let x="## "+h+`
31
+ `;f&&(x+=`License: ${f}
32
+ `);const v=new Set;for(const T of[p,...g,...d]){const Q=typeof T=="string"?T:T?.name;Q&&v.add(Q)}return v.size>0&&(x+=`By: ${[...v].join(", ")}
33
+ `),b&&(x+=`Repository: ${typeof b=="string"?b:b.url}
34
+ `),y&&(x+=`
35
+ `+y.trim().replaceAll(/\r\n|\r/g,`
36
+ `).replaceAll(`<!-- ${n} -->`,"").replaceAll(e?`<!-- ${e} -->`:"","").replaceAll(`<!-- /${n} -->`,"").replaceAll(e?`<!-- /${e} -->`:"","").trim().split(`
37
+ `).map(T=>T?`> ${T}`:">").join(`
53
38
  `)+`
54
- `),f&&c.add(f),w}).join(`
39
+ `),f&&l.add(f),x}).join(`
55
40
  ---------------------------------------
56
41
 
57
- `);if(l===""){s.info({message:"No dependencies license information found.",prefix:"plugin:license:"+n});return}const p=o(Kn(c),l,i);try{const d=Me(t),u=qn(d,r,p);if(!u){s.error({message:`Could not find the license marker: <!-- ${r} --><!-- /${r} --> in ${t}`,prefix:"plugin:license:"+n});return}d!==u&&(ee(t,u),s.info({message:`${t} updated.`,prefix:"plugin:license:"+n}))}catch(d){s.error(d)}}}),"license");var Gn=Object.defineProperty,Yn=m((e,t)=>Gn(e,"name",{value:t,configurable:!0}),"i$a");const Xn=Yn(e=>({async buildEnd(){const t=[];for(const s of this.getModuleIds()){const r=this.getModuleInfo(s);if(r!=null&&!r.isExternal)for(const n of r.importedIds)t.push({source:s,target:n})}if(Array.isArray(t)&&t.length===0)return;const o=j(e.rootDir,e.outDir,"graph.json");Te(o,t)},name:"packem:metafile"}),"metafilePlugin");var Qn=Object.defineProperty,Zn=m((e,t)=>Qn(e,"name",{value:t,configurable:!0}),"g$5");let Ot=!1;const ei=Zn((e,t,o,s,r,n)=>{if(n!=="*"&&ys(vs(n))===null)throw new Error("Invalid typeScriptVersion option. It must be a valid semver range.");return{name:"packem:node10-compatibility",writeBundle(){Ot||(e.info({message:"Declaration node10 compatibility mode is enabled.",prefix:"plugin:node10-compatibility"}),Ot=!0);const i={};for(const l of t)for(const p of l.exportKey)p.includes("/*")?i[p]=["./"+$(o,J(l.name),"*.d.ts")]:i[p]=[...i[p]??[],"./"+$(o,l.name+".d.ts")];const a=$(s,"package.json"),c=rt(a);r==="file"&&Object.keys(i).length>0?(Te(a,{...c,typesVersions:{...c.typesVersions,[n]: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:
42
+ `);if(c===""){r.info({message:"No dependencies license information found.",prefix:"plugin:license:"+i});return}const u=o(yn(l),c,s);try{const p=Ne(t),d=fn(p,n,u);if(!d){r.error({message:`Could not find the license marker: <!-- ${n} --><!-- /${n} --> in ${t}`,prefix:"plugin:license:"+i});return}p!==d&&(F(t,d),r.info({message:`${t} updated.`,prefix:"plugin:license:"+i}))}catch(p){r.error(p)}}}),"license");var hn=Object.defineProperty,vn=m((e,t)=>hn(e,"name",{value:t,configurable:!0}),"i$8");const bn=vn(e=>({async buildEnd(){const t=[];for(const r of this.getModuleIds()){const n=this.getModuleInfo(r);if(n!=null&&!n.isExternal)for(const i of n.importedIds)t.push({source:r,target:i})}if(Array.isArray(t)&&t.length===0)return;const o=$(e.rootDir,e.outDir,"graph.json");me(o,t)},name:"packem:metafile"}),"metafilePlugin");var wn=Object.defineProperty,$n=m((e,t)=>wn(e,"name",{value:t,configurable:!0}),"g$6");let Ge=!1;const jn=$n((e,t,o,r,n,i)=>{if(i!=="*"&&Mo(Ao(i))===null)throw new Error("Invalid typeScriptVersion option. It must be a valid semver range.");return{name:"packem:node10-compatibility",writeBundle(){Ge||(e.info({message:"Declaration node10 compatibility mode is enabled.",prefix:"plugin:node10-compatibility"}),Ge=!0);const s={};for(const c of t)for(const u of c.exportKey)u.includes("/*")?s[u]=["./"+w(o,V(c.name),"*.d.ts")]:s[u]=[...s[u]??[],"./"+w(o,c.name+".d.ts")];const a=w(r,"package.json"),l=Pe(a);n==="file"&&Object.keys(s).length>0?(me(a,{...l,typesVersions:{...l.typesVersions,[i]: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:
58
43
 
59
- ${JSON.stringify({typesVersions:{"*":i}},null,4)}
60
- `,prefix:"plugin:node10-compatibility"})}}},"node10CompatibilityPlugin");var ti=Object.defineProperty,oi=m((e,t)=>ti(e,"name",{value:t,configurable:!0}),"t$8");const Y=oi(e=>Is("sha256").update(e).digest("hex"),"getHash");var si=Object.defineProperty,wo=m((e,t)=>si(e,"name",{value:t,configurable:!0}),"d$b");const de=wo(e=>e.handler||e,"getHandler"),I=wo((e,t,o="")=>({...e,async buildEnd(s){e.buildEnd&&await de(e.buildEnd).call(this,s)},async buildStart(s){e.buildStart&&await de(e.buildStart).call(this,s)},async load(s){if(!e.load)return null;const r=$(o,e.name),n=$("load",Y(s));if(t.has(n,r))return await t.get(n,r);const i=await de(e.load).call(this,s);return t.set(n,i,r),i},name:`cached(${e.name})`,async resolveId(s,r,n){if(!e.resolveId)return null;const i=$(o,e.name),a=$("resolveId",Y(s),r?Y(r):"",Y(JSON.stringify(n)));if(t.has(a,i))return await t.get(a,i);const c=await de(e.resolveId).call(this,s,r,n);return t.set(a,c,i),c},async transform(s,r){if(!e.transform)return null;const n=$(o,e.name),i=$("transform",Y(r),Y(s));if(t.has(i,n))return await t.get(i,n);const a=await de(e.transform).call(this,s,r);return t.set(i,a,n),a}}),"cachingPlugin");var ri=Object.defineProperty,ni=m((e,t)=>ri(e,"name",{value:t,configurable:!0}),"n$6");const ii=ni(()=>({name:"packem:prepend-directive",transform:{handler(e,t){const o=this.getModuleInfo(t);if(o?.meta.preserveDirectives){const s=o.meta.preserveDirectives.directives[0];if(s)return`'${s.value}';
61
- `+e}return null},order:"post"}}),"prependDirectivePlugin");var ai=Object.defineProperty,li=m((e,t)=>ai(e,"name",{value:t,configurable:!0}),"c$9");const ci=li(({directiveRegex:e,exclude:t=[],include:o=[],logger:s})=>{const r={},n={},i=oe(o,t);return{name:"packem:preserve-directives",onLog(a,c){return c.code==="MODULE_LEVEL_DIRECTIVE"&&a==="warn"?!1:null},renderChunk:{handler(a,c,{sourcemap:l}){const p=c.moduleIds.map(f=>r[f]?r[f]:null).reduce((f,g)=>(g&&g.forEach(b=>{f.add(b)}),f),new Set),d=new H(a);p.size>0&&(s.debug({message:`directives for chunk "${c.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),d.prepend(`${[...p].map(f=>`'${f}';`).join(`
44
+ ${JSON.stringify({typesVersions:{"*":s}},null,4)}
45
+ `,prefix:"plugin:node10-compatibility"})}}},"node10CompatibilityPlugin");var kn=Object.defineProperty,xn=m((e,t)=>kn(e,"name",{value:t,configurable:!0}),"r$a");const A=xn(e=>{const t=Ko("md5");return t.update(e),t.digest("hex")},"getHash");var En=Object.defineProperty,At=m((e,t)=>En(e,"name",{value:t,configurable:!0}),"d$a");const H=At(e=>e.handler||e,"getHandler"),E=At((e,t,o="")=>({...e,async buildEnd(r){e.buildEnd&&await H(e.buildEnd).call(this,r)},async buildStart(r){e.buildStart&&await H(e.buildStart).call(this,r)},async load(r){if(!e.load)return null;const n=w(o,e.name),i=w("load",A(r));if(t.has(i,n))return await t.get(i,n);const s=await H(e.load).call(this,r);return t.set(i,s,n),s},name:`cached(${e.name})`,async resolveId(r,n,i){if(!e.resolveId)return null;const s=w(o,e.name),a=w("resolveId",A(r),n?A(n):"",A(JSON.stringify(i)));if(t.has(a,s))return await t.get(a,s);const l=await H(e.resolveId).call(this,r,n,i);return t.set(a,l,s),l},async transform(r,n){if(!e.transform)return null;const i=w(o,e.name),s=w("transform",A(n),A(r));if(t.has(s,i))return await t.get(s,i);const a=await H(e.transform).call(this,r,n);return t.set(s,a,i),a}}),"cachingPlugin");var Dn=Object.defineProperty,Sn=m((e,t)=>Dn(e,"name",{value:t,configurable:!0}),"n$7");const On=Sn(()=>({name:"packem:prepend-directive",transform:{handler(e,t){const o=this.getModuleInfo(t);if(o?.meta.preserveDirectives){const r=o.meta.preserveDirectives.directives[0];if(r)return`'${r.value}';
46
+ `+e}return null},order:"post"}}),"prependDirectivePlugin");var Nn=Object.defineProperty,Pn=m((e,t)=>Nn(e,"name",{value:t,configurable:!0}),"c$8");const Cn=Pn(({directiveRegex:e,exclude:t=[],include:o=[],logger:r})=>{const n={},i={},s=z(o,t);return{name:"packem:preserve-directives",onLog(a,l){return l.code==="MODULE_LEVEL_DIRECTIVE"&&a==="warn"?!1:null},renderChunk:{handler(a,l,{sourcemap:c}){const u=l.moduleIds.map(f=>n[f]?n[f]:null).reduce((f,y)=>(y&&y.forEach(g=>{f.add(g)}),f),new Set),p=new _(a);u.size>0&&(r.debug({message:`directives for chunk "${l.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),p.prepend(`${[...u].map(f=>`'${f}';`).join(`
62
47
  `)}
63
- `));let u;return c.facadeModuleId&&typeof n[c.facadeModuleId]=="string"&&(u=n[c.facadeModuleId]),u&&(s.debug({message:`shebang for chunk "${c.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),d.prepend(`${u}
64
- `)),p.size===0&&u===void 0?null:{code:d.toString(),map:l?d.generateMap({hires:!0}):null}},order:"post"},transform(a,c){if(!i(c))return null;let l=!1;const p=new H(a);if(a.startsWith("#")&&a[1]==="!"){let u=0;for(let f=2,g=a.length;f<g;f++){const b=a.codePointAt(f);if(b===10||b===13||b===8232||b===8233){u=f;break}}u&&(n[c]=a.slice(0,u),p.remove(0,u+1),l=!0,s.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.`}),s.warn(u),null}if(d.type!=="Program")return null;for(const u of d.body.filter(Boolean)){if(u.type!=="ExpressionStatement")break;let f=null;"directive"in u?f=u.directive:u.expression.type==="Literal"&&typeof u.expression.value=="string"&&e.test(u.expression.value)&&(f=u.expression.value),f!=="use strict"&&f&&(r[c]||=new Set,r[c].add(f),"start"in u&&typeof u.start=="number"&&"end"in u&&typeof u.end=="number"&&(p.remove(u.start,u.end),l=!0),s.debug({message:`directive "${f}" for module "${c}" is preserved.`,prefix:"plugin:preserve-directives"}))}return l?{code:p.toString(),map:p.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...r[c]??[]],shebang:n[c]??null}}}:null}}},"preserveDirectives");var pi=Object.defineProperty,ui=m((e,t)=>pi(e,"name",{value:t,configurable:!0}),"t$7");const di=ui(e=>{const t=oe(e.include,e.exclude);return{name:"packem:raw",transform(o,s){return t(s)?{code:`export default ${JSON.stringify(o)}`,map:null}:null}}},"rawPlugin");var fi=Object.defineProperty,mi=m((e,t)=>fi(e,"name",{value:t,configurable:!0}),"r$9");const $o=mi(()=>({name:"packem:resolve-file-url",resolveId(e){if(e.startsWith("file://"))return oo(e)}}),"resolveFileUrl");var gi=Object.defineProperty,Je=m((e,t)=>gi(e,"name",{value:t,configurable:!0}),"i$6");const Ne=/^#![^\n]*/,et=Je(async e=>{await Zo(e,493).catch(()=>{})},"makeExecutable"),hi=Je((e,t)=>({name:"packem:shebang",renderChunk:{handler(o,s,r){if(!s.isEntry||!s.facadeModuleId)return null;const n=o.startsWith("#")&&o[1]==="!";if(n&&t.replace)return o.replace(Ne,t.shebang+`
65
- `);if(n)return null;if(e.includes(s.name)){const i=new H(o);return i.prepend(t.shebang+`
66
- `),{code:i.toString(),map:r.sourcemap?i.generateMap({hires:!0}):void 0}}return null},order:"post"},async writeBundle(o,s){for(const[r,n]of Object.entries(s))if(n.type==="chunk"&&Ne.test(n.code)&&o.dir){const i=j(o.dir,r);await et(i)}}}),"shebangPlugin"),yi=Je(()=>({name:"packem:remove-shebang",renderChunk(e){return e.replace(Ne,"")}}),"removeShebangPlugin"),vi=Je((e,t=`
67
- `)=>{const o=Ne.exec(e);return o?o+t:""},"getShebang");var bi=Object.defineProperty,se=m((e,t)=>bi(e,"name",{value:t,configurable:!0}),"r$8");const wi=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,$i=/MIT License|MIT license|BSD license/,xi=/\n{2,}/g,ji=/\b(\w+)\$\d+\b/g,ki=/[-/\\^$*+?.()|[\]{}]/g,Ei=se(e=>e.replaceAll(ki,"\\$&"),"escapeRegex"),Si=se(e=>[...new Set(e)],"unique"),Oi=se(e=>e.replaceAll(wi,t=>$i.test(t)?"":t).replaceAll(xi,`
48
+ `));let d;return l.facadeModuleId&&typeof i[l.facadeModuleId]=="string"&&(d=i[l.facadeModuleId]),d&&(r.debug({message:`shebang for chunk "${l.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),p.prepend(`${d}
49
+ `)),u.size===0&&d===void 0?null:{code:p.toString(),map:c?p.generateMap({hires:!0}):null}},order:"post"},transform(a,l){if(!s(l))return null;let c=!1;const u=new _(a);if(a.startsWith("#")&&a[1]==="!"){let d=0;for(let f=2,y=a.length;f<y;f++){const g=a.codePointAt(f);if(g===10||g===13||g===8232||g===8233){d=f;break}}d&&(i[l]=a.slice(0,d),u.remove(0,d+1),c=!0,r.debug({message:`shebang for module "${l}" is preserved.`,prefix:"plugin:preserve-directives"}))}let p=null;try{p=this.parse(u.toString(),{allowReturnOutsideFunction:!0})}catch(d){return this.warn({code:"PARSE_ERROR",message:`failed to parse "${l}" and extract the directives.`}),r.warn(d),null}if(p.type!=="Program")return null;for(const d of p.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[l]||=new Set,n[l].add(f),"start"in d&&typeof d.start=="number"&&"end"in d&&typeof d.end=="number"&&(u.remove(d.start,d.end),c=!0),r.debug({message:`directive "${f}" for module "${l}" is preserved.`,prefix:"plugin:preserve-directives"}))}return c?{code:u.toString(),map:u.generateMap({hires:!0}),meta:{preserveDirectives:{directives:[...n[l]??[]],shebang:i[l]??null}}}:null}}},"preserveDirectives");var _n=Object.defineProperty,Tn=m((e,t)=>_n(e,"name",{value:t,configurable:!0}),"n$6");const In=Tn(e=>{const t=z(e.include,e.exclude);return{async load(o){return o.includes("?raw")?await this.load({id:o.replace(/\?raw$/,"")}):null},name:"packem:raw",transform(o,r){return!t(r)&&!r.includes("?raw")?null:(r.includes("?raw")||(o=`export default ${JSON.stringify(o)}`),{code:o,map:{mappings:""}})}}},"rawPlugin");var Mn=Object.defineProperty,An=m((e,t)=>Mn(e,"name",{value:t,configurable:!0}),"r$9");const Rt=An(()=>({name:"packem:resolve-file-url",resolveId(e){if(e.startsWith("file://"))return Ho(e)}}),"resolveFileUrl");var Rn=Object.defineProperty,ye=m((e,t)=>Rn(e,"name",{value:t,configurable:!0}),"i$6");const ce=/^#![^\n]*/,De=ye(async e=>{await bo(e,493).catch(()=>{})},"makeExecutable"),Fn=ye((e,t)=>({name:"packem:shebang",renderChunk:{handler(o,r,n){if(!r.isEntry||!r.facadeModuleId)return null;const i=o.startsWith("#")&&o[1]==="!";if(i&&t.replace)return o.replace(ce,t.shebang+`
50
+ `);if(i)return null;if(e.includes(r.name)){const s=new _(o);return s.prepend(t.shebang+`
51
+ `),{code:s.toString(),map:n.sourcemap?s.generateMap({hires:!0}):void 0}}return null},order:"post"},async writeBundle(o,r){for(const[n,i]of Object.entries(r))if(i.type==="chunk"&&ce.test(i.code)&&o.dir){const s=$(o.dir,n);await De(s)}}}),"shebangPlugin"),Jn=ye(()=>({name:"packem:remove-shebang",renderChunk(e){return e.replace(ce,"")}}),"removeShebangPlugin"),Bn=ye((e,t=`
52
+ `)=>{const o=ce.exec(e);return o?o+t:""},"getShebang");var Wn=Object.defineProperty,B=m((e,t)=>Wn(e,"name",{value:t,configurable:!0}),"r$8");const Ln=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,Vn=/MIT License|MIT license|BSD license/,zn=/\n{2,}/g,Un=/\b(\w+)\$\d+\b/g,Kn=/[-/\\^$*+?.()|[\]{}]/g,Hn=B(e=>e.replaceAll(Kn,"\\$&"),"escapeRegex"),qn=B(e=>[...new Set(e)],"unique"),Gn=B(e=>e.replaceAll(Ln,t=>Vn.test(t)?"":t).replaceAll(zn,`
68
53
 
69
- `),"cleanUnnecessaryComments"),Dt=new Map;function xo(e,t,{identifierReplacements:o},s){const r=to(e);for(const i in o){const a=r.find(l=>l.specifier===i&&l.imports.includes("{"));if(!a){this.warn(`${t.fileName} does not import "${i}" for replacement`),process.exitCode=1;continue}const c=o[i];for(const l in c){if(!a.imports.includes(l))throw new Error(`${t.fileName} does not import "${l}" from "${i}" for replacement`);const p=c[l],d=Ei(l);p.includes(".")&&(e=e.replace(new RegExp(`\\b\\w+\\b as ${d},?\\s?`),"")),e=e.replaceAll(new RegExp(`\\b${d}\\b`,"g"),p)}}const n=Si(Array.from(e.matchAll(ji),i=>i[0]));if(n.length>0){const i=n.map(c=>`
70
- - ${c}`).join(""),a=t.fileName.replace(/\.[^/.]+$/,"");Dt.has(a)||s.warn({message:`${t.fileName} contains confusing identifier names${i}
54
+ `),"cleanUnnecessaryComments"),Xe=new Map;function Ft(e,t,{identifierReplacements:o},r){const n=xt(e);for(const s in o){const a=n.find(c=>c.specifier===s&&c.imports.includes("{"));if(!a){this.warn(`${t.fileName} does not import "${s}" for replacement`),process.exitCode=1;continue}const l=o[s];for(const c in l){if(!a.imports.includes(c))throw new Error(`${t.fileName} does not import "${c}" from "${s}" for replacement`);const u=l[c],p=Hn(c);u.includes(".")&&(e=e.replace(new RegExp(`\\b\\w+\\b as ${p},?\\s?`),"")),e=e.replaceAll(new RegExp(`\\b${p}\\b`,"g"),u)}}const i=qn(Array.from(e.matchAll(Un),s=>s[0]));if(i.length>0){const s=i.map(l=>`
55
+ - ${l}`).join(""),a=t.fileName.replace(/\.[^/.]+$/,"");Xe.has(a)||r.warn({message:`${t.fileName} contains confusing identifier names${s}
71
56
 
72
- To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),Dt.set(a,!0)}return e}m(xo,"I");se(xo,"replaceConfusingTypeNames");const Di=se((e,t)=>{if(t.leadingComments?.some(o=>o.type==="CommentBlock"&&o.value.includes("@internal"))){const o=e.original[t.end]===","?t.end+1:t.end;return e.remove(t.leadingComments[0].start,o),!0}return!1},"removeInternal");function jo(e,t){if(e.includes("@internal")){const o=new H(e),s=Ms(e,{plugins:["typescript"],sourceType:"module"});if(yo(s,{enter(r){Di(o,r)&&this.skip()}}),e=o.toString(),e.includes("@internal"))throw new Error(`${t.fileName} has unhandled @internal declarations`)}return e}m(jo,"S");se(jo,"stripInternalTypes");const Pi=se((e,t)=>({name:"packem:patch-types",renderChunk(o,s){return o=xo.call(this,o,s,e,t),o=jo.call(this,o,s),o=Oi(o),o},resolveId(o){return o.startsWith("types/")?{external:!0,id:"../../"+(o.endsWith(".js")?o:o+".js")}:null}}),"patchTypescriptTypes");var Ni=Object.defineProperty,ko=m((e,t)=>Ni(e,"name",{value:t,configurable:!0}),"m$7");const Eo=ko((e,t=!0)=>{if(!e)return null;const{config:o,path:s}=e;if(!o.compilerOptions)return null;const{baseUrl:r,paths:n}=o.compilerOptions;if(!r)return null;const i=j(J(s),r),a=[];if(n)for(const[c,l]of Object.entries(n)){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 l){const f=[...F(j(i,u))].map(g=>g==="*"?"$"+(++d+""):g==="$"?"$$":g).join("");a.push({find:p,replacement:f})}}return t&&a.push({find:/^(?!\.*\/|\.*$|\w:)(.+)$/,replacement:`${[...F(i)].map(c=>c==="$"?"$$":c).join("")}/$1`}),a},"getConfigAlias"),So=ko((e,t)=>{const o=Eo(e);return{name:"packem:resolve-tsconfig-paths",async resolveId(s,r,n){if(!o||s.includes("\0"))return null;for(const{find:i,replacement:a}of o)if(i.test(s)){const c=s.replace(i,a),l=await this.resolve(c,r,{skipSelf:!0,...n});if(l)return t.debug({message:`Resolved ${s} to ${l.id} using paths from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-paths"}),l.id}return null}}},"resolveTsconfigPaths");var Ci=Object.defineProperty,Oo=m((e,t)=>Ci(e,"name",{value:t,configurable:!0}),"u$8");const _i=Oo((e,t)=>{if(!t)return null;const{config:o,path:s}=t;if(!o.compilerOptions)return null;const{rootDirs:r}=o.compilerOptions;if(!r)return null;const n=[];for(const i of r){if(i.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${s}.`);if(i.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${s}.`);n.push(j(e,i))}return n},"getRootDirectories"),Do=Oo((e,t,o)=>{const s=_i(e,o);return{name:"packem:resolve-tsconfig-root-dirs",async resolveId(r,n,i){if(s===null||s.length===0)return null;if(r.startsWith("."))for(const a of s){const c=$(a,r),l=await this.resolve(c,n,{skipSelf:!0,...i});if(l)return t.debug({message:`Resolved ${r} to ${l.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),l.id}return null}}},"resolveTsconfigRootDirectories");var Ii=Object.defineProperty,Mi=m((e,t)=>Ii(e,"name",{value:t,configurable:!0}),"r$7");const Po=Mi(()=>{const e=/\.(?:[mc]?js|jsx)$/;return{name:"packem:resolve-typescript-mjs-cjs",async resolveId(t,o,s){return e.test(t)&&o?await this.resolve(t.replace(/js(x?)$/,"ts$1"),o,s):null}}},"resolveTypescriptMjsCts");var Ti=Object.defineProperty,No=m((e,t)=>Ti(e,"name",{value:t,configurable:!0}),"u$7");const Pt=No((e,t,o,s)=>{const r=e.findIndex(i=>typeof i=="object"?i.name===o:!1);if(r===-1)throw new Error(`Plugin with name "${o}" was not found, try one of: ${e.map(i=>{if(typeof i=="object")return i.name}).filter(Boolean).join(", ")}`);const n=s?r+1:r;return e.splice(n,0,t),e},"appendPlugin"),Co=No((e,t)=>{if(!t)return e;for(const{after:o=void 0,before:s=void 0,plugin:r}of t)e=o?Pt(e,r,o,!0):Pt(e,r,s,!1);return e},"appendPlugins");var Ai=Object.defineProperty,Ri=m((e,t)=>Ai(e,"name",{value:t,configurable:!0}),"s$7");const Fi=Ri(e=>{const t=le(e).split(".");if(t.length>=2){const[o,s]=t.slice(-2),r=t[0],n=/^(\w+)-runtime$/.exec(o)?.[1];if(nt.includes(s)&&n&&n.length>0)return r+"-"+n}},"getCustomModuleLayer");var Ji=Object.defineProperty,Li=m((e,t)=>Ji(e,"name",{value:t,configurable:!0}),"i$5");const Ke=Li(e=>(e.preserveDirectives||{directives:[]}).directives.map(t=>t.replace(/^use /,"")).find(t=>t!=="strict"),"getModuleLayer");var Bi=Object.defineProperty,Nt=m((e,t)=>Bi(e,"name",{value:t,configurable:!0}),"d$9");const Wi=Nt((e,t)=>{const o=new Map;return Nt(function(s,r){const n=r.getModuleInfo(s);if(!n)return;const{isEntry:i}=n,a=n.meta,c=Ke(a);if(!i){const l=o.get(s);if(l)return l;const p=Fi(s);if(p)return o.set(s,p),p}if(i){const l=r.getModuleIds();for(const p of l)r.getModuleInfo(p)&&Ke(a)===c&&(e.has(p)||e.set(p,new Set),e.get(p).add([s,c]))}if(c&&!i&&e.has(s)){const l=[...e.get(s)];if(l.some(([d])=>{if(t.some(u=>u.path===d)){const u=r.getModuleInfo(d);return Ke(u?u.meta:{})===c}return!1}))return;if(l.every(([,d])=>d===c))return o.has(s)?o.get(s):void 0;const p=le(s,Vt(s))+"-"+c;return o.set(s,p),p}},"splitChunks")},"createSplitChunks");var zi=Object.defineProperty,Vi=m((e,t)=>zi(e,"name",{value:t,configurable:!0}),"n$4");const X=Vi((e,t)=>e.isDynamicEntry?`${Ks}/[name].${t}`:`${Gs}/${e.name}-[hash].${t}`,"getChunkFilename");var Ui=Object.defineProperty,qi=m((e,t)=>Ui(e,"name",{value:t,configurable:!0}),"o$4");const Hi=process.platform==="win32",Ct=qi((e,t)=>{const o=Hi?"\\":"/";for(let s of Array.isArray(e.names)?e.names:[]){if(s.includes("node_modules"+o+".pnpm"))return s=s.replace("node_modules"+o+".pnpm","external")+"."+t,s.replace("node_modules"+o,"");if(s.includes("node_modules"))return s.replace("node_modules","external")+"."+t}return"[name]."+t},"getEntryFileNames");var Ki=Object.defineProperty,Gi=m((e,t)=>Ki(e,"name",{value:t,configurable:!0}),"p$1");const lt=Gi((e,t)=>{let o={};if(e.pkg.name&&(o[e.pkg.name]=e.options.rootDir),e.pkg.imports){const{imports:s}=e.pkg;for(const r in s){if(r.startsWith("#"))continue;const n=s[r];typeof n=="string"&&(o[r]=$(e.options.rootDir,n))}}return o={...o,...e.options.alias},e.options.rollup.alias&&(Array.isArray(e.options.rollup.alias.entries)?Object.assign(o,Object.fromEntries(e.options.rollup.alias.entries.map(s=>[s.find,s.replacement]))):Object.assign(o,e.options.rollup.alias.entries??e.options.rollup.alias)),e.logger.debug({message:"Resolved aliases: "+JSON.stringify(o),prefix:t}),o},"resolveAliases");var Yi=Object.defineProperty,M=m((e,t)=>Yi(e,"name",{value:t,configurable:!0}),"l$4");const Xi=M((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 o="node"+Ho.node.split(".")[0];if(t.pkg.engines?.node){const s=eo(t.pkg.engines.node);s&&(o="node"+s.major)}if(t.options.rollup.esbuild.target){const s=me(t.options.rollup.esbuild.target);s.some(r=>r.startsWith("node"))||(t.options.rollup.esbuild.target=[...new Set([...me(o),...s])])}else t.options.rollup.esbuild.target=me(o);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"),_o=M((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 "${O(_(j(),e.id))}"
57
+ To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),Xe.set(a,!0)}return e}m(Ft,"I");B(Ft,"replaceConfusingTypeNames");const Xn=B((e,t)=>{if(t.leadingComments?.some(o=>o.type==="CommentBlock"&&o.value.includes("@internal"))){const o=e.original[t.end]===","?t.end+1:t.end;return e.remove(t.leadingComments[0].start,o),!0}return!1},"removeInternal");function Jt(e,t){if(e.includes("@internal")){const o=new _(e),r=qo(e,{plugins:["typescript"],sourceType:"module"});if(Tt(r,{enter(n){Xn(o,n)&&this.skip()}}),e=o.toString(),e.includes("@internal"))throw new Error(`${t.fileName} has unhandled @internal declarations`)}return e}m(Jt,"S$1");B(Jt,"stripInternalTypes");const Yn=B((e,t)=>({name:"packem:patch-types",renderChunk(o,r){return o=Ft.call(this,o,r,e,t),o=Jt.call(this,o,r),o=Gn(o),o},resolveId(o){return o.startsWith("types/")?{external:!0,id:"../../"+(o.endsWith(".js")?o:o+".js")}:null}}),"patchTypescriptTypes");var Qn=Object.defineProperty,Bt=m((e,t)=>Qn(e,"name",{value:t,configurable:!0}),"m$7");const Wt=Bt((e,t=!0)=>{if(!e)return null;const{config:o,path:r}=e;if(!o.compilerOptions)return null;const{baseUrl:n,paths:i}=o.compilerOptions;if(!n)return null;const s=$(V(r),n),a=[];if(i)for(const[l,c]of Object.entries(i)){let u;l==="@"||l==="~"||l==="#"?u=new RegExp(`^${l}/(.+)$`):u=new RegExp(`^${[...l].map(d=>d==="*"?"(.+)":d.replace(/[\\^$*+?.()|[\]{}]/,"\\$&")).join("")}$`);let p=0;for(const d of c){const f=[...Be($(s,d))].map(y=>y==="*"?"$"+(++p+""):y==="$"?"$$":y).join("");a.push({find:u,replacement:f})}}return t&&a.push({find:/^(?!\.*\/|\.*$|\w:)(.+)$/,replacement:`${[...Be(s)].map(l=>l==="$"?"$$":l).join("")}/$1`}),a},"getConfigAlias"),Lt=Bt((e,t)=>{const o=Wt(e);return{name:"packem:resolve-tsconfig-paths",async resolveId(r,n,i){if(!o||r.includes("\0"))return null;for(const{find:s,replacement:a}of o)if(s.test(r)){const l=r.replace(s,a),c=await this.resolve(l,n,{skipSelf:!0,...i});if(c)return t.debug({message:`Resolved ${r} to ${c.id} using paths from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-paths"}),c.id}return null}}},"resolveTsconfigPaths");var Zn=Object.defineProperty,Vt=m((e,t)=>Zn(e,"name",{value:t,configurable:!0}),"u$6");const ei=Vt((e,t)=>{if(!t)return null;const{config:o,path:r}=t;if(!o.compilerOptions)return null;const{rootDirs:n}=o.compilerOptions;if(!n)return null;const i=[];for(const s of n){if(s.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${r}.`);if(s.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${r}.`);i.push($(e,s))}return i},"getRootDirectories"),zt=Vt((e,t,o)=>{const r=ei(e,o);return{name:"packem:resolve-tsconfig-root-dirs",async resolveId(n,i,s){if(r===null||r.length===0)return null;if(n.startsWith("."))for(const a of r){const l=w(a,n),c=await this.resolve(l,i,{skipSelf:!0,...s});if(c)return t.debug({message:`Resolved ${n} to ${c.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),c.id}return null}}},"resolveTsconfigRootDirectories");var ti=Object.defineProperty,oi=m((e,t)=>ti(e,"name",{value:t,configurable:!0}),"r$7");const Ut=oi(()=>{const e=/\.(?:[mc]?js|jsx)$/;return{name:"packem:resolve-typescript-mjs-cjs",async resolveId(t,o,r){return e.test(t)&&o?await this.resolve(t.replace(/js(x?)$/,"ts$1"),o,r):null}}},"resolveTypescriptMjsCts");var ri=Object.defineProperty,Kt=m((e,t)=>ri(e,"name",{value:t,configurable:!0}),"u$5");const Ye=Kt((e,t,o,r)=>{const n=e.findIndex(s=>typeof s=="object"?s.name===o:!1);if(n===-1)throw new Error(`Plugin with name "${o}" was not found, try one of: ${e.map(s=>{if(typeof s=="object")return s.name}).filter(Boolean).join(", ")}`);const i=r?n+1:n;return e.splice(i,0,t),e},"appendPlugin"),Ht=Kt((e,t)=>{if(!t)return e;for(const{after:o=void 0,before:r=void 0,plugin:n}of t)e=o?Ye(e,n,o,!0):Ye(e,n,r,!1);return e},"appendPlugins");var ni=Object.defineProperty,ii=m((e,t)=>ni(e,"name",{value:t,configurable:!0}),"s$7");const si=ii(e=>{const t=fe(e).split(".");if(t.length>=2){const[o,r]=t.slice(-2),n=t[0],i=/^(\w+)-runtime$/.exec(o)?.[1];if(Ce.includes(r)&&i&&i.length>0)return n+"-"+i}},"getCustomModuleLayer");var ai=Object.defineProperty,li=m((e,t)=>ai(e,"name",{value:t,configurable:!0}),"i$5");const $e=li(e=>(e.preserveDirectives||{directives:[]}).directives.map(t=>t.replace(/^use /,"")).find(t=>t!=="strict"),"getModuleLayer");var ci=Object.defineProperty,Qe=m((e,t)=>ci(e,"name",{value:t,configurable:!0}),"d$8");const pi=Qe((e,t)=>{const o=new Map;return Qe(function(r,n){const i=n.getModuleInfo(r);if(!i)return;const{isEntry:s}=i,a=i.meta,l=$e(a);if(!s){const c=o.get(r);if(c)return c;const u=si(r);if(u)return o.set(r,u),u}if(s){const c=n.getModuleIds();for(const u of c)n.getModuleInfo(u)&&$e(a)===l&&(e.has(u)||e.set(u,new Set),e.get(u).add([r,l]))}if(l&&!s&&e.has(r)){const c=[...e.get(r)];if(c.some(([p])=>{if(t.some(d=>d.path===p)){const d=n.getModuleInfo(p);return $e(d?d.meta:{})===l}return!1}))return;if(c.every(([,p])=>p===l))return o.has(r)?o.get(r):void 0;const u=fe(r,mt(r))+"-"+l;return o.set(r,u),u}},"splitChunks")},"createSplitChunks");var ui=Object.defineProperty,di=m((e,t)=>ui(e,"name",{value:t,configurable:!0}),"n$4");const R=di((e,t)=>e.isDynamicEntry?`${lr}/[name].${t}`:`${cr}/${e.name}-[hash].${t}`,"getChunkFilename");var mi=Object.defineProperty,fi=m((e,t)=>mi(e,"name",{value:t,configurable:!0}),"o$4");const gi=process.platform==="win32",Ze=fi((e,t)=>{const o=gi?"\\":"/";for(let r of Array.isArray(e.names)?e.names:[]){if(r.includes("node_modules"+o+".pnpm"))return r=r.replace("node_modules"+o+".pnpm","external")+"."+t,r.replace("node_modules"+o,"");if(r.includes("node_modules"))return r.replace("node_modules","external")+"."+t}return"[name]."+t},"getEntryFileNames");var yi=Object.defineProperty,hi=m((e,t)=>yi(e,"name",{value:t,configurable:!0}),"p$2");const Ie=hi((e,t)=>{let o={};if(e.pkg.name&&(o[e.pkg.name]=e.options.rootDir),e.pkg.imports){const{imports:r}=e.pkg;for(const n in r){if(n.startsWith("#"))continue;const i=r[n];typeof i=="string"&&(o[n]=w(e.options.rootDir,i))}}return o={...o,...e.options.alias},e.options.rollup.alias&&(Array.isArray(e.options.rollup.alias.entries)?Object.assign(o,Object.fromEntries(e.options.rollup.alias.entries.map(r=>[r.find,r.replacement]))):Object.assign(o,e.options.rollup.alias.entries??e.options.rollup.alias)),e.logger.debug({message:"Resolved aliases: "+JSON.stringify(o),prefix:t}),o},"resolveAliases");var vi=Object.defineProperty,D=m((e,t)=>vi(e,"name",{value:t,configurable:!0}),"p$1");const bi=D((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 o="node"+uo.node.split(".")[0];if(t.pkg.engines?.node){const r=kt(t.pkg.engines.node);r&&(o="node"+r.major)}if(t.options.rollup.esbuild.target){const r=q(t.options.rollup.esbuild.target);r.some(n=>n.startsWith("node"))||(t.options.rollup.esbuild.target=[...new Set([...q(o),...r])])}else t.options.rollup.esbuild.target=q(o);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"),qt=D((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 "${k(O($(),e.id))}"
73
58
  Is the module installed? Note:
74
59
  ↳ to inline a module into your bundle, install it to "devDependencies".
75
- ↳ 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,Ge=new Map,Io=M((e,t,o)=>{const s=Eo(e.tsconfig,!1);return{external(r){r=ms(r,t);const n=no(r);if(Xe(e.options.externals,n)||Xe(e.options.externals,r))return!0;const{pkg:i}=e;if(r.startsWith(".")||Ae(r)||/src[/\\]/.test(r)||i.name&&r.startsWith(i.name))return!1;if(i.imports)for(const[a,c]of Object.entries(i.imports)){if(a===r)return!1;if(a.includes("*")){let l;Ge.has(a)?l=Ge.get(a):(l=Ut($(e.options.rootDir,c.replace("/*","")),{withFileTypes:!0}).filter(p=>p.isFile()).map(p=>p.name),Ge.set(a,l));for(const p of l)if(p.replace(te,"")===r.replace(te,"").replace("#",""))return!1}}if(s){for(const{find:a}of s)if(a.test(r))return e.logger.debug({message:`Resolved alias ${r} to ${a.source}`,prefix:o}),!1}return _t.has(r)||e.logger.info({message:'Inlined implicit external "'+O(r)+'". If this is incorrect, add it to the "externals" option.',prefix:o}),_t.set(r,!0),!1},input:Object.fromEntries(e.options.entries.map(r=>[r.name,j(e.options.rootDir,r.input)])),logLevel:e.options.debug?"debug":"info",onLog:M((r,n)=>{let i=n.message;switch(n.stack&&(i=`${i}
76
- ${n.stack}`),r){case"info":{e.logger.info({message:i,prefix:o+(n.plugin?":plugin:"+n.plugin:"")});return}case"warn":{e.logger.warn({message:i,prefix:o+(n.plugin?":plugin:"+n.plugin:"")});return}case"debug":e.logger.debug({message:i,prefix:o+(n.plugin?":plugin:"+n.plugin:"")})}},"onLog"),onwarn(r,n){_o(r,e)||r.code||n(r)},watch:e.mode==="watch"?e.options.rollup.watch:!1}},"baseRollupOptions"),Mo=M(async(e,t)=>{const o=lt(e,"build");let s;e.options.rollup.resolve&&(s=I(Xt({...e.options.rollup.resolve}),t));const r=e.options.rollup.output?.preserveModules?{preserveModules:!0,preserveModulesRoot:e.options.rollup.output.preserveModulesRoot??"src"}:{manualChunks:Wi(e.dependencyGraphMap,e.buildEntries),preserveModules:!1};return{...Io(e,o,"dependencies"),output:[e.options.emitCJS&&{assetFileNames:"[name]-[hash][extname]",chunkFileNames:M(n=>X(n,"cjs"),"chunkFileNames"),compact:e.options.minify,dir:j(e.options.rootDir,e.options.outDir),entryFileNames:M(n=>Ct(n,"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,...r},e.options.emitESM&&{assetFileNames:"[name]-[hash][extname]",chunkFileNames:M(n=>X(n,"mjs"),"chunkFileNames"),compact:e.options.minify,dir:j(e.options.rootDir,e.options.outDir),entryFileNames:M(n=>Ct(n,"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,...r}].filter(Boolean),plugins:Co([I($o(),t),I(Po(),t),e.tsconfig&&I(Do(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&I(So(e.tsconfig,e.logger),t),e.options.rollup.replace&&Qt({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&Yt({customResolver:s,...e.options.rollup.alias,entries:o}),s,e.options.rollup.polyfillNode&&gs({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),e.options.rollup.json&&ho({...e.options.rollup.json}),yr(),e.options.rollup.wasm&&fs(e.options.rollup.wasm),e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer&&An($(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 dn({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,o),e.options.rollup.css&&e.options.rollup.css.loaders&&e.options.rollup.css.loaders.length>0&&e.options.declaration&&bn(e.options.rollup.css,e.options.rootDir,e.logger),e.options.transformer(Xi(e.options.transformerName,e)),I(ci({directiveRegex:/^['|"](use (\w+))['|"]$/,...e.options.rollup.preserveDirectives,logger:e.logger}),t),e.options.rollup.shebang&&hi(e.options.entries.filter(n=>n.executable).map(n=>n.name).filter(Boolean),e.options.rollup.shebang),e.options.cjsInterop&&e.options.emitCJS&&co({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.dynamicVars&&Dn(),e.options.rollup.dynamicVars&&ds(e.options.rollup.dynamicVars),e.options.rollup.commonjs&&I(us({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&&En(e.pkg,e.options.rollup.shim),e.options.rollup.raw&&I(di(e.options.rollup.raw),t),e.options.rollup.jsxRemoveAttributes&&I(zn({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:e.logger}),t),e.options.rollup.metafile&&Xn({outDir:j(e.options.rootDir,e.options.outDir),rootDir:e.options.rootDir}),e.options.rollup.copy&&Sr(e.options.rollup.copy,e.logger),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&bo({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}),ii(),e.options.emitCJS&&e.mode==="build"&&e.options.declaration==="compatible"&&e.options.rollup.node10Compatibility&&ei(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&&hs({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),e.options.rollup.plugins)}},"getRollupOptions"),Qi=M(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"),Zi=rr(Qi),To=M(async(e,t)=>{const o=lt(e,"types"),s=e.tsconfig?.config.compilerOptions;delete s?.lib;let r;e.options.rollup.resolve&&(r=I(Xt({...e.options.rollup.resolve}),t));const n="dts-plugin:"+process.pid+e.tsconfig.path;return{...Io(e,o,"dts"),onwarn(i,a){_o(i,e)||i.code!=="EMPTY_BUNDLE"&&a(i)},output:[e.options.emitCJS&&{chunkFileNames:M(i=>X(i,"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:M(i=>X(i,"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:M(i=>X(i,"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:Co([I($o(),t),I(Po(),t),e.options.rollup.json&&ho({...e.options.rollup.json}),{load(i){return/\.(?:js|cjs|mjs|jsx|ts|tsx|ctsx|mtsx|mts|json)$/.test(i)?null:""},name:"packem:ignore-files"},e.tsconfig&&I(Do(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&I(So(e.tsconfig,e.logger),t),e.options.rollup.replace&&Qt({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&Yt({customResolver:r,...e.options.rollup.alias,entries:o}),r,await Zi(n)(e),e.options.cjsInterop&&e.options.emitCJS&&co({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.patchTypes&&I(Pi(e.options.rollup.patchTypes,e.logger),t),yi(),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dtsTemplate=="function"&&bo({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),e.options.rollup.plugins)}},"getRollupDtsOptions");var ea=Object.defineProperty,ta=m((e,t)=>ea(e,"name",{value:t,configurable:!0}),"m$5");const It="rollup-build.json",oa=ta(async(e,t,o)=>{const s=await Mo(e,t);if(await e.hooks.callHook("rollup:options",e,s),Object.keys(s.input).length===0)return;let r=!0;(e.options.rollup.isolatedDeclarations||e.options.isolatedDeclarationTransformer||e.options.rollup.css)&&(r=!1),r&&(s.cache=t.get(It,o));const n=await Gt(s);r&&t.set(It,n.cache,o),await e.hooks.callHook("rollup:build",e,n);const i=new Map;for(const a of s.output){const{output:c}=await n.write(a),l=new Set,p=c.filter(u=>u.type==="chunk");for(const u of p){l.add(u.fileName);for(const f of u.imports)e.usedImports.add(f);u.isEntry&&e.buildEntries.push({bytes:Buffer.byteLength(u.code,"utf8"),chunks:u.imports.filter(f=>p.find(g=>g.fileName===f)),exports:u.exports,modules:Object.entries(u.modules).map(([f,g])=>({bytes:g.renderedLength,id:f})),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 l)e.usedImports.delete(u)}e.buildEntries.push(...i.values())},"build");var sa=Object.defineProperty,xe=m((e,t)=>sa(e,"name",{value:t,configurable:!0}),"a$7");const Mt="rollup-dts.json",ra=xe(async(e,t,o)=>{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 s=await To(e,t);if(await e.hooks.callHook("rollup:dts:options",e,s),Object.keys(s.input).length===0)return;s.cache=t.get(Mt,o);const r=await Gt(s);t.set(Mt,r.cache,o),await e.hooks.callHook("rollup:dts:build",e,r),e.logger.info({message:"Building declaration files...",prefix:"dts"}),e.options.emitCJS&&await r.write({chunkFileNames:xe(n=>X(n,"d.cts"),"chunkFileNames"),dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts"}),e.options.emitESM&&await r.write({chunkFileNames:xe(n=>X(n,"d.mts"),"chunkFileNames"),dir:j(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts"}),e.options.declaration==="compatible"&&await r.write({chunkFileNames:xe(n=>X(n,"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 na=Object.defineProperty,ia=m((e,t)=>na(e,"name",{value:t,configurable:!0}),"y$2");const aa=ia((e,t,o)=>e.reduce((s,r)=>{const n=r[t],i=r[o];return s[n]||(s[n]={}),s[n][i]||(s[n][i]=[]),s[n][i].push(r),s},{}),"groupByKeys");var la=Object.defineProperty,Ce=m((e,t)=>la(e,"name",{value:t,configurable:!0}),"j$1");const ca=Ce((e,t)=>{const o=Ce(i=>_(t.options.rootDir,j(t.options.outDir,i)),"rPath");let s=!1;const r=[],n=t.buildEntries.filter(i=>i.type==="entry");if(n.length>0){e.raw(`Entries:
77
- `);for(const i of n){let a=i.bytes??0;for(const l of i.chunks??[])a+=t.buildEntries.find(p=>p.path===l)?.bytes??0;let c=` ${W(o(i.path))} (${["total size: "+O(K(a)),i.bytes&&"chunk size: "+O(K(i.bytes))].filter(Boolean).join(", ")})`;if(c+=i.exports?.length?`
78
- exports: `+G(i.exports.join(", ")):"",i.chunks?.length&&(c+=`
79
- ${i.chunks.map(l=>{const p=t.buildEntries.find(d=>d.path===l)??{};return G(" └─ "+o(l)+W(p.bytes?" ("+K(p?.bytes)+")":""))}).join(`
80
- `)}`),i.modules&&i.modules.length>0){const l=i.modules.filter(p=>p.id.includes("node_modules")).sort((p,d)=>(d.bytes||0)-(p.bytes||0)).map(p=>G(" 📦 "+o(p.id)+W(p.bytes?" ("+K(p.bytes)+")":""))).join(`
81
- `);c+=l.length>0?`
60
+ ↳ 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"),et=new Map,je=new Map,Gt=D((e,t,o)=>{const r=D(i=>{for(const[s,a]of Object.entries(t))if(i.startsWith(s))return i.replace(s,a)},"findAlias"),n=Wt(e.tsconfig,!1);return{external(i){const s=r(i);s&&(i=s);const a=St(i);if(Ee(e.options.externals,a)||Ee(e.options.externals,i))return!0;const{pkg:l}=e;if(i.startsWith(".")||ft(i)||/src[/\\]/.test(i)||l.name&&i.startsWith(l.name))return!1;if(l.imports)for(const[c,u]of Object.entries(l.imports)){if(c===i)return!1;if(c.includes("*")){let p;je.has(c)?p=je.get(c):(p=gt(w(e.options.rootDir,u.replace("/*","")),{withFileTypes:!0}).filter(d=>d.isFile()).map(d=>d.name),je.set(c,p));for(const d of p)if(d.replace(J,"")===i.replace(J,"").replace("#",""))return!1}}if(n){for(const{find:c}of n)if(c.test(i))return e.logger.debug({message:`Resolved alias ${i} to ${c.source}`,prefix:o}),!1}return et.has(i)||e.logger.info({message:'Inlined implicit external "'+k(i)+'". If this is incorrect, add it to the "externals" option.',prefix:o}),et.set(i,!0),!1},input:Object.fromEntries(e.options.entries.map(i=>[i.name,$(e.options.rootDir,i.input)])),logLevel:e.options.debug?"debug":"info",onLog:D((i,s)=>{let a=s.message;switch(s.stack&&(a=`${a}
61
+ ${s.stack}`),i){case"info":{e.logger.info({message:a,prefix:o+(s.plugin?":plugin:"+s.plugin:"")});return}case"warn":{e.logger.warn({message:a,prefix:o+(s.plugin?":plugin:"+s.plugin:"")});return}case"debug":e.logger.debug({message:a,prefix:o+(s.plugin?":plugin:"+s.plugin:"")})}},"onLog"),onwarn(i,s){qt(i,e)||i.code||s(i)},watch:e.mode==="watch"?e.options.rollup.watch:!1}},"baseRollupOptions"),Xt=D(async(e,t)=>{const o=Ie(e,"build");let r;e.options.rollup.resolve&&(r=E($t({...e.options.rollup.resolve}),t));const n=e.options.rollup.output?.preserveModules?{preserveModules:!0,preserveModulesRoot:e.options.rollup.output.preserveModulesRoot??"src"}:{manualChunks:pi(e.dependencyGraphMap,e.buildEntries),preserveModules:!1};return{...Gt(e,o,"dependencies"),output:[e.options.emitCJS&&{chunkFileNames:D(i=>R(i,"cjs"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:D(i=>Ze(i,"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&&{chunkFileNames:D(i=>R(i,"mjs"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:D(i=>Ze(i,"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:Ht([E(Rt(),t),E(Ut(),t),e.tsconfig&&E(zt(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&E(Lt(e.tsconfig,e.logger),t),e.options.rollup.replace&&jt({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&wt({customResolver:r,...e.options.rollup.alias,entries:o}),r,e.options.rollup.polyfillNode&&To({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),e.options.rollup.json&&_t({...e.options.rollup.json}),Cr(),e.options.rollup.wasm&&_o(e.options.rollup.wasm),e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer&&rn(w(e.options.rootDir,e.options.sourceDir),e.options.isolatedDeclarationTransformer,e.options.declaration,!!e.options.rollup.cjsInterop,e.options.rollup.isolatedDeclarations),e.options.rollup.raw&&E(In(e.options.rollup.raw),t),e.options.transformer(bi(e.options.transformerName,e)),E(Cn({directiveRegex:/^['|"](use (\w+))['|"]$/,...e.options.rollup.preserveDirectives,logger:e.logger}),t),e.options.rollup.shebang&&Fn(e.options.entries.filter(i=>i.executable).map(i=>i.name).filter(Boolean),e.options.rollup.shebang),e.options.cjsInterop&&e.options.emitCJS&&Ct({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.dynamicVars&&Gr(),e.options.rollup.dynamicVars&&Co(e.options.rollup.dynamicVars),e.options.rollup.commonjs&&E(Po({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&&Kr(e.pkg,e.options.rollup.shim),e.options.rollup.jsxRemoveAttributes&&E(un({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:e.logger}),t),e.options.rollup.metafile&&bn({outDir:$(e.options.rootDir,e.options.outDir),rootDir:e.options.rootDir}),e.options.rollup.copy&&Br(e.options.rollup.copy,e.logger),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&Mt({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}),On(),e.options.emitCJS&&e.mode==="build"&&e.options.declaration==="compatible"&&e.options.rollup.node10Compatibility&&jn(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&&Io({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),e.options.rollup.plugins)}},"getRollupOptions"),wi=D(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"),$i=vr(wi),Yt=D(async(e,t)=>{const o=Ie(e,"types"),r={load(a){return/\.(?:js|cjs|mjs|jsx|ts|tsx|ctsx|mtsx|mts|json)$/.test(a)?null:""},name:"packem:ignore-files"},n=e.tsconfig?.config.compilerOptions;delete n?.lib;let i;e.options.rollup.resolve&&(i=E($t({...e.options.rollup.resolve}),t));const s="dts-plugin:"+process.pid+e.tsconfig.path;return{...Gt(e,o,"dts"),onwarn(a,l){qt(a,e)||a.code!=="EMPTY_BUNDLE"&&l(a)},output:[e.options.emitCJS&&{chunkFileNames:D(a=>R(a,"d.cts"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.emitESM&&{chunkFileNames:D(a=>R(a,"d.mts"),"chunkFileNames"),dir:$(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:D(a=>R(a,"d.ts"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output}].filter(Boolean),plugins:Ht([E(Rt(),t),E(Ut(),t),e.options.rollup.json&&_t({...e.options.rollup.json}),r,e.tsconfig&&E(zt(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&E(Lt(e.tsconfig,e.logger),t),e.options.rollup.replace&&jt({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&wt({customResolver:i,...e.options.rollup.alias,entries:o}),i,await $i(s)(e),e.options.cjsInterop&&e.options.emitCJS&&Ct({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.patchTypes&&E(Yn(e.options.rollup.patchTypes,e.logger),t),Jn(),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dtsTemplate=="function"&&Mt({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),e.options.rollup.plugins)}},"getRollupDtsOptions");var ji=Object.defineProperty,ki=m((e,t)=>ji(e,"name",{value:t,configurable:!0}),"f$4");const tt="rollup-build.json",ke=ki(async(e,t,o)=>{const r=await Xt(e,t);if(await e.hooks.callHook("rollup:options",e,r),Object.keys(r.input).length===0)return;(!e.options.rollup.isolatedDeclarations||!e.options.isolatedDeclarationTransformer)&&(r.cache=t.get(tt,o));const n=await bt(r);t.set(tt,n.cache,o),await e.hooks.callHook("rollup:build",e,n);const i=new Map;for(const s of r.output){const{output:a}=await n.write(s),l=new Set,c=a.filter(p=>p.type==="chunk");for(const p of c){l.add(p.fileName);for(const d of p.imports)e.usedImports.add(d);p.isEntry&&e.buildEntries.push({bytes:Buffer.byteLength(p.code,"utf8"),chunks:p.imports.filter(d=>c.find(f=>f.fileName===d)),exports:p.exports,modules:Object.entries(p.modules).map(([d,f])=>({bytes:f.renderedLength,id:d})),path:p.fileName,type:"entry"})}const u=a.filter(p=>p.type==="asset");for(const p of u)i.has(p.fileName)||i.set(p.fileName,{bytes:Buffer.byteLength(p.source,"utf8"),path:p.fileName,type:"asset"});for(const p of l)e.usedImports.delete(p)}e.buildEntries.push(...i.values())},"build");var xi=Object.defineProperty,Z=m((e,t)=>xi(e,"name",{value:t,configurable:!0}),"a$7");const ot="rollup-dts.json",ee=Z(async(e,t,o)=>{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 r=await Yt(e,t);if(await e.hooks.callHook("rollup:dts:options",e,r),Object.keys(r.input).length===0)return;r.cache=t.get(ot,o);const n=await bt(r);t.set(ot,n.cache,o),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:Z(i=>R(i,"d.cts"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts"}),e.options.emitESM&&await n.write({chunkFileNames:Z(i=>R(i,"d.mts"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts"}),e.options.declaration==="compatible"&&await n.write({chunkFileNames:Z(i=>R(i,"d.mjs"),"chunkFileNames"),dir:$(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts"}),await e.hooks.callHook("rollup:dts:done",e)},"buildTypes");var Ei=Object.defineProperty,Di=m((e,t)=>Ei(e,"name",{value:t,configurable:!0}),"y$2");const Si=Di((e,t,o)=>e.reduce((r,n)=>{const i=n[t],s=n[o];return r[i]||(r[i]={}),r[i][s]||(r[i][s]=[]),r[i][s].push(n),r},{}),"groupByKeys");var Oi=Object.defineProperty,pe=m((e,t)=>Oi(e,"name",{value:t,configurable:!0}),"j$1");const Ni=pe((e,t)=>{const o=pe(s=>O(t.options.rootDir,$(t.options.outDir,s)),"rPath");let r=!1;const n=[],i=t.buildEntries.filter(s=>s.type==="entry");if(i.length>0){e.raw(`Entries:
62
+ `);for(const s of i){let a=s.bytes??0;for(const c of s.chunks??[])a+=t.buildEntries.find(u=>u.path===c)?.bytes??0;let l=` ${N(o(s.path))} (${["total size: "+k(I(a)),s.bytes&&"chunk size: "+k(I(s.bytes))].filter(Boolean).join(", ")})`;if(l+=s.exports?.length?`
63
+ exports: `+M(s.exports.join(", ")):"",s.chunks?.length&&(l+=`
64
+ ${s.chunks.map(c=>{const u=t.buildEntries.find(p=>p.path===c)??{};return M(" └─ "+o(c)+N(u.bytes?" ("+I(u?.bytes)+")":""))}).join(`
65
+ `)}`),s.modules&&s.modules.length>0){const c=s.modules.filter(u=>u.id.includes("node_modules")).sort((u,p)=>(p.bytes||0)-(u.bytes||0)).map(u=>M(" 📦 "+o(u.id)+N(u.bytes?" ("+I(u.bytes)+")":""))).join(`
66
+ `);l+=c.length>0?`
82
67
  inlined modules:
83
- `+l:""}if(t.options.declaration){let l=i.path.replace(/\.js$/,".d.ts"),p="commonjs";i.path.endsWith(".cjs")?l=i.path.replace(/\.cjs$/,".d.cts"):i.path.endsWith(".mjs")&&(p="module",l=i.path.replace(/\.mjs$/,".d.mts"));const d=t.buildEntries.find(u=>u.path.endsWith(l));if(d){r.push(d.path);let u;l.includes(".d.ts")||(l=l.replace(".d.c",".d."),u=t.buildEntries.find(f=>f.path.endsWith(l))),u&&(r.push(u.path),c+=p==="commonjs"?`
68
+ `+c:""}if(t.options.declaration){let c=s.path.replace(/\.js$/,".d.ts"),u="commonjs";s.path.endsWith(".cjs")?c=s.path.replace(/\.cjs$/,".d.cts"):s.path.endsWith(".mjs")&&(u="module",c=s.path.replace(/\.mjs$/,".d.mts"));const p=t.buildEntries.find(d=>d.path.endsWith(c));if(p){n.push(p.path);let d;c.includes(".d.ts")||(c=c.replace(".d.c",".d."),d=t.buildEntries.find(f=>f.path.endsWith(c))),d&&(n.push(d.path),l+=u==="commonjs"?`
84
69
  types:
85
- `+[d,u].map(f=>G(" └─ ")+W(o(f.path))+" (total size: "+O(K(f.bytes??0))+")").join(`
70
+ `+[p,d].map(f=>M(" └─ ")+N(o(f.path))+" (total size: "+k(I(f.bytes??0))+")").join(`
86
71
  `):`
87
- types: `+W(o(d.path))+" (total size: "+O(K(d.bytes??0))+")")}}s=!0,c+=`
72
+ types: `+N(o(p.path))+" (total size: "+k(I(p.bytes??0))+")")}}r=!0,l+=`
88
73
 
89
- `,e.raw(i.chunk?G(c):c)}}if(t.buildEntries.filter(i=>i.type==="asset").length>0){let i="Assets:";for(const a of t.buildEntries.filter(c=>c.type==="asset"))r.includes(a.path)||(i+=G(`
90
- └─ `)+W(o(a.path))+" (total size: "+O(K(a.bytes??0))+")");i+=`
74
+ `,e.raw(s.chunk?M(l):l)}}if(t.buildEntries.filter(s=>s.type==="asset").length>0){let s="Assets:";for(const a of t.buildEntries.filter(l=>l.type==="asset"))n.includes(a.path)||(s+=M(`
75
+ └─ `)+N(o(a.path))+" (total size: "+k(I(a.bytes??0))+")");s+=`
91
76
 
92
- `,e.raw(i)}return s&&e.raw("Σ Total dist size (byte size):",O(K(t.buildEntries.reduce((i,a)=>i+(a.bytes??0),0),{decimals:2})),`
93
- `),s},"showSizeInformation"),pa=Ce((e,t)=>{const o=aa(e.options.entries,"environment","runtime"),s=new Set,r=new Set;for(const[n,i]of Object.entries(o))for(const[a,c]of Object.entries(i)){const l={...e};!e.options.dtsOnly&&(n!=="undefined"||a!=="undefined")&&e.logger.info("Preparing build for "+(n==="undefined"?"":O(n)+" environment"+(a==="undefined"?"":" with "))+(a==="undefined"?"":O(a)+" runtime"));const p={};l.options.rollup.replace?(l.options.rollup.replace.values===void 0&&(l.options.rollup.replace.values={}),n!=="undefined"&&(p[["process","env","NODE_ENV"].join(".")]=JSON.stringify(n)),p[["process","env","EdgeRuntime"].join(".")]=JSON.stringify(a==="edge-light"),Object.freeze(p)):e.logger.warn("'replace' plugin is disabled. You should enable it to replace 'process.env.*' environments.");let d="";n!=="undefined"&&(d+=n+"/"),a!=="undefined"&&(d+=a+"/");let u=!1;l.options.minify!==void 0&&(u=l.options.minify),n==="development"?u=!1:n==="production"&&(u=!0);const f=[],g=[],b=[],h=[];for(const v of c)v.cjs&&v.esm?f.push(v):v.cjs?b.push(v):v.esm?g.push(v):v.declaration&&h.push(v);if(f.length>0){const v={...l,options:{...l.options,emitCJS:!0,emitESM:!0,entries:f,minify:u,rollup:{...l.options.rollup,replace:l.options.rollup.replace?{...l.options.rollup.replace,values:{...l.options.rollup.replace.values,...p}}:!1}}};if(e.options.dtsOnly||s.add({context:v,fileCache:t,subDirectory:d}),e.options.declaration){const w=v.options.entries.filter(y=>y.declaration);w.length>0&&r.add({context:{...v,options:{...v.options,entries:w}},fileCache:t,subDirectory:d})}}if(g.length>0){const v={...l,options:{...l.options,emitCJS:!1,emitESM:!0,entries:g,minify:u,rollup:{...l.options.rollup,replace:l.options.rollup.replace?{...l.options.rollup.replace,values:{...l.options.rollup.replace.values,...p}}:!1}}};if(e.options.dtsOnly||s.add({context:v,fileCache:t,subDirectory:d}),e.options.declaration){const w=v.options.entries.filter(y=>y.declaration);w.length>0&&r.add({context:{...v,options:{...v.options,entries:w}},fileCache:t,subDirectory:d})}}if(b.length>0){const v={...l,options:{...l.options,emitCJS:!0,emitESM:!1,entries:b,minify:u,rollup:{...l.options.rollup,replace:l.options.rollup.replace?{...l.options.rollup.replace,values:{...l.options.rollup.replace.values,...p}}:!1}}};if(e.options.dtsOnly||s.add({context:v,fileCache:t,subDirectory:d}),e.options.declaration){const w=v.options.entries.filter(y=>y.declaration);w.length>0&&r.add({context:{...v,options:{...v.options,entries:w}},fileCache:t,subDirectory:d})}}l.options.declaration&&h.length>0&&r.add({context:{...l,options:{...l.options,emitCJS:!1,emitESM:!1,entries:h,minify:u,rollup:{...l.options.rollup,replace:l.options.rollup.replace?{...l.options.rollup.replace,values:{...l.options.rollup.replace.values,...p}}:!1}}},fileCache:t,subDirectory:d})}return{builders:s,typeBuilders:r}},"prepareRollupConfig"),ua=Ce(async(e,t)=>{await e.hooks.callHook("build:before",e);const{builders:o,typeBuilders:s}=pa(e,t);await Promise.all([...o].map(async({context:r,fileCache:n,subDirectory:i})=>await oa(r,n,i))),await Promise.all([...s].map(async({context:r,fileCache:n,subDirectory:i})=>await ra(r,n,i))),e.logger.success(ts(e.options.name?"Build succeeded for "+e.options.name:"Build succeeded"));for await(const r of Go($(e.options.rootDir,e.options.outDir))){let n=e.buildEntries.find(i=>$(e.options.rootDir,e.options.outDir,i.path)===r.path);if(n||(n={chunk:!0,path:r.path},e.buildEntries.push(n)),!n.bytes){const i=await Ht(j(e.options.rootDir,e.options.outDir,r.path));n.bytes=i.size}}return await e.hooks.callHook("build:done",e),ca(e.logger,e)},"build");var da=Object.defineProperty,fa=m((e,t)=>da(e,"name",{value:t,configurable:!0}),"r$5");const E=fa((e,t)=>{e.warnings.has(t)||e.warnings.add(t)},"warn");var ma=Object.defineProperty,Ao=m((e,t)=>ma(e,"name",{value:t,configurable:!0}),"t$3");const _e=Ao(e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},"inferExportTypeFromFileName"),tt=Ao((e,t,o,s)=>{if(e==="module-sync")return"esm";if(s){const i=_e(s);if(i)return i}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return o;const[r,...n]=t;return tt(r,n,o,s)},"inferExportType");var ga=Object.defineProperty,ha=m((e,t)=>ga(e,"name",{value:t,configurable:!0}),"y$1");const ya=new Set(["electron","import","require","node","node-addons","default","types","deno","browser","module-sync","bun","workerd",...it,...Pe]),ct=ha((e,t,o,s=[])=>{if(!e)return[];if(typeof e=="string"){const r=_e(e);if(r&&r!==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:r??t}]}if(typeof e=="object"){const r=Object.entries(e).filter(([i])=>!i.endsWith(".json"));let n=[];for(const[i,a]of r)if(typeof a=="string"){let c={};Number.isInteger(+i)?c={exportKey:"*"}:i.startsWith("./")?c={exportKey:i.replace("./","")}:c={exportKey:i==="."?".":"*",subKey:i},n.push({...c,file:a,key:"exports",type:tt(i,s,t,a)})}else if(typeof a=="object"&&a!==null)for(const[c,l]of Object.entries(a)){if(o===!1&&c==="types")continue;const p=Number.isInteger(+i)?c:i;typeof l=="string"?n.push({exportKey:p.replace("./",""),file:l,key:"exports",...ya.has(c)?{subKey:c}:{},type:tt(c,s,t,l)}):n=[...n,...ct({[p]:l},t,o,[...s,c])]}return n}return[]},"extractExportFilenames");var va=Object.defineProperty,Le=m((e,t)=>va(e,"name",{value:t,configurable:!0}),"c$3");const ba=Le((e,t)=>e.key==="exports"&&e.subKey===q?q:e.key==="exports"&&e.subKey===ge?ge:t,"getEnvironment"),je=Le((e,t,o,s,r,n,i)=>{const a=ba(r,n.environment);let c="node";for(const d of it)if(r.file.includes("."+d+".")||r.subKey===d){c=d;break}let l=e.find(d=>d.input===t&&d.environment===a&&d.runtime===c);l===void 0?l=e[e.push({environment:a,exportKey:new Set([r.exportKey].filter(Boolean)),input:t,runtime:c})-1]:l.exportKey&&r.exportKey&&l.exportKey.add(r.exportKey),i&&(l.isGlob=!0),o&&(l.outDir=s),r.isExecutable?(l.executable=!0,l.declaration=!1,r.type==="cjs"?l.cjs=!0:r.type==="esm"&&(l.esm=!0)):(/\.d\.[mc]?ts$/.test(r.file)&&n.options.declaration!==!1&&(l.declaration=n.options.declaration),r.type==="cjs"?l.cjs=!0:r.type==="esm"&&(l.esm=!0));const p=r.file.replace(Vt(r.file),"").replace(new RegExp(`^./${n.options.outDir.replace(/^\.\//,"")}/`),"");Pe.has(r.subKey)&&!t.includes(p)&&(l.fileAlias=p)},"createOrUpdateEntry");let Tt=!1;const At=Le(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"),wa=Le((e,t,o)=>{const s=[];t.sort((a,c)=>a.split("/").length-c.split("/").length);const r=e.type==="module"?"esm":"cjs";r==="esm"&&(o.options.emitESM=!0),r==="cjs"&&(o.options.emitCJS=!0);const n=ct(e.exports,r,o.options.declaration);if(e.bin){const a=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const c of a){const l=_e(c);if(l&&l!==r)throw new Error(`Exported file "${c}" has an extension that does not match the package.json type "${e.type??"commonjs"}".`);n.push({file:c,isExecutable:!0,key:"bin",type:l??r})}}e.main&&n.push({file:e.main,key:"main",type:_e(e.main)??r}),e.module&&n.push({file:e.module,key:"module",type:"esm"}),(e.types||e.typings)&&(At(o),o.options.declaration===void 0&&(o.options.declaration="compatible"),n.push({file:e.types??e.typings,key:"types"}));const i=[];for(const a of n){o.options.declaration===void 0&&(a.key==="types"||a.subKey==="types")&&(o.options.declaration=a.file.includes(".d.ts")?"compatible":!0),o.options.emitCJS===void 0&&a.type==="cjs"&&(o.options.emitCJS=!0),o.options.emitESM===void 0&&a.type==="esm"&&(o.options.emitESM=!0);const c=a.file.replace(/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,""),l=c.endsWith("/");if(l&&["./","/"].includes(c))continue;const p=c.replace(new RegExp("(./)?"+o.options.outDir),o.options.sourceDir).replace("./",""),d="(?<=/|$)",u=l?"":"\\.\\w+$";if(a.file.includes("/*")&&a.key==="exports"){Tt||(o.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),Tt=!0);const h=[],v=new RegExp(d+p.replace("*","(.*)")+u),w=new RegExp(d+p.replace(/(.*)\.[^.]*$/,"$1").replace("*","(.*)")+u);for(const y of t)(v.test(y)||Pe.has(a.subKey)&&w.test(y))&&h.push(y);if(h.length===0){s.push(`Could not find entrypoint for \`${a.file}\``);continue}for(const y of h)je(i,y,l,c,a,o,!0);continue}const f=new RegExp(d+p+u);let g=t.find(h=>f.test(h));if(Pe.has(a.subKey)&&g===void 0){const h=new RegExp(d+p.replace(/(.*)\.[^.]*$/,"$1")+u);g=t.find(v=>h.test(v))}if(g===void 0){T(j(o.options.rootDir,a.file))||s.push(`Could not find entrypoint for \`${a.file}\``);continue}(g.endsWith(".ts")||g.endsWith(".cts")||g.endsWith(".mts"))&&T(g)&&At(o);const b=Oe(g.replace(te,""));T(b+".cts")&&T(b+".mts")?(je(i,b+".cts",l,c,{...a,type:"cjs"},o,!1),je(i,b+".mts",l,c,{...a,type:"esm"},o,!1)):je(i,g,l,c,a,o,!1)}return{entries:i,warnings:s}},"inferEntries");var $a=Object.defineProperty,xa=m((e,t)=>$a(e,"name",{value:t,configurable:!0}),"o$3");const ja=xa((e,t)=>{const{publishConfig:o}=e;return o&&(o.bin&&(typeof o.bin=="object"||typeof o.bin=="string")&&(e.bin=o.bin),o.type&&typeof o.type=="string"&&o.type!==""&&(e.type=o.type),o.main&&typeof o.main=="string"&&o.main!==""&&(e.main=o.main),o.module&&typeof o.module=="string"&&o.module!==""&&(e.module=o.module),t===void 0&&o.types&&typeof o.types=="string"&&o.types!==""?e.types=o.types:t===void 0&&o.typings&&typeof o.typings=="string"&&o.typings!==""&&(e.typings=o.typings),o.exports&&typeof o.exports=="object"&&(e.exports=o.exports)),e},"overwriteWithPublishConfig");var ka=Object.defineProperty,Ea=m((e,t)=>ka(e,"name",{value:t,configurable:!0}),"t$2");const Sa={hooks:{"build:prepare":Ea(function(e){if(e.options.entries.length>0)return;const t=$(e.options.rootDir,e.options.sourceDir);if(!qt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const o=Yo(t,{extensions:[],includeDirs:!1,includeSymlinks:!1});if(o.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");let s={...e.pkg};s.publishConfig&&(e.logger.info('Using publishConfig found in package.json, to override the default key-value pairs of "'+Object.keys(s.publishConfig).join(", ")+'".'),e.logger.debug(s.publishConfig),s=ja(s,e.options.declaration));const r=wa(s,o,e);for(const n of r.warnings)E(e,n);if(e.options.entries.push(...r.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");e.logger.info("Automatically detected entries:",O(e.options.entries.map(n=>n.fileAlias?W(n.fileAlias)+" => "+W(n.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*")):W(n.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),G([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(n=>`[${n}]`).join(" ")))},"build:prepare")}};var Oa=Object.defineProperty,Da=m((e,t)=>Oa(e,"name",{value:t,configurable:!0}),"t$1");const Pa=Da(async(e,t)=>{if(e==="auto")e=Sa;else{if(e==="none")return{};typeof e=="string"&&(e=await t.import(e)||{})}return typeof e=="function"&&(e=e()),e},"resolvePreset");var Na=Object.defineProperty,Ca=m((e,t)=>Na(e,"name",{value:t,configurable:!0}),"j");const _a=Ca(async e=>{const t=e.options.jiti.transformOptions?.babel?.plugins,o=[],s=JSON.stringify({...e.options.jiti,alias:{...lt(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((r,n)=>{if(Array.isArray(r)){const[i,...a]=r;return o.push(i),"["+["plugin"+n,...a.map(c=>JSON.stringify(c))].join(", ")+"]"}return o.push(r),"plugin"+n}).join(",")+"]":"[]");for(const r of e.options.entries){const n=j(e.options.rootDir,e.options.outDir,r.name),i=Os(e.jiti.esmResolve(r.input,{try:!0})??r.input),a=i.replace(te,""),c=Me(i),l=vi(c);let p=[];try{p=await Ds(i,{extensions:nt})}catch(u){E(e,`Cannot analyze ${i} for exports: ${u.toString()}`);return}const d=p.includes("default")||p.length===0;if(e.options.emitESM){const u=_(J(n),await gt("jiti",{conditions:["node","import"],url:import.meta.url})),f=a+".d.mts";ee(`${n}.mjs`,l+['import { createJiti } from "'+u+'";',...o.map((g,b)=>"import plugin"+b+' from "'+g+'";'),"","const jiti = createJiti(import.meta.url, "+s+");","",'/** @type {import("'+f+'")} */','const _module = await jiti.import("'+i+'");',d?`
94
- export default _module;`:"",...p.filter(g=>g!=="default").map(g=>`export const ${g} = _module.${g};`)].join(`
95
- `)),e.options.declaration&&ee(`${n}.d.mts`,'export * from "'+f+`";
96
- `+(d?'export { default } from "'+f+'";':""))}if(e.options.emitCJS){const u=_(J(n),await gt("jiti",{conditions:["node","require"],url:import.meta.url})),f=a+".d.cts";ee(`${n}.cjs`,l+['const { createJiti } = require("'+u+'");',...o.map((g,b)=>"const plugin"+b+" = require("+JSON.stringify(g)+")"),"","const jiti = createJiti(__filename, "+s+");","",'/** @type {import("'+f+'")} */','module.exports = jiti("'+i+'")'].join(`
97
- `)),e.options.declaration&&ee(n+".d.cts",'export * from "'+f+`";
98
- `+(d?'export { default } from "'+f+'";':""))}l&&(await et(`${n}.cjs`),await et(`${n}.mjs`))}await e.hooks.callHook("rollup:done",e)},"createStub");var Ia=Object.defineProperty,pt=m((e,t)=>Ia(e,"name",{value:t,configurable:!0}),"i$3");const Ma=pt(e=>{const{message:t,name:o="Error",stack:s}=e;if(!s)return s;const r=`${o}: ${t}
99
- `;return s.startsWith(r)?s.slice(r.length):s},"extractStack"),Ta=pt(e=>`
77
+ `,e.raw(s)}return r&&e.raw("Σ Total dist size (byte size):",k(I(t.buildEntries.reduce((s,a)=>s+(a.bytes??0),0))),`
78
+ `),r},"showSizeInformation"),Pi=pe((e,t)=>{const o=Si(e.options.entries,"environment","runtime"),r=[];for(const[n,i]of Object.entries(o))for(const[s,a]of Object.entries(i)){const l={...e};!e.options.dtsOnly&&(n!=="undefined"||s!=="undefined")&&e.logger.info("Preparing build for "+(n==="undefined"?"":k(n)+" environment"+(s==="undefined"?"":" with "))+(s==="undefined"?"":k(s)+" runtime")),l.options.rollup.replace?(l.options.rollup.replace.values===void 0&&(l.options.rollup.replace.values={}),n!=="undefined"&&(l.options.rollup.replace.values={...l.options.rollup.replace.values,[["process","env","NODE_ENV"].join(".")]:JSON.stringify(n)}),l.options.rollup.replace.values={...l.options.rollup.replace.values,[["process","env","EdgeRuntime"].join(".")]:JSON.stringify(s==="edge-light")}):e.logger.warn("'replace' plugin is disabled. You should enable it to replace 'process.env.*' environments.");let c="";n!=="undefined"&&(c+=n+"/"),s!=="undefined"&&(c+=s+"/");let u=!1;l.options.minify!==void 0&&(u=l.options.minify),n==="development"?u=!1:n==="production"&&(u=!0);const p=[],d=[],f=[],y=[];for(const g of a)g.cjs&&g.esm?p.push(g):g.cjs?f.push(g):g.esm?d.push(g):g.declaration&&y.push(g);if(p.length>0){const g={...l,options:{...l.options,emitCJS:!0,emitESM:!0,entries:p,minify:u}};if(e.options.dtsOnly||r.push(ke(g,t,c)),e.options.declaration){const h=g.options.entries.filter(b=>b.declaration);h.length>0&&r.push(ee({...g,options:{...g.options,entries:h}},t,c))}}if(d.length>0){const g={...l,options:{...l.options,emitCJS:!1,emitESM:!0,entries:d,minify:u}};if(e.options.dtsOnly||r.push(ke(g,t,c)),e.options.declaration){const h=g.options.entries.filter(b=>b.declaration);h.length>0&&r.push(ee({...g,options:{...g.options,entries:h}},t,c))}}if(f.length>0){const g={...l,options:{...l.options,emitCJS:!0,emitESM:!1,entries:f,minify:u}};if(e.options.dtsOnly||r.push(ke(g,t,c)),e.options.declaration){const h=g.options.entries.filter(b=>b.declaration);h.length>0&&r.push(ee({...g,options:{...g.options,entries:h}},t,c))}}if(l.options.declaration&&y.length>0){const g={...l,options:{...l.options,emitCJS:!1,emitESM:!1,entries:y,minify:u}};r.push(ee(g,t,c))}}return r.filter(Boolean)},"prepareRollupConfig"),Ci=pe(async(e,t)=>{await e.hooks.callHook("build:before",e),await Promise.all(Pi(e,t)),e.logger.success($o(e.options.name?"Build succeeded for "+e.options.name:"Build succeeded"));for await(const o of go(w(e.options.rootDir,e.options.outDir))){let r=e.buildEntries.find(n=>w(e.options.rootDir,e.options.outDir,n.path)===o.path);if(r||(r={chunk:!0,path:o.path},e.buildEntries.push(r)),!r.bytes){const n=await ht($(e.options.rootDir,e.options.outDir,o.path));r.bytes=n.size}}return await e.hooks.callHook("build:done",e),Ni(e.logger,e)},"build");var _i=Object.defineProperty,Ti=m((e,t)=>_i(e,"name",{value:t,configurable:!0}),"r$5");const j=Ti((e,t)=>{e.warnings.has(t)||e.warnings.add(t)},"warn");var Ii=Object.defineProperty,Qt=m((e,t)=>Ii(e,"name",{value:t,configurable:!0}),"t$4");const ue=Qt(e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},"inferExportTypeFromFileName"),Se=Qt((e,t,o,r)=>{if(e==="module-sync")return"esm";if(r){const s=ue(r);if(s)return s}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return o;const[n,...i]=t;return Se(n,i,o,r)},"inferExportType");var Mi=Object.defineProperty,Ai=m((e,t)=>Mi(e,"name",{value:t,configurable:!0}),"y$1");const Ri=new Set(["electron","import","require","node","node-addons","default","types","deno","browser","module-sync","bun","workerd",..._e,...le]),Me=Ai((e,t,o,r=[])=>{if(!e)return[];if(typeof e=="string"){const n=ue(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 i=[];for(const[s,a]of n)if(typeof a=="string"){let l={};Number.isInteger(+s)?l={exportKey:"*"}:s.startsWith("./")?l={exportKey:s.replace("./","")}:l={exportKey:s==="."?".":"*",subKey:s},i.push({...l,file:a,key:"exports",type:Se(s,r,t,a)})}else if(typeof a=="object"&&a!==null)for(const[l,c]of Object.entries(a)){if(o===!1&&l==="types")continue;const u=Number.isInteger(+s)?l:s;typeof c=="string"?i.push({exportKey:u.replace("./",""),file:c,key:"exports",...Ri.has(l)?{subKey:l}:{},type:Se(l,r,t,c)}):i=[...i,...Me({[u]:c},t,o,[...r,l])]}return i}return[]},"extractExportFilenames");var Fi=Object.defineProperty,he=m((e,t)=>Fi(e,"name",{value:t,configurable:!0}),"c$3");const Ji=he((e,t)=>e.key==="exports"&&e.subKey===C?C:e.key==="exports"&&e.subKey===G?G:t,"getEnvironment"),te=he((e,t,o,r,n,i,s)=>{const a=Ji(n,i.environment);let l="node";for(const p of _e)if(n.file.includes("."+p+".")||n.subKey===p){l=p;break}let c=e.find(p=>p.input===t&&p.environment===a&&p.runtime===l);c===void 0?c=e[e.push({environment:a,exportKey:new Set([n.exportKey].filter(Boolean)),input:t,runtime:l})-1]:c.exportKey&&n.exportKey&&c.exportKey.add(n.exportKey),s&&(c.isGlob=!0),o&&(c.outDir=r),n.isExecutable?(c.executable=!0,c.declaration=!1,n.type==="cjs"?c.cjs=!0:n.type==="esm"&&(c.esm=!0)):(/\.d\.[mc]?ts$/.test(n.file)&&i.options.declaration!==!1&&(c.declaration=i.options.declaration),n.type==="cjs"?c.cjs=!0:n.type==="esm"&&(c.esm=!0));const u=n.file.replace(mt(n.file),"").replace(new RegExp(`^./${i.options.outDir.replace(/^\.\//,"")}/`),"");le.has(n.subKey)&&!t.includes(u)&&(c.fileAlias=u)},"createOrUpdateEntry");let rt=!1;const nt=he(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"),Bi=he((e,t,o)=>{const r=[];t.sort((a,l)=>a.split("/").length-l.split("/").length);const n=e.type==="module"?"esm":"cjs";n==="esm"&&(o.options.emitESM=!0),n==="cjs"&&(o.options.emitCJS=!0);const i=Me(e.exports,n,o.options.declaration);if(e.bin){const a=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const l of a){const c=ue(l);if(c&&c!==n)throw new Error(`Exported file "${l}" has an extension that does not match the package.json type "${e.type??"commonjs"}".`);i.push({file:l,isExecutable:!0,key:"bin",type:c??n})}}e.main&&i.push({file:e.main,key:"main",type:ue(e.main)??n}),e.module&&i.push({file:e.module,key:"module",type:"esm"}),(e.types||e.typings)&&(nt(o),o.options.declaration===void 0&&(o.options.declaration="compatible"),i.push({file:e.types??e.typings,key:"types"}));const s=[];for(const a of i){o.options.declaration===void 0&&(a.key==="types"||a.subKey==="types")&&(o.options.declaration=a.file.includes(".d.ts")?"compatible":!0),o.options.emitCJS===void 0&&a.type==="cjs"&&(o.options.emitCJS=!0),o.options.emitESM===void 0&&a.type==="esm"&&(o.options.emitESM=!0);const l=a.file.replace(/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,""),c=l.endsWith("/");if(c&&["./","/"].includes(l))continue;const u=l.replace(new RegExp("(./)?"+o.options.outDir),o.options.sourceDir).replace("./",""),p="(?<=/|$)",d=c?"":"\\.\\w+$";if(a.file.includes("/*")&&a.key==="exports"){rt||(o.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),rt=!0);const h=[],b=new RegExp(p+u.replace("*","(.*)")+d),x=new RegExp(p+u.replace(/(.*)\.[^.]*$/,"$1").replace("*","(.*)")+d);for(const v of t)(b.test(v)||le.has(a.subKey)&&x.test(v))&&h.push(v);if(h.length===0){r.push(`Could not find entrypoint for \`${a.file}\``);continue}for(const v of h)te(s,v,c,l,a,o,!0);continue}const f=new RegExp(p+u+d);let y=t.find(h=>f.test(h));if(le.has(a.subKey)&&y===void 0){const h=new RegExp(p+u.replace(/(.*)\.[^.]*$/,"$1")+d);y=t.find(b=>h.test(b))}if(y===void 0){S($(o.options.rootDir,a.file))||r.push(`Could not find entrypoint for \`${a.file}\``);continue}(y.endsWith(".ts")||y.endsWith(".cts")||y.endsWith(".mts"))&&S(y)&&nt(o);const g=se(y.replace(J,""));S(g+".cts")&&S(g+".mts")?(te(s,g+".cts",c,l,{...a,type:"cjs"},o,!1),te(s,g+".mts",c,l,{...a,type:"esm"},o,!1)):te(s,y,c,l,a,o,!1)}return{entries:s,warnings:r}},"inferEntries");var Wi=Object.defineProperty,Li=m((e,t)=>Wi(e,"name",{value:t,configurable:!0}),"o$3");const Vi=Li((e,t)=>{const{publishConfig:o}=e;return o&&(o.bin&&(typeof o.bin=="object"||typeof o.bin=="string")&&(e.bin=o.bin),o.type&&typeof o.type=="string"&&o.type!==""&&(e.type=o.type),o.main&&typeof o.main=="string"&&o.main!==""&&(e.main=o.main),o.module&&typeof o.module=="string"&&o.module!==""&&(e.module=o.module),t===void 0&&o.types&&typeof o.types=="string"&&o.types!==""?e.types=o.types:t===void 0&&o.typings&&typeof o.typings=="string"&&o.typings!==""&&(e.typings=o.typings),o.exports&&typeof o.exports=="object"&&(e.exports=o.exports)),e},"overwriteWithPublishConfig");var zi=Object.defineProperty,Ui=m((e,t)=>zi(e,"name",{value:t,configurable:!0}),"t$3");const Ki={hooks:{"build:prepare":Ui(function(e){if(e.options.entries.length>0)return;const t=w(e.options.rootDir,e.options.sourceDir);if(!yt(t))throw new Error("No 'src' directory found. Please provide entries manually.");const o=yo(t,{extensions:[],includeDirs:!1,includeSymlinks:!1});if(o.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");let r={...e.pkg};r.publishConfig&&(e.logger.info('Using publishConfig found in package.json, to override the default key-value pairs of "'+Object.keys(r.publishConfig).join(", ")+'".'),e.logger.debug(r.publishConfig),r=Vi(r,e.options.declaration));const n=Bi(r,o,e);for(const i of n.warnings)j(e,i);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:",k(e.options.entries.map(i=>i.fileAlias?N(i.fileAlias)+" => "+N(i.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*")):N(i.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),M([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(i=>`[${i}]`).join(" ")))},"build:prepare")}};var Hi=Object.defineProperty,qi=m((e,t)=>Hi(e,"name",{value:t,configurable:!0}),"t$2");const Gi=qi(async(e,t)=>{if(e==="auto")e=Ki;else{if(e==="none")return{};typeof e=="string"&&(e=await t.import(e)||{})}return typeof e=="function"&&(e=e()),e},"resolvePreset");var Xi=Object.defineProperty,Yi=m((e,t)=>Xi(e,"name",{value:t,configurable:!0}),"j");const Qi=Yi(async e=>{const t=e.options.jiti.transformOptions?.babel?.plugins,o=[],r=JSON.stringify({...e.options.jiti,alias:{...Ie(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,i)=>{if(Array.isArray(n)){const[s,...a]=n;return o.push(s),"["+["plugin"+i,...a.map(l=>JSON.stringify(l))].join(", ")+"]"}return o.push(n),"plugin"+i}).join(",")+"]":"[]");for(const n of e.options.entries){const i=$(e.options.rootDir,e.options.outDir,n.name),s=Wo(e.jiti.esmResolve(n.input,{try:!0})??n.input),a=s.replace(J,""),l=Ne(s),c=Bn(l);let u=[];try{u=await Lo(s,{extensions:Ce})}catch(d){j(e,`Cannot analyze ${s} for exports: ${d.toString()}`);return}const p=u.includes("default")||u.length===0;if(e.options.emitESM){const d=O(V(i),await Le("jiti",{conditions:["node","import"],url:import.meta.url})),f=a+".d.mts";F(`${i}.mjs`,c+['import { createJiti } from "'+d+'";',...o.map((y,g)=>"import plugin"+g+' from "'+y+'";'),"","const jiti = createJiti(import.meta.url, "+r+");","",'/** @type {import("'+f+'")} */','const _module = await jiti.import("'+s+'");',p?`
79
+ export default _module;`:"",...u.filter(y=>y!=="default").map(y=>`export const ${y} = _module.${y};`)].join(`
80
+ `)),e.options.declaration&&F(`${i}.d.mts`,'export * from "'+f+`";
81
+ `+(p?'export { default } from "'+f+'";':""))}if(e.options.emitCJS){const d=O(V(i),await Le("jiti",{conditions:["node","require"],url:import.meta.url})),f=a+".d.cts";F(`${i}.cjs`,c+['const { createJiti } = require("'+d+'");',...o.map((y,g)=>"const plugin"+g+" = require("+JSON.stringify(y)+")"),"","const jiti = createJiti(__filename, "+r+");","",'/** @type {import("'+f+'")} */','module.exports = jiti("'+s+'")'].join(`
82
+ `)),e.options.declaration&&F(i+".d.cts",'export * from "'+f+`";
83
+ `+(p?'export { default } from "'+f+'";':""))}c&&(await De(`${i}.cjs`),await De(`${i}.mjs`))}await e.hooks.callHook("rollup:done",e)},"createStub");var Zi=Object.defineProperty,Ae=m((e,t)=>Zi(e,"name",{value:t,configurable:!0}),"i$3");const es=Ae(e=>{const{message:t,name:o="Error",stack:r}=e;if(!r)return r;const n=`${o}: ${t}
84
+ `;return r.startsWith(n)?r.slice(n.length):r},"extractStack"),ts=Ae(e=>`
100
85
  ${e.replaceAll(/^\n|\n$/g,"")}
101
- `,"normalizeCodeFrame"),Ro=pt(e=>{const t=Ma(e);let o=(e.plugin?`[${e.plugin}] `:"")+e.message;e.id&&(o+=`
102
- file: ${O(e.id+(e.loc?":"+e.loc.line+":"+e.loc.column:""))}`),e.frame&&(o+=`
103
- `+os(Ta(e.frame))),e.message=o,t!==void 0&&(e.stack=`${e.message}
104
- ${t}`)},"enhanceRollupError");var Aa=Object.defineProperty,Fo=m((e,t)=>Aa(e,"name",{value:t,configurable:!0}),"u$5");const Ie="rollup-watch.json",Rt=Fo((e,t,o,s,r)=>{const n="watcher:"+o;e.on("change",(i,{event:a})=>{s.logger.info({message:`${O(_(".",i))} was ${a}d`,prefix:n})}),e.on("restart",()=>{s.logger.info({message:"Rebuilding "+o+"...",prefix:n})}),e.on("event",async i=>{switch(i.code){case"END":{s.logger.success({message:"Rebuild "+o+" finished",prefix:n});break}case"BUNDLE_START":{s.logger.info({message:O("build started..."),prefix:n});break}case"BUNDLE_END":{await i.result.close(),r&&t.set(o==="bundle"?Ie:"dts-"+Ie,i.result.cache),s.logger.info({message:O(`built in ${i.duration+""}ms.`),prefix:n});break}case"ERROR":{Ro(i.error),s.logger.error({context:[i.error],message:"Rebuild "+o+" failed: "+i.error.message,prefix:n});break}}})},"watchHandler"),Ra=Fo(async(e,t)=>{const o=await Mo(e,t);if(await e.hooks.callHook("rollup:options",e,o),Object.keys(o.input).length===0)return;let s=!0;(e.options.rollup.isolatedDeclarations||e.options.isolatedDeclarationTransformer||e.options.rollup.css)&&(s=!1),s&&(o.cache=t.get(Ie)),e.options.rollup.watch&&typeof o.watch=="object"&&o.watch.include===void 0&&(o.watch={...o.watch,...e.options.rollup.watch},o.watch.include=[$(e.options.sourceDir,"**","*"),"package.json"],Array.isArray(e.options.rollup.watch.include)?o.watch.include=[...o.watch.include,...e.options.rollup.watch.include]:e.options.rollup.watch.include&&o.watch.include.push(e.options.rollup.watch.include),o.watch.chokidar={cwd:e.options.rootDir,...o.watch.chokidar,ignored:["**/.git/**","**/node_modules/**","**/test-results/**",...o.watch.chokidar?.ignored??[]]});const r=ft(o);await e.hooks.callHook("rollup:watch",e,r);const n=[...Array.isArray(o.input)?o.input:typeof o.input=="string"?[o.input]:Object.keys(o.input??{})];let i="Starting watchers for entries:";for(const a of n)i+=G(`
105
- └─ ${_(process.cwd(),a)}`);if(e.logger.info(i),Rt(r,t,"bundle",e,s),e.options.declaration){const a=await To(e,t);s&&(a.cache=t.get("dts-"+Ie)),await e.hooks.callHook("rollup:dts:options",e,a);const c=ft(a);await e.hooks.callHook("rollup:watch",e,c),Rt(c,t,"types",e,s)}},"watch");var Fa=Object.defineProperty,Ja=m((e,t)=>Fa(e,"name",{value:t,configurable:!0}),"i$2");const La=Ja((e,t,o,s)=>{try{let r={};const n=$(t,"keystore.json");s&&T(n)&&(r=rt(n)),r[e]===void 0&&(r[e]=new Date().toISOString()),Te(n,r,{overwrite:!0})}catch(r){o.debug({context:r,message:r.message,prefix:"cache-key-store"})}},"createOrUpdateKeyStorage");var Ba=Object.defineProperty,Jo=m((e,t)=>Ba(e,"name",{value:t,configurable:!0}),"s$4");const Wa=Jo(e=>{try{JSON.parse(e)}catch{return!1}return!0},"isJson");let za=class{static{m(this,"g")}static{Jo(this,"FileCache")}#e;#o;#n;#a=!0;#i=new Map;constructor(t,o,s,r){this.#e=t,this.#n=s,o===void 0?r.debug({message:"Could not create cache directory.",prefix:"file-cache"}):(this.#o=o,r.debug({message:"Cache path is: "+this.#o,prefix:"file-cache"}))}set isEnabled(t){this.#a=t}has(t,o){return!this.#a||this.#o===void 0?!1:T(this.getFilePath(t,o))}get(t,o){if(!this.#a||this.#o===void 0)return;const s=this.getFilePath(t,o);if(this.#i.has(s))return this.#i.get(s);if(!T(s))return;const r=Me(s);if(Wa(r)){const n=JSON.parse(r);return this.#i.set(s,n),n}return this.#i.set(s,r),r}set(t,o,s){if(!this.#a||this.#o===void 0||o===void 0)return;const r=this.getFilePath(t,s);typeof o=="object"&&(o=JSON.stringify(o)),ee(r,o,{overwrite:!0})}getFilePath(t,o){let s=t.replaceAll(Oe(this.#e),"");return s=s.replaceAll(":","-"),$(this.#o,this.#n,o?.replaceAll(":","-")??"",Oe(s))}};var Va=Object.defineProperty,ke=m((e,t)=>Va(e,"name",{value:t,configurable:!0}),"l$3");const Ua=oe,qa=ke((e,t)=>{const{sideEffects:o}=t;let s;if(typeof o=="boolean")s=ke(()=>o,"hasSideEffects");else if(Array.isArray(o))if(o.length<=0)s=ke(()=>!1,"hasSideEffects");else{const r=o.map(n=>n.includes("/")?n:`**/${n}`);s=Ua(r,null,{resolve:e})}else s=ke(()=>null,"hasSideEffects");return s},"getPackageSideEffect");var Ha=Object.defineProperty,Ka=m((e,t)=>Ha(e,"name",{value:t,configurable:!0}),"n");const Lo=Ka(e=>{const t=$(e,"package.json");if(!T(t))throw new Error("package.json not found at "+t);return{packageJson:so(t),packageJsonPath:t}},"loadPackageJson");var Ga=Object.defineProperty,Ya=m((e,t)=>Ga(e,"name",{value:t,configurable:!0}),"r$3");const Ft=Ya((e,t)=>{if(e.warnings.size>0&&(t&&e.logger.raw(`
86
+ `,"normalizeCodeFrame"),Zt=Ae(e=>{const t=es(e);let o=(e.plugin?`[${e.plugin}] `:"")+e.message;e.id&&(o+=`
87
+ file: ${k(e.id+(e.loc?":"+e.loc.line+":"+e.loc.column:""))}`),e.frame&&(o+=`
88
+ `+jo(ts(e.frame))),e.message=o,t!==void 0&&(e.stack=`${e.message}
89
+ ${t}`)},"enhanceRollupError");var os=Object.defineProperty,eo=m((e,t)=>os(e,"name",{value:t,configurable:!0}),"p");const de="rollup-watch.json",it=eo((e,t,o,r)=>{const n="watcher:"+o;e.on("change",(i,{event:s})=>{r.logger.info({message:`${k(O(".",i))} was ${s}d`,prefix:n})}),e.on("restart",()=>{r.logger.info({message:"Rebuilding "+o+"...",prefix:n})}),e.on("event",async i=>{switch(i.code){case"END":{r.logger.success({message:"Rebuild "+o+" finished",prefix:n});break}case"BUNDLE_START":{r.logger.info({message:k("build started..."),prefix:n});break}case"BUNDLE_END":{await i.result.close(),t.set(o==="bundle"?de:"dts-"+de,i.result.cache),r.logger.info({message:k(`built in ${i.duration+""}ms.`),prefix:n});break}case"ERROR":{Zt(i.error),r.logger.error({context:[i.error],message:"Rebuild "+o+" failed: "+i.error.message,prefix:n});break}}})},"watchHandler"),rs=eo(async(e,t)=>{const o=await Xt(e,t);if(await e.hooks.callHook("rollup:options",e,o),Object.keys(o.input).length===0)return;(!e.options.rollup.isolatedDeclarations||!e.options.isolatedDeclarationTransformer)&&(o.cache=t.get(de)),e.options.rollup.watch&&typeof o.watch=="object"&&o.watch.include===void 0&&(o.watch={...o.watch,...e.options.rollup.watch},o.watch.include=[w(e.options.sourceDir,"**","*"),"package.json"],Array.isArray(e.options.rollup.watch.include)?o.watch.include=[...o.watch.include,...e.options.rollup.watch.include]:e.options.rollup.watch.include&&o.watch.include.push(e.options.rollup.watch.include),o.watch.chokidar={cwd:e.options.rootDir,...o.watch.chokidar,ignored:["**/.git/**","**/node_modules/**","**/test-results/**",...o.watch.chokidar?.ignored??[]]});const r=Je(o);await e.hooks.callHook("rollup:watch",e,r);const n=[...Array.isArray(o.input)?o.input:typeof o.input=="string"?[o.input]:Object.keys(o.input??{})];let i="Starting watchers for entries:";for(const s of n)i+=M(`
90
+ └─ ${O(process.cwd(),s)}`);if(e.logger.info(i),it(r,t,"bundle",e),e.options.declaration){const s=await Yt(e,t);s.cache=t.get("dts-"+de),await e.hooks.callHook("rollup:dts:options",e,s);const a=Je(s);await e.hooks.callHook("rollup:watch",e,a),it(a,t,"types",e)}},"watch");var ns=Object.defineProperty,is=m((e,t)=>ns(e,"name",{value:t,configurable:!0}),"i$2");const ss=is((e,t,o,r)=>{try{let n={};const i=w(t,"keystore.json");r&&S(i)&&(n=Pe(i)),n[e]===void 0&&(n[e]=new Date().toISOString()),me(i,n,{overwrite:!0})}catch(n){o.debug({context:n,message:n.message,prefix:"cache-key-store"})}},"createOrUpdateKeyStorage");var as=Object.defineProperty,to=m((e,t)=>as(e,"name",{value:t,configurable:!0}),"s$4");const ls=to(e=>{try{JSON.parse(e)}catch{return!1}return!0},"isJson");let cs=class{static{m(this,"g")}static{to(this,"FileCache")}#r;#e;#n;#t=!0;#o=new Map;constructor(t,o,r,n){this.#r=t,this.#n=r,o===void 0?n.debug({message:"Could not create cache directory.",prefix:"file-cache"}):(this.#e=o,n.debug({message:"Cache path is: "+this.#e,prefix:"file-cache"}))}set isEnabled(t){this.#t=t}has(t,o){return!this.#t||this.#e===void 0?!1:S(this.getFilePath(t,o))}get(t,o){if(!this.#t||this.#e===void 0)return;const r=this.getFilePath(t,o);if(this.#o.has(r))return this.#o.get(r);if(!S(r))return;const n=Ne(r);if(ls(n)){const i=JSON.parse(n);return this.#o.set(r,i),i}return this.#o.set(r,n),n}set(t,o,r){if(!this.#t||this.#e===void 0||o===void 0)return;const n=this.getFilePath(t,r);typeof o=="object"&&(o=JSON.stringify(o)),F(n,o,{overwrite:!0})}getFilePath(t,o){let r=t.replaceAll(se(this.#r),"");return r=r.replaceAll(":","-"),w(this.#e,this.#n,o?.replaceAll(":","-")??"",se(r))}};var ps=Object.defineProperty,oe=m((e,t)=>ps(e,"name",{value:t,configurable:!0}),"l$4");const us=z,ds=oe((e,t)=>{const{sideEffects:o}=t;let r;if(typeof o=="boolean")r=oe(()=>o,"hasSideEffects");else if(Array.isArray(o))if(o.length<=0)r=oe(()=>!1,"hasSideEffects");else{const n=o.map(i=>i.includes("/")?i:`**/${i}`);r=us(n,null,{resolve:e})}else r=oe(()=>null,"hasSideEffects");return r},"getPackageSideEffect");var ms=Object.defineProperty,fs=m((e,t)=>ms(e,"name",{value:t,configurable:!0}),"n");const oo=fs(e=>{const t=w(e,"package.json");if(!S(t))throw new Error("package.json not found at "+t);return{packageJson:Et(t),packageJsonPath:t}},"loadPackageJson");var gs=Object.defineProperty,ys=m((e,t)=>gs(e,"name",{value:t,configurable:!0}),"r$3");const st=ys((e,t)=>{if(e.warnings.size>0&&(t&&e.logger.raw(`
106
91
  `),e.logger.warn(`Build is done with some warnings:
107
92
 
108
93
  ${[...e.warnings].map(o=>`- ${o}`).join(`
109
- `)}`),e.options.failOnWarn))throw new Error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`.")},"logBuildErrors");var Xa=Object.defineProperty,Bo=m((e,t)=>Xa(e,"name",{value:t,configurable:!0}),"r$2");const Jt=Bo(async(e,t)=>{if(typeof e.name!="string"){let o=Ae(e.input)?_(t.options.rootDir,e.input):F(e.input);o.startsWith("./")&&(o=o.slice(2)),e.name=o.replace(new RegExp(`^${t.options.sourceDir}/`),"").replace(te,"")}if(!e.input)throw new Error(`Missing entry input: ${JSON.stringify(e)}`);Zt(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"),Qa=Bo(async e=>{e.options.entries=e.options.entries.map(t=>typeof t=="string"?{input:t,isGlob:mt(t)}:{...t,exportKey:t.exportKey??new Set,isGlob:mt(t.input)});for(const t of e.options.entries.filter(o=>o.isGlob)){const{isGlob:o,...s}=t,r=["**/.git/**","**/node_modules/**","**/test-results/**"];if(e.options.rollup.watch){if(typeof e.options.rollup.watch.exclude=="string")r.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"&&r.push(i)}const n=xs([s.input],{cwd:e.options.rootDir,dot:!1,ignore:r,onlyFiles:!0});if(n.length===0)throw new Ts("No files found in the glob pattern: "+O($(e.options.rootDir,s.input)));for(const i of n)e.options.entries.push({...s,input:j(e.options.rootDir,i)});e.options.entries.splice(e.options.entries.indexOf(t),1)}for await(const t of e.options.entries.filter(o=>o.fileAlias===void 0))await Jt(t,e);for await(const t of e.options.entries.filter(o=>o.fileAlias!==void 0))t.name=t.fileAlias,t.fileAlias=void 0,await Jt(t,e)},"prepareEntries");var Za=Object.defineProperty,el=m((e,t)=>Za(e,"name",{value:t,configurable:!0}),"o$1");const tl=el(e=>{if(e.options.validation?.packageJson?.dependencies===!1)return;const t=new Set,o=new Set(Object.keys(e.pkg?.dependencies??{})),s=new Set;for(const r of e.usedImports)o.delete(r),t.add(r);if(e.pkg?.dependencies)for(const r of Object.keys(e.pkg?.dependencies))o.delete(r);for(const r of t){const n=no(r);!Xe(e.options.externals,r)&&!r.startsWith("chunks/")&&e.pkg?.dependencies?.[n]===void 0&&e.pkg?.peerDependencies?.[n]===void 0&&s.add(r)}o.size>0&&E(e,`Potential unused dependencies found: ${[...o].map(r=>O(r)).join(", ")}`),s.size>0&&E(e,`Potential implicit dependencies found: ${[...s].map(r=>O(r)).join(", ")}`)},"validateDependencies");var ol=Object.defineProperty,Wo=m((e,t)=>ol(e,"name",{value:t,configurable:!0}),"i$1");const sl=Wo((e,t)=>As(e,t)<=e.length/3||t.includes(e),"isSimilar"),rl=Wo((e,t)=>{const o=e.toLowerCase();return t.filter(s=>sl(s.toLowerCase(),o))},"findAlternatives");var nl=Object.defineProperty,Lt=m((e,t)=>nl(e,"name",{value:t,configurable:!0}),"r$1");const il=Lt(e=>{const{options:t}=e;if(t.validation?.packageJson?.exports===!1)return;const o=t.validation?.packageJson,s=new Set([t.declaration&&o?.types?e.pkg.types:"",t.declaration&&o?.types?e.pkg.typings:"",...t.dtsOnly||o?.bin===!1?[""]:typeof e.pkg.bin=="string"?[e.pkg.bin]:Object.values(e.pkg.bin??{}),t.dtsOnly&&o?.main===!1?"":e.pkg.main,t.dtsOnly&&o?.module===!1?"":e.pkg.module,...o?.exports===!1?[]:ct(e.pkg.exports,e.pkg.type==="module"?"esm":"cjs",t.declaration).map(a=>t.dtsOnly?a.subKey==="types"?a.file:void 0:a.file)].filter(Boolean).map(a=>a&&j(t.rootDir,a.replace(/\/[^*/]*\*[^\n\r/\u2028\u2029]*(?:[\n\r\u2028\u2029][^*/]*\*[^\n\r/\u2028\u2029]*)*(?:\/.*)?$/,"")))),r=[];for(const a of s)a&&!a.includes("*")&&!qt(a)&&r.push(a.replace(`${t.rootDir}/`,""));const n=Lt(a=>_(t.rootDir,j(t.outDir,a)),"rPath"),i=e.buildEntries.filter(a=>!a.chunk).map(a=>n(a.path));if(r.length>0){let a="Potential missing or wrong package.json files:";for(const c of r){const l=rl(c,i);a+=`
110
- - `+O(c)+(l.length>0?ss` (did you mean ${l.map(p=>`"${p}"`).join(", ")}?)`:"")}E(e,a)}},"validatePackageEntries");var al=Object.defineProperty,ll=m((e,t)=>al(e,"name",{value:t,configurable:!0}),"l$1");const cl=ll(e=>{const{options:{validation:t},pkg:o}=e;o.name===void 0&&t?.packageJson?.name!==!1&&E(e,"The 'name' field is missing in your package.json. Please provide a valid package name."),t?.packageJson?.files!==!1&&(o.files===void 0?E(e,"The 'files' field is missing in your package.json. Add the files to be included in the package."):o.files.length===0?E(e,"The 'files' field in your package.json is empty. Please specify the files to be included in the package."):o.files.some(n=>n.includes(e.options.outDir))||E(e,`The 'files' field in your package.json is missing the '${e.options.outDir}' directory. Ensure the output directory is included.`));const s=o.type==="commonjs"||o.type===void 0,r=o.type==="module";if(s?(t?.packageJson?.main!==!1&&(o.main===void 0&&E(e,"The 'main' field is missing in your package.json. This field should point to your main entry file."),o.main?.includes(".mjs")&&E(e,"The 'main' field in your package.json should not use a '.mjs' extension for CommonJS modules.")),t?.packageJson?.module!==!1&&(o.module===void 0&&e.options.emitESM&&E(e,"The 'module' field is missing in your package.json, but you are emitting ES modules."),o.module&&o.main&&o.module===o.main&&E(e,`Conflict detected: The 'module' and 'main' fields both point to '${o.module}'. Please ensure they refer to different module types.`),e.options.emitESM&&o.module?.includes(".cjs")&&E(e,"The 'module' field in your package.json should not use a '.cjs' extension for ES modules."))):r&&(o.exports===void 0&&!e.options.emitCJS?t?.packageJson?.exports!==!1&&E(e,"The 'exports' field is missing in your package.json. Define module exports explicitly."):e.options.emitCJS&&(t?.packageJson?.main!==!1&&o.main===void 0&&E(e,"The 'main' field is missing in your package.json. This field is needed when emitting CommonJS modules."),t?.packageJson?.module!==!1&&(o.module===void 0&&E(e,"The 'module' field is missing in your package.json. This field is necessary when emitting ES modules."),o.module?.includes(".cjs")&&E(e,"The 'module' field should not use a '.cjs' extension for ES modules."),o.module&&o.main&&o.module===o.main&&E(e,`Conflict detected: The 'module' and 'main' fields both point to '${o.module}'. Please ensure they refer to different module types.`)),t?.packageJson?.exports!==!1&&o.exports===void 0&&E(e,"The 'exports' field is missing in your package.json. This field is required for defining explicit exports."))),o.exports,t?.packageJson?.bin!==!1){if(typeof o.bin=="string"&&o.bin.includes(s?".mjs":".cjs"))E(e,`The 'bin' field in your package.json should not use a ${s?".mjs":".cjs"} extension for ${s?"CommonJS":"ES modules"} binaries.`);else if(typeof o.bin=="object")for(const[n,i]of Object.entries(o.bin))i&&i.includes(s?".mjs":".cjs")&&E(e,`The 'bin.${n}' field in your package.json should not use a ${s?".mjs":".cjs"} extension for ${s?"CommonJS":"ES modules"} binaries.`)}if(e.options.declaration){let n=!0;o.type==="module"&&(n=!!o.main?.endsWith(".cjs")),o.types===void 0&&o.typings===void 0&&n&&t?.packageJson?.types!==!1&&E(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")&&n&&t?.packageJson?.typesVersions!==!1&&(o.typesVersions===void 0||Object.keys(o.typesVersions).length===0)&&E(e,"No 'typesVersions' field found in your package.json. Consider adding this field, or change the declaration option to 'node16' or 'false'.")}},"validatePackageFields");var pl=Object.defineProperty,ul=m((e,t)=>pl(e,"name",{value:t,configurable:!0}),"i");const dl=ul(e=>{const{packageJson:t}=Lo(e.options.rootDir);e.pkg=t,tl(e),cl(e),il(e)},"validator");var fl=Object.defineProperty,ml=m((e,t)=>fl(e,"name",{value:t,configurable:!0}),"a");const gl=/^[^a-z_@#~]|[^\w/@#~-]|@\/|#\/|~\//i,hl=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"]),Bt=ml(e=>{if(!Array.isArray(e)&&e!==null)for(const[t,o]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(gl.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(hl.has(t))throw new Error(`Alias name "${t}" is a reserved keyword and cannot be used.`);const s=j(o);if(!T(s))throw new Error(`Target path "${s}" for alias "${t}" does not exist.`)}},"validateAliasEntries");var yl=Object.defineProperty,z=m((e,t)=>yl(e,"name",{value:t,configurable:!0}),"u$2");const vl=z(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"),bl=z((e,t,o,s,r,n,i,a,c)=>{const l=vl(c?.config.compilerOptions?.jsx),p=ls(n,r,i,{alias:{},browserTargets:as(),cjsInterop:!1,clean:!0,debug:s,declaration:void 0,emitCJS:void 0,emitESM:void 0,entries:[],externals:[...ut.builtinModules,...ut.builtinModules.map(d=>`node:${d}`)],failOnWarn:!0,fileCache:!0,jiti:{alias:{},debug:s,interopDefault:!0},minify:o===q,name:(a.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:ne,jsx:l,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:ne,ignoreErrors:!1,include:ue},json:{preferConst:!0},license:{dependenciesTemplate:z((d,u,f)=>`
94
+ `)}`),e.options.failOnWarn))throw new Error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`.")},"logBuildErrors");var hs=Object.defineProperty,ro=m((e,t)=>hs(e,"name",{value:t,configurable:!0}),"r$2");const at=ro(async(e,t)=>{if(typeof e.name!="string"){let o=ft(e.input)?O(t.options.rootDir,e.input):dt(e.input);o.startsWith("./")&&(o=o.slice(2)),e.name=o.replace(new RegExp(`^${t.options.sourceDir}/`),"").replace(J,"")}if(!e.input)throw new Error(`Missing entry input: ${JSON.stringify(e)}`);Xo(e.input)&&(e.input=$(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=$(t.options.rootDir,e.outDir??t.options.outDir)},"extendEntry"),vs=ro(async e=>{e.options.entries=e.options.entries.map(t=>typeof t=="string"?{input:t,isGlob:We(t)}:{...t,exportKey:t.exportKey??new Set,isGlob:We(t.input)});for(const t of e.options.entries.filter(o=>o.isGlob)){const{isGlob:o,...r}=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 i=Bo([r.input],{cwd:e.options.rootDir,dot:!1,ignore:n,onlyFiles:!0});if(i.length===0)throw new Go("No files found in the glob pattern: "+k(w(e.options.rootDir,r.input)));for(const s of i)e.options.entries.push({...r,input:$(e.options.rootDir,s)});e.options.entries.splice(e.options.entries.indexOf(t),1)}for await(const t of e.options.entries.filter(o=>o.fileAlias===void 0))await at(t,e);for await(const t of e.options.entries.filter(o=>o.fileAlias!==void 0))t.name=t.fileAlias,t.fileAlias=void 0,await at(t,e)},"prepareEntries");var bs=Object.defineProperty,ws=m((e,t)=>bs(e,"name",{value:t,configurable:!0}),"o$1");const $s=ws(e=>{if(e.options.validation?.packageJson?.dependencies===!1)return;const t=new Set,o=new Set(Object.keys(e.pkg?.dependencies??{})),r=new Set;for(const n of e.usedImports)o.delete(n),t.add(n);if(e.pkg?.dependencies)for(const n of Object.keys(e.pkg?.dependencies))o.delete(n);for(const n of t){const i=St(n);!Ee(e.options.externals,n)&&!n.startsWith("chunks/")&&e.pkg?.dependencies?.[i]===void 0&&e.pkg?.peerDependencies?.[i]===void 0&&r.add(n)}o.size>0&&j(e,`Potential unused dependencies found: ${[...o].map(n=>k(n)).join(", ")}`),r.size>0&&j(e,`Potential implicit dependencies found: ${[...r].map(n=>k(n)).join(", ")}`)},"validateDependencies");var js=Object.defineProperty,no=m((e,t)=>js(e,"name",{value:t,configurable:!0}),"i$1");const ks=no((e,t)=>Yo(e,t)<=e.length/3||t.includes(e),"isSimilar"),xs=no((e,t)=>{const o=e.toLowerCase();return t.filter(r=>ks(r.toLowerCase(),o))},"findAlternatives");var Es=Object.defineProperty,lt=m((e,t)=>Es(e,"name",{value:t,configurable:!0}),"r$1");const Ds=lt(e=>{const{options:t}=e;if(t.validation?.packageJson?.exports===!1)return;const o=t.validation?.packageJson,r=new Set([t.declaration&&o?.types?e.pkg.types:"",t.declaration&&o?.types?e.pkg.typings:"",...t.dtsOnly||o?.bin===!1?[""]:typeof e.pkg.bin=="string"?[e.pkg.bin]:Object.values(e.pkg.bin??{}),t.dtsOnly&&o?.main===!1?"":e.pkg.main,t.dtsOnly&&o?.module===!1?"":e.pkg.module,...o?.exports===!1?[]:Me(e.pkg.exports,e.pkg.type==="module"?"esm":"cjs",t.declaration).map(a=>t.dtsOnly?a.subKey==="types"?a.file:void 0:a.file)].filter(Boolean).map(a=>a&&$(t.rootDir,a.replace(/\/[^*/]*\*[^\n\r/\u2028\u2029]*(?:[\n\r\u2028\u2029][^*/]*\*[^\n\r/\u2028\u2029]*)*(?:\/.*)?$/,"")))),n=[];for(const a of r)a&&!a.includes("*")&&!yt(a)&&n.push(a.replace(`${t.rootDir}/`,""));const i=lt(a=>O(t.rootDir,$(t.outDir,a)),"rPath"),s=e.buildEntries.filter(a=>!a.chunk).map(a=>i(a.path));if(n.length>0){let a="Potential missing or wrong package.json files:";for(const l of n){const c=xs(l,s);a+=`
95
+ - `+k(l)+(c.length>0?ko` (did you mean ${c.map(u=>`"${u}"`).join(", ")}?)`:"")}j(e,a)}},"validatePackageEntries");var Ss=Object.defineProperty,Os=m((e,t)=>Ss(e,"name",{value:t,configurable:!0}),"l$2");const Ns=Os(e=>{const{options:{validation:t},pkg:o}=e;o.name===void 0&&t?.packageJson?.name!==!1&&j(e,"The 'name' field is missing in your package.json. Please provide a valid package name."),t?.packageJson?.files!==!1&&(o.files===void 0?j(e,"The 'files' field is missing in your package.json. Add the files to be included in the package."):o.files.length===0?j(e,"The 'files' field in your package.json is empty. Please specify the files to be included in the package."):o.files.some(i=>i.includes(e.options.outDir))||j(e,`The 'files' field in your package.json is missing the '${e.options.outDir}' directory. Ensure the output directory is included.`));const r=o.type==="commonjs"||o.type===void 0,n=o.type==="module";if(r?(t?.packageJson?.main!==!1&&(o.main===void 0&&j(e,"The 'main' field is missing in your package.json. This field should point to your main entry file."),o.main?.includes(".mjs")&&j(e,"The 'main' field in your package.json should not use a '.mjs' extension for CommonJS modules.")),t?.packageJson?.module!==!1&&(o.module===void 0&&e.options.emitESM&&j(e,"The 'module' field is missing in your package.json, but you are emitting ES modules."),o.module&&o.main&&o.module===o.main&&j(e,`Conflict detected: The 'module' and 'main' fields both point to '${o.module}'. Please ensure they refer to different module types.`),e.options.emitESM&&o.module?.includes(".cjs")&&j(e,"The 'module' field in your package.json should not use a '.cjs' extension for ES modules."))):n&&(o.exports===void 0&&!e.options.emitCJS?t?.packageJson?.exports!==!1&&j(e,"The 'exports' field is missing in your package.json. Define module exports explicitly."):e.options.emitCJS&&(t?.packageJson?.main!==!1&&o.main===void 0&&j(e,"The 'main' field is missing in your package.json. This field is needed when emitting CommonJS modules."),t?.packageJson?.module!==!1&&(o.module===void 0&&j(e,"The 'module' field is missing in your package.json. This field is necessary when emitting ES modules."),o.module?.includes(".cjs")&&j(e,"The 'module' field should not use a '.cjs' extension for ES modules."),o.module&&o.main&&o.module===o.main&&j(e,`Conflict detected: The 'module' and 'main' fields both point to '${o.module}'. Please ensure they refer to different module types.`)),t?.packageJson?.exports!==!1&&o.exports===void 0&&j(e,"The 'exports' field is missing in your package.json. This field is required for defining explicit exports."))),o.exports,t?.packageJson?.bin!==!1){if(typeof o.bin=="string"&&o.bin.includes(r?".mjs":".cjs"))j(e,`The 'bin' field in your package.json should not use a ${r?".mjs":".cjs"} extension for ${r?"CommonJS":"ES modules"} binaries.`);else if(typeof o.bin=="object")for(const[i,s]of Object.entries(o.bin))s&&s.includes(r?".mjs":".cjs")&&j(e,`The 'bin.${i}' field in your package.json should not use a ${r?".mjs":".cjs"} extension for ${r?"CommonJS":"ES modules"} binaries.`)}if(e.options.declaration){let i=!0;o.type==="module"&&(i=!!o.main?.endsWith(".cjs")),o.types===void 0&&o.typings===void 0&&i&&t?.packageJson?.types!==!1&&j(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")&&i&&t?.packageJson?.typesVersions!==!1&&(o.typesVersions===void 0||Object.keys(o.typesVersions).length===0)&&j(e,"No 'typesVersions' field found in your package.json. Consider adding this field, or change the declaration option to 'node16' or 'false'.")}},"validatePackageFields");var Ps=Object.defineProperty,Cs=m((e,t)=>Ps(e,"name",{value:t,configurable:!0}),"i");const _s=Cs(e=>{const{packageJson:t}=oo(e.options.rootDir);e.pkg=t,$s(e),Ns(e),Ds(e)},"validator");var Ts=Object.defineProperty,Is=m((e,t)=>Ts(e,"name",{value:t,configurable:!0}),"a");const Ms=/^[^a-z_@#~]|[^\w/@#~-]|@\/|#\/|~\//i,As=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"]),ct=Is(e=>{if(!Array.isArray(e)&&e!==null)for(const[t,o]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(Ms.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(As.has(t))throw new Error(`Alias name "${t}" is a reserved keyword and cannot be used.`);const r=$(o);if(!S(r))throw new Error(`Target path "${r}" for alias "${t}" does not exist.`)}},"validateAliasEntries");var Rs=Object.defineProperty,P=m((e,t)=>Rs(e,"name",{value:t,configurable:!0}),"u$1");const Fs=P(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"),Js=P((e,t,o,r,n,i,s,a,l)=>{const c=Fs(l?.config.compilerOptions?.jsx),u=So(i,n,s,{alias:{},cjsInterop:!1,clean:!0,debug:r,declaration:void 0,emitCJS:void 0,emitESM:void 0,entries:[],externals:[...Re.builtinModules,...Re.builtinModules.map(p=>`node:${p}`)],failOnWarn:!0,fileCache:!0,jiti:{alias:{},debug:r,interopDefault:!0},minify:o===C,name:(a.name??"").split("/").pop()??"default",outDir:l?.config.compilerOptions?.outDir??"dist",rollup:{alias:{},cjsInterop:{addDefaultProperty:!1},commonjs:{extensions:[".mjs",".js",".json",".node",".cjs"],ignoreTryCatch:!0,preserveSymlinks:!0,transformMixedEsModules:!1},dts:{compilerOptions:{baseUrl:l?.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:L,jsx:c,jsxDev:l?.config.compilerOptions?.jsx==="react-jsxdev",jsxFactory:l?.config.compilerOptions?.jsxFactory,jsxFragment:l?.config.compilerOptions?.jsxFragmentFactory,jsxImportSource:l?.config.compilerOptions?.jsxImportSource,jsxSideEffects:!0,keepNames:!0,sourcesContent:!1,target:l?.config.compilerOptions?.target,treeShaking:!0,tsconfigRaw:l?.config},isolatedDeclarations:{exclude:L,ignoreErrors:!1,include:K},json:{preferConst:!0},license:{dependenciesTemplate:P((p,d,f)=>`
111
96
  # Licenses of bundled dependencies
112
97
  The published ${f} artifact additionally contains code with the following licenses:
113
- `+(d.length>0?`${d.join(", ")}
98
+ `+(p.length>0?`${p.join(", ")}
114
99
 
115
100
  `:`
116
101
  `)+`# Bundled dependencies:
117
- `+u,"dependenciesTemplate"),dtsTemplate:z((d,u,f)=>`
102
+ `+d,"dependenciesTemplate"),dtsTemplate:P((p,d,f)=>`
118
103
  # Licenses of bundled types
119
104
  The published ${f} artifact additionally contains code with the following licenses:
120
- `+(d.length>0?`${d.join(", ")}
105
+ `+(p.length>0?`${p.join(", ")}
121
106
 
122
107
  `:`
123
108
  `)+`# Bundled types:
124
- `+u,"dtsTemplate")},node10Compatibility:{},patchTypes:{},polyfillNode:{},preserveDirectives:{exclude:ne,include:ue},preserveDynamicImports:!0,raw:{exclude:ne,include:[/\.(md|txt|htm|html|data)$/]},replace:{objectGuards:!0,preventAssignment:!0},resolve:{allowExportsFolderMapping:!1,exportConditions:["module-sync"],extensions:nt,preferBuiltins:!1},shebang:{replace:!1,shebang:"#!/usr/bin/env node"},shim:{exclude:ne,include:ue},sucrase:{disableESTransforms:!0,enableLegacyBabel5ModuleInterop:!1,enableLegacyTypeScriptModuleInterop:c?.config.compilerOptions?.esModuleInterop===!1,include:ue,injectCreateRequireForImportRequire:!1,preserveDynamicImport:!0,production:o===q,...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:l,transforms:["typescript","jsx",...c.config.compilerOptions.esModuleInterop?["imports"]:[]]}:{transforms:["typescript",...c?.config.compilerOptions?.esModuleInterop?["imports"]:[]]}},swc:{include:ue,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:o!==q,pragma:c?.config.compilerOptions?.jsxFactory,pragmaFrag:c?.config.compilerOptions?.jsxFragmentFactory,runtime:l,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:qa(t,a),preset:"recommended",propertyReadSideEffects:!0},visualizer:{},watch:{chokidar:{ignoreInitial:!0,ignorePermissionErrors:!0},clearScreen:!0,exclude:ne}},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:a.name??"unknown",pretty:!0,readme:"none",showConfig:s,tsconfig:c?.path}});if(!p.transformerName){const d=new Map([...Object.entries(a.dependencies??{}),...Object.entries(a.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 "+O("rollup ")+ps),e.info({message:"Using "+O(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(", ")),a.dependencies&&p.externals.push(...Object.keys(a.dependencies)),a.peerDependencies&&p.externals.push(...Object.keys(a.peerDependencies)),a.optionalDependencies&&p.externals.push(...Object.keys(a.optionalDependencies)),Bt(p.alias),p.rollup.alias&&p.rollup.alias.entries&&Bt(p.rollup.alias.entries),p},"generateOptions"),wl=z(async(e,t,o,s,r,n,i,a,c,l)=>{const p=await Pa(i.preset??n.preset??"auto",l),d=bl(e,t,s,r,n,i,p,a,c);Xo($(d.rootDir,d.outDir));const u={buildEntries:[],dependencyGraphMap:new Map,environment:s,hooks:cs(),jiti:Kt(d.rootDir,d.jiti),logger:e,mode:o,options:d,pkg:a,tsconfig:c,usedImports:new Set,warnings:new Set};p.hooks&&u.hooks.addHooks(p.hooks),n.hooks&&u.hooks.addHooks(n.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 f=a.dependencies?.typescript!==void 0||a.devDependencies?.typescript!==void 0;if(u.options.declaration&&u.tsconfig===void 0&&f)throw new Error("Cannot build declaration files without a tsconfig.json");return f?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: "+O(a.devDependencies?.typescript??a.dependencies?.typescript??"unknown")),u.options.declaration&&(a.dependencies?.typescript||a.devDependencies?.typescript)&&!u.tsconfig?.config.compilerOptions?.isolatedModules&&u.logger.warn(`'compilerOptions.isolatedModules' is not enabled in tsconfig.
109
+ `+d,"dtsTemplate")},node10Compatibility:{},patchTypes:{},polyfillNode:{},preserveDirectives:{exclude:L,include:K},preserveDynamicImports:!0,raw:{exclude:L,include:[/\.(md|txt|css|htm|html|data)$/]},replace:{objectGuards:!0,preventAssignment:!0},resolve:{allowExportsFolderMapping:!1,exportConditions:["module-sync"],extensions:Ce,preferBuiltins:!1},shebang:{replace:!1,shebang:"#!/usr/bin/env node"},shim:{exclude:L,include:K},sucrase:{disableESTransforms:!0,enableLegacyBabel5ModuleInterop:!1,enableLegacyTypeScriptModuleInterop:l?.config.compilerOptions?.esModuleInterop===!1,include:K,injectCreateRequireForImportRequire:!1,preserveDynamicImport:!0,production:o===C,...l?.config.compilerOptions?.jsx&&["react","react-jsx","react-jsxdev"].includes(l.config.compilerOptions.jsx)?{jsxFragmentPragma:l.config.compilerOptions.jsxFragmentFactory,jsxImportSource:l.config.compilerOptions.jsxImportSource,jsxPragma:l.config.compilerOptions.jsxFactory,jsxRuntime:c,transforms:["typescript","jsx",...l.config.compilerOptions.esModuleInterop?["imports"]:[]]}:{transforms:["typescript",...l?.config.compilerOptions?.esModuleInterop?["imports"]:[]]}},swc:{include:K,inlineSourcesContent:!1,inputSourceMap:!1,isModule:!0,jsc:{experimental:{keepImportAttributes:!0},externalHelpers:!1,keepClassNames:!0,loose:!0,parser:{decorators:l?.config.compilerOptions?.experimentalDecorators,syntax:l?"typescript":"ecmascript",[l?"tsx":"jsx"]:!0},target:l?.config.compilerOptions?.target?.toLowerCase(),transform:{decoratorMetadata:l?.config.compilerOptions?.emitDecoratorMetadata,decoratorVersion:"2022-03",legacyDecorator:l?.config.compilerOptions?.experimentalDecorators,react:{development:o!==C,pragma:l?.config.compilerOptions?.jsxFactory,pragmaFrag:l?.config.compilerOptions?.jsxFragmentFactory,runtime:c,throwIfNamespace:!0},treatConstEnumAsEnum:l?.config.compilerOptions?.preserveConstEnums,useDefineForClassFields:l?.config.compilerOptions?.useDefineForClassFields}},module:{ignoreDynamic:!0,importInterop:"none",preserveImportMeta:!0,strict:!1,strictMode:!1,type:"es6"}},treeshake:{moduleSideEffects:ds(t,a),preset:"recommended",propertyReadSideEffects:!0},visualizer:{},watch:{chokidar:{ignoreInitial:!0,ignorePermissionErrors:!0},clearScreen:!0,exclude:L}},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:a.name??"unknown",pretty:!0,readme:"none",showConfig:r,tsconfig:l?.path}});if(!u.transformerName){const p=new Map([...Object.entries(a.dependencies??{}),...Object.entries(a.devDependencies??{})]);let d="0.0.0";if(p.has("esbuild"))u.transformerName="esbuild",d=p.get("esbuild");else if(p.has("@swc/core"))u.transformerName="swc",d=p.get("@swc/core");else if(p.has("sucrase"))u.transformerName="sucrase",d=p.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 "+k("rollup ")+No),e.info({message:"Using "+k(u.transformerName)+" "+d,prefix:"transformer"})}return u.rollup.resolve&&u.rollup.resolve.preferBuiltins===!0&&(u.rollup.polyfillNode=!1,e.debug("Disabling polyfillNode because preferBuiltins is set to true")),a.dependencies&&u.externals.push(...Object.keys(a.dependencies)),a.peerDependencies&&u.externals.push(...Object.keys(a.peerDependencies)),a.optionalDependencies&&u.externals.push(...Object.keys(a.optionalDependencies)),ct(u.alias),u.rollup.alias&&u.rollup.alias.entries&&ct(u.rollup.alias.entries),u},"generateOptions"),Bs=P(async(e,t,o,r,n,i,s,a,l,c)=>{const u=await Gi(s.preset??i.preset??"auto",c),p=Js(e,t,r,n,i,s,u,a,l);ho(w(p.rootDir,p.outDir));const d={buildEntries:[],dependencyGraphMap:new Map,environment:r,hooks:Oo(),jiti:vt(p.rootDir,p.jiti),logger:e,mode:o,options:p,pkg:a,tsconfig:l,usedImports:new Set,warnings:new Set};u.hooks&&d.hooks.addHooks(u.hooks),i.hooks&&d.hooks.addHooks(i.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=a.dependencies?.typescript!==void 0||a.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: "+k(a.devDependencies?.typescript??a.dependencies?.typescript??"unknown")),d.options.declaration&&(a.dependencies?.typescript||a.devDependencies?.typescript)&&!d.tsconfig?.config.compilerOptions?.isolatedModules&&d.logger.warn(`'compilerOptions.isolatedModules' is not enabled in tsconfig.
125
110
  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.
126
- 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 Qa(u),u},"createContext"),$l=z(async e=>{const t=[];if(e.options.clean)for(const o of new Set(e.options.entries.map(s=>s.outDir).filter(Boolean).sort()))o===e.options.rootDir||o===e.options.sourceDir||e.options.rootDir.startsWith(o.endsWith("/")?o:`${o}/`)||t.some(s=>o.startsWith(s))||(t.push(o),e.logger.info(`Cleaning dist directory: \`./${_(e.options.rootDir,o)}\``),await Qo(o))},"cleanDistributionDirectories"),xl=z(async(e,t,o)=>{if(e&&T($(e,"keystore1.json"))){const s=rt($(e,"keystore.json")),r=Ut(e,{withFileTypes:!0}).filter(i=>i.isDirectory());let n=o;for await(const i of r)s[i.name]||(await es($(e,i.name),{force:!0,recursive:!0}),n&&t.raw(`
111
+ 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 vs(d),d},"createContext"),Ws=P(async e=>{const t=[];if(e.options.clean)for(const o of new Set(e.options.entries.map(r=>r.outDir).filter(Boolean).sort()))o===e.options.rootDir||o===e.options.sourceDir||e.options.rootDir.startsWith(o.endsWith("/")?o:`${o}/`)||t.some(r=>o.startsWith(r))||(t.push(o),e.logger.info(`Cleaning dist directory: \`./${O(e.options.rootDir,o)}\``),await vo(o))},"cleanDistributionDirectories"),Ls=P(async(e,t,o)=>{if(e&&S(w(e,"keystore1.json"))){const r=Pe(w(e,"keystore.json")),n=gt(e,{withFileTypes:!0}).filter(s=>s.isDirectory());let i=o;for await(const s of n)r[s.name]||(await wo(w(e,s.name),{force:!0,recursive:!0}),i&&t.raw(`
127
112
 
128
- `),t.info({message:"Removing "+i.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),n=!1)}},"removeOldCacheFolders"),jl=z(e=>{switch(e){case"jit":return"Stubbing";case"watch":return"Watching";case"tsdoc":return"Generating TSDoc";default:return"Building"}},"getMode"),kl=z(async(e,t,o,s,r={})=>{const{configPath:n,debug:i,tsconfigPath:a,...c}=r;s.wrapAll(),e=j(Wt(),e),s.debug("Root directory:",e);const{packageJson:l,packageJsonPath:p}=Lo(e);s.debug("Using package.json found at",p);let d;if(a){const g=$(e,a);if(!await ot(g))throw new Error("tsconfig.json not found at "+g);d={config:ns(g),path:g},s.info("Using tsconfig settings at",g)}else if(l.dependencies?.typescript||l.devDependencies?.typescript)try{d=await is(e),s.debug("Using tsconfig settings found at",d.path)}catch{s.info("No tsconfig.json or jsconfig.json found.")}const u=rs("@visulima/packem",{cwd:e});let f=!1;try{const g=await ro(e,n??""),b=Kt(e,{debug:i});let h=await b.import(g,{default:!0,try:!0})||{};typeof h=="function"&&(h=await h(o,t)),s.debug("Using packem config found at",$(e,g));const v=Y(JSON.stringify({version:l.version,...l.dependencies,...l.devDependencies,...l.peerDependencies,...l.peerDependenciesMeta,browser:l.browser,eNode:l.engines?.node,exports:l.exports,main:l.main,module:l.module,type:l.type,types:l.types}))+Y(JSON.stringify(h));u&&La(v,u,s);const w=new za(e,u,v,s),y=await wl(s,e,t,o,i??!1,c,h,l,d,b);w.isEnabled=y.options.fileCache,y.logger.info(O(jl(t)+" "+y.options.name)),y.logger.debug({context:y.options.entries,message:`${W("Root dir:")} ${y.options.rootDir}
129
- ${W("Entries:")}`}),await $l(y);const D=Date.now(),x=z(()=>dt(Math.floor(Date.now()-D)),"getDuration");if(t==="watch"){if(y.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await Ra(y,w),Ft(y,!1);return}t==="jit"?(await _a(y),await y.hooks.callHook("build:done",y)):(f=await ua(y,w),await y.hooks.callHook("validate:before",y),dl(y),await y.hooks.callHook("validate:done",y),Ft(y,f)),y.logger.raw(`
130
- ⚡️ Build run in `+x());for await(const[P,A]of Object.entries(y.options.builder??{})){y.logger.raw(`
131
- `),await y.hooks.callHook("builder:before",P,y);const V=Date.now(),R=z(()=>dt(Math.floor(Date.now()-V)),"getBuilderDuration");await A(y,u,w,f),await y.hooks.callHook("builder:done",P,y),y.logger.raw(`
132
- ⚡️ `+P+" run in "+R())}y.logger.restoreAll()}catch(g){throw s.raw(`
133
- `),Ro(g),g}finally{await xl(u,s,f)}},"createBundler");var El=Object.defineProperty,Ye=m((e,t)=>El(e,"name",{value:t,configurable:!0}),"o");const Sl=Ye(e=>{e.addCommand({description:"Demonstrate options required",execute:Ye(async({logger:t,options:o})=>{let s="build";o.watch?s="watch":o.jit&&(s="jit");const r={};let n;if(Se.NODE_ENV&&[ge,q].includes(Se.NODE_ENV)&&(n=Se.NODE_ENV),o.env)for(const i of o.env)if(i.key==="NODE_ENV"){if(n)throw new Error("NODE_ENV was already set, this can't be overridden.");n=i.value}else r["process.env."+i.key]=JSON.stringify(i.value);n===void 0&&(o.production?n=q:o.development&&(n=ge));try{await kl(o.dir,s,n,t,{analyze:o.analyze,cjsInterop:o.cjsInterop,clean:o.clean,configPath:o.config??void 0,debug:o.debug,dtsOnly:o.dtsOnly,minify:o.minify===void 0?n===q:o.minify,rollup:{esbuild:{target:o.target},license:{path:o.license},metafile:o.metafile,replace:{values:r}},sourcemap:o.analyze||o.sourcemap,tsconfigPath:o.tsconfig??void 0,validation:o.validation===!1?{packageJson:{bin:!1,dependencies:!1,exports:!1,files:!1,main:!1,module:!1,name:!1,types:!1,typesVersions:!1}}:{},...o.typedoc?{typedoc:{format:"html"}}:{}})}catch(i){t.error(i),Ko(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:Ye(t=>{const[o,s]=t.split("=");return{key:o,value:s}},"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}]})},"createBuildCommand");var Ol=Object.defineProperty,Ee=m((e,t)=>Ol(e,"name",{value:t,configurable:!0}),"u");const Dl={less:["less"],lightningcss:["lightningcss"],"node-sass":["node-sass"],postcss:["postcss","postcss-load-config","postcss-modules","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"]},Pl=Ee(e=>{e.addCommand({description:"Initialize packem configuration",execute:Ee(async({logger:t,options:o})=>{if(Rs("Welcome to packem setup"),T($(o.dir,"packem.config.ts"))){t.info("Packem project already initialized, you can use `packem build` to build your project");return}const s=$(o.dir,"package.json");if(!T(s))throw new Error("No package.json found in the directory");const r=so(s),n=[];r.dependencies&&n.push(...Object.keys(r.dependencies)),r.devDependencies&&n.push(...Object.keys(r.devDependencies));const i=!!(r.devDependencies?.typescript??r.dependencies?.typescript);if(o.typescript===void 0&&!i){if(o.typescript=await U({message:"Do you want to install TypeScript?"}),o.typescript){const f=Q();f.start("Installing typescript@latest"),await ie("typescript@latest",{cwd:o.dir,dev:!0,silent:!0}),f.stop("")}}else ht.message("TypeScript version "+(r.devDependencies?.typescript??r.dependencies?.typescript)+" is already installed");if(!T($(o.dir,"tsconfig.json"))){const f=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(f){const b=Q();b.start("Generating tsconfig.json"),Te($(o.dir,"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"]}}),b.stop("")}}if(n.includes("esbuild")?o.transformer="esbuild":n.includes("@swc/core")?o.transformer="swc":n.includes("sucrase")&&(o.transformer="sucrase"),o.transformer===void 0){if(o.transformer=await $e({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"}]}),o.transformer&&!n.includes(o.transformer)&&await U({message:"Do you want to install "+o.transformer+"?"})){const f=Q();f.start("Installing "+o.transformer),await ie(o.transformer==="swc"?"@swc/core":o.transformer,{cwd:o.dir,dev:!0,silent:!0}),f.stop("")}}else ht.message("Transformer "+o.transformer+" is already installed.");if(o.isolatedDeclarationTransformer===void 0&&(o.isolatedDeclarationTransformer=await U({message:"Do you want to use an isolated declaration types?",initialValue:!1})),o.isolatedDeclarationTransformer===void 0&&(o.isolatedDeclarationTransformer=await $e({message:"Pick a isolated declaration transformer",options:[{label:"Typescript",value:"typescript"},{label:"swc",value:"swc"},{label:"OXC",value:"oxc"},{label:"None",value:null}]}),o.isolatedDeclarationTransformer!==null)){let f;switch(o.isolatedDeclarationTransformer){case"typescript":{f="typescript";break}case"swc":{f="@swc/core";break}case"oxc":{f="oxc-transform";break}default:Fs("Invalid isolated declaration transformer")}if(f!==void 0&&!n.includes(f)&&await U({message:"Do you want to install "+f+"?"})){const g=Q();g.start("Installing "+o.isolatedDeclarationTransformer),await ie(f,{cwd:o.dir,dev:!0,silent:!0}),g.stop("")}}o.css===void 0&&(o.css=await U({message:"Do you want to use css in your project?",initialValue:!1}));let a=[];if(o.css){if(a=await Js({message:"Pick your loaders",options:[{label:"Sass",value:"sass"},{label:"Stylus",value:"stylus"},{label:"Less",value:"less"},{label:"Lightning CSS",value:"lightningcss"},{label:"PostCSS",value:"postcss"}],required:!1}),a.includes("sass")){const f=await $e({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"}]});f!=="sass"&&(a=a.filter(g=>g!=="sass"),a.push(f))}if(await U({message:'Do you want to install "'+a.join('", "')+'"?'})){const f=Q();f.start('Installing dependencies for "'+a.join('", "')+'"');for await(const g of a)await ie(Dl[g],{cwd:o.dir,dev:!0,silent:!0});f.stop("")}a.push("sourceMap")}o.cssMinifier===void 0&&(o.cssMinifier=await U({message:"Do you want to minify your css?",initialValue:!1}));let c;if(o.cssMinifier&&(c=await $e({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 "'+c+'"?'}))){const f=Q();f.start("Installing css minifier"),await ie(c,{cwd:o.dir,dev:!0,silent:!0}),f.stop("")}let l="",p="";if(o.isolatedDeclarationTransformer&&(p+=`,
134
- isolatedDeclarationTransformer`),(o.css||o.cssMinifier)&&(p+=`,
135
- rollup: {
136
- css: {`),o.css){p+=`
137
- loaders: [ `;for(let f of a)(f==="sass-embedded"||f==="node-sass")&&(f="sass"),p+=`${f}Loader, `;p+="],"}if(o.cssMinifier&&c&&(p+=`
138
- minifier: `+c+"Minifier,"),(o.css||o.cssMinifier)&&(p+=`
139
- }
140
- }`),i||r.type==="module"){let f="";if(o.isolatedDeclarationTransformer&&(f+=`import isolatedDeclarationTransformer from "@visulima/packem/dts/isolated/transformer/${o.isolatedDeclarationTransformer}";
141
- `),o.css)for(let g of a)(g==="sass-embedded"||g==="node-sass")&&(g="sass"),f+=`import ${g}Loader from "@visulima/packem/css/loader/${g.toLowerCase()}";
142
- `;o.cssMinifier&&c&&(f+=`import ${c}Minifier from "@visulima/packem/css/minifier/${c.toLowerCase()}";
143
- `),l=`import { defineConfig } from "@visulima/packem/config";
113
+ `),t.info({message:"Removing "+s.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),i=!1)}},"removeOldCacheFolders"),Vs=P(e=>{switch(e){case"jit":return"Stubbing";case"watch":return"Watching";case"tsdoc":return"Generating TSDoc";default:return"Building"}},"getMode"),zs=P(async(e,t,o,r,n={})=>{const{configPath:i,debug:s,tsconfigPath:a,...l}=n;r.wrapAll(),e=$(pt(),e),r.debug("Root directory:",e);const{packageJson:c,packageJsonPath:u}=oo(e);r.debug("Using package.json found at",u);let p;if(a){const y=w(e,a);if(!await ut(y))throw new Error("tsconfig.json not found at "+y);p={config:Eo(y),path:y},r.info("Using tsconfig settings at",y)}else if(c.dependencies?.typescript||c.devDependencies?.typescript)try{p=await Do(e),r.debug("Using tsconfig settings found at",p.path)}catch{r.info("No tsconfig.json or jsconfig.json found.")}const d=xo("@visulima/packem",{cwd:e});let f=!1;try{const y=await Dt(e,i??""),g=vt(e,{debug:s});let h=await g.import(y,{default:!0,try:!0})||{};typeof h=="function"&&(h=await h(o,t)),r.debug("Using packem config found at",w(e,y));const b=A(JSON.stringify({version:c.version,...c.dependencies,...c.devDependencies,...c.peerDependencies,...c.peerDependenciesMeta,browser:c.browser,eNode:c.engines?.node,exports:c.exports,main:c.main,module:c.module,type:c.type,types:c.types}))+A(JSON.stringify(h));d&&ss(b,d,r);const x=new cs(e,d,b,r),v=await Bs(r,e,t,o,s??!1,l,h,c,p,g);x.isEnabled=v.options.fileCache,v.logger.info(k(Vs(t)+" "+v.options.name)),v.logger.debug({context:v.options.entries,message:`${N("Root dir:")} ${v.options.rootDir}
114
+ ${N("Entries:")}}`}),await Ws(v);const T=Date.now(),Q=P(()=>Fe(Math.floor(Date.now()-T)),"getDuration");if(t==="watch"){if(v.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await rs(v,x),st(v,!1);return}t==="jit"?(await Qi(v),await v.hooks.callHook("build:done",v)):(f=await Ci(v,x),await v.hooks.callHook("validate:before",v),_s(v),await v.hooks.callHook("validate:done",v),st(v,f)),v.logger.raw(`
115
+ ⚡️ Build run in `+Q());for await(const[be,io]of Object.entries(v.options.builder??{})){v.logger.raw(`
116
+ `),await v.hooks.callHook("builder:before",be,v);const so=Date.now(),ao=P(()=>Fe(Math.floor(Date.now()-so)),"getBuilderDuration");await io(v,d,x,f),await v.hooks.callHook("builder:done",be,v),v.logger.raw(`
117
+ ⚡️ `+be+" run in "+ao())}v.logger.restoreAll()}catch(y){throw r.raw(`
118
+ `),Zt(y),y}finally{await Ls(d,r,f)}},"createBundler");var Us=Object.defineProperty,xe=m((e,t)=>Us(e,"name",{value:t,configurable:!0}),"o");const Ks=xe(e=>{e.addCommand({description:"Demonstrate options required",execute:xe(async({logger:t,options:o})=>{let r="build";o.watch?r="watch":o.jit&&(r="jit");const n={};let i;if(ne.NODE_ENV&&[G,C].includes(ne.NODE_ENV)&&(i=ne.NODE_ENV),o.env)for(const s of o.env)if(s.key==="NODE_ENV"){if(i)throw new Error("NODE_ENV was already set, this can't be overridden.");i=s.value}else n["process.env."+s.key]=JSON.stringify(s.value);i===void 0&&(o.production?i=C:o.development&&(i=G));try{await zs(o.dir,r,i,t,{analyze:o.analyze,cjsInterop:o.cjsInterop,clean:o.clean,configPath:o.config??void 0,debug:o.debug,dtsOnly:o.dtsOnly,minify:o.minify===void 0?i===C:o.minify,rollup:{esbuild:{target:o.target},license:{path:o.license},metafile:o.metafile,replace:{values:n}},sourcemap:o.analyze||o.sourcemap,tsconfigPath:o.tsconfig??void 0,validation:o.validation===!1?{packageJson:{bin:!1,dependencies:!1,exports:!1,files:!1,main:!1,module:!1,name:!1,types:!1,typesVersions:!1}}:{},...o.typedoc?{typedoc:{format:"html"}}:{}})}catch(s){t.error(s),mo(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:xe(t=>{const[o,r]=t.split("=");return{key:o,value:r}},"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}]})},"createBuildCommand");var Hs=Object.defineProperty,re=m((e,t)=>Hs(e,"name",{value:t,configurable:!0}),"l");const qs=re(e=>{e.addCommand({description:"Initialize packem configuration",execute:re(async({logger:t,options:o})=>{if(Qo("Welcome to packem setup"),S(w(o.dir,"packem.config.ts"))){t.info("Packem project already initialized, you can use `packem build` to build your project");return}const r=w(o.dir,"package.json");if(!S(r))throw new Error("No package.json found in the directory");const n=Et(r),i=[];n.dependencies&&i.push(...Object.keys(n.dependencies)),n.devDependencies&&i.push(...Object.keys(n.devDependencies));const s=!!(n.devDependencies?.typescript??n.dependencies?.typescript);if(o.typescript===void 0&&!s){if(o.typescript=await W({message:"Do you want to install TypeScript?"}),o.typescript){const p=U();p.start("Installing typescript@latest"),await ie("typescript@latest",{cwd:o.dir,dev:!0,silent:!0}),p.stop("")}}else Ve.message("TypeScript version "+(n.devDependencies?.typescript??n.dependencies?.typescript)+" is already installed");if(!S(w(o.dir,"tsconfig.json"))){const p=await W({message:"Do you want to use generate a tsconfig.json?"}),d=await W({message:"Do you want to run your code in the DOM?"});if(p){const f=U();f.start("Generating tsconfig.json"),me(w(o.dir,"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:d?["es2022","dom","dom.iterable"]:["es2022"]}}),f.stop("")}}if(i.includes("esbuild")?o.transformer="esbuild":i.includes("@swc/core")?o.transformer="swc":i.includes("sucrase")&&(o.transformer="sucrase"),o.transformer===void 0){if(o.transformer=await ze({message:"Pick a transformer",options:[{label:"esbuild",value:"esbuild"},{label:"swc",value:"swc"},{label:"Sucrase",value:"sucrase"}]}),o.transformer&&!i.includes(o.transformer)&&await W({message:"Do you want to install "+o.transformer+"?"})){const p=U();p.start("Installing "+o.transformer),await ie(o.transformer==="swc"?"@swc/core":o.transformer,{cwd:o.dir,dev:!0,silent:!0}),p.stop("")}}else Ve.message("Transformer "+o.transformer+" is already installed.");let a=!0;if(o.isolatedDeclarationTransformer===void 0&&(a=await W({message:"Do you want to use an isolated declaration types?",initialValue:!1})),o.isolatedDeclarationTransformer===void 0&&a&&(o.isolatedDeclarationTransformer=await ze({message:"Pick a isolated declaration transformer",options:[{label:"Typescript",value:"typescript"},{label:"swc",value:"swc"},{label:"OXC",value:"oxc"},{label:"None",value:null}]}),o.isolatedDeclarationTransformer!==null)){let p;switch(o.isolatedDeclarationTransformer){case"typescript":{p="typescript";break}case"swc":{p="@swc/core";break}case"oxc":{p="oxc-transform";break}default:Zo("Invalid isolated declaration transformer")}if(p!==void 0&&!i.includes(p)&&await W({message:"Do you want to install "+p+"?"})){const d=U();d.start("Installing "+o.isolatedDeclarationTransformer),await ie(p,{cwd:o.dir,dev:!0,silent:!0}),d.stop("")}}let l="";s||n.type==="module"?l=`import { defineConfig } from "@visulima/packem/config";
144
119
  import transformer from "@visulima/packem/transformer/${o.transformer}";
145
- ${f}
120
+ ${!a||!o.isolatedDeclarationTransformer?"":`import isolatedDeclarationTransformer from "@visulima/packem/dts/isolated/transformer/${o.isolatedDeclarationTransformer}";
121
+ `}
146
122
  export default defineConfig({
147
- transformer${p}
123
+ transformer${!a||!o.isolatedDeclarationTransformer?"":`,
124
+ isolatedDeclarationTransformer`}
148
125
  });
149
- `}else{let f="";if(o.isolatedDeclarationTransformer&&(f+=`const isolatedDeclarationTransformer = require("@visulima/packem/dts/isolated/transformer/${o.isolatedDeclarationTransformer}");
150
- `),o.css)for(let g of a)(g==="sass-embedded"||g==="node-sass")&&(g="sass"),f+=`const ${g}Loader = require("@visulima/packem/css/loader/${g.toLowerCase()}");
151
- `;o.cssMinifier&&c&&(f+=`const ${c}Minifier = require("@visulima/packem/css/minifier/${c.toLowerCase()}");
152
- `),l=`const { defineConfig } = require("@visulima/packem/config");
126
+ `:l=`const { defineConfig } = require("@visulima/packem/config");
153
127
  const transformer = require("@visulima/packem/transformer/${o.transformer}");
154
- ${f}
128
+ ${!a||!o.isolatedDeclarationTransformer?"":`const isolatedDeclarationTransformer = require("@visulima/packem/dts/isolated/transformer/${o.isolatedDeclarationTransformer}");
129
+ `}
155
130
  module.exports = defineConfig({
156
- transformer${p}
131
+ transformer${!a||!o.isolatedDeclarationTransformer?"":`,
132
+ isolatedDeclarationTransformer`}
157
133
  });
158
- `}const d=Q(),u=i?"ts":"js";d.start("Creating packem.config."+u),ee($(o.dir,"packem.config."+u),l),d.stop("Created packem.config."+u),Ls("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 Uo("packem",{logger:{reporters:[new qo({error:{hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0}})],scope:"packem"},packageName:Bs,packageVersion:Ws});Pl(Be);Sl(Be);Hs(Be);Be.run({shouldExitProcess:!1});
134
+ `;const c=U(),u=s?"ts":"js";c.start("Creating packem.config."+u),F(w(o.dir,"packem.config."+u),l),c.stop("Created packem.config."+u),er("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:re(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:re(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 TypeScript",name:"typescript",type:Boolean}]})},"createInitCommand"),ve=new co("packem",{logger:{reporters:[new po({error:{hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0}})],scope:"packem"},packageName:tr,packageVersion:or});qs(ve);Ks(ve);ar(ve);ve.run({shouldExitProcess:!1});