@visulima/email 1.0.0-alpha.8 → 1.0.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 (396) hide show
  1. package/CHANGELOG.md +786 -0
  2. package/LICENSE.md +541 -847
  3. package/README.md +212 -191
  4. package/dist/crypto/index.d.ts +304 -4
  5. package/dist/crypto/index.js +1 -1
  6. package/dist/deliverability/dmarc-report.d.ts +95 -0
  7. package/dist/deliverability/dmarc-report.js +1 -0
  8. package/dist/deliverability/index.d.ts +360 -0
  9. package/dist/deliverability/index.js +1 -0
  10. package/dist/events/index.d.ts +31 -0
  11. package/dist/events/index.js +1 -0
  12. package/dist/inbound/index.d.ts +375 -0
  13. package/dist/inbound/index.js +1 -0
  14. package/dist/index.d.ts +94 -9
  15. package/dist/index.js +1 -1
  16. package/dist/middleware/index.d.ts +346 -0
  17. package/dist/middleware/index.js +1 -0
  18. package/dist/packem_shared/ALL_EVENTS-3kwh5CBE.js +1 -0
  19. package/dist/packem_shared/DkimSigner-BuSbnos1.js +18 -0
  20. package/dist/packem_shared/DraftMailMessage-BxqGSLMN.js +1 -0
  21. package/dist/packem_shared/EmailError-B-sEf3bp.js +1 -0
  22. package/dist/packem_shared/Mail-BEuzrB00.js +1 -0
  23. package/dist/packem_shared/MailMessage-D9k5gYrd.js +1 -0
  24. package/dist/packem_shared/MemoryEventStore-CuhfO9aj.js +1 -0
  25. package/dist/packem_shared/MemoryQueue-Dl1Fa6OJ.js +1 -0
  26. package/dist/packem_shared/MemorySuppressionStore-DZnbz-_B.js +1 -0
  27. package/dist/packem_shared/RATE_LIMIT_PRESETS-BPADLgcA.js +1 -0
  28. package/dist/packem_shared/RequiredOptionError-DuNNY_a5.js +1 -0
  29. package/dist/packem_shared/SmimeEncrypter-C7usORKF.js +6 -0
  30. package/dist/packem_shared/SmimeSigner-DgAApLPS.js +8 -0
  31. package/dist/packem_shared/addDarkModeSupport-DZYxULjl.js +1 -0
  32. package/dist/packem_shared/address-formatter-BWR2Dddx.js +1 -0
  33. package/dist/packem_shared/aggregate-features-BqEjPd42.js +1 -0
  34. package/dist/packem_shared/ahaSendProvider-D81_wUA1.js +1 -0
  35. package/dist/packem_shared/arcMessageSignatureBase-BY4j0TxM.js +17 -0
  36. package/dist/packem_shared/attachment-processor-CMp7qqMI.js +1 -0
  37. package/dist/packem_shared/awsSesProvider-BGZJUIep.js +32 -0
  38. package/dist/packem_shared/azureProvider-CmcK4bsf.js +1 -0
  39. package/dist/packem_shared/brevoProvider-C1BDXr41.js +1 -0
  40. package/dist/packem_shared/build-mime-message-B6927SQy.js +3 -0
  41. package/dist/packem_shared/buildListUnsubscribe-Cdr8MvR_.js +1 -0
  42. package/dist/packem_shared/buildMtaStsPolicy-oEQg8y_C.js +6 -0
  43. package/dist/packem_shared/circuitBreakerMiddleware-D2SA_07f.js +1 -0
  44. package/dist/packem_shared/cloudflareEmailProvider-Bv-ty-74.js +1 -0
  45. package/dist/packem_shared/composeMiddleware-BHwLLEzK.js +1 -0
  46. package/dist/packem_shared/create-logger-BQTS3f-I.js +1 -0
  47. package/dist/packem_shared/createSuppressionStore-CeAZKCbY.js +1 -0
  48. package/dist/packem_shared/createTestEmail-CF_RUjqo.js +1 -0
  49. package/dist/packem_shared/createWorker-_-yMWcNQ.js +1 -0
  50. package/dist/packem_shared/dedupeMiddleware-B6ajWOTi.js +1 -0
  51. package/dist/packem_shared/defineInboundHandler-CnL2BzlL.js +1 -0
  52. package/dist/packem_shared/defineProvider-C9q-7iwt.js +1 -0
  53. package/dist/packem_shared/detectMimeType-Dxv4MjZ7.js +1 -0
  54. package/dist/packem_shared/emailMatchers-DZDkrZ_3.js +1 -0
  55. package/dist/packem_shared/event-bus.d-DEl3w_EW.d.ts +104 -0
  56. package/dist/packem_shared/extractCidReferences-BuoTREMp.js +1 -0
  57. package/dist/packem_shared/extractReply-BUjIBt9A.js +5 -0
  58. package/dist/packem_shared/failoverProvider-BgX6zfnY.js +1 -0
  59. package/dist/packem_shared/format-address-DTl-9O70.js +1 -0
  60. package/dist/packem_shared/generate-boundary-DQbzDiOI.js +1 -0
  61. package/dist/packem_shared/generate-message-id-gXAuMz4g.js +1 -0
  62. package/dist/packem_shared/headers-to-record-De1Eg951.js +1 -0
  63. package/dist/packem_shared/httpProvider-DJAsYSun.js +1 -0
  64. package/dist/packem_shared/index-yDU-1zOZ.js +11 -0
  65. package/dist/packem_shared/infobipProvider-lHyGrXgZ.js +1 -0
  66. package/dist/packem_shared/injectPreheader-CF9WHZ7J.js +1 -0
  67. package/dist/packem_shared/inlineCss-BQ7d2Cyz.js +1 -0
  68. package/dist/packem_shared/isValidSigningCertUrl-Bii1AMGC.js +3 -0
  69. package/dist/packem_shared/loggingMiddleware-CZIiVMVp.js +1 -0
  70. package/dist/packem_shared/loopsProvider-DyloxzNC.js +1 -0
  71. package/dist/packem_shared/mail.d-B9SSqyy0.d.ts +909 -0
  72. package/dist/packem_shared/{mailCrabProvider-CM_CFDca.js → mailCrabProvider-CPtBT6Th.js} +1 -1
  73. package/dist/packem_shared/mailPaceProvider-CJEvOFBh.js +1 -0
  74. package/dist/packem_shared/mailchannelsProvider-osRkW_tz.js +1 -0
  75. package/dist/packem_shared/mailerSendProvider-C_6LzARK.js +1 -0
  76. package/dist/packem_shared/mailgunProvider-DkISvMPe.js +1 -0
  77. package/dist/packem_shared/mailjetProvider-CV0i4Xzh.js +1 -0
  78. package/dist/packem_shared/mailomatProvider-B5YFonEO.js +1 -0
  79. package/dist/packem_shared/mailtrapProvider-C4ZquIPz.js +1 -0
  80. package/dist/packem_shared/make-request-BlK_B72c.js +1 -0
  81. package/dist/packem_shared/mandrillProvider-DWPFh_Sj.js +1 -0
  82. package/dist/packem_shared/mockProvider-Behywbl1.js +1 -0
  83. package/dist/packem_shared/netcoreProvider-C5TEciaN.js +1 -0
  84. package/dist/packem_shared/nodemailerProvider-BFHobXxt.js +1 -0
  85. package/dist/packem_shared/normalizeMessageId-DAx2pGe2.js +1 -0
  86. package/dist/packem_shared/oauth2Middleware-CodqXkyj.js +1 -0
  87. package/dist/packem_shared/opentelemetryProvider-ByHC01ub.js +1 -0
  88. package/dist/packem_shared/outlook365Provider-63ggDpqV.js +1 -0
  89. package/dist/packem_shared/parseAddress-DdbViBAJ.js +1 -0
  90. package/dist/packem_shared/parseArfReport-Ds6S3c4J.js +6 -0
  91. package/dist/packem_shared/parseCloudflareInbound-C__j-oNa.js +1 -0
  92. package/dist/packem_shared/parseDmarcRecord-DXZ-_rF0.js +1 -0
  93. package/dist/packem_shared/parseMailgunInbound-BpC6uPNe.js +1 -0
  94. package/dist/packem_shared/parsePostmarkInbound-Co3_c6-9.js +1 -0
  95. package/dist/packem_shared/parseSendGridInbound-DsALoijO.js +4 -0
  96. package/dist/packem_shared/parseSesInbound-CH5tHIjp.js +1 -0
  97. package/dist/packem_shared/parseTlsReport-wPe1lIDs.js +1 -0
  98. package/dist/packem_shared/plunkProvider-yTlrJVEp.js +1 -0
  99. package/dist/packem_shared/postProcessHtml-DqKi2Ucg.js +1 -0
  100. package/dist/packem_shared/postalProvider-CRX_bMYD.js +1 -0
  101. package/dist/packem_shared/postmarkProvider-CDx85Yge.js +1 -0
  102. package/dist/packem_shared/provider-base-C7PuopYK.js +1 -0
  103. package/dist/packem_shared/provider.d-J-y6iogK.d.ts +28 -0
  104. package/dist/packem_shared/quoted-printable-nSGDA1tA.js +7 -0
  105. package/dist/packem_shared/resendProvider-CiclWxzr.js +1 -0
  106. package/dist/packem_shared/retry-3pnxTuNs.js +1 -0
  107. package/dist/packem_shared/retryMiddleware-DbViDX4r.js +1 -0
  108. package/dist/packem_shared/roundRobinProvider-D1by5KGW.js +1 -0
  109. package/dist/packem_shared/sanitize-header-DJhgZl3y.js +1 -0
  110. package/dist/packem_shared/scalewayProvider-BcND48qO.js +1 -0
  111. package/dist/packem_shared/sendGridProvider-D8ZLgY62.js +1 -0
  112. package/dist/packem_shared/smtpProvider-Bm0yP97W.js +25 -0
  113. package/dist/packem_shared/sparkpostProvider-CTYfSRaV.js +1 -0
  114. package/dist/packem_shared/sweegoProvider-DOoin_vi.js +1 -0
  115. package/dist/packem_shared/toEmailSnapshot-DeRqM5SJ.js +1 -0
  116. package/dist/packem_shared/tracer.d-MU42G1jG.d.ts +494 -0
  117. package/dist/packem_shared/types.d-BId55FW2.d.ts +107 -0
  118. package/dist/packem_shared/types.d-CmoWvdZi.d.ts +61 -0
  119. package/dist/packem_shared/types.d-DCkecJse.d.ts +51 -0
  120. package/dist/packem_shared/types.d-Mpu0HZoG.d.ts +24 -0
  121. package/dist/packem_shared/types.d-ejzh-xBP.d.ts +209 -0
  122. package/dist/packem_shared/types.d-lcJZmwRK.d.ts +69 -0
  123. package/dist/packem_shared/types.d-nyR1ty1Q.d.ts +9 -0
  124. package/dist/packem_shared/utils-BfYfPB_I.js +1 -0
  125. package/dist/packem_shared/validate-email-options-mCM9dVug.js +1 -0
  126. package/dist/packem_shared/verifyMailgunWebhook-Cwl0OD3P.js +1 -0
  127. package/dist/packem_shared/verifyPostmarkWebhook-C72ZvbrG.js +1 -0
  128. package/dist/packem_shared/verifyResendWebhook-YK2zNDXR.js +1 -0
  129. package/dist/packem_shared/verifySendGridWebhook-Dbwc1tfG.js +1 -0
  130. package/dist/packem_shared/withEvents-CCVblSqj.js +1 -0
  131. package/dist/packem_shared/withMetrics-DWywX_6M.js +1 -0
  132. package/dist/packem_shared/withRender-VP9wE5Yr.js +1 -0
  133. package/dist/packem_shared/withSuppression-DBaZDMAr.js +1 -0
  134. package/dist/packem_shared/withTelemetry-DL2qo0Hp.js +1 -0
  135. package/dist/packem_shared/zeptomailProvider-DKBPSHPj.js +1 -0
  136. package/dist/providers/ahasend/index.d.ts +36 -3
  137. package/dist/providers/ahasend/index.js +1 -1
  138. package/dist/providers/aws-ses/index.d.ts +47 -3
  139. package/dist/providers/aws-ses/index.js +1 -1
  140. package/dist/providers/azure/index.d.ts +52 -3
  141. package/dist/providers/azure/index.js +1 -1
  142. package/dist/providers/brevo/index.d.ts +65 -3
  143. package/dist/providers/brevo/index.js +1 -1
  144. package/dist/providers/cloudflare-email/index.d.ts +36 -0
  145. package/dist/providers/cloudflare-email/index.js +1 -0
  146. package/dist/providers/failover/index.d.ts +27 -3
  147. package/dist/providers/failover/index.js +1 -1
  148. package/dist/providers/http/index.d.ts +35 -3
  149. package/dist/providers/http/index.js +1 -1
  150. package/dist/providers/infobip/index.d.ts +56 -3
  151. package/dist/providers/infobip/index.js +1 -1
  152. package/dist/providers/loops/index.d.ts +47 -0
  153. package/dist/providers/loops/index.js +1 -0
  154. package/dist/providers/mailchannels/index.d.ts +26 -0
  155. package/dist/providers/mailchannels/index.js +1 -0
  156. package/dist/providers/mailcrab/index.d.ts +32 -3
  157. package/dist/providers/mailcrab/index.js +1 -1
  158. package/dist/providers/mailersend/index.d.ts +51 -3
  159. package/dist/providers/mailersend/index.js +1 -1
  160. package/dist/providers/mailgun/index.d.ts +73 -3
  161. package/dist/providers/mailgun/index.js +1 -1
  162. package/dist/providers/mailjet/index.d.ts +72 -3
  163. package/dist/providers/mailjet/index.js +1 -1
  164. package/dist/providers/mailomat/index.d.ts +40 -3
  165. package/dist/providers/mailomat/index.js +1 -1
  166. package/dist/providers/mailpace/index.d.ts +52 -3
  167. package/dist/providers/mailpace/index.js +1 -1
  168. package/dist/providers/mailtrap/index.d.ts +44 -3
  169. package/dist/providers/mailtrap/index.js +1 -1
  170. package/dist/providers/mandrill/index.d.ts +87 -3
  171. package/dist/providers/mandrill/index.js +1 -1
  172. package/dist/providers/mock/index.d.ts +12 -3
  173. package/dist/providers/mock/index.js +1 -1
  174. package/dist/providers/netcore/index.d.ts +35 -0
  175. package/dist/providers/netcore/index.js +1 -0
  176. package/dist/providers/nodemailer/index.d.ts +38 -3
  177. package/dist/providers/nodemailer/index.js +1 -1
  178. package/dist/providers/opentelemetry/index.d.ts +37 -3
  179. package/dist/providers/opentelemetry/index.js +1 -1
  180. package/dist/providers/outlook365/index.d.ts +48 -0
  181. package/dist/providers/outlook365/index.js +1 -0
  182. package/dist/providers/plunk/index.d.ts +38 -3
  183. package/dist/providers/plunk/index.js +1 -1
  184. package/dist/providers/postal/index.d.ts +48 -3
  185. package/dist/providers/postal/index.js +1 -1
  186. package/dist/providers/postmark/index.d.ts +60 -3
  187. package/dist/providers/postmark/index.js +1 -1
  188. package/dist/providers/resend/index.d.ts +51 -3
  189. package/dist/providers/resend/index.js +1 -1
  190. package/dist/providers/roundrobin/index.d.ts +27 -3
  191. package/dist/providers/roundrobin/index.js +1 -1
  192. package/dist/providers/scaleway/index.d.ts +44 -3
  193. package/dist/providers/scaleway/index.js +1 -1
  194. package/dist/providers/sendgrid/index.d.ts +84 -3
  195. package/dist/providers/sendgrid/index.js +1 -1
  196. package/dist/providers/smtp/index.d.ts +71 -3
  197. package/dist/providers/smtp/index.js +1 -1
  198. package/dist/providers/sparkpost/index.d.ts +43 -0
  199. package/dist/providers/sparkpost/index.js +1 -0
  200. package/dist/providers/sweego/index.d.ts +40 -3
  201. package/dist/providers/sweego/index.js +1 -1
  202. package/dist/providers/zeptomail/index.d.ts +37 -3
  203. package/dist/providers/zeptomail/index.js +1 -1
  204. package/dist/queue/bullmq-queue.d.ts +46 -0
  205. package/dist/queue/bullmq-queue.js +1 -0
  206. package/dist/queue/index.d.ts +147 -0
  207. package/dist/queue/index.js +1 -0
  208. package/dist/queue/pg-boss-queue.d.ts +41 -0
  209. package/dist/queue/pg-boss-queue.js +1 -0
  210. package/dist/queue/sqs-queue.d.ts +72 -0
  211. package/dist/queue/sqs-queue.js +1 -0
  212. package/dist/queue/unstorage-queue.d.ts +199 -0
  213. package/dist/queue/unstorage-queue.js +1 -0
  214. package/dist/render/index.d.ts +107 -0
  215. package/dist/render/index.js +1 -0
  216. package/dist/template-engines/handlebars.d.ts +23 -22
  217. package/dist/template-engines/handlebars.js +1 -1
  218. package/dist/template-engines/html-to-text.d.ts +24 -24
  219. package/dist/template-engines/html-to-text.js +1 -1
  220. package/dist/template-engines/i18n.d.ts +61 -0
  221. package/dist/template-engines/i18n.js +1 -0
  222. package/dist/template-engines/jsx-email.d.ts +11 -0
  223. package/dist/template-engines/jsx-email.js +1 -0
  224. package/dist/template-engines/liquid.d.ts +12 -0
  225. package/dist/template-engines/liquid.js +1 -0
  226. package/dist/template-engines/mjml.d.ts +10 -10
  227. package/dist/template-engines/mjml.js +1 -1
  228. package/dist/template-engines/react-email.d.ts +9 -9
  229. package/dist/template-engines/react-email.js +1 -1
  230. package/dist/template-engines/vue-email.d.ts +9 -9
  231. package/dist/template-engines/vue-email.js +1 -1
  232. package/dist/test/index.d.ts +155 -0
  233. package/dist/test/index.js +1 -0
  234. package/dist/utils/cache.d.ts +49 -48
  235. package/dist/utils/cache.js +1 -1
  236. package/dist/utils/format-email-address.d.ts +8 -7
  237. package/dist/utils/format-email-address.js +1 -1
  238. package/dist/utils/normalize-email-aliases.d.ts +20 -20
  239. package/dist/utils/normalize-email-aliases.js +1 -1
  240. package/dist/utils/parse-address.d.ts +18 -17
  241. package/dist/utils/parse-address.js +1 -1
  242. package/dist/utils/parse-eml.d.ts +22 -0
  243. package/dist/utils/parse-eml.js +6 -0
  244. package/dist/utils/result.d.ts +49 -0
  245. package/dist/utils/result.js +1 -0
  246. package/dist/utils/validation/check-feature-support.d.ts +53 -0
  247. package/dist/utils/validation/check-feature-support.js +1 -0
  248. package/dist/utils/validation/validate-email.d.ts +5 -5
  249. package/dist/utils/validation/validate-email.js +1 -1
  250. package/dist/webhooks/index.d.ts +231 -0
  251. package/dist/webhooks/index.js +1 -0
  252. package/package.json +177 -67
  253. package/dist/attachment-helpers.d.ts +0 -64
  254. package/dist/crypto/dkim-signer.d.ts +0 -48
  255. package/dist/crypto/smime-encrypter.d.ts +0 -53
  256. package/dist/crypto/smime-signer.d.ts +0 -48
  257. package/dist/crypto/types.d.ts +0 -101
  258. package/dist/draft-mail-message.d.ts +0 -13
  259. package/dist/errors/email-error.d.ts +0 -17
  260. package/dist/errors/required-option-error.d.ts +0 -10
  261. package/dist/mail-message.d.ts +0 -425
  262. package/dist/mail.d.ts +0 -206
  263. package/dist/packem_shared/DkimSigner-pFd4c3fZ.js +0 -18
  264. package/dist/packem_shared/EmailError-zm2ffVav.js +0 -1
  265. package/dist/packem_shared/Mail-6Bltpy_p.js +0 -1
  266. package/dist/packem_shared/MailMessage-B76GPBBA.js +0 -1
  267. package/dist/packem_shared/RequiredOptionError-CevW3u2K.js +0 -1
  268. package/dist/packem_shared/SmimeEncrypter-CBevU534.js +0 -6
  269. package/dist/packem_shared/SmimeSigner-CObA4jzT.js +0 -8
  270. package/dist/packem_shared/address-formatter-Cm_E_ZMa.js +0 -1
  271. package/dist/packem_shared/ahaSendProvider-DlFKEQ6D.js +0 -1
  272. package/dist/packem_shared/attachment-processor-2rHmfa7j.js +0 -1
  273. package/dist/packem_shared/awsSesProvider-Ba-eVJxZ.js +0 -32
  274. package/dist/packem_shared/azureProvider-CQYAkgVF.js +0 -1
  275. package/dist/packem_shared/brevoProvider-5p6jjiK9.js +0 -1
  276. package/dist/packem_shared/build-mime-message-IYaUqqPJ.js +0 -2
  277. package/dist/packem_shared/create-logger-BiWdqFNg.js +0 -1
  278. package/dist/packem_shared/defineProvider-B9rSklAJ.js +0 -1
  279. package/dist/packem_shared/detectMimeType-S8WRsNtY.js +0 -1
  280. package/dist/packem_shared/failoverProvider-CAHQQueo.js +0 -1
  281. package/dist/packem_shared/generate-boundary-Cx8nXYS0.js +0 -1
  282. package/dist/packem_shared/generate-message-id-D4uA8gkj.js +0 -1
  283. package/dist/packem_shared/headers-to-record-Qo124ImV.js +0 -1
  284. package/dist/packem_shared/httpProvider-CZD6LZX3.js +0 -1
  285. package/dist/packem_shared/infobipProvider-CtLwrUaP.js +0 -1
  286. package/dist/packem_shared/mailPaceProvider-B6yKvh6z.js +0 -1
  287. package/dist/packem_shared/mailerSendProvider-CeeIXFnW.js +0 -1
  288. package/dist/packem_shared/mailgunProvider-mmjKzouh.js +0 -1
  289. package/dist/packem_shared/mailjetProvider-DwN6i0VA.js +0 -1
  290. package/dist/packem_shared/mailomatProvider-DMQmjKHT.js +0 -1
  291. package/dist/packem_shared/mailtrapProvider-BN3UBEQw.js +0 -1
  292. package/dist/packem_shared/make-request-BDzF9W9D.js +0 -1
  293. package/dist/packem_shared/mandrillProvider-370y7CLu.js +0 -1
  294. package/dist/packem_shared/mockProvider-DN5ZwutD.js +0 -1
  295. package/dist/packem_shared/nodemailerProvider-_w8QXMU-.js +0 -1
  296. package/dist/packem_shared/opentelemetryProvider-C_ZXOLSd.js +0 -1
  297. package/dist/packem_shared/plunkProvider-DfJumQ4U.js +0 -1
  298. package/dist/packem_shared/postalProvider-Bavx2FcH.js +0 -1
  299. package/dist/packem_shared/postmarkProvider-DFC0uvjO.js +0 -1
  300. package/dist/packem_shared/provider-base-Cmzx6BTO.js +0 -1
  301. package/dist/packem_shared/readFile-BlZxbhCU-C8bCdiA2.js +0 -1
  302. package/dist/packem_shared/resendProvider-CfqU7UdE.js +0 -1
  303. package/dist/packem_shared/roundRobinProvider-1WQnuKR8.js +0 -1
  304. package/dist/packem_shared/sanitize-header-wWav-Scu.js +0 -1
  305. package/dist/packem_shared/scalewayProvider-be1HPimL.js +0 -1
  306. package/dist/packem_shared/sendGridProvider-BVI1sq3n.js +0 -1
  307. package/dist/packem_shared/smtpProvider-BV-ufR53.js +0 -23
  308. package/dist/packem_shared/sweegoProvider-7419CSAq.js +0 -1
  309. package/dist/packem_shared/validate-email-options-DfJ7llf8.js +0 -1
  310. package/dist/packem_shared/zeptomailProvider-C2lh0Xmo.js +0 -1
  311. package/dist/providers/ahasend/provider.d.ts +0 -7
  312. package/dist/providers/ahasend/types.d.ts +0 -28
  313. package/dist/providers/aws-ses/provider.d.ts +0 -8
  314. package/dist/providers/aws-ses/types.d.ts +0 -38
  315. package/dist/providers/azure/provider.d.ts +0 -7
  316. package/dist/providers/azure/types.d.ts +0 -44
  317. package/dist/providers/brevo/provider.d.ts +0 -7
  318. package/dist/providers/brevo/types.d.ts +0 -57
  319. package/dist/providers/failover/provider.d.ts +0 -7
  320. package/dist/providers/failover/types.d.ts +0 -19
  321. package/dist/providers/http/provider.d.ts +0 -7
  322. package/dist/providers/http/types.d.ts +0 -27
  323. package/dist/providers/infobip/provider.d.ts +0 -7
  324. package/dist/providers/infobip/types.d.ts +0 -48
  325. package/dist/providers/mailcrab/provider.d.ts +0 -9
  326. package/dist/providers/mailcrab/types.d.ts +0 -22
  327. package/dist/providers/mailersend/provider.d.ts +0 -7
  328. package/dist/providers/mailersend/types.d.ts +0 -43
  329. package/dist/providers/mailgun/provider.d.ts +0 -7
  330. package/dist/providers/mailgun/types.d.ts +0 -65
  331. package/dist/providers/mailjet/provider.d.ts +0 -7
  332. package/dist/providers/mailjet/types.d.ts +0 -64
  333. package/dist/providers/mailomat/provider.d.ts +0 -7
  334. package/dist/providers/mailomat/types.d.ts +0 -32
  335. package/dist/providers/mailpace/provider.d.ts +0 -7
  336. package/dist/providers/mailpace/types.d.ts +0 -44
  337. package/dist/providers/mailtrap/provider.d.ts +0 -7
  338. package/dist/providers/mailtrap/types.d.ts +0 -36
  339. package/dist/providers/mandrill/provider.d.ts +0 -7
  340. package/dist/providers/mandrill/types.d.ts +0 -79
  341. package/dist/providers/mock/provider.d.ts +0 -8
  342. package/dist/providers/mock/types.d.ts +0 -50
  343. package/dist/providers/nodemailer/provider.d.ts +0 -7
  344. package/dist/providers/nodemailer/types.d.ts +0 -30
  345. package/dist/providers/opentelemetry/provider.d.ts +0 -8
  346. package/dist/providers/opentelemetry/types.d.ts +0 -31
  347. package/dist/providers/plunk/provider.d.ts +0 -7
  348. package/dist/providers/plunk/types.d.ts +0 -30
  349. package/dist/providers/postal/provider.d.ts +0 -7
  350. package/dist/providers/postal/types.d.ts +0 -40
  351. package/dist/providers/postmark/provider.d.ts +0 -7
  352. package/dist/providers/postmark/types.d.ts +0 -52
  353. package/dist/providers/provider.d.ts +0 -27
  354. package/dist/providers/resend/provider.d.ts +0 -7
  355. package/dist/providers/resend/types.d.ts +0 -43
  356. package/dist/providers/roundrobin/provider.d.ts +0 -7
  357. package/dist/providers/roundrobin/types.d.ts +0 -19
  358. package/dist/providers/scaleway/provider.d.ts +0 -7
  359. package/dist/providers/scaleway/types.d.ts +0 -36
  360. package/dist/providers/sendgrid/provider.d.ts +0 -7
  361. package/dist/providers/sendgrid/types.d.ts +0 -76
  362. package/dist/providers/smtp/provider.d.ts +0 -7
  363. package/dist/providers/smtp/types.d.ts +0 -63
  364. package/dist/providers/sweego/provider.d.ts +0 -7
  365. package/dist/providers/sweego/types.d.ts +0 -32
  366. package/dist/providers/utils/address-formatter.d.ts +0 -139
  367. package/dist/providers/utils/attachment-processor.d.ts +0 -58
  368. package/dist/providers/utils/index.d.ts +0 -4
  369. package/dist/providers/utils/payload-builder.d.ts +0 -78
  370. package/dist/providers/utils/provider-base.d.ts +0 -69
  371. package/dist/providers/zeptomail/provider.d.ts +0 -7
  372. package/dist/providers/zeptomail/types.d.ts +0 -29
  373. package/dist/template-engines/types.d.ts +0 -8
  374. package/dist/types.d.ts +0 -203
  375. package/dist/utils/build-mime-message.d.ts +0 -8
  376. package/dist/utils/create-logger.d.ts +0 -16
  377. package/dist/utils/format-email-addresses.d.ts +0 -8
  378. package/dist/utils/generate-boundary.d.ts +0 -7
  379. package/dist/utils/generate-message-id.d.ts +0 -6
  380. package/dist/utils/headers-to-record.d.ts +0 -9
  381. package/dist/utils/is-port-available.d.ts +0 -9
  382. package/dist/utils/make-request.d.ts +0 -18
  383. package/dist/utils/retry.d.ts +0 -10
  384. package/dist/utils/sanitize-header.d.ts +0 -14
  385. package/dist/utils/to-base64.d.ts +0 -8
  386. package/dist/utils/validation/check-mx-records.d.ts +0 -42
  387. package/dist/utils/validation/check-mx-records.js +0 -1
  388. package/dist/utils/validation/disposable-email-domains.d.ts +0 -13
  389. package/dist/utils/validation/disposable-email-domains.js +0 -1
  390. package/dist/utils/validation/role-accounts.d.ts +0 -21
  391. package/dist/utils/validation/role-accounts.js +0 -1
  392. package/dist/utils/validation/validate-email-options.d.ts +0 -8
  393. package/dist/utils/validation/verify-email.d.ts +0 -47
  394. package/dist/utils/validation/verify-email.js +0 -1
  395. package/dist/utils/validation/verify-smtp.d.ts +0 -39
  396. package/dist/utils/validation/verify-smtp.js +0 -4
@@ -0,0 +1 @@
1
+ import d from"./EmailError-B-sEf3bp.js";import T from"./RequiredOptionError-DuNNY_a5.js";import{e as A}from"./generate-message-id-gXAuMz4g.js";import{s as I}from"./headers-to-record-De1Eg951.js";import{m}from"./make-request-BlK_B72c.js";import{u as g}from"./retry-3pnxTuNs.js";import{f as P}from"./validate-email-options-mCM9dVug.js";import{defineProvider as C}from"./defineProvider-C9q-7iwt.js";import{P as k,h as b,c as E}from"./provider-base-C7PuopYK.js";import{f as p,a as y}from"./address-formatter-BWR2Dddx.js";import{p as j}from"./attachment-processor-CMp7qqMI.js";const r="brevo",S="https://api.brevo.com/v3",z=3e4,K=3,L=C((n={})=>{if(!n.apiKey)throw new T(r,"apiKey");const v=n.endpoint??S,s={apiKey:n.apiKey,debug:n.debug??!1,endpoint:v,hardValidation:n.hardValidation??!1,retries:n.retries??K,timeout:n.timeout??z,...n.logger&&{logger:n.logger}},u=new k,i=E(r,n.logger);return{endpoint:s.endpoint,features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!0,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new d(r,"Email ID is required to retrieve email details"),success:!1};await u.ensureInitialized(()=>this.initialize(),r);const t={"api-key":s.apiKey,"Content-Type":"application/json"};i.debug("Retrieving email details",{id:e});const l=await g(async()=>m(`${s.endpoint}/smtp/emails/${e}`,{headers:t,method:"GET",timeout:s.timeout}),s.retries);return l.success?(i.debug("Email details retrieved successfully"),{data:l.data?.body,success:!0}):(i.debug("API request failed when retrieving email",l.error),{error:new d(r,`Failed to retrieve email: ${l.error instanceof Error?l.error.message:"Unknown error"}`,{cause:l.error}),success:!1})}catch(t){return{error:b(r,"retrieve email",t,i),success:!1}}},async initialize(){await u.ensureInitialized(async()=>{if(!await this.isAvailable())throw new d(r,"Brevo API not available or invalid API key");i.debug("Provider initialized successfully")},r)},async isAvailable(){try{const e={"api-key":s.apiKey,"Content-Type":"application/json"};i.debug("Checking Brevo API availability");const t=await m(`${s.endpoint}/account`,{headers:e,method:"GET",timeout:s.timeout});return i.debug("Brevo API availability check response:",{error:t.error instanceof Error?t.error.message:void 0,statusCode:t.data?.statusCode,success:t.success}),!!(t.success&&t.data&&typeof t.data=="object"&&"statusCode"in t.data&&typeof t.data.statusCode=="number"&&t.data.statusCode>=200&&t.data.statusCode<300)}catch(e){return i.debug("Error checking availability:",e),!1}},name:r,options:s,async sendEmail(e){try{let t;Array.isArray(e.replyTo)?t=e.replyTo.length>0?e.replyTo[0]:void 0:t=e.replyTo;const l={...e,replyTo:t},f=P(l);if(f.length>0)return{error:new d(r,`Invalid email options: ${f.join(", ")}`),success:!1};await u.ensureInitialized(()=>this.initialize(),r);const a={sender:y(e.from),subject:e.subject,to:p(e.to)};if(e.html&&(a.htmlContent=e.html),e.text&&(a.textContent=e.text),e.cc&&(a.cc=p(e.cc)),e.bcc&&(a.bcc=p(e.bcc)),e.replyTo)if(Array.isArray(e.replyTo)){if(s.hardValidation)return{error:new d(r,"Only one replyTo address is allowed"),success:!1};if(e.replyTo.length===0)return{error:new d(r,"replyTo array cannot be empty"),success:!1};const o=e.replyTo[0];if(!o)return{error:new d(r,"replyTo array cannot be empty"),success:!1};a.replyTo=y(o)}else a.replyTo=y(e.replyTo);if(e.templateId&&(a.templateId=e.templateId,e.templateParams&&(a.params=e.templateParams)),e.tags&&e.tags.length>0&&(a.tags=e.tags),e.scheduledAt){const o=typeof e.scheduledAt=="number"?new Date(e.scheduledAt*1e3).toISOString():e.scheduledAt;a.scheduledAt=o}if(e.batchId&&(a.batchId=e.batchId),e.headers){const o=I(e.headers);a.headers=o}e.attachments&&e.attachments.length>0&&(a.attachment=await Promise.all(e.attachments.map(async o=>({content:await j(o,r),name:o.filename,...o.contentType&&{type:o.contentType}})))),i.debug("Sending email via Brevo API",{subject:a.subject,to:a.to});const w={"api-key":s.apiKey,"Content-Type":"application/json"},c=await g(async()=>m(`${s.endpoint}/smtp/email`,{headers:w,method:"POST",timeout:s.timeout},JSON.stringify(a)),s.retries);if(!c.success)return i.debug("API request failed when sending email",c.error),{error:c.error??new d(r,"Failed to send email"),success:!1};const h=c.data?.body?.messageId??A();return i.debug("Email sent successfully",{messageId:h}),{data:{messageId:h,provider:r,response:c.data,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:b(r,"send email",t,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{L as default};
@@ -0,0 +1,3 @@
1
+ import v from"./EmailError-B-sEf3bp.js";import l from"../utils/format-email-address.js";import{r as F}from"./generate-boundary-DQbzDiOI.js";import{s as M}from"./headers-to-record-De1Eg951.js";import{f as g}from"./quoted-printable-nSGDA1tA.js";import{a as T,s as f}from"./sanitize-header-DJhgZl3y.js";const d=globalThis.Buffer!==void 0,$=t=>{if(typeof t=="string"){if(d)return Buffer.from(t,"utf8").toString("base64");const e=new TextEncoder().encode(t);let r="";const n=8192;for(let s=0;s<e.length;s+=n){const i=e.subarray(s,Math.min(s+n,e.length));r+=String.fromCharCode(...i)}return btoa(r)}if(d&&t instanceof Buffer)return t.toString("base64");const a=t instanceof Uint8Array?t:new Uint8Array(t);if(d)return Buffer.from(a).toString("base64");let h="";const o=8192;for(let e=0;e<a.length;e+=o){const r=a.subarray(e,Math.min(e+o,a.length));h+=String.fromCharCode(...r)}return btoa(h)},j=globalThis.Buffer!==void 0,A=/[^\u0000-\u007F]/,S=t=>!A.test(t),U=t=>{if(S(t))return t;const a=45,h=new TextDecoder,o=j?Buffer.from(t,"utf8"):new TextEncoder().encode(t),e=[];let r=0;for(;r<o.length;){let n=Math.min(r+a,o.length);if(n<o.length)for(;n>r&&(o[n]&192)===128;)n-=1;const s=o.subarray(r,n),i=h.decode(s);e.push(`=?UTF-8?B?${$(i)}?=`),r=n}return e.join(" ")},b=t=>Array.isArray(t)?t.map(a=>l(a)).join(", "):l(t),y=/[^ -]/,C=t=>U(f(t)),D=globalThis.Buffer!==void 0,x=t=>t.replaceAll(/.{1,76}/g,`$&\r
2
+ `).trimEnd(),P=async(t,a={})=>{const{includeBcc:h=!1}=a,o=F(),e=[`From: ${l(t.from)}`,`To: ${b(t.to)}`];if(t.cc&&e.push(`Cc: ${b(t.cc)}`),h&&t.bcc&&e.push(`Bcc: ${b(t.bcc)}`),t.replyTo&&e.push(`Reply-To: ${l(t.replyTo)}`),e.push(`Subject: ${C(t.subject)}`,"MIME-Version: 1.0"),t.headers){const r=M(t.headers);Object.entries(r).forEach(([n,s])=>{const i=T(n),p=f(s);e.push(`${i}: ${p}`)})}if(e.push(`Content-Type: multipart/mixed; boundary="${o}"`,""),t.text&&(y.test(t.text)?e.push(`--${o}`,"Content-Type: text/plain; charset=UTF-8","Content-Transfer-Encoding: quoted-printable","",g(t.text),""):e.push(`--${o}`,"Content-Type: text/plain; charset=UTF-8","Content-Transfer-Encoding: 7bit","",t.text,"")),t.html&&(y.test(t.html)?e.push(`--${o}`,"Content-Type: text/html; charset=UTF-8","Content-Transfer-Encoding: quoted-printable","",g(t.html),""):e.push(`--${o}`,"Content-Type: text/html; charset=UTF-8","Content-Transfer-Encoding: 7bit","",t.html,"")),t.attachments&&t.attachments.length>0){const r=await Promise.all(t.attachments.map(async n=>{let s;if(n.raw!==void 0)s=n.raw;else{if(n.content===void 0)throw new v("attachment",`Attachment '${n.filename}' must have content, raw, or be resolved from path/href before building MIME message`);s=n.content instanceof Promise?await n.content:n.content}return{...n,resolvedContent:s}}));for(const n of r){e.push(`--${o}`);const s=f(n.contentType??"application/octet-stream"),i=C(n.filename);e.push(`Content-Type: ${s}; name="${i}"`);const p=f(n.contentDisposition??"attachment");e.push(`Content-Disposition: ${p}; filename="${i}"`),n.cid&&e.push(`Content-ID: <${f(n.cid)}>`),n.headers&&Object.entries(n.headers).forEach(([m,w])=>{const B=T(m),E=f(w);e.push(`${B}: ${E}`)});const u=f(n.encoding??"base64");e.push(`Content-Transfer-Encoding: ${u}`,"");const c=n.resolvedContent;if(u==="base64")e.push(x($(c)));else if(u==="7bit"||u==="8bit")if(typeof c=="string")e.push(c);else if(D&&c instanceof Buffer)e.push(c.toString("utf8"));else{const m=new TextDecoder;e.push(m.decode(c))}else e.push(x($(c)));e.push("")}}return e.push(`--${o}--`),e.join(`\r
3
+ `)};export{P as F};
@@ -0,0 +1 @@
1
+ const u=r=>{const{mailto:s,mailtoSubject:e="unsubscribe",oneClick:o=!1,url:t}=r;if(!t&&!s)throw new TypeError("buildListUnsubscribe requires at least one of `url` or `mailto`");const i=[];t&&i.push(`<${t}>`),s&&(s.startsWith("mailto:")?i.push(`<${s}>`):i.push(`<mailto:${s}?subject=${encodeURIComponent(e)}>`));const n={"List-Unsubscribe":i.join(", ")};if(o){if(!t?.startsWith("https:"))throw new TypeError("One-click unsubscribe (RFC 8058) requires an https `url`");n["List-Unsubscribe-Post"]="List-Unsubscribe=One-Click"}return n},c=r=>{const s=r.match(/<[^<>]+>/g);return s?s.map(e=>e.slice(1,-1).trim()):[]};export{u as buildListUnsubscribe,c as parseListUnsubscribe};
@@ -0,0 +1,6 @@
1
+ const c=new Set(["enforce","none","testing"]),g=o=>{const n=[];let e,r,s;for(const m of o.replaceAll(`\r
2
+ `,`
3
+ `).split(`
4
+ `)){const a=m.indexOf(":");if(a===-1)continue;const i=m.slice(0,a).trim().toLowerCase(),t=m.slice(a+1).trim();if(i==="version")e=t;else if(i==="mode"&&(t==="enforce"||t==="testing"||t==="none"))r=t;else if(i==="max_age"){const l=Number.parseInt(t,10);s=Number.isNaN(l)?void 0:l}else i==="mx"&&t.length>0&&n.push(t)}return{maxAge:s,mode:r,mx:n,valid:e==="STSv1"&&r!==void 0&&s!==void 0,version:e}},d=o=>{if(!c.has(o.mode))throw new TypeError('buildMtaStsPolicy: `mode` must be one of "enforce", "testing", or "none"');if(!Number.isInteger(o.maxAge)||o.maxAge<0)throw new TypeError("buildMtaStsPolicy: `maxAge` must be a non-negative integer");const n=o.mx.map(e=>e.trim());if(n.length===0||n.some(e=>e.length===0))throw new TypeError("buildMtaStsPolicy: `mx` must contain at least one non-empty host");return`${["version: STSv1",`mode: ${o.mode}`,...n.map(e=>`mx: ${e}`),`max_age: ${String(o.maxAge)}`].join(`\r
5
+ `)}\r
6
+ `};export{d as buildMtaStsPolicy,g as parseMtaStsPolicy};
@@ -0,0 +1 @@
1
+ import w from"./EmailError-B-sEf3bp.js";const C=(c={})=>{const{failureThreshold:u=5,now:s=Date.now,onStateChange:p,resetTimeout:d=3e4}=c;let e="closed",n=0,l=0,t=!1;const a=r=>{e!==r&&(e=r,p?.(r))},i=()=>({error:new w("middleware","Circuit breaker is open",{code:"CIRCUIT_OPEN"}),success:!1});return async(r,h)=>{if(e==="open"&&s()-l>=d&&(a("half-open"),t=!1),e==="open")return i();let f=!1;if(e==="half-open"){if(t)return i();t=!0,f=!0}let o;try{o=await h(r)}finally{f&&(t=!1)}return o.success?(n=0,a("closed"),o):(n+=1,(e==="half-open"||n>=u)&&(l=s(),a("open")),o)}};export{C as circuitBreakerMiddleware};
@@ -0,0 +1 @@
1
+ import a from"./EmailError-B-sEf3bp.js";import m from"./RequiredOptionError-DuNNY_a5.js";import{F as d}from"./build-mime-message-B6927SQy.js";import{e as f}from"./generate-message-id-gXAuMz4g.js";import{s as u}from"./headers-to-record-De1Eg951.js";import{f as p}from"./validate-email-options-mCM9dVug.js";import{defineProvider as g}from"./defineProvider-C9q-7iwt.js";import{h,c as v}from"./provider-base-C7PuopYK.js";const r="cloudflare-email",C=g((t={})=>{if(typeof t.send!="function")throw new m(r,"send");const c=v(r,t.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){await Promise.resolve()},async isAvailable(){return typeof t.send=="function"},name:r,async sendEmail(e){try{const s=p(e);if(s.length>0)return{error:new a(r,`Invalid email options: ${s.join(", ")}`),success:!1};const i=Array.isArray(e.to)?e.to:[e.to];if(i.length!==1||e.cc!==void 0||e.bcc!==void 0)return{error:new a(r,"Cloudflare Email supports exactly one `to` recipient and does not support cc/bcc"),success:!1};const[o]=i;if(!o)return{error:new a(r,"A single `to` recipient is required"),success:!1};const n=f(),l=await d({...e,headers:{...e.headers?u(e.headers):{},"Message-ID":n}});return await t.send(e.from.email,o.email,l),{data:{messageId:n,provider:r,sent:!0,timestamp:new Date},success:!0}}catch(s){return{error:h(r,"send email",s,c),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{C as default};
@@ -0,0 +1 @@
1
+ const c=(o,t)=>{let e=t;for(const r of o.toReversed()){const n=e;e=s=>r(s,n)}return e};export{c as composeMiddleware};
@@ -0,0 +1 @@
1
+ const a=(n,e)=>{const $=()=>{};return e?{debug:(r,...o)=>{e.log(`[${n}] ${r}`,...o)},error:(r,...o)=>{e.error(`[${n}] ${r}`,...o)},info:(r,...o)=>{e.info(`[${n}] ${r}`,...o)},warn:(r,...o)=>{e.warn(`[${n}] ${r}`,...o)}}:{debug:$,error:$,info:$,warn:$}};export{a as c};
@@ -0,0 +1 @@
1
+ import a from"./MemorySuppressionStore-DZnbz-_B.js";const i=async(r,p)=>{const t=Array.isArray(r)?r:[r],o=[],e=[];for(const s of t)await p.has(s.email)?e.push(s):o.push(s);return{allowed:o,suppressed:e}},u=r=>new a(r);export{a as MemorySuppressionStore,u as createSuppressionStore,i as filterSuppressed};
@@ -0,0 +1 @@
1
+ import{createMail as w}from"./Mail-BEuzrB00.js";import u from"./mockProvider-Behywbl1.js";const d=(t,o,e,n)=>{const r=Date.now()+e;return new Promise((s,c)=>{const a=()=>{const i=t.find(m=>o(m));if(i){s(i);return}if(Date.now()>=r){c(new Error("waitFor timed out before a matching message was captured"));return}setTimeout(a,n)};a()})},l=()=>{const t=u(),o=w(t),e=t.getInstance?.();if(!e)throw new Error("mockProvider() did not expose getInstance(); cannot create a test harness");return{mail:o,reset:()=>{e.length=0},sent:()=>e,waitFor:(n,r={})=>d(e,n,r.timeout??1e3,r.interval??10)}};export{l as createTestEmail};
@@ -0,0 +1 @@
1
+ const p=n=>1e3*2**(n-1),g=n=>{const{backoff:y=p,concurrency:E=1,maxAttempts:d=3,onDeadLetter:m,onError:l,onReserveError:v,pollInterval:h=1e3,queue:e,send:k}=n;let c=!1,o=0,s;const i=async(r,t)=>{try{await t()}catch(a){l?.(r,{error:a instanceof Error?a:new Error(String(a)),success:!1})}},u=async r=>{let t;try{t=await k(r.message)}catch(f){t={error:f instanceof Error?f:new Error(String(f)),success:!1}}if(t.success){await i(r,()=>e.ack(r.id));return}l?.(r,t);const a=r.attempts+1;if(a>=d){await i(r,()=>e.ack(r.id)),m?.(r,t);return}await i(r,()=>e.retry(r.id,y(a)))},w=async()=>{if(c){try{for(;o<E;){const r=await e.reserve();if(!r)break;o+=1,u(r).finally(()=>{o-=1}).catch(()=>{})}}catch(r){v?.(r instanceof Error?r:new Error(String(r)))}c&&(s=setTimeout(()=>{w().catch(()=>{})},h))}};return{drain:async()=>{let r=await e.reserve();for(;r;)await u(r),r=await e.reserve()},start:()=>{c||(c=!0,w().catch(()=>{}))},stop:()=>{c=!1,s&&(clearTimeout(s),s=void 0)}}};export{g as createWorker};
@@ -0,0 +1 @@
1
+ import{createRequire as m}from"node:module";const _=m(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=t=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[e,s]=r.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return r.getBuiltinModule(t)}return _(t)},{createHash:g}=f("node:crypto"),p=t=>t?(Array.isArray(t)?t:[t]).map(e=>e.email.toLowerCase()).toSorted((e,s)=>e.localeCompare(s)).join(","):"",y=t=>{const e=g("sha256");return e.update(p(t.to)),e.update("\0"),e.update(p(t.cc)),e.update("\0"),e.update(t.subject),e.update("\0"),e.update(t.text??t.html??""),e.digest("hex")},j=(t={})=>{const{keyFn:e=y,now:s=Date.now,ttl:d=6e4}=t,a=new Map;return async(c,l)=>{const i=e(c),u=s(),o=a.get(i);if(o&&o.expires>u)return o.result;const n=await l(c);return n.success&&a.set(i,{expires:u+d,result:n}),n}};export{j as dedupeMiddleware};
@@ -0,0 +1 @@
1
+ import n from"./parseCloudflareInbound-C__j-oNa.js";import a from"./parseMailgunInbound-BpC6uPNe.js";import i from"./parsePostmarkInbound-Co3_c6-9.js";import s from"./parseSendGridInbound-DsALoijO.js";import m from"./parseSesInbound-CH5tHIjp.js";import{extractReply as c}from"./extractReply-BUjIBt9A.js";const u=(e,r)=>{switch(e){case"cloudflare":return n(r);case"mailgun":return a(r);case"sendgrid":return s(r);case"ses":return m(r);default:return i(r)}},w=e=>({handle:async(r,o)=>{try{const t=u(r,o);return e.stripReply&&t.text!==void 0&&(t.text=c(t.text)),await e.onMessage(t),t}catch(t){if(e.onError){await e.onError(t,r,o);return}throw t}}});export{w as defineInboundHandler,u as parseInbound};
@@ -0,0 +1 @@
1
+ const o=e=>e;export{o as defineProvider};
@@ -0,0 +1 @@
1
+ import{z as o}from"./index-yDU-1zOZ.js";import a from"mime";const n=e=>a.getType(e)??"application/octet-stream",p=e=>{const t=e.replaceAll(/[^a-z0-9]/gi,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"").toLowerCase(),r=Math.random().toString(36).slice(2,9);return`${t}-${r}@email`},c=e=>o(e,{buffer:!0});export{n as detectMimeType,p as generateContentId,c as readFileAsBuffer};
@@ -0,0 +1 @@
1
+ const o=e=>Array.isArray(e)?e:e.sent(),c=e=>e?(Array.isArray(e)?e:[e]).map(t=>t.email.toLowerCase()):[],m=e=>[...c(e.to),...c(e.cc),...c(e.bcc)],h=(e,t)=>{const n=t.toLowerCase(),s=o(e).some(a=>m(a.options).includes(n));return{message:()=>`expected ${s?"no ":""}email to have been sent to ${t}`,pass:s}},p=(e,t)=>{const n=o(e).some(s=>typeof t=="string"?s.options.subject===t:t.test(s.options.subject));return{message:()=>`expected ${n?"no ":""}email to have been sent with subject ${String(t)}`,pass:n}},v=(e,t)=>{const n=o(e).some(s=>{const a=s.options.attachments??[];return t===void 0?a.length>0:a.some(i=>i.filename===t)});return{message:()=>`expected ${n?"no ":""}email to have been sent with attachment${t?` "${t}"`:""}`,pass:n}},u=(e,t)=>{const n=typeof t=="function"?t:a=>Object.entries(t).every(([i,r])=>a[i]===r),s=o(e).some(a=>n(a.options));return{message:()=>`expected ${s?"no ":""}email to have been sent matching the given condition`,pass:s}},g={toHaveSentMatching:u,toHaveSentTo:h,toHaveSentWithAttachment:v,toHaveSentWithSubject:p},b=e=>{e.extend(g)};export{g as emailMatchers,b as registerEmailMatchers,u as toHaveSentMatching,h as toHaveSentTo,v as toHaveSentWithAttachment,p as toHaveSentWithSubject};
@@ -0,0 +1,104 @@
1
+ /**
2
+ * The lifecycle/engagement event types that converge onto a single {@link EmailEvent} shape.
3
+ *
4
+ * The first group (`queued` → `failed`) is emitted by the send pipeline; the rest typically originate
5
+ * from provider webhooks (delivery/engagement signals).
6
+ */
7
+ type EmailEventType = "attempt" | "bounced" | "clicked" | "complained" | "deferred" | "delivered" | "failed" | "opened" | "queued" | "sent" | "unsubscribed";
8
+ /**
9
+ * A single, provider-agnostic email event. Both internal send-lifecycle signals and normalized
10
+ * webhook events use this shape so a timeline can be reconstructed from one stream.
11
+ */
12
+ interface EmailEvent {
13
+ /**
14
+ * Arbitrary structured payload (provider response, bounce sub-type, click URL, …).
15
+ */
16
+ data?: Record<string, unknown>;
17
+ /**
18
+ * A unique id for this event.
19
+ */
20
+ id: string;
21
+ /**
22
+ * The message this event concerns.
23
+ */
24
+ messageId?: string;
25
+ /**
26
+ * The provider that produced (or will produce) the message.
27
+ */
28
+ provider?: string;
29
+ /**
30
+ * The recipient address this event concerns, when applicable.
31
+ */
32
+ recipient?: string;
33
+ /**
34
+ * When the event occurred.
35
+ */
36
+ timestamp: Date;
37
+ /**
38
+ * The kind of event.
39
+ */
40
+ type: EmailEventType;
41
+ }
42
+ /**
43
+ * A listener invoked for matching {@link EmailEvent}s.
44
+ */
45
+ type EmailEventListener = (event: EmailEvent) => void;
46
+ /**
47
+ * A persistence backend for {@link EmailEvent}s.
48
+ */
49
+ interface EventStore {
50
+ /**
51
+ * Appends an event.
52
+ * @param event The event to store.
53
+ */
54
+ append: (event: EmailEvent) => Promise<void> | void;
55
+ /**
56
+ * Returns the full, time-ordered timeline for a message.
57
+ * @param messageId The message to reconstruct.
58
+ */
59
+ timeline: (messageId: string) => EmailEvent[] | Promise<EmailEvent[]>;
60
+ }
61
+ type Selector = "*" | EmailEventType;
62
+ /**
63
+ * The wildcard selector that subscribes to every event type.
64
+ */
65
+ declare const ALL_EVENTS: "*";
66
+ /**
67
+ * A tiny synchronous pub/sub bus for {@link EmailEvent}s.
68
+ *
69
+ * Subscribe to a specific {@link EmailEventType} or to {@link ALL_EVENTS} (`"*"`) for every event.
70
+ */
71
+ declare class EventBus {
72
+ private readonly listeners;
73
+ /**
74
+ * Subscribes a listener to an event type (or all events).
75
+ * @param type The event type, or `"*"` for all events.
76
+ * @param listener The listener to invoke.
77
+ * @returns An unsubscribe function.
78
+ */
79
+ on(type: Selector, listener: EmailEventListener): () => void;
80
+ /**
81
+ * Subscribes a listener that is removed after its first invocation.
82
+ * @param type The event type, or `"*"` for all events.
83
+ * @param listener The listener to invoke once.
84
+ * @returns An unsubscribe function.
85
+ */
86
+ once(type: Selector, listener: EmailEventListener): () => void;
87
+ /**
88
+ * Removes a previously-added listener.
89
+ * @param type The event type the listener was registered under.
90
+ * @param listener The listener to remove.
91
+ */
92
+ off(type: Selector, listener: EmailEventListener): void;
93
+ /**
94
+ * Emits an event to all matching listeners (type-specific first, then wildcard).
95
+ * @param event The event to dispatch.
96
+ */
97
+ emit(event: EmailEvent): void;
98
+ /**
99
+ * Removes all listeners (optionally for a single type).
100
+ * @param type When provided, only listeners for this type are removed.
101
+ */
102
+ clear(type?: Selector): void;
103
+ }
104
+ export { ALL_EVENTS as A, EmailEvent as E, EventStore as a, EmailEventListener as b, EmailEventType as c, EventBus as d };
@@ -0,0 +1 @@
1
+ const o=/\b(src|href)\s*=\s*(["'])cid:([^"']+)\2/gi,d=(t,e)=>t.replaceAll(o,(r,s,c,i)=>{const n=e(i);return n===void 0?r:`${s}=${c}${n}${c}`}),l=t=>{const e=new Set;for(const r of t.matchAll(o))r[3]&&e.add(r[3]);return[...e]};export{l as extractCidReferences,d as rewriteCidLinks};
@@ -0,0 +1,5 @@
1
+ const a=[/^On .*wrote:$/i,/^Am .*schrieb.*:$/i,/^Le .*a écrit ?:$/i,/^El .*escribió:$/i,/^.+\btarihinde\b.+yazdı:$/i],l=[/^-{2,}\s*Original Message\s*-{2,}/i,/^-{2,}\s*Forwarded message\s*-{2,}/i,/^_{5,}$/],c=/^--\s?$/,f=/^(?:from|von):\s/i,u=/^(?:to|an|cc|sent|gesendet|date|datum|subject|betreff|reply-to):\s/i,m=e=>e.startsWith(">")||l.some(r=>r.test(e))?!0:a.some(r=>r.test(e)),g=(e,r)=>{if(!f.test((e[r]??"").trim()))return!1;let i=0;for(let s=r+1;s<e.length&&i<3;s+=1){const t=e[s].trim();if(t!==""&&(i+=1,u.test(t)))return!0}return!1},p=(e,r={})=>{const{stripSignature:i=!0}=r,s=e.replaceAll(`\r
2
+ `,`
3
+ `).split(`
4
+ `),t=[];for(let n=0;n<s.length;n+=1){const o=s[n];if(m(o.trim())||g(s,n)||i&&c.test(o))break;t.push(o)}for(;t.length>0&&t[t.length-1].trim()==="";)t.pop();return t.join(`
5
+ `).trim()};export{p as extractReply};
@@ -0,0 +1 @@
1
+ import u from"./EmailError-B-sEf3bp.js";import b from"./RequiredOptionError-DuNNY_a5.js";import{c as w}from"./create-logger-BQTS3f-I.js";import{e as y}from"./generate-message-id-gXAuMz4g.js";import{defineProvider as $}from"./defineProvider-C9q-7iwt.js";import{d as A}from"./aggregate-features-BqEjPd42.js";const E=i=>typeof i=="function",z=i=>i!==null&&typeof i=="object"&&"sendEmail"in i&&"initialize"in i&&"isAvailable"in i,o="failover",j=$((i={})=>{if(!i.mailers||i.mailers.length===0)throw new b(o,"mailers");const d={debug:i.debug??!1,mailers:i.mailers,retryAfter:i.retryAfter??60};let v=!1;const t=[],n=w(o,i.logger);let g;const m=async()=>g||(g=(async()=>{t.length=0;for(const a of d.mailers)try{let e;if(E(a))e=a({});else if(z(a))e=a;else{n.debug(`Skipping invalid mailer: ${a}`);continue}try{await e.initialize(),t.push(e),n.debug(`Initialized provider: ${e.name??"unknown"}`)}catch(l){n.debug(`Failed to initialize provider ${e.name??"unknown"}:`,l)}}catch(e){n.debug("Error processing mailer:",e)}if(t.length===0)throw new u(o,"No providers could be initialized")})(),g);return{features:A(d.mailers),async initialize(){if(!v)try{await m(),v=!0,n.debug(`Failover provider initialized with ${t.length} provider(s)`)}catch(a){throw new u(o,`Failed to initialize: ${a.message}`,{cause:a})}},async isAvailable(){try{t.length===0&&await m();for(const a of t)try{if(await a.isAvailable())return!0}catch{}return!1}catch{return!1}},name:o,options:d,async sendEmail(a){try{if(t.length===0&&await m(),t.length===0)return{error:new u(o,"No providers available"),success:!1};const e=[];let l;for(let s=0;s<t.length;s+=1){const f=t[s];if(!f)continue;const c=f.name??`provider-${s+1}`;n.debug(`Attempting to send email via ${c} (${s+1}/${t.length})`);try{if(!await f.isAvailable()){n.debug(`Provider ${c} is not available, skipping`),e.push(new u(o,`Provider ${c} is not available`));continue}const r=await f.sendEmail(a);if(r.success&&r.data)return n.debug(`Email sent successfully via ${c}`),{data:{...r.data,messageId:r.data.messageId||y(),provider:`${o}(${c})`},success:!0};if(r.error){l=r.error,e.push(r.error);const p=r.error instanceof Error?r.error.message:String(r.error);n.debug(`Failed to send via ${c}:`,p)}}catch(r){l=r instanceof Error?r:new Error(String(r)),e.push(l);const p=l instanceof Error?l.message:String(l);n.debug(`Exception sending via ${c}:`,p)}s<t.length-1&&d.retryAfter>0&&(n.debug(`Waiting ${d.retryAfter}ms before trying next provider`),await new Promise(r=>{setTimeout(()=>{r()},d.retryAfter)}))}const h=e.map(s=>s instanceof Error?s.message:String(s)).join("; ");return{error:new u(o,`All providers failed. Errors: ${h}`,{cause:l}),success:!1}}catch(e){return{error:new u(o,`Failed to send email: ${e.message}`,{cause:e}),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{j as default};
@@ -0,0 +1 @@
1
+ const n=/[\r\n<>]/,i=e=>{let a=e.replaceAll(/[\r\n\t]+/g," ");a=[...a].filter(s=>{const t=s.codePointAt(0);return t===void 0?!1:t>=32&&t<=126||t>159}).join("");const r="\\",l='"';return a=a.replaceAll(r,r+r).replaceAll(l,r+l),a.trim().replaceAll(/\s+/g," ")},o=e=>{if(n.test(e.email))throw new Error("Invalid email address for header formatting");if(e.name){const a=i(e.name);if(a)return`"${a}" <${e.email}>`}return e.email},m=e=>(Array.isArray(e)?e:[e]).map(a=>o(a)).join(", ");export{o as a,m as f,i as s};
@@ -0,0 +1 @@
1
+ import{createRequire as t}from"node:module";const n=t(import.meta.url),e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=r=>{if(typeof e<"u"&&e.versions&&e.versions.node){const[o,s]=e.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return e.getBuiltinModule(r)}return n(r)},{randomBytes:c}=i("node:crypto"),u=()=>`----_=_NextPart_${c(16).toString("hex")}`;export{u as r};
@@ -0,0 +1 @@
1
+ const a=()=>{const t="visulima.local",n=Date.now(),o=Math.random().toString(36).slice(2,10);return`<${n}.${o}@${t}>`};export{a as e};
@@ -0,0 +1 @@
1
+ const r=e=>{if(!(e instanceof Headers))return e;const n={};return e.forEach((t,o)=>{n[o]=t}),n};export{r as s};
@@ -0,0 +1 @@
1
+ import c from"./EmailError-B-sEf3bp.js";import g from"./RequiredOptionError-DuNNY_a5.js";import{e as w}from"./generate-message-id-gXAuMz4g.js";import{m as u}from"./make-request-BlK_B72c.js";import{f as A}from"./validate-email-options-mCM9dVug.js";import{defineProvider as j}from"./defineProvider-C9q-7iwt.js";const i="http",v="POST",f=3e4,S=j((o={})=>{if(!o.endpoint)throw new g(i,"endpoint");const a={apiKey:o.apiKey??"",endpoint:o.endpoint,headers:o.headers??{},method:o.method??v},d=()=>{const e={"Content-Type":"application/json",...a.headers};return a.apiKey&&(e.Authorization=`Bearer ${a.apiKey}`),e},p=e=>{const t={from:e.from.email,from_name:e.from.name,html:e.html,subject:e.subject,text:e.text,to:Array.isArray(e.to)?e.to.map(s=>s.email):e.to.email};return e.cc&&(t.cc=Array.isArray(e.cc)?e.cc.map(s=>s.email):e.cc.email),e.bcc&&(t.bcc=Array.isArray(e.bcc)?e.bcc.map(s=>s.email):e.bcc.email),e.customParams&&Object.assign(t,e.customParams),t};let m=!1;return{features:{attachments:!1,batchSending:!1,customHeaders:!0,html:!0,replyTo:!1,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){if(!m){if(!await this.isAvailable())throw new c(i,"API endpoint not available");m=!0}},async isAvailable(){try{return!!(await u(a.endpoint,{headers:d(),method:"OPTIONS",timeout:f})).success}catch(e){if(e instanceof Error){const t=e.message;if(t.includes("401")||t.includes("403"))return!1}return!1}},name:i,options:a,async sendEmail(e){try{const t=A(e);if(t.length>0)return{error:new c(i,`Invalid email options: ${t.join(", ")}`),success:!1};m||await this.initialize();const s=d();e.headers&&Object.assign(s,e.headers);const h=p(e),y=e.endpointOverride??a.endpoint,b=e.methodOverride??a.method,n=await u(y,{headers:s,method:b,timeout:f},JSON.stringify(h));if(!n.success)return{error:new c(i,`Failed to send email: ${n.error?.message||"Unknown error"}`,{cause:n.error}),success:!1};let l;const r=n.data?.body;return r&&typeof r=="object"&&(l=r.id??r.messageId??(r.data&&typeof r.data=="object"&&(r.data.id??r.data.messageId))),l??=w(),{data:{messageId:l,provider:i,response:n.data?.body,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:new c(i,`Failed to send email: ${t.message}`,{cause:t}),success:!1}}},async validateCredentials(){try{const e=await u(a.endpoint,{headers:d(),method:"GET",timeout:f});return!!(e.data&&typeof e.data=="object"&&"statusCode"in e.data&&typeof e.data.statusCode=="number"&&e.data.statusCode>=200&&e.data.statusCode<300)}catch{return!1}}}});export{S as default};
@@ -0,0 +1,11 @@
1
+ import{createRequire as Bt}from"node:module";const It=Bt(import.meta.url),de=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pt=t=>{if(typeof de<"u"&&de.versions&&de.versions.node){const[e,o]=de.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return de.getBuiltinModule(t)}return It(t)},{createRequire:O}=Pt("node:module"),Dt=/^[A-Z]:\//i,Gt=(t="")=>t&&t.replaceAll("\\","/").replace(Dt,e=>e.toUpperCase()),Ut=O(import.meta.url),be=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Kt=t=>{if(typeof be<"u"&&be.versions&&be.versions.node){const[e,o]=be.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return be.getBuiltinModule(t)}return Ut(t)},{fileURLToPath:zt}=Kt("node:url");function Ft(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var gt,dt;function jt(){return dt||(dt=1,gt=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),gt}var Xt=jt();const Qt=Ft(Xt);new Set(Qt);const Wt=t=>Gt(t instanceof URL?zt(t):t),qt=t=>{if(!t||!(t instanceof URL)&&typeof t!="string")throw new TypeError("Path must be a non-empty string or URL.")},Zt=O(import.meta.url),he=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Yt=t=>{if(typeof he<"u"&&he.versions&&he.versions.node){const[e,o]=he.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return he.getBuiltinModule(t)}return Zt(t)};Yt("node:fs/promises");const Vt=O(import.meta.url),me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Jt=t=>{if(typeof me<"u"&&me.versions&&me.versions.node){const[e,o]=me.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return me.getBuiltinModule(t)}return Vt(t)};Jt("node:fs");const eo=O(import.meta.url),ye=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,to=t=>{if(typeof ye<"u"&&ye.versions&&ye.versions.node){const[e,o]=ye.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return ye.getBuiltinModule(t)}return eo(t)};to("node:fs/promises");const oo=O(import.meta.url),ve=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ro=t=>{if(typeof ve<"u"&&ve.versions&&ve.versions.node){const[e,o]=ve.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return ve.getBuiltinModule(t)}return oo(t)};ro("node:fs");const so=O(import.meta.url),Re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,no=t=>{if(typeof Re<"u"&&Re.versions&&Re.versions.node){const[e,o]=Re.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Re.getBuiltinModule(t)}return so(t)};no("node:fs/promises");const uo=O(import.meta.url),$e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,io=t=>{if(typeof $e<"u"&&$e.versions&&$e.versions.node){const[e,o]=$e.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return $e.getBuiltinModule(t)}return uo(t)};io("node:fs");const ao=O(import.meta.url),Ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,lo=t=>{if(typeof Ee<"u"&&Ee.versions&&Ee.versions.node){const[e,o]=Ee.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ee.getBuiltinModule(t)}return ao(t)};lo("node:fs/promises");const po=O(import.meta.url),Ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,co=t=>{if(typeof Ae<"u"&&Ae.versions&&Ae.versions.node){const[e,o]=Ae.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ae.getBuiltinModule(t)}return po(t)};co("node:fs");const fo=O(import.meta.url),_e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,go=t=>{if(typeof _e<"u"&&_e.versions&&_e.versions.node){const[e,o]=_e.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return _e.getBuiltinModule(t)}return fo(t)};go("node:fs/promises");const bo=O(import.meta.url),Te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ho=t=>{if(typeof Te<"u"&&Te.versions&&Te.versions.node){const[e,o]=Te.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Te.getBuiltinModule(t)}return bo(t)};ho("node:fs");O(import.meta.url);const mo=O(import.meta.url),xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,yo=t=>{if(typeof xe<"u"&&xe.versions&&xe.versions.node){const[e,o]=xe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return xe.getBuiltinModule(t)}return mo(t)};yo("node:fs/promises");const vo=O(import.meta.url),Ce=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ro=t=>{if(typeof Ce<"u"&&Ce.versions&&Ce.versions.node){const[e,o]=Ce.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ce.getBuiltinModule(t)}return vo(t)};Ro("node:fs");const $o=O(import.meta.url),Se=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Eo=t=>{if(typeof Se<"u"&&Se.versions&&Se.versions.node){const[e,o]=Se.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Se.getBuiltinModule(t)}return $o(t)};Eo("node:fs/promises");const Ao=O(import.meta.url),Oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_o=t=>{if(typeof Oe<"u"&&Oe.versions&&Oe.versions.node){const[e,o]=Oe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Oe.getBuiltinModule(t)}return Ao(t)};_o("node:fs");function pt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var bt={},tt,ht;function Je(){if(ht)return tt;ht=1;const t="[^\\\\/]",e=Symbol("unignore"),o="\\.",N="\\+",b="\\?",s="\\/",a="(?=.)",g="[^/]",l=`(?:${s}|$)`,A=`(?:^|${s})`,d=`${o}{1,2}${l}`,x=`(?!${o})`,S=`(?!${A}${d})`,$=`(?!${o}{0,1}${l})`,M=`(?!${d})`,te=`[^.${s}]`,q=`${g}*?`,j="/",c={DOT_LITERAL:o,PLUS_LITERAL:N,QMARK_LITERAL:b,SLASH_LITERAL:s,ONE_CHAR:a,QMARK:g,END_ANCHOR:l,DOTS_SLASH:d,NO_DOT:x,NO_DOTS:S,NO_DOT_SLASH:$,NO_DOTS_SLASH:M,QMARK_NO_DOT:te,STAR:q,START_ANCHOR:A,SEP:j},h={...c,SLASH_LITERAL:"[\\\\/]",QMARK:t,STAR:`${t}*?`,DOTS_SLASH:`${o}{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!${o})`,NO_DOTS:`(?!(?:^|[\\\\/])${o}{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!${o}{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!${o}{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},r={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return tt={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:r,UNIGNORE:e,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(m){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${m.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(m){return m===!0?h:c}},tt}var mt;function et(){return mt||(mt=1,(function(t){const{REGEX_BACKSLASH:e,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:N,REGEX_SPECIAL_CHARS_GLOBAL:b}=Je();t.isObject=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),t.hasRegexChars=s=>N.test(s),t.isRegexChar=s=>s.length===1&&t.hasRegexChars(s),t.escapeRegex=s=>s.replace(b,"\\$1"),t.toPosixSlashes=s=>s.replace(e,"/"),t.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const s=navigator.platform.toLowerCase();return s==="win32"||s==="windows"}return process.platform?process.platform==="win32":!1},t.removeBackslashes=s=>s.replace(o,a=>a==="\\"?"":a),t.escapeLast=(s,a,g)=>{const l=s.lastIndexOf(a,g);return l===-1?s:s[l-1]==="\\"?t.escapeLast(s,a,l-1):`${s.slice(0,l)}\\${s.slice(l)}`},t.removePrefix=(s,a={})=>{let g=s;return g.startsWith("./")&&(g=g.slice(2),a.prefix="./"),g},t.wrapOutput=(s,a={},g={})=>{const l=g.contains?"":"^",A=g.contains?"":"$";let d=`${l}(?:${s})${A}`;return a.negated===!0&&(d=`(?:^(?!${d}).*$)`),d},t.basename=(s,{windows:a}={})=>{const g=s.split(a?/[\\/]/:"/"),l=g[g.length-1];return l===""?g[g.length-2]:l}})(bt)),bt}var ot,yt;function To(){if(yt)return ot;yt=1;const t=et(),{CHAR_ASTERISK:e,CHAR_AT:o,CHAR_BACKWARD_SLASH:N,CHAR_COMMA:b,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:a,CHAR_FORWARD_SLASH:g,CHAR_LEFT_CURLY_BRACE:l,CHAR_LEFT_PARENTHESES:A,CHAR_LEFT_SQUARE_BRACKET:d,CHAR_PLUS:x,CHAR_QUESTION_MARK:S,CHAR_RIGHT_CURLY_BRACE:$,CHAR_RIGHT_PARENTHESES:M,CHAR_RIGHT_SQUARE_BRACKET:te}=Je(),q=c=>c===g||c===N,j=c=>{c.isPrefix!==!0&&(c.depth=c.isGlobstar?1/0:1)};return ot=(c,h)=>{const r=h||{},m=c.length-1,v=r.parts===!0||r.scanToEnd===!0,R=[],y=[],H=[];let X=c,Z=-1,U=0,oe=0,Q=!1,re=!1,I=!1,ae=!1,fe=!1,se=!1,L=!1,ne=!1,ge=!1,W=!1,F=0,V,E,C={value:"",depth:0,isGlob:!1};const i=()=>Z>=m,Y=()=>X.charCodeAt(Z+1),K=()=>(V=E,X.charCodeAt(++Z));for(;Z<m;){E=K();let w;if(E===N){L=C.backslashes=!0,E=K(),E===l&&(se=!0);continue}if(se===!0||E===l){for(F++;i()!==!0&&(E=K());){if(E===N){L=C.backslashes=!0,K();continue}if(E===l){F++;continue}if(se!==!0&&E===s&&(E=K())===s){if(Q=C.isBrace=!0,I=C.isGlob=!0,W=!0,v===!0)continue;break}if(se!==!0&&E===b){if(Q=C.isBrace=!0,I=C.isGlob=!0,W=!0,v===!0)continue;break}if(E===$&&(F--,F===0)){se=!1,Q=C.isBrace=!0,W=!0;break}}if(v===!0)continue;break}if(E===g){if(R.push(Z),y.push(C),C={value:"",depth:0,isGlob:!1},W===!0)continue;if(V===s&&Z===U+1){U+=2;continue}oe=Z+1;continue}if(r.noext!==!0&&(E===x||E===o||E===e||E===S||E===a)&&Y()===A){if(I=C.isGlob=!0,ae=C.isExtglob=!0,W=!0,E===a&&Z===U&&(ge=!0),v===!0){for(;i()!==!0&&(E=K());){if(E===N){L=C.backslashes=!0,E=K();continue}if(E===M){I=C.isGlob=!0,W=!0;break}}continue}break}if(E===e){if(V===e&&(fe=C.isGlobstar=!0),I=C.isGlob=!0,W=!0,v===!0)continue;break}if(E===S){if(I=C.isGlob=!0,W=!0,v===!0)continue;break}if(E===d){for(;i()!==!0&&(w=K());){if(w===N){L=C.backslashes=!0,K();continue}if(w===te){re=C.isBracket=!0,I=C.isGlob=!0,W=!0;break}}if(v===!0)continue;break}if(r.nonegate!==!0&&E===a&&Z===U){ne=C.negated=!0,U++;continue}if(r.noparen!==!0&&E===A){if(I=C.isGlob=!0,v===!0){for(;i()!==!0&&(E=K());){if(E===A){L=C.backslashes=!0,E=K();continue}if(E===M){W=!0;break}}continue}break}if(I===!0){if(W=!0,v===!0)continue;break}}r.noext===!0&&(ae=!1,I=!1);let G=X,n="",u="";U>0&&(n=X.slice(0,U),X=X.slice(U),oe-=U),G&&I===!0&&oe>0?(G=X.slice(0,oe),u=X.slice(oe)):I===!0?(G="",u=X):G=X,G&&G!==""&&G!=="/"&&G!==X&&q(G.charCodeAt(G.length-1))&&(G=G.slice(0,-1)),r.unescape===!0&&(u&&(u=t.removeBackslashes(u)),G&&L===!0&&(G=t.removeBackslashes(G)));const ee={prefix:n,input:c,start:U,base:G,glob:u,isBrace:Q,isBracket:re,isGlob:I,isExtglob:ae,isGlobstar:fe,negated:ne,negatedExtglob:ge};if(r.tokens===!0&&(ee.maxDepth=0,q(E)||y.push(C),ee.tokens=y),r.parts===!0||r.tokens===!0){let w;for(let P=0;P<R.length;P++){const le=w?w+1:U,J=R[P],pe=c.slice(le,J);r.tokens&&(P===0&&U!==0?(y[P].isPrefix=!0,y[P].value=n):y[P].value=pe,j(y[P]),ee.maxDepth+=y[P].depth),(P!==0||pe!=="")&&H.push(pe),w=J}if(w&&w+1<c.length){const P=c.slice(w+1);H.push(P),r.tokens&&(y[y.length-1].value=P,j(y[y.length-1]),ee.maxDepth+=y[y.length-1].depth)}ee.slashes=R,ee.parts=H}return ee},ot}var rt,vt;function xo(){if(vt)return rt;vt=1;const t=Je(),e=et(),{MAX_LENGTH:o,POSIX_REGEX_SOURCE:N,REGEX_NON_SPECIAL_CHARS:b,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:a}=t,g=(c,h)=>typeof h.expandRange=="function"?h.expandRange(...c,h):(c.sort(),`[${c.join("-")}]`),l=(c,h)=>`Missing ${c}: "${h}" - use "\\\\${h}" to match literal characters`,A=c=>{const h=[];let r=0,m=0,v=0,R="",y=!1;for(const H of c){if(y===!0){R+=H,y=!1;continue}if(H==="\\"){R+=H,y=!0;continue}if(H==='"'){v=v===1?0:1,R+=H;continue}if(v===0){if(H==="[")r++;else if(H==="]"&&r>0)r--;else if(r===0){if(H==="(")m++;else if(H===")"&&m>0)m--;else if(H==="|"&&m===0){h.push(R),R="";continue}}}R+=H}return h.push(R),h},d=c=>{let h=!1;for(const r of c){if(h===!0){h=!1;continue}if(r==="\\"){h=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},x=c=>{let h=c.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(h)&&(h=h.slice(2,-1),r=!0);if(d(h))return h.replace(/\\(.)/g,"$1")},S=c=>{const h=c.map(x).filter(Boolean);for(let r=0;r<h.length;r++)for(let m=r+1;m<h.length;m++){const v=h[r],R=h[m],y=v[0];if(!(!y||v!==y.repeat(v.length)||R!==y.repeat(R.length))&&(v===R||v.startsWith(R)||R.startsWith(v)))return!0}return!1},$=(c,h=!0)=>{if(c[0]!=="+"&&c[0]!=="*"||c[1]!=="(")return;let r=0,m=0,v=0,R=!1;for(let y=1;y<c.length;y++){const H=c[y];if(R===!0){R=!1;continue}if(H==="\\"){R=!0;continue}if(H==='"'){v=v===1?0:1;continue}if(v!==1){if(H==="["){r++;continue}if(H==="]"&&r>0){r--;continue}if(!(r>0)){if(H==="("){m++;continue}if(H===")"&&(m--,m===0))return h===!0&&y!==c.length-1?void 0:{type:c[0],body:c.slice(2,y),end:y}}}}},M=c=>{let h=0;const r=[];for(;h<c.length;){const m=$(c.slice(h),!1);if(!m||m.type!=="*")return;const v=A(m.body).map(y=>y.trim());if(v.length!==1)return;const R=x(v[0]);if(!R||R.length!==1)return;r.push(R),h+=m.end+1}return r.length<1?void 0:`${r.length===1?e.escapeRegex(r[0]):`[${r.map(m=>e.escapeRegex(m)).join("")}]`}*`},te=c=>{let h=0,r=c.trim(),m=$(r);for(;m;)h++,r=m.body.trim(),m=$(r);return h},q=(c,h)=>{if(h.maxExtglobRecursion===!1)return{risky:!1};const r=typeof h.maxExtglobRecursion=="number"?h.maxExtglobRecursion:t.DEFAULT_MAX_EXTGLOB_RECURSION,m=A(c).map(v=>v.trim());if(m.length>1&&(m.some(v=>v==="")||m.some(v=>/^[*?]+$/.test(v))||S(m)))return{risky:!0};for(const v of m){const R=M(v);if(R)return{risky:!0,safeOutput:R};if(te(v)>r)return{risky:!0}}return{risky:!1}},j=(c,h)=>{if(typeof c!="string")throw new TypeError("Expected a string");c=a[c]||c;const r={...h},m=typeof r.maxLength=="number"?Math.min(o,r.maxLength):o;let v=c.length;if(v>m)throw new SyntaxError(`Input length: ${v}, exceeds maximum allowed length: ${m}`);const R={type:"bos",value:"",output:r.prepend||""},y=[R],H=r.capture?"":"?:",X=t.globChars(r.windows),Z=t.extglobChars(X),{DOT_LITERAL:U,PLUS_LITERAL:oe,SLASH_LITERAL:Q,ONE_CHAR:re,DOTS_SLASH:I,NO_DOT:ae,NO_DOT_SLASH:fe,NO_DOTS_SLASH:se,QMARK:L,QMARK_NO_DOT:ne,STAR:ge,START_ANCHOR:W}=X,F=f=>`(${H}(?:(?!${W}${f.dot?I:U}).)*?)`,V=r.dot?"":ae,E=r.dot?L:ne;let C=r.bash===!0?F(r):ge;r.capture&&(C=`(${C})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);const i={input:c,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:y};c=e.removePrefix(c,i),v=c.length;const Y=[],K=[],G=[];let n=R,u;const ee=()=>i.index===v-1,w=i.peek=(f=1)=>c[i.index+f],P=i.advance=()=>c[++i.index]||"",le=()=>c.slice(i.index+1),J=(f="",B=0)=>{i.consumed+=f,i.index+=B},pe=f=>{i.output+=f.output!=null?f.output:f.value,J(f.value)},Lt=()=>{let f=1;for(;w()==="!"&&(w(2)!=="("||w(3)==="?");)P(),i.start++,f++;return f%2===0?!1:(i.negated=!0,i.start++,!0)},Ye=f=>{i[f]++,G.push(f)},ce=f=>{i[f]--,G.pop()},_=f=>{if(n.type==="globstar"){const B=i.braces>0&&(f.type==="comma"||f.type==="brace"),p=f.extglob===!0||Y.length&&(f.type==="pipe"||f.type==="paren");f.type!=="slash"&&f.type!=="paren"&&!B&&!p&&(i.output=i.output.slice(0,-n.output.length),n.type="star",n.value="*",n.output=C,i.output+=n.output)}if(Y.length&&f.type!=="paren"&&(Y[Y.length-1].inner+=f.value),(f.value||f.output)&&pe(f),n&&n.type==="text"&&f.type==="text"){n.output=(n.output||n.value)+f.value,n.value+=f.value;return}f.prev=n,y.push(f),n=f},Ve=(f,B)=>{const p={...Z[B],conditions:1,inner:""};p.prev=n,p.parens=i.parens,p.output=i.output,p.startIndex=i.index,p.tokensIndex=y.length;const T=(r.capture?"(":"")+p.open;Ye("parens"),_({type:f,value:B,output:i.output?"":re}),_({type:"paren",extglob:!0,value:P(),output:T}),Y.push(p)},Mt=f=>{const B=c.slice(f.startIndex,i.index+1),p=c.slice(f.startIndex+2,i.index),T=q(p,r);if((f.type==="plus"||f.type==="star")&&T.risky){const k=T.safeOutput?(f.output?"":re)+(r.capture?`(${T.safeOutput})`:T.safeOutput):void 0,ue=y[f.tokensIndex];ue.type="text",ue.value=B,ue.output=k||e.escapeRegex(B);for(let ie=f.tokensIndex+1;ie<y.length;ie++)y[ie].value="",y[ie].output="",delete y[ie].suffix;i.output=f.output+ue.output,i.backtrack=!0,_({type:"paren",extglob:!0,value:u,output:""}),ce("parens");return}let D=f.close+(r.capture?")":""),z;if(f.type==="negate"){let k=C;if(f.inner&&f.inner.length>1&&f.inner.includes("/")&&(k=F(r)),(k!==C||ee()||/^\)+$/.test(le()))&&(D=f.close=`)$))${k}`),f.inner.includes("*")&&(z=le())&&/^\.[^\\/.]+$/.test(z)){const ue=j(z,{...h,fastpaths:!1}).output;D=f.close=`)${ue})${k})`}f.prev.type==="bos"&&(i.negatedExtglob=!0)}_({type:"paren",extglob:!0,value:u,output:D}),ce("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(c)){let f=!1,B=c.replace(s,(p,T,D,z,k,ue)=>z==="\\"?(f=!0,p):z==="?"?T?T+z+(k?L.repeat(k.length):""):ue===0?E+(k?L.repeat(k.length):""):L.repeat(D.length):z==="."?U.repeat(D.length):z==="*"?T?T+z+(k?C:""):C:T?p:`\\${p}`);return f===!0&&(r.unescape===!0?B=B.replace(/\\/g,""):B=B.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),B===c&&r.contains===!0?(i.output=c,i):(i.output=e.wrapOutput(B,i,h),i)}for(;!ee();){if(u=P(),u==="\0")continue;if(u==="\\"){const p=w();if(p==="/"&&r.bash!==!0||p==="."||p===";")continue;if(!p){u+="\\",_({type:"text",value:u});continue}const T=/^\\+/.exec(le());let D=0;if(T&&T[0].length>2&&(D=T[0].length,i.index+=D,D%2!==0&&(u+="\\")),r.unescape===!0?u=P():u+=P(),i.brackets===0){_({type:"text",value:u});continue}}if(i.brackets>0&&(u!=="]"||n.value==="["||n.value==="[^")){if(r.posix!==!1&&u===":"){const p=n.value.slice(1);if(p.includes("[")&&(n.posix=!0,p.includes(":"))){const T=n.value.lastIndexOf("["),D=n.value.slice(0,T),z=n.value.slice(T+2),k=N[z];if(k){n.value=D+k,i.backtrack=!0,P(),!R.output&&y.indexOf(n)===1&&(R.output=re);continue}}}(u==="["&&w()!==":"||u==="-"&&w()==="]")&&(u=`\\${u}`),u==="]"&&(n.value==="["||n.value==="[^")&&(u=`\\${u}`),r.posix===!0&&u==="!"&&n.value==="["&&(u="^"),n.value+=u,pe({value:u});continue}if(i.quotes===1&&u!=='"'){u=e.escapeRegex(u),n.value+=u,pe({value:u});continue}if(u==='"'){i.quotes=i.quotes===1?0:1,r.keepQuotes===!0&&_({type:"text",value:u});continue}if(u==="("){Ye("parens"),_({type:"paren",value:u});continue}if(u===")"){if(i.parens===0&&r.strictBrackets===!0)throw new SyntaxError(l("opening","("));const p=Y[Y.length-1];if(p&&i.parens===p.parens+1){Mt(Y.pop());continue}_({type:"paren",value:u,output:i.parens?")":"\\)"}),ce("parens");continue}if(u==="["){if(r.nobracket===!0||!le().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(l("closing","]"));u=`\\${u}`}else Ye("brackets");_({type:"bracket",value:u});continue}if(u==="]"){if(r.nobracket===!0||n&&n.type==="bracket"&&n.value.length===1){_({type:"text",value:u,output:`\\${u}`});continue}if(i.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(l("opening","["));_({type:"text",value:u,output:`\\${u}`});continue}ce("brackets");const p=n.value.slice(1);if(n.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(u=`/${u}`),n.value+=u,pe({value:u}),r.literalBrackets===!1||e.hasRegexChars(p))continue;const T=e.escapeRegex(n.value);if(i.output=i.output.slice(0,-n.value.length),r.literalBrackets===!0){i.output+=T,n.value=T;continue}n.value=`(${H}${T}|${n.value})`,i.output+=n.value;continue}if(u==="{"&&r.nobrace!==!0){Ye("braces");const p={type:"brace",value:u,output:"(",outputIndex:i.output.length,tokensIndex:i.tokens.length};K.push(p),_(p);continue}if(u==="}"){const p=K[K.length-1];if(r.nobrace===!0||!p){_({type:"text",value:u,output:u});continue}let T=")";if(p.dots===!0){const D=y.slice(),z=[];for(let k=D.length-1;k>=0&&(y.pop(),D[k].type!=="brace");k--)D[k].type!=="dots"&&z.unshift(D[k].value);T=g(z,r),i.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){const D=i.output.slice(0,p.outputIndex),z=i.tokens.slice(p.tokensIndex);p.value=p.output="\\{",u=T="\\}",i.output=D;for(const k of z)i.output+=k.output||k.value}_({type:"brace",value:u,output:T}),ce("braces"),K.pop();continue}if(u==="|"){Y.length>0&&Y[Y.length-1].conditions++,_({type:"text",value:u});continue}if(u===","){let p=u;const T=K[K.length-1];T&&G[G.length-1]==="braces"&&(T.comma=!0,p="|"),_({type:"comma",value:u,output:p});continue}if(u==="/"){if(n.type==="dot"&&i.index===i.start+1){i.start=i.index+1,i.consumed="",i.output="",y.pop(),n=R;continue}_({type:"slash",value:u,output:Q});continue}if(u==="."){if(i.braces>0&&n.type==="dot"){n.value==="."&&(n.output=U);const p=K[K.length-1];n.type="dots",n.output+=u,n.value+=u,p.dots=!0;continue}if(i.braces+i.parens===0&&n.type!=="bos"&&n.type!=="slash"){_({type:"text",value:u,output:U});continue}_({type:"dot",value:u,output:U});continue}if(u==="?"){if(!(n&&n.value==="(")&&r.noextglob!==!0&&w()==="("&&w(2)!=="?"){Ve("qmark",u);continue}if(n&&n.type==="paren"){const p=w();let T=u;(n.value==="("&&!/[!=<:]/.test(p)||p==="<"&&!/<([!=]|\w+>)/.test(le()))&&(T=`\\${u}`),_({type:"text",value:u,output:T});continue}if(r.dot!==!0&&(n.type==="slash"||n.type==="bos")){_({type:"qmark",value:u,output:ne});continue}_({type:"qmark",value:u,output:L});continue}if(u==="!"){if(r.noextglob!==!0&&w()==="("&&(w(2)!=="?"||!/[!=<:]/.test(w(3)))){Ve("negate",u);continue}if(r.nonegate!==!0&&i.index===0){Lt();continue}}if(u==="+"){if(r.noextglob!==!0&&w()==="("&&w(2)!=="?"){Ve("plus",u);continue}if(n&&n.value==="("||r.regex===!1){_({type:"plus",value:u,output:oe});continue}if(n&&(n.type==="bracket"||n.type==="paren"||n.type==="brace")||i.parens>0){_({type:"plus",value:u});continue}_({type:"plus",value:oe});continue}if(u==="@"){if(r.noextglob!==!0&&w()==="("&&w(2)!=="?"){_({type:"at",extglob:!0,value:u,output:""});continue}_({type:"text",value:u});continue}if(u!=="*"){(u==="$"||u==="^")&&(u=`\\${u}`);const p=b.exec(le());p&&(u+=p[0],i.index+=p[0].length),_({type:"text",value:u});continue}if(n&&(n.type==="globstar"||n.star===!0)){n.type="star",n.star=!0,n.value+=u,n.output=C,i.backtrack=!0,i.globstar=!0,J(u);continue}let f=le();if(r.noextglob!==!0&&/^\([^?]/.test(f)){Ve("star",u);continue}if(n.type==="star"){if(r.noglobstar===!0){J(u);continue}const p=n.prev,T=p.prev,D=p.type==="slash"||p.type==="bos",z=T&&(T.type==="star"||T.type==="globstar");if(r.bash===!0&&(!D||f[0]&&f[0]!=="/")){_({type:"star",value:u,output:""});continue}const k=i.braces>0&&(p.type==="comma"||p.type==="brace"),ue=Y.length&&(p.type==="pipe"||p.type==="paren");if(!D&&p.type!=="paren"&&!k&&!ue){_({type:"star",value:u,output:""});continue}for(;f.slice(0,3)==="/**";){const ie=c[i.index+4];if(ie&&ie!=="/")break;f=f.slice(3),J("/**",3)}if(p.type==="bos"&&ee()){n.type="globstar",n.value+=u,n.output=F(r),i.output=n.output,i.globstar=!0,J(u);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!z&&ee()){i.output=i.output.slice(0,-(p.output+n.output).length),p.output=`(?:${p.output}`,n.type="globstar",n.output=F(r)+(r.strictSlashes?")":"|$)"),n.value+=u,i.globstar=!0,i.output+=p.output+n.output,J(u);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&f[0]==="/"){const ie=f[1]!==void 0?"|$":"";i.output=i.output.slice(0,-(p.output+n.output).length),p.output=`(?:${p.output}`,n.type="globstar",n.output=`${F(r)}${Q}|${Q}${ie})`,n.value+=u,i.output+=p.output+n.output,i.globstar=!0,J(u+P()),_({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&f[0]==="/"){n.type="globstar",n.value+=u,n.output=`(?:^|${Q}|${F(r)}${Q})`,i.output=n.output,i.globstar=!0,J(u+P()),_({type:"slash",value:"/",output:""});continue}if(k&&f[0]==="/"){n.type="globstar",n.value+=u,n.output=`(?:^|${Q}|${F(r)}${Q})`,i.output+=n.output,i.globstar=!0,J(u+P()),_({type:"slash",value:"/",output:""});continue}i.output=i.output.slice(0,-n.output.length),n.type="globstar",n.output=F(r),n.value+=u,i.output+=n.output,i.globstar=!0,J(u);continue}const B={type:"star",value:u,output:C};if(r.bash===!0){B.output=".*?",(n.type==="bos"||n.type==="slash")&&(B.output=V+B.output),_(B);continue}if(n&&(n.type==="bracket"||n.type==="paren")&&r.regex===!0){B.output=u,_(B);continue}(i.index===i.start||n.type==="slash"||n.type==="dot")&&(n.type==="dot"?(i.output+=fe,n.output+=fe):r.dot===!0?(i.output+=se,n.output+=se):(i.output+=V,n.output+=V),w()!=="*"&&(i.output+=re,n.output+=re)),_(B)}for(;i.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(l("closing","]"));i.output=e.escapeLast(i.output,"["),ce("brackets")}for(;i.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(l("closing",")"));i.output=e.escapeLast(i.output,"("),ce("parens")}for(;i.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(l("closing","}"));i.output=e.escapeLast(i.output,"{"),ce("braces")}if(r.strictSlashes!==!0&&(n.type==="star"||n.type==="bracket")&&_({type:"maybe_slash",value:"",output:`${Q}?`}),i.backtrack===!0){i.output="";for(const f of i.tokens)i.output+=f.output!=null?f.output:f.value,f.suffix&&(i.output+=f.suffix)}return i};return j.fastpaths=(c,h)=>{const r={...h},m=typeof r.maxLength=="number"?Math.min(o,r.maxLength):o,v=c.length;if(v>m)throw new SyntaxError(`Input length: ${v}, exceeds maximum allowed length: ${m}`);c=a[c]||c;const{DOT_LITERAL:R,SLASH_LITERAL:y,ONE_CHAR:H,DOTS_SLASH:X,NO_DOT:Z,NO_DOTS:U,NO_DOTS_SLASH:oe,STAR:Q,START_ANCHOR:re}=t.globChars(r.windows),I=r.dot?U:Z,ae=r.dot?oe:Z,fe=r.capture?"":"?:",se={negated:!1,prefix:""};let L=r.bash===!0?".*?":Q;r.capture&&(L=`(${L})`);const ne=V=>V.noglobstar===!0?L:`(${fe}(?:(?!${re}${V.dot?X:R}).)*?)`,ge=V=>{switch(V){case"*":return`${I}${H}${L}`;case".*":return`${R}${H}${L}`;case"*.*":return`${I}${L}${R}${H}${L}`;case"*/*":return`${I}${L}${y}${H}${ae}${L}`;case"**":return I+ne(r);case"**/*":return`(?:${I}${ne(r)}${y})?${ae}${H}${L}`;case"**/*.*":return`(?:${I}${ne(r)}${y})?${ae}${L}${R}${H}${L}`;case"**/.*":return`(?:${I}${ne(r)}${y})?${R}${H}${L}`;default:{const E=/^(.*?)\.(\w+)$/.exec(V);if(!E)return;const C=ge(E[1]);return C?C+R+E[2]:void 0}}},W=e.removePrefix(c,se);let F=ge(W);return F&&r.strictSlashes!==!0&&(F+=`${y}?`),F},rt=j,rt}var st,Rt;function Co(){if(Rt)return st;Rt=1;const t=To(),e=xo(),o=et(),N=Je(),b=a=>a&&typeof a=="object"&&!Array.isArray(a),s=(a,g,l=!1)=>{if(Array.isArray(a)){const q=a.map(j=>s(j,g,l));return j=>{for(const c of q){const h=c(j);if(h)return h}return!1}}const A=b(a)&&a.tokens&&a.input;if(a===""||typeof a!="string"&&!A)throw new TypeError("Expected pattern to be a non-empty string");const d=g||{},x=d.windows,S=A?s.compileRe(a,g):s.makeRe(a,g,!1,!0),$=S.state;delete S.state;let M=()=>!1;if(d.ignore){const q={...g,ignore:null,onMatch:null,onResult:null};M=s(d.ignore,q,l)}const te=(q,j=!1)=>{const{isMatch:c,match:h,output:r}=s.test(q,S,g,{glob:a,posix:x}),m={glob:a,state:$,regex:S,posix:x,input:q,output:r,match:h,isMatch:c};if(typeof d.onResult=="function"&&d.onResult(m),c===!1)return m.isMatch=!1,j?m:!1;e:if(M(q)){if(typeof d.onIgnore=="function"&&d.onIgnore(m)===N.UNIGNORE){m.isMatch=!0;break e}return m.isMatch=!1,j?m:!1}return typeof d.onMatch=="function"&&d.onMatch(m),j?m:!0};return l&&(te.state=$),te};return s.test=(a,g,l,{glob:A,posix:d}={})=>{if(typeof a!="string")throw new TypeError("Expected input to be a string");if(a==="")return{isMatch:!1,output:""};const x=l||{},S=x.format||(d?o.toPosixSlashes:null);let $=a===A,M=$&&S?S(a):a;return $===!1&&(M=S?S(a):a,$=M===A),($===!1||x.capture===!0)&&(x.matchBase===!0||x.basename===!0?$=s.matchBase(a,g,l,d):$=g.exec(M)),{isMatch:!!$,match:$,output:M}},s.matchBase=(a,g,l)=>(g instanceof RegExp?g:s.makeRe(g,l)).test(o.basename(a)),s.isMatch=(a,g,l)=>s(g,l)(a),s.parse=(a,g)=>Array.isArray(a)?a.map(l=>s.parse(l,g)):e(a,{...g,fastpaths:!1}),s.scan=(a,g)=>t(a,g),s.compileRe=(a,g,l=!1,A=!1)=>{if(l===!0)return a.output;const d=g||{},x=d.contains?"":"^",S=d.contains?"":"$";let $=`${x}(?:${a.output})${S}`;a&&a.negated===!0&&($=`^(?!${$}).*$`);const M=s.toRegex($,g);return A===!0&&(M.state=a),M},s.makeRe=(a,g={},l=!1,A=!1)=>{if(!a||typeof a!="string")throw new TypeError("Expected a non-empty string");let d={negated:!1,fastpaths:!0};return g.fastpaths!==!1&&(a[0]==="."||a[0]==="*")&&(d.output=e.fastpaths(a,g)),d.output||(d=e(a,g)),s.compileRe(d,g,l,A)},s.toRegex=(a,g)=>{try{const l=g||{};return new RegExp(a,l.flags||(l.nocase?"i":""))}catch(l){if(g&&g.debug===!0)throw l;return/$^/}},s.constants=N,st=s,st}var nt,$t;function So(){if($t)return nt;$t=1;const t=Co(),e=et();function o(N,b,s=!1){return b&&(b.windows===null||b.windows===void 0)&&(b={...b,windows:e.isWindows()}),t(N,b,s)}return Object.assign(o,t),nt=o,nt}var Oo=So();pt(Oo);const Ho=O(import.meta.url),He=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ze=t=>{if(typeof He<"u"&&He.versions&&He.versions.node){const[e,o]=He.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return He.getBuiltinModule(t)}return Ho(t)};Ze("fs");Ze("fs");Ze("path");Ze("url");const{createRequire:wo}=Ze("module");var Et=wo(import.meta.url);try{Et.resolve("picomatch"),Et("picomatch")}catch{}var ut,At;function No(){if(At)return ut;At=1;/*!
2
+ * is-extglob <https://github.com/jonschlinkert/is-extglob>
3
+ *
4
+ * Copyright (c) 2014-2016, Jon Schlinkert.
5
+ * Licensed under the MIT License.
6
+ */return ut=function(t){if(typeof t!="string"||t==="")return!1;for(var e;e=/(\\).|([@?!+*]\(.*\))/g.exec(t);){if(e[2])return!0;t=t.slice(e.index+e[0].length)}return!1},ut}var it,_t;function Ct(){if(_t)return it;_t=1;/*!
7
+ * is-glob <https://github.com/jonschlinkert/is-glob>
8
+ *
9
+ * Copyright (c) 2014-2017, Jon Schlinkert.
10
+ * Released under the MIT License.
11
+ */var t=No(),e={"{":"}","(":")","[":"]"},o=function(b){if(b[0]==="!")return!0;for(var s=0,a=-2,g=-2,l=-2,A=-2,d=-2;s<b.length;){if(b[s]==="*"||b[s+1]==="?"&&/[\].+)]/.test(b[s])||g!==-1&&b[s]==="["&&b[s+1]!=="]"&&(g<s&&(g=b.indexOf("]",s)),g>s&&(d===-1||d>g||(d=b.indexOf("\\",s),d===-1||d>g)))||l!==-1&&b[s]==="{"&&b[s+1]!=="}"&&(l=b.indexOf("}",s),l>s&&(d=b.indexOf("\\",s),d===-1||d>l))||A!==-1&&b[s]==="("&&b[s+1]==="?"&&/[:!=]/.test(b[s+2])&&b[s+3]!==")"&&(A=b.indexOf(")",s),A>s&&(d=b.indexOf("\\",s),d===-1||d>A))||a!==-1&&b[s]==="("&&b[s+1]!=="|"&&(a<s&&(a=b.indexOf("|",s)),a!==-1&&b[a+1]!==")"&&(A=b.indexOf(")",a),A>a&&(d=b.indexOf("\\",a),d===-1||d>A))))return!0;if(b[s]==="\\"){var x=b[s+1];s+=2;var S=e[x];if(S){var $=b.indexOf(S,s);$!==-1&&(s=$+1)}if(b[s]==="!")return!0}else s++}return!1},N=function(b){if(b[0]==="!")return!0;for(var s=0;s<b.length;){if(/[*?{}()[\]]/.test(b[s]))return!0;if(b[s]==="\\"){var a=b[s+1];s+=2;var g=e[a];if(g){var l=b.indexOf(g,s);l!==-1&&(s=l+1)}if(b[s]==="!")return!0}else s++}return!1};return it=function(b,s){if(typeof b!="string"||b==="")return!1;if(t(b))return!0;var a=o;return s&&s.strict===!1&&(a=N),a(b)},it}const ko=O(import.meta.url),we=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,St=t=>{if(typeof we<"u"&&we.versions&&we.versions.node){const[e,o]=we.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return we.getBuiltinModule(t)}return ko(t)},Lo=St("path"),Mo=St("os");var at,Tt;function Bo(){if(Tt)return at;Tt=1;var t=Ct(),e=Lo.posix.dirname,o=Mo.platform()==="win32",N="/",b=/\\/g,s=/\\([!*?|[\](){}])/g;at=function(l,A){var d=Object.assign({flipBackslashes:!0},A);d.flipBackslashes&&o&&l.indexOf(N)<0&&(l=l.replace(b,N)),a(l)&&(l+=N),l+="a";do l=e(l);while(g(l));return l.replace(s,"$1")};function a(l){var A=l.slice(-1),d;switch(A){case"}":d="{";break;case"]":d="[";break;default:return!1}var x=l.indexOf(d);return x<0?!1:l.slice(x+1,-1).includes(N)}function g(l){return/\([^()]+$/.test(l)||l[0]==="{"||l[0]==="["||/[^\\][{[]/.test(l)?!0:t(l)}return at}var Io=Bo();pt(Io);const Po=O(import.meta.url),Ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Do=t=>{if(typeof Ne<"u"&&Ne.versions&&Ne.versions.node){const[e,o]=Ne.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ne.getBuiltinModule(t)}return Po(t)};Do("node:fs/promises");const Go=O(import.meta.url),ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Uo=t=>{if(typeof ke<"u"&&ke.versions&&ke.versions.node){const[e,o]=ke.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return ke.getBuiltinModule(t)}return Go(t)};Uo("node:fs");var Ko=Ct();pt(Ko);const zo=O(import.meta.url),Le=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ot=t=>{if(typeof Le<"u"&&Le.versions&&Le.versions.node){const[e,o]=Le.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Le.getBuiltinModule(t)}return zo(t)};Ot("node:fs/promises");Ot("node:fs");let Fo=class extends Error{constructor(e){super(`ENOENT: ${e}`)}get code(){return"ENOENT"}set code(e){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(e){throw new Error("Cannot overwrite name of NotFoundError")}},jo=class extends Error{constructor(e){super(`EPERM: Operation not permitted, ${e}`)}get code(){return"EPERM"}set code(e){throw new Error("Cannot overwrite code EPERM")}get name(){return"PermissionError"}set name(e){throw new Error("Cannot overwrite name of PermissionError")}};const Xo=(t,e)=>{const o=t?.code;return o==="ENOENT"?new Fo(`no such file or directory, open '${e}'`):o==="EACCES"||o==="EPERM"?new jo(`unable to read the non-readable file: ${e}`):t},Qo=O(import.meta.url),Me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ht=t=>{if(typeof Me<"u"&&Me.versions&&Me.versions.node){const[e,o]=Me.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Me.getBuiltinModule(t)}return Qo(t)},{readFile:Wo}=Ht("node:fs/promises"),{unzip:qo,brotliDecompress:Zo}=Ht("node:zlib"),Yo={brotli:Zo,gzip:qo,none:(t,e)=>{e(null,t)}},Hr=async(t,e)=>{qt(t),t=Wt(t);const{buffer:o,compression:N,encoding:b,flag:s}=e??{};let a;try{a=await Wo(t,s?{flag:s}:{})}catch(g){throw Xo(g,t)}return await new Promise((g,l)=>{Yo[N??"none"](a,(A,d)=>{A?l(A):g(o?d:d.toString(b??"utf8"))})})},Vo=O(import.meta.url),Be=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,wt=t=>{if(typeof Be<"u"&&Be.versions&&Be.versions.node){const[e,o]=Be.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Be.getBuiltinModule(t)}return Vo(t)};wt("node:fs");wt("node:zlib");const Jo=O(import.meta.url),Ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,er=t=>{if(typeof Ie<"u"&&Ie.versions&&Ie.versions.node){const[e,o]=Ie.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ie.getBuiltinModule(t)}return Jo(t)},{createRequire:Nt}=er("node:module"),tr=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&tr.set("AggregateError",AggregateError);const or=Nt(import.meta.url),Pe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,rr=t=>{if(typeof Pe<"u"&&Pe.versions&&Pe.versions.node){const[e,o]=Pe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Pe.getBuiltinModule(t)}return or(t)};rr("node:util");const sr=Nt(import.meta.url),De=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ct=t=>{if(typeof De<"u"&&De.versions&&De.versions.node){const[e,o]=De.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return De.getBuiltinModule(t)}return sr(t)};ct("node:fs");ct("node:path");ct("node:url");const nr=O(import.meta.url),Ge=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kt=t=>{if(typeof Ge<"u"&&Ge.versions&&Ge.versions.node){const[e,o]=Ge.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ge.getBuiltinModule(t)}return nr(t)};kt("node:fs");kt("node:fs/promises");const ur=O(import.meta.url),Ue=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ir=t=>{if(typeof Ue<"u"&&Ue.versions&&Ue.versions.node){const[e,o]=Ue.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ue.getBuiltinModule(t)}return ur(t)};ir("node:fs");const ar=O(import.meta.url),Ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,lr=t=>{if(typeof Ke<"u"&&Ke.versions&&Ke.versions.node){const[e,o]=Ke.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ke.getBuiltinModule(t)}return ar(t)};lr("node:fs/promises");const pr=O(import.meta.url),ze=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,cr=t=>{if(typeof ze<"u"&&ze.versions&&ze.versions.node){const[e,o]=ze.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return ze.getBuiltinModule(t)}return pr(t)};cr("node:fs");O(import.meta.url);const fr=O(import.meta.url),Fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,gr=t=>{if(typeof Fe<"u"&&Fe.versions&&Fe.versions.node){const[e,o]=Fe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Fe.getBuiltinModule(t)}return fr(t)};gr("node:crypto");new TextEncoder;const dr=O(import.meta.url),je=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,br=t=>{if(typeof je<"u"&&je.versions&&je.versions.node){const[e,o]=je.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return je.getBuiltinModule(t)}return dr(t)};br("node:fs/promises");const hr=O(import.meta.url),Xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,mr=t=>{if(typeof Xe<"u"&&Xe.versions&&Xe.versions.node){const[e,o]=Xe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Xe.getBuiltinModule(t)}return hr(t)};mr("node:fs");const yr=O(import.meta.url),Qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,vr=t=>{if(typeof Qe<"u"&&Qe.versions&&Qe.versions.node){const[e,o]=Qe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Qe.getBuiltinModule(t)}return yr(t)};vr("node:fs/promises");const Rr=O(import.meta.url),We=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$r=t=>{if(typeof We<"u"&&We.versions&&We.versions.node){const[e,o]=We.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return We.getBuiltinModule(t)}return Rr(t)};$r("node:fs");const Er=O(import.meta.url),qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=t=>{if(typeof qe<"u"&&qe.versions&&qe.versions.node){const[e,o]=qe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return qe.getBuiltinModule(t)}return Er(t)},Ar=ft("fs"),_r=ft("os"),Tr=ft("path");var lt={},xt;function xr(){if(xt)return lt;xt=1;var t=Object.defineProperty,e=(d,x)=>t(d,"name",{value:x,configurable:!0}),o=Ar,N=_r,b=Tr;const s=e(d=>{let x="";for(let S=0;S<d.length;S+=1){const $=d[S],M=$.toUpperCase();x+=$===M?$.toLowerCase():M}return x},"invertCase"),a=new Map,g=e((d,x)=>{const S=b.join(d,`.is-fs-case-sensitive-test-${process.pid}`);try{return x.writeFileSync(S,""),!x.existsSync(s(S))}finally{try{x.unlinkSync(S)}catch{}}},"checkDirectoryCaseWithWrite"),l=e((d,x,S)=>{try{return g(d,S)}catch($){if(x===void 0)return g(N.tmpdir(),S);throw $}},"checkDirectoryCaseWithFallback"),A=e((d,x=o,S=!0)=>{const $=d??process.cwd();if(S&&a.has($))return a.get($);let M;const te=s($);return te!==$&&x.existsSync($)?M=!x.existsSync(te):M=l($,d,x),S&&a.set($,M),M},"isFsCaseSensitive");return lt.isFsCaseSensitive=A,lt}xr();export{Hr as z};
@@ -0,0 +1 @@
1
+ import c from"./EmailError-B-sEf3bp.js";import v from"./RequiredOptionError-DuNNY_a5.js";import{e as w}from"./generate-message-id-gXAuMz4g.js";import{s as A}from"./headers-to-record-De1Eg951.js";import{m as d}from"./make-request-BlK_B72c.js";import{u as g}from"./retry-3pnxTuNs.js";import{f as I}from"./validate-email-options-mCM9dVug.js";import{defineProvider as P}from"./defineProvider-C9q-7iwt.js";import{P as T,h as y,c as U}from"./provider-base-C7PuopYK.js";import{d as u}from"./address-formatter-BWR2Dddx.js";import{p as z}from"./attachment-processor-CMp7qqMI.js";const r="infobip",E="https://api.infobip.com",k=3e4,j=3,H=P((s={})=>{if(!s.apiKey)throw new v(r,"apiKey");const p=s.baseUrl??E,h=s.endpoint??`${p}/email/3/send`,a={apiKey:s.apiKey,baseUrl:p,debug:s.debug??!1,endpoint:h,retries:s.retries??j,timeout:s.timeout??k,...s.logger&&{logger:s.logger}},m=new T,i=U(r,s.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!0,tagging:!1,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new c(r,"Email ID is required to retrieve email details"),success:!1};await m.ensureInitialized(()=>this.initialize(),r);const n={Authorization:`App ${a.apiKey}`,"Content-Type":"application/json"};i.debug("Retrieving email details",{id:e});const t=await g(async()=>d(`${a.baseUrl}/email/3/reports/${e}`,{headers:n,method:"GET",timeout:a.timeout}),a.retries);return t.success?(i.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(i.debug("API request failed when retrieving email",t.error),{error:new c(r,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(n){return{error:y(r,"retrieve email",n,i),success:!1}}},async initialize(){await m.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(r,"Infobip API not available or invalid API key");i.debug("Provider initialized successfully")},r)},async isAvailable(){try{i.debug("Checking Infobip API availability");const e={Authorization:`App ${a.apiKey}`,"Content-Type":"application/json"};return(await d(`${a.baseUrl}/account/1/me`,{headers:e,method:"GET",timeout:a.timeout})).success}catch(e){return i.debug("Error checking availability:",e),!1}},name:r,options:a,async sendEmail(e){try{const n=I(e);if(n.length>0)return{error:new c(r,`Invalid email options: ${n.join(", ")}`),success:!1};await m.ensureInitialized(()=>this.initialize(),r);const t={from:typeof e.from=="string"?e.from:e.from.email,subject:e.subject,to:u(e.to)};if(e.html&&(t.html=e.html),e.text&&(t.text=e.text),e.cc&&(t.cc=u(e.cc)),e.bcc&&(t.bcc=u(e.bcc)),e.replyTo&&(t.replyTo=typeof e.replyTo=="string"?e.replyTo:e.replyTo.email),e.templateId&&(t.templateId=e.templateId,e.templateVariables&&(t.templateData=e.templateVariables)),e.trackingUrl&&(t.trackingUrl=e.trackingUrl),e.notifyUrl&&(t.notifyUrl=e.notifyUrl),e.intermediateReport!==void 0&&(t.intermediateReport=e.intermediateReport),e.sendAt&&(t.sendAt=e.sendAt),e.headers){const l=A(e.headers);t.headers=l}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async l=>({content:await z(l,r),contentType:l.contentType??"application/octet-stream",name:l.filename})))),i.debug("Sending email via Infobip API",{subject:t.subject,to:t.to});const b={Authorization:`App ${a.apiKey}`,"Content-Type":"application/json"},o=await g(async()=>d(a.endpoint,{headers:b,method:"POST",timeout:a.timeout},JSON.stringify(t)),a.retries);if(!o.success)return i.debug("API request failed when sending email",o.error),{error:o.error??new c(r,"Failed to send email"),success:!1};const f=o.data?.body?.messages?.[0]?.messageId??w();return i.debug("Email sent successfully",{messageId:f}),{data:{messageId:f,provider:r,response:o.data,sent:!0,timestamp:new Date},success:!0}}catch(n){return{error:y(r,"send email",n,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{H as default};
@@ -0,0 +1 @@
1
+ const i=/<body[^<>]*>/i,o=e=>e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;"),s=(e,c,a={})=>{const n=a.spacer===!1?"":"‌ ".repeat(120),t=`<div style="display:none;max-height:0;overflow:hidden;mso-hide:all;">${o(c)}${n}</div>`,l=i.exec(e);if(l){const r=l.index+l[0].length;return`${e.slice(0,r)}${t}${e.slice(r)}`}return`${t}${e}`};export{s as injectPreheader};
@@ -0,0 +1 @@
1
+ import{createRequire as i}from"node:module";import r from"./EmailError-B-sEf3bp.js";const a=i(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=o=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[s,t]=n.versions.node.split(".").map(Number);if(s>22||s===22&&t>=3||s===20&&t>=16)return n.getBuiltinModule(o)}return a(o)},{createRequire:u}=c("node:module"),d=u(import.meta.url),p=(o,s)=>{let t;try{const e=d("juice");t=e.default??e}catch(e){throw e instanceof Error&&(e.code==="MODULE_NOT_FOUND"||e.message.includes("Cannot find module")||e.message.includes("Cannot find package"))?new r("render","juice is not installed. Please install it: pnpm add juice",{cause:e}):new r("render",`Failed to load juice: ${e.message}`,{cause:e})}try{return t(o,s)}catch(e){throw new r("render",`Failed to inline CSS: ${e.message}`,{cause:e})}};export{p as default};
@@ -0,0 +1,3 @@
1
+ import{createRequire as g}from"node:module";import o from"./EmailError-B-sEf3bp.js";const p=g(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[t,s]=n.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return n.getBuiltinModule(e)}return p(e)},{Buffer:m}=u("node:buffer"),{X509Certificate:d,createVerify:S}=u("node:crypto"),y={Notification:["Message","MessageId","Subject","Timestamp","TopicArn","Type"],SubscriptionConfirmation:["Message","MessageId","SubscribeURL","Timestamp","Token","TopicArn","Type"],UnsubscribeConfirmation:["Message","MessageId","SubscribeURL","Timestamp","Token","TopicArn","Type"]},b=/^sns\.[a-z0-9-]+\.amazonaws\.com(?:\.cn)?$/,w=/\.$/,h=e=>{let t;try{t=new URL(e)}catch{return!1}if(t.protocol!=="https:"||t.username!==""||t.password!==""||t.port!=="")return!1;const s=t.hostname.toLowerCase().replace(w,"");return b.test(s)},T=async e=>{if(!h(e))throw new o("webhooks",`Refusing to fetch SNS signing certificate from untrusted URL: ${e}`);const t=await fetch(e,{signal:AbortSignal.timeout(5e3)});if(!t.ok)throw new o("webhooks",`Failed to fetch SNS signing certificate (status ${String(t.status)})`);return await t.text()},v=e=>{const t=y[e.Type??""];if(!t)return;let s="";for(const i of t){const r=e[i];typeof r=="string"&&(s+=`${i}
2
+ ${r}
3
+ `)}return s},M=async(e,t={})=>{const{certificateResolver:s=T}=t;if(!e.Signature||!e.SigningCertURL)return{reason:"missing-signature",valid:!1};const i=v(e);if(i===void 0)return{reason:"unknown-message-type",valid:!1};let r;if(e.SignatureVersion==="1")r="RSA-SHA1";else if(e.SignatureVersion==="2")r="RSA-SHA256";else return{reason:"unknown-signature-version",valid:!1};const f=await s(e.SigningCertURL);let a;try{a=new d(f).publicKey}catch(l){throw new o("webhooks","Failed to parse SNS signing certificate",{cause:l})}let c;try{c=S(r).update(i,"utf8").verify(a,m.from(e.Signature,"base64"))}catch{return{reason:"signature-malformed",valid:!1}}return c?{valid:!0}:{reason:"signature-mismatch",valid:!1}};export{h as isValidSigningCertUrl,M as verifySnsMessage};
@@ -0,0 +1 @@
1
+ const n=e=>{const r=e.indexOf("@");if(r<=0)return"•••";const s=e.slice(0,r),a=e.slice(r+1);return`${s.slice(0,1)}${"•".repeat(Math.max(1,s.length-1))}@${a}`},c=(e,r)=>(Array.isArray(e)?e:[e]).map(s=>r?n(s.email):s.email),l=(e={})=>{const{logger:r=console,redact:s=!0}=e;return async(a,t)=>{const o=c(a.to,s);r.info("[@visulima/email] sending",{subject:s?void 0:a.subject,to:o});const i=await t(a);return i.success?r.info("[@visulima/email] sent",{messageId:i.data?.messageId,to:o}):r.error("[@visulima/email] send failed",{error:i.error instanceof Error?i.error.message:i.error,to:o}),i}};export{l as loggingMiddleware};
@@ -0,0 +1 @@
1
+ import o from"./EmailError-B-sEf3bp.js";import f from"./RequiredOptionError-DuNNY_a5.js";import{e as g}from"./generate-message-id-gXAuMz4g.js";import{m as h}from"./make-request-BlK_B72c.js";import{u as y}from"./retry-3pnxTuNs.js";import{defineProvider as b}from"./defineProvider-C9q-7iwt.js";import{c as v}from"./attachment-processor-CMp7qqMI.js";import{h as w,P as T,c as A}from"./provider-base-C7PuopYK.js";const t="loops",I="https://app.loops.so/api/v1/transactional",P=3e4,K=3,E=b((a={})=>{if(!a.apiKey)throw new f(t,"apiKey");const r={apiKey:a.apiKey,debug:a.debug??!1,defaultTransactionalId:a.defaultTransactionalId,endpoint:a.endpoint??I,logger:a.logger,retries:a.retries??K,timeout:a.timeout??P},m=new T,u=A(t,a.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!1,html:!1,replyTo:!1,scheduling:!1,tagging:!1,templates:!0,tracking:!0},async initialize(){m.setInitialized()},async isAvailable(){return r.apiKey.length>0},name:t,options:r,async sendEmail(e){try{const s=e.transactionalId??r.defaultTransactionalId;if(!s)return{error:new o(t,"Loops requires a `transactionalId` (on the message or as `defaultTransactionalId`)"),success:!1};const l=Array.isArray(e.to)?e.to:[e.to];if(l.length!==1||e.cc!==void 0||e.bcc!==void 0)return{error:new o(t,"Loops supports exactly one `to` recipient and does not support cc/bcc"),success:!1};const[d]=l;if(!d)return{error:new o(t,"A `to` recipient is required"),success:!1};const n={email:d.email,transactionalId:s};e.dataVariables&&(n.dataVariables=e.dataVariables),e.addToAudience&&(n.addToAudience=!0),e.attachments&&e.attachments.length>0&&(n.attachments=await Promise.all(e.attachments.map(async p=>{const c=await v(p,t);return{contentType:c.contentType,data:c.content,filename:c.filename}})));const i=await y(async()=>h(r.endpoint,{headers:{Authorization:`Bearer ${r.apiKey}`,"Content-Type":"application/json"},method:"POST",timeout:r.timeout},JSON.stringify(n)),r.retries);return i.success?{data:{messageId:g(),provider:t,response:i.data,sent:!0,timestamp:new Date},success:!0}:{error:i.error??new o(t,"Failed to send email"),success:!1}}catch(s){return{error:w(t,"send email",s,u),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{E as default};