@visulima/email 2.1.7 → 2.1.9

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 (273) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE.md +159 -19
  3. package/dist/crypto/index.js +1 -1
  4. package/dist/deliverability/dmarc-report.js +1 -1
  5. package/dist/deliverability/index.js +1 -1
  6. package/dist/events/index.js +1 -1
  7. package/dist/inbound/index.js +1 -1
  8. package/dist/index.d.ts +1 -2
  9. package/dist/index.js +1 -1
  10. package/dist/middleware/index.js +1 -1
  11. package/dist/packem_shared/ALL_EVENTS-CSpGgYbV.js +1 -0
  12. package/dist/packem_shared/DkimSigner-B_pEwGCS.js +18 -0
  13. package/dist/packem_shared/DraftMailMessage-Tj3sH8nn.js +1 -0
  14. package/dist/packem_shared/EmailError-BIaHK1Uw.js +1 -0
  15. package/dist/packem_shared/Mail-Cm24B3w0.js +1 -0
  16. package/dist/packem_shared/MailMessage-BtI4qMU1.js +1 -0
  17. package/dist/packem_shared/MemorySuppressionStore-D_bge6rS.js +1 -0
  18. package/dist/packem_shared/RATE_LIMIT_PRESETS-BIFmRuh2.js +1 -0
  19. package/dist/packem_shared/RequiredOptionError-ctDEEB1s.js +1 -0
  20. package/dist/packem_shared/SmimeEncrypter-BjBwjaTg.js +6 -0
  21. package/dist/packem_shared/SmimeSigner-CK5TITxI.js +8 -0
  22. package/dist/packem_shared/address-formatter-CXZ1aWBX.js +1 -0
  23. package/dist/packem_shared/aggregate-features-Bst55u8k.js +1 -0
  24. package/dist/packem_shared/ahaSendProvider-DY559XjD.js +1 -0
  25. package/dist/packem_shared/arcMessageSignatureBase-B0Qi-724.js +17 -0
  26. package/dist/packem_shared/attachment-processor-BJFDS343.js +1 -0
  27. package/dist/packem_shared/autoSendProvider-BgdWf422.js +1 -0
  28. package/dist/packem_shared/awsSesProvider-DTnLwAbE.js +32 -0
  29. package/dist/packem_shared/azureProvider-Bs4BGYR1.js +1 -0
  30. package/dist/packem_shared/brevoProvider-xoRTeFIx.js +1 -0
  31. package/dist/packem_shared/build-mime-message-QNCMA6oQ.js +3 -0
  32. package/dist/packem_shared/buildListUnsubscribe-g1CoihSv.js +1 -0
  33. package/dist/packem_shared/buildMtaStsPolicy-BA2YXL72.js +6 -0
  34. package/dist/packem_shared/circuitBreakerMiddleware-DcBN7K6H.js +1 -0
  35. package/dist/packem_shared/cloudflareEmailProvider-BkR-P0YD.js +1 -0
  36. package/dist/packem_shared/composeMiddleware-B3RCDFsy.js +1 -0
  37. package/dist/packem_shared/create-logger-CazqtXcL.js +1 -0
  38. package/dist/packem_shared/create-token-cache-BdMsMzf7.js +1 -0
  39. package/dist/packem_shared/createSuppressionStore-DbocihI8.js +1 -0
  40. package/dist/packem_shared/createTestEmail-CPnHNKBT.js +1 -0
  41. package/dist/packem_shared/createWorker-ChuTgETP.js +1 -0
  42. package/dist/packem_shared/dedupeMiddleware-BTo8Qjje.js +1 -0
  43. package/dist/packem_shared/defineInboundHandler-CnYn10ex.js +1 -0
  44. package/dist/packem_shared/detectMimeType-DVC9Uvy9.js +1 -0
  45. package/dist/packem_shared/emailMatchers-DpwItmkN.js +1 -0
  46. package/dist/packem_shared/extractReply-CLoWMY97.js +5 -0
  47. package/dist/packem_shared/failoverProvider-DSsuXHYK.js +1 -0
  48. package/dist/packem_shared/format-address-BDKhXcXV.js +1 -0
  49. package/dist/packem_shared/{generate-boundary-0xGe9GqK.js → generate-boundary-BCSUEi6x.js} +1 -1
  50. package/dist/packem_shared/generate-message-id-B2n2yqR6.js +1 -0
  51. package/dist/packem_shared/headers-to-record-ZOZ7Dubo.js +1 -0
  52. package/dist/packem_shared/httpProvider-CdoJ-tL7.js +1 -0
  53. package/dist/packem_shared/index-B8wiKJdh.js +1 -0
  54. package/dist/packem_shared/infobipProvider-mEYgfWJ7.js +1 -0
  55. package/dist/packem_shared/isValidSigningCertUrl-CK1t2a7x.js +3 -0
  56. package/dist/packem_shared/loggingMiddleware-DNVf8O1B.js +1 -0
  57. package/dist/packem_shared/loopsProvider-CKJ_rzLq.js +1 -0
  58. package/dist/packem_shared/{mail.d-xKtvoKMK.d.ts → mail.d-8M9NjOr0.d.ts} +2 -2
  59. package/dist/packem_shared/mailCrabProvider-Cx9rnuyE.js +1 -0
  60. package/dist/packem_shared/mailPaceProvider-DvSlan-v.js +1 -0
  61. package/dist/packem_shared/mailchannelsProvider-Cgb8el7C.js +1 -0
  62. package/dist/packem_shared/mailerSendProvider-BvRIjuVE.js +1 -0
  63. package/dist/packem_shared/mailgunProvider-kNcvF_z6.js +1 -0
  64. package/dist/packem_shared/mailjetProvider-DqJUhLuH.js +1 -0
  65. package/dist/packem_shared/mailomatProvider-BBOqRhV_.js +1 -0
  66. package/dist/packem_shared/mailtrapProvider-CeBW2Gzg.js +1 -0
  67. package/dist/packem_shared/make-request-Cyz5_yu8.js +1 -0
  68. package/dist/packem_shared/mandrillProvider-Dab8i0gF.js +1 -0
  69. package/dist/packem_shared/mockProvider-Bf5eJ_rl.js +1 -0
  70. package/dist/packem_shared/netcoreProvider-DMJsQ8IM.js +1 -0
  71. package/dist/packem_shared/nodemailerProvider-CJ4zkTPF.js +1 -0
  72. package/dist/packem_shared/normalizeMessageId-0yB1zeyC.js +1 -0
  73. package/dist/packem_shared/oauth2Middleware-DbKGd7Z9.js +1 -0
  74. package/dist/packem_shared/opentelemetryProvider-s0gvh05u.js +1 -0
  75. package/dist/packem_shared/outlook365Provider-DKMz0Vvh.js +1 -0
  76. package/dist/packem_shared/parseAddress-DW9suGjV.js +1 -0
  77. package/dist/packem_shared/parseArfReport-VbQeofN4.js +6 -0
  78. package/dist/packem_shared/parseCloudflareInbound-BKZzk0De.js +1 -0
  79. package/dist/packem_shared/parseDmarcRecord-9B3Qhba8.js +1 -0
  80. package/dist/packem_shared/parseMailgunInbound-nY-DXZrK.js +1 -0
  81. package/dist/packem_shared/parsePostmarkInbound-0zG71J7F.js +1 -0
  82. package/dist/packem_shared/parseSendGridInbound-BzEhN-gd.js +4 -0
  83. package/dist/packem_shared/parseSesInbound-C4cRtAUq.js +1 -0
  84. package/dist/packem_shared/parseTlsReport-DSiCaKFH.js +1 -0
  85. package/dist/packem_shared/plunkProvider-B-JtCJQy.js +1 -0
  86. package/dist/packem_shared/postalProvider-COVY4T94.js +1 -0
  87. package/dist/packem_shared/postmarkProvider-Cj64C4dc.js +1 -0
  88. package/dist/packem_shared/provider-base-BEz00m9R.js +1 -0
  89. package/dist/packem_shared/quoted-printable-BgiHOYdV.js +7 -0
  90. package/dist/packem_shared/resendProvider-Da5r7dMe.js +1 -0
  91. package/dist/packem_shared/retry-aghj7y8m.js +1 -0
  92. package/dist/packem_shared/retryMiddleware-CaTv0UIm.js +1 -0
  93. package/dist/packem_shared/roundRobinProvider-Dr1DdT2L.js +1 -0
  94. package/dist/packem_shared/sanitize-header-CW0f3IT7.js +1 -0
  95. package/dist/packem_shared/scalewayProvider-CDjpYmJc.js +1 -0
  96. package/dist/packem_shared/sendGridProvider-C1rp9hpg.js +1 -0
  97. package/dist/packem_shared/smtpProvider-Dr2XAFQu.js +27 -0
  98. package/dist/packem_shared/sparkpostProvider-DKon_hyx.js +1 -0
  99. package/dist/packem_shared/sweegoProvider-BclZuNBf.js +1 -0
  100. package/dist/packem_shared/toEmailSnapshot-BOhTn44E.js +1 -0
  101. package/dist/packem_shared/utils-CDV8xy3e.js +1 -0
  102. package/dist/packem_shared/validate-email-options-DxdAVLlu.js +1 -0
  103. package/dist/packem_shared/{verifyMailgunWebhook-DNk080BF.js → verifyMailgunWebhook-DS4o0kZL.js} +1 -1
  104. package/dist/packem_shared/{verifyPostmarkWebhook-B4OIEHQF.js → verifyPostmarkWebhook-pLwWmeOl.js} +1 -1
  105. package/dist/packem_shared/verifyResendWebhook-D3GuwWjv.js +1 -0
  106. package/dist/packem_shared/verifySendGridWebhook-csuRasH3.js +1 -0
  107. package/dist/packem_shared/withEvents-BinK2hMw.js +1 -0
  108. package/dist/packem_shared/withMetrics-i3mZVfeE.js +1 -0
  109. package/dist/packem_shared/withRender-Ce6leoYE.js +1 -0
  110. package/dist/packem_shared/withSuppression-B0eZ2xNQ.js +1 -0
  111. package/dist/packem_shared/{withTelemetry-DL2qo0Hp.js → withTelemetry-DEKTis1I.js} +1 -1
  112. package/dist/packem_shared/zeptomailProvider-D5B3kqFm.js +1 -0
  113. package/dist/providers/ahasend/index.js +1 -1
  114. package/dist/providers/autosend/index.js +1 -1
  115. package/dist/providers/aws-ses/index.js +1 -1
  116. package/dist/providers/azure/index.js +1 -1
  117. package/dist/providers/brevo/index.js +1 -1
  118. package/dist/providers/cloudflare-email/index.js +1 -1
  119. package/dist/providers/failover/index.js +1 -1
  120. package/dist/providers/http/index.js +1 -1
  121. package/dist/providers/infobip/index.js +1 -1
  122. package/dist/providers/loops/index.js +1 -1
  123. package/dist/providers/mailchannels/index.js +1 -1
  124. package/dist/providers/mailcrab/index.js +1 -1
  125. package/dist/providers/mailersend/index.js +1 -1
  126. package/dist/providers/mailgun/index.js +1 -1
  127. package/dist/providers/mailjet/index.js +1 -1
  128. package/dist/providers/mailomat/index.js +1 -1
  129. package/dist/providers/mailpace/index.js +1 -1
  130. package/dist/providers/mailtrap/index.js +1 -1
  131. package/dist/providers/mandrill/index.js +1 -1
  132. package/dist/providers/mock/index.js +1 -1
  133. package/dist/providers/netcore/index.js +1 -1
  134. package/dist/providers/nodemailer/index.js +1 -1
  135. package/dist/providers/opentelemetry/index.d.ts +1 -1
  136. package/dist/providers/opentelemetry/index.js +1 -1
  137. package/dist/providers/outlook365/index.js +1 -1
  138. package/dist/providers/plunk/index.js +1 -1
  139. package/dist/providers/postal/index.js +1 -1
  140. package/dist/providers/postmark/index.js +1 -1
  141. package/dist/providers/resend/index.js +1 -1
  142. package/dist/providers/roundrobin/index.js +1 -1
  143. package/dist/providers/scaleway/index.js +1 -1
  144. package/dist/providers/sendgrid/index.js +1 -1
  145. package/dist/providers/smtp/index.js +1 -1
  146. package/dist/providers/sparkpost/index.js +1 -1
  147. package/dist/providers/sweego/index.js +1 -1
  148. package/dist/providers/zeptomail/index.js +1 -1
  149. package/dist/queue/bullmq-queue.js +1 -1
  150. package/dist/queue/index.js +1 -1
  151. package/dist/queue/pg-boss-queue.js +1 -1
  152. package/dist/queue/sqs-queue.js +1 -1
  153. package/dist/queue/unstorage-queue.js +1 -1
  154. package/dist/render/cid.js +1 -1
  155. package/dist/render/css-inline.js +1 -1
  156. package/dist/render/dark-mode.js +1 -1
  157. package/dist/render/preheader.js +1 -1
  158. package/dist/template-engines/handlebars.js +1 -1
  159. package/dist/template-engines/html-to-text.js +1 -1
  160. package/dist/template-engines/i18n.js +1 -1
  161. package/dist/template-engines/jsx-email.js +1 -1
  162. package/dist/template-engines/liquid.js +1 -1
  163. package/dist/template-engines/mjml.js +1 -1
  164. package/dist/template-engines/react-email.js +1 -1
  165. package/dist/template-engines/vue-email.js +1 -1
  166. package/dist/test/index.d.ts +2 -3
  167. package/dist/test/index.js +1 -1
  168. package/dist/utils/cache.js +1 -1
  169. package/dist/utils/format-email-address.js +1 -1
  170. package/dist/utils/parse-address.js +1 -1
  171. package/dist/utils/parse-eml.js +4 -4
  172. package/dist/utils/result.js +1 -1
  173. package/dist/utils/validation/check-feature-support.js +1 -1
  174. package/dist/utils/validation/validate-email.js +1 -1
  175. package/dist/webhooks/index.js +1 -1
  176. package/package.json +6 -6
  177. package/dist/packem_shared/ALL_EVENTS-3kwh5CBE.js +0 -1
  178. package/dist/packem_shared/DkimSigner-sLcIw9bp.js +0 -18
  179. package/dist/packem_shared/DraftMailMessage-C3YTXqWo.js +0 -1
  180. package/dist/packem_shared/EmailError-CDvYwuqz.js +0 -1
  181. package/dist/packem_shared/Mail-CIyxkmxu.js +0 -1
  182. package/dist/packem_shared/MailMessage-DuEXJiCg.js +0 -1
  183. package/dist/packem_shared/MemorySuppressionStore-DZnbz-_B.js +0 -1
  184. package/dist/packem_shared/RATE_LIMIT_PRESETS-BPADLgcA.js +0 -1
  185. package/dist/packem_shared/RequiredOptionError-DU2lxzk3.js +0 -1
  186. package/dist/packem_shared/SmimeEncrypter-CzTbQM-z.js +0 -6
  187. package/dist/packem_shared/SmimeSigner-DjLShaOw.js +0 -8
  188. package/dist/packem_shared/address-formatter-BWR2Dddx.js +0 -1
  189. package/dist/packem_shared/aggregate-features-BqEjPd42.js +0 -1
  190. package/dist/packem_shared/ahaSendProvider-br1yB2un.js +0 -1
  191. package/dist/packem_shared/arcMessageSignatureBase-D54jQIWu.js +0 -17
  192. package/dist/packem_shared/attachment-processor-D1cbAhQi.js +0 -1
  193. package/dist/packem_shared/autoSendProvider-BSP8ueOC.js +0 -1
  194. package/dist/packem_shared/awsSesProvider-zRICW1pH.js +0 -32
  195. package/dist/packem_shared/azureProvider-DwN4c5dC.js +0 -1
  196. package/dist/packem_shared/brevoProvider-C491beE_.js +0 -1
  197. package/dist/packem_shared/build-mime-message-DT67qfMp.js +0 -3
  198. package/dist/packem_shared/buildListUnsubscribe-Cdr8MvR_.js +0 -1
  199. package/dist/packem_shared/buildMtaStsPolicy-oEQg8y_C.js +0 -6
  200. package/dist/packem_shared/circuitBreakerMiddleware-N0CKF90q.js +0 -1
  201. package/dist/packem_shared/cloudflareEmailProvider-8JxzLbpX.js +0 -1
  202. package/dist/packem_shared/composeMiddleware-BHwLLEzK.js +0 -1
  203. package/dist/packem_shared/create-logger-BQTS3f-I.js +0 -1
  204. package/dist/packem_shared/create-token-cache-D56KQGVQ.js +0 -1
  205. package/dist/packem_shared/createSuppressionStore-CeAZKCbY.js +0 -1
  206. package/dist/packem_shared/createTestEmail-D_ksEez3.js +0 -1
  207. package/dist/packem_shared/createWorker-_-yMWcNQ.js +0 -1
  208. package/dist/packem_shared/dedupeMiddleware-CYYI_O7S.js +0 -1
  209. package/dist/packem_shared/defineInboundHandler-CnL2BzlL.js +0 -1
  210. package/dist/packem_shared/detectMimeType-CmYmWDXE.js +0 -1
  211. package/dist/packem_shared/emailMatchers-DZDkrZ_3.js +0 -1
  212. package/dist/packem_shared/extractReply-BUjIBt9A.js +0 -5
  213. package/dist/packem_shared/failoverProvider-6qwE_HSJ.js +0 -1
  214. package/dist/packem_shared/format-address-DTl-9O70.js +0 -1
  215. package/dist/packem_shared/generate-message-id-gXAuMz4g.js +0 -1
  216. package/dist/packem_shared/headers-to-record-De1Eg951.js +0 -1
  217. package/dist/packem_shared/httpProvider-BqrdZhGw.js +0 -1
  218. package/dist/packem_shared/index-Gd7m-UQA.js +0 -11
  219. package/dist/packem_shared/infobipProvider-C2FU6VMP.js +0 -1
  220. package/dist/packem_shared/isValidSigningCertUrl-DNxPA0Q-.js +0 -3
  221. package/dist/packem_shared/loggingMiddleware-CZIiVMVp.js +0 -1
  222. package/dist/packem_shared/loopsProvider-Bz63so6m.js +0 -1
  223. package/dist/packem_shared/mailCrabProvider-bkQy-2a1.js +0 -1
  224. package/dist/packem_shared/mailPaceProvider-S1AB-AYq.js +0 -1
  225. package/dist/packem_shared/mailchannelsProvider-B_K6X4VY.js +0 -1
  226. package/dist/packem_shared/mailerSendProvider-DPEww2H1.js +0 -1
  227. package/dist/packem_shared/mailgunProvider-DKxzVbDW.js +0 -1
  228. package/dist/packem_shared/mailjetProvider-C2TQcujL.js +0 -1
  229. package/dist/packem_shared/mailomatProvider-B8-5bQsu.js +0 -1
  230. package/dist/packem_shared/mailtrapProvider-DW7TLOdG.js +0 -1
  231. package/dist/packem_shared/make-request-CylyuRaN.js +0 -1
  232. package/dist/packem_shared/mandrillProvider-S-0lKNGd.js +0 -1
  233. package/dist/packem_shared/mockProvider-BAl292mW.js +0 -1
  234. package/dist/packem_shared/netcoreProvider-DajMprlo.js +0 -1
  235. package/dist/packem_shared/nodemailerProvider-DRo0lJ6g.js +0 -1
  236. package/dist/packem_shared/normalizeMessageId-DAx2pGe2.js +0 -1
  237. package/dist/packem_shared/oauth2Middleware-DQh-hIkv.js +0 -1
  238. package/dist/packem_shared/opentelemetryProvider-C6spx2CD.js +0 -1
  239. package/dist/packem_shared/outlook365Provider-B0o7UZBW.js +0 -1
  240. package/dist/packem_shared/parseAddress-DdbViBAJ.js +0 -1
  241. package/dist/packem_shared/parseArfReport-Ds6S3c4J.js +0 -6
  242. package/dist/packem_shared/parseCloudflareInbound-C__j-oNa.js +0 -1
  243. package/dist/packem_shared/parseDmarcRecord-DXZ-_rF0.js +0 -1
  244. package/dist/packem_shared/parseMailgunInbound-BpC6uPNe.js +0 -1
  245. package/dist/packem_shared/parsePostmarkInbound-Co3_c6-9.js +0 -1
  246. package/dist/packem_shared/parseSendGridInbound-DsALoijO.js +0 -4
  247. package/dist/packem_shared/parseSesInbound-CH5tHIjp.js +0 -1
  248. package/dist/packem_shared/parseTlsReport-wPe1lIDs.js +0 -1
  249. package/dist/packem_shared/plunkProvider-DJzEUEtU.js +0 -1
  250. package/dist/packem_shared/postalProvider-DHFjFE3Y.js +0 -1
  251. package/dist/packem_shared/postmarkProvider-Dt1EGGBA.js +0 -1
  252. package/dist/packem_shared/provider-base-DjPzWncP.js +0 -1
  253. package/dist/packem_shared/quoted-printable-nSGDA1tA.js +0 -7
  254. package/dist/packem_shared/resendProvider-qjI86j_d.js +0 -1
  255. package/dist/packem_shared/retry-CG9iT2wF.js +0 -1
  256. package/dist/packem_shared/retryMiddleware-DbViDX4r.js +0 -1
  257. package/dist/packem_shared/roundRobinProvider-CO5YvhgR.js +0 -1
  258. package/dist/packem_shared/sanitize-header-DtQwAnzg.js +0 -1
  259. package/dist/packem_shared/scalewayProvider-CihQKhw6.js +0 -1
  260. package/dist/packem_shared/sendGridProvider-Dkc5AKlC.js +0 -1
  261. package/dist/packem_shared/smtpProvider-CIXMxPu-.js +0 -25
  262. package/dist/packem_shared/sparkpostProvider-CKxQhpyB.js +0 -1
  263. package/dist/packem_shared/sweegoProvider-DjmAs6La.js +0 -1
  264. package/dist/packem_shared/toEmailSnapshot-DeRqM5SJ.js +0 -1
  265. package/dist/packem_shared/utils-DjEtR3qT.js +0 -1
  266. package/dist/packem_shared/validate-email-options-mCM9dVug.js +0 -1
  267. package/dist/packem_shared/verifyResendWebhook-C7E32LZ1.js +0 -1
  268. package/dist/packem_shared/verifySendGridWebhook-1l9bqIMw.js +0 -1
  269. package/dist/packem_shared/withEvents-CytsykaK.js +0 -1
  270. package/dist/packem_shared/withMetrics-DWywX_6M.js +0 -1
  271. package/dist/packem_shared/withRender-VP9wE5Yr.js +0 -1
  272. package/dist/packem_shared/withSuppression-BoaO4Qdz.js +0 -1
  273. package/dist/packem_shared/zeptomailProvider-DSTC9pUi.js +0 -1
@@ -1,11 +0,0 @@
1
- import{createRequire as It}from"node:module";let Pt;const Dt=e=>(Pt??=It(import.meta.url))(e),de=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Gt=e=>{if(typeof de<"u"&&de.versions&&de.versions.node){const[t,o]=de.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return de.getBuiltinModule(e)}return Dt(e)},{createRequire:O}=Gt("node:module"),Ut=/^[A-Z]:\//i,zt=(e="")=>e&&e.replaceAll("\\","/").replace(Ut,t=>t.toUpperCase());let Kt;const Ft=e=>(Kt??=O(import.meta.url))(e),be=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xt=e=>{if(typeof be<"u"&&be.versions&&be.versions.node){const[t,o]=be.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return be.getBuiltinModule(e)}return Ft(e)},{fileURLToPath:jt}=Xt("node:url");function qt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dt,bt;function Qt(){return bt||(bt=1,dt=["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"]),dt}var Wt=Qt();const Zt=qt(Wt);new Set(Zt);const Vt=e=>zt(e instanceof URL?jt(e):e),Yt=e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")};let Jt;const eo=e=>(Jt??=O(import.meta.url))(e),he=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,to=e=>{if(typeof he<"u"&&he.versions&&he.versions.node){const[t,o]=he.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return he.getBuiltinModule(e)}return eo(e)};to("node:fs/promises");let oo;const so=e=>(oo??=O(import.meta.url))(e),me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ro=e=>{if(typeof me<"u"&&me.versions&&me.versions.node){const[t,o]=me.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return me.getBuiltinModule(e)}return so(e)};ro("node:fs");let no;const uo=e=>(no??=O(import.meta.url))(e),ye=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,io=e=>{if(typeof ye<"u"&&ye.versions&&ye.versions.node){const[t,o]=ye.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return ye.getBuiltinModule(e)}return uo(e)};io("node:fs/promises");let lo;const ao=e=>(lo??=O(import.meta.url))(e),ve=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,po=e=>{if(typeof ve<"u"&&ve.versions&&ve.versions.node){const[t,o]=ve.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return ve.getBuiltinModule(e)}return ao(e)};po("node:fs");let co;const fo=e=>(co??=O(import.meta.url))(e),$e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,go=e=>{if(typeof $e<"u"&&$e.versions&&$e.versions.node){const[t,o]=$e.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return $e.getBuiltinModule(e)}return fo(e)};go("node:fs/promises");let bo;const ho=e=>(bo??=O(import.meta.url))(e),Ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,mo=e=>{if(typeof Ee<"u"&&Ee.versions&&Ee.versions.node){const[t,o]=Ee.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ee.getBuiltinModule(e)}return ho(e)};mo("node:fs");let yo;const vo=e=>(yo??=O(import.meta.url))(e),_e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$o=e=>{if(typeof _e<"u"&&_e.versions&&_e.versions.node){const[t,o]=_e.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return _e.getBuiltinModule(e)}return vo(e)};$o("node:fs/promises");let Eo;const _o=e=>(Eo??=O(import.meta.url))(e),Re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ro=e=>{if(typeof Re<"u"&&Re.versions&&Re.versions.node){const[t,o]=Re.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Re.getBuiltinModule(e)}return _o(e)};Ro("node:fs");let Ao;const To=e=>(Ao??=O(import.meta.url))(e),Ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,xo=e=>{if(typeof Ae<"u"&&Ae.versions&&Ae.versions.node){const[t,o]=Ae.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ae.getBuiltinModule(e)}return To(e)};xo("node:fs/promises");let Co;const So=e=>(Co??=O(import.meta.url))(e),Te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Oo=e=>{if(typeof Te<"u"&&Te.versions&&Te.versions.node){const[t,o]=Te.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Te.getBuiltinModule(e)}return So(e)};Oo("node:fs");let wo;const ko=e=>(wo??=O(import.meta.url))(e),xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ho=e=>{if(typeof xe<"u"&&xe.versions&&xe.versions.node){const[t,o]=xe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return xe.getBuiltinModule(e)}return ko(e)};Ho("node:fs/promises");let No;const Lo=e=>(No??=O(import.meta.url))(e),Ce=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Mo=e=>{if(typeof Ce<"u"&&Ce.versions&&Ce.versions.node){const[t,o]=Ce.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ce.getBuiltinModule(e)}return Lo(e)};Mo("node:fs");let Bo;const Io=e=>(Bo??=O(import.meta.url))(e),Se=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Po=e=>{if(typeof Se<"u"&&Se.versions&&Se.versions.node){const[t,o]=Se.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Se.getBuiltinModule(e)}return Io(e)};Po("node:fs/promises");let Do;const Go=e=>(Do??=O(import.meta.url))(e),Oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Uo=e=>{if(typeof Oe<"u"&&Oe.versions&&Oe.versions.node){const[t,o]=Oe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Oe.getBuiltinModule(e)}return Go(e)};Uo("node:fs");function ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ht={},ot,mt;function et(){if(mt)return ot;mt=1;const e="[^\\\\/]",t=Symbol("unignore"),o="\\.",H="\\+",b="\\?",n="\\/",l="(?=.)",f="[^/]",a=`(?:${n}|$)`,_=`(?:^|${n})`,g=`${o}{1,2}${a}`,T=`(?!${o})`,C=`(?!${_}${g})`,R=`(?!${o}{0,1}${a})`,L=`(?!${g})`,te=`[^.${n}]`,W=`${f}*?`,Z="/",M={DOT_LITERAL:o,PLUS_LITERAL:H,QMARK_LITERAL:b,SLASH_LITERAL:n,ONE_CHAR:l,QMARK:f,END_ANCHOR:a,DOTS_SLASH:g,NO_DOT:T,NO_DOTS:C,NO_DOT_SLASH:R,NO_DOTS_SLASH:L,QMARK_NO_DOT:te,STAR:W,START_ANCHOR:_,SEP:Z},d={...M,SLASH_LITERAL:"[\\\\/]",QMARK:e,STAR:`${e}*?`,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:"\\"},h={__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 ot={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:h,UNIGNORE:t,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(s){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${s.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(s){return s===!0?d:M}},ot}var yt;function tt(){return yt||(yt=1,(function(e){const{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:H,REGEX_SPECIAL_CHARS_GLOBAL:b}=et();e.isObject=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),e.hasRegexChars=n=>H.test(n),e.isRegexChar=n=>n.length===1&&e.hasRegexChars(n),e.escapeRegex=n=>n.replace(b,"\\$1"),e.toPosixSlashes=n=>n.replace(t,"/"),e.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const n=navigator.platform.toLowerCase();return n==="win32"||n==="windows"}return process.platform?process.platform==="win32":!1},e.removeBackslashes=n=>n.replace(o,l=>l==="\\"?"":l),e.escapeLast=(n,l,f)=>{const a=n.lastIndexOf(l,f);return a===-1?n:n[a-1]==="\\"?e.escapeLast(n,l,a-1):`${n.slice(0,a)}\\${n.slice(a)}`},e.removePrefix=(n,l={})=>{let f=n;return f.startsWith("./")&&(f=f.slice(2),l.prefix="./"),f},e.wrapOutput=(n,l={},f={})=>{const a=f.contains?"":"^",_=f.contains?"":"$";let g=`${a}(?:${n})${_}`;return l.negated===!0&&(g=`(?:^(?!${g}).*$)`),g},e.basename=(n,{windows:l}={})=>{const f=n.split(l?/[\\/]/:"/"),a=f[f.length-1];return a===""?f[f.length-2]:a}})(ht)),ht}var st,vt;function zo(){if(vt)return st;vt=1;const e=tt(),{CHAR_ASTERISK:t,CHAR_AT:o,CHAR_BACKWARD_SLASH:H,CHAR_COMMA:b,CHAR_DOT:n,CHAR_EXCLAMATION_MARK:l,CHAR_FORWARD_SLASH:f,CHAR_LEFT_CURLY_BRACE:a,CHAR_LEFT_PARENTHESES:_,CHAR_LEFT_SQUARE_BRACKET:g,CHAR_PLUS:T,CHAR_QUESTION_MARK:C,CHAR_RIGHT_CURLY_BRACE:R,CHAR_RIGHT_PARENTHESES:L,CHAR_RIGHT_SQUARE_BRACKET:te}=et(),W=M=>M===f||M===H,Z=M=>{M.isPrefix!==!0&&(M.depth=M.isGlobstar?1/0:1)};return st=(M,d)=>{const h=d||{},s=M.length-1,$=h.parts===!0||h.scanToEnd===!0,S=[],m=[],E=[];let y=M,F=-1,U=0,Y=0,ae=!1,J=!1,z=!1,ee=!1,pe=!1,re=!1,oe=!1,D=!1,ne=!1,j=!1,ce=0,q,v,k={value:"",depth:0,isGlob:!1};const X=()=>F>=s,i=()=>y.charCodeAt(F+1),I=()=>(q=v,y.charCodeAt(++F));for(;F<s;){v=I();let Q;if(v===H){oe=k.backslashes=!0,v=I(),v===a&&(re=!0);continue}if(re===!0||v===a){for(ce++;X()!==!0&&(v=I());){if(v===H){oe=k.backslashes=!0,I();continue}if(v===a){ce++;continue}if(re!==!0&&v===n&&(v=I())===n){if(ae=k.isBrace=!0,z=k.isGlob=!0,j=!0,$===!0)continue;break}if(re!==!0&&v===b){if(ae=k.isBrace=!0,z=k.isGlob=!0,j=!0,$===!0)continue;break}if(v===R&&(ce--,ce===0)){re=!1,ae=k.isBrace=!0,j=!0;break}}if($===!0)continue;break}if(v===f){if(S.push(F),m.push(k),k={value:"",depth:0,isGlob:!1},j===!0)continue;if(q===n&&F===U+1){U+=2;continue}Y=F+1;continue}if(h.noext!==!0&&(v===T||v===o||v===t||v===C||v===l)&&i()===_){if(z=k.isGlob=!0,ee=k.isExtglob=!0,j=!0,v===l&&F===U&&(ne=!0),$===!0){for(;X()!==!0&&(v=I());){if(v===H){oe=k.backslashes=!0,v=I();continue}if(v===L){z=k.isGlob=!0,j=!0;break}}continue}break}if(v===t){if(q===t&&(pe=k.isGlobstar=!0),z=k.isGlob=!0,j=!0,$===!0)continue;break}if(v===C){if(z=k.isGlob=!0,j=!0,$===!0)continue;break}if(v===g){for(;X()!==!0&&(Q=I());){if(Q===H){oe=k.backslashes=!0,I();continue}if(Q===te){J=k.isBracket=!0,z=k.isGlob=!0,j=!0;break}}if($===!0)continue;break}if(h.nonegate!==!0&&v===l&&F===U){D=k.negated=!0,U++;continue}if(h.noparen!==!0&&v===_){if(z=k.isGlob=!0,$===!0){for(;X()!==!0&&(v=I());){if(v===_){oe=k.backslashes=!0,v=I();continue}if(v===L){j=!0;break}}continue}break}if(z===!0){if(j=!0,$===!0)continue;break}}h.noext===!0&&(ee=!1,z=!1);let B=y,fe="",r="";U>0&&(fe=y.slice(0,U),y=y.slice(U),Y-=U),B&&z===!0&&Y>0?(B=y.slice(0,Y),r=y.slice(Y)):z===!0?(B="",r=y):B=y,B&&B!==""&&B!=="/"&&B!==y&&W(B.charCodeAt(B.length-1))&&(B=B.slice(0,-1)),h.unescape===!0&&(r&&(r=e.removeBackslashes(r)),B&&oe===!0&&(B=e.removeBackslashes(B)));const u={prefix:fe,input:M,start:U,base:B,glob:r,isBrace:ae,isBracket:J,isGlob:z,isExtglob:ee,isGlobstar:pe,negated:D,negatedExtglob:ne};if(h.tokens===!0&&(u.maxDepth=0,W(v)||m.push(k),u.tokens=m),h.parts===!0||h.tokens===!0){let Q;for(let w=0;w<S.length;w++){const se=Q?Q+1:U,ue=S[w],V=M.slice(se,ue);h.tokens&&(w===0&&U!==0?(m[w].isPrefix=!0,m[w].value=fe):m[w].value=V,Z(m[w]),u.maxDepth+=m[w].depth),(w!==0||V!=="")&&E.push(V),Q=ue}if(Q&&Q+1<M.length){const w=M.slice(Q+1);E.push(w),h.tokens&&(m[m.length-1].value=w,Z(m[m.length-1]),u.maxDepth+=m[m.length-1].depth)}u.slashes=S,u.parts=E}return u},st}var rt,$t;function Ko(){if($t)return rt;$t=1;const e=et(),t=tt(),{MAX_LENGTH:o,POSIX_REGEX_SOURCE:H,REGEX_NON_SPECIAL_CHARS:b,REGEX_SPECIAL_CHARS_BACKREF:n,REPLACEMENTS:l}=e,f=(d,h)=>typeof h.expandRange=="function"?h.expandRange(...d,h):(d.sort(),`[${d.join("-")}]`),a=(d,h)=>`Missing ${d}: "${h}" - use "\\\\${h}" to match literal characters`,_=d=>{const h=[];let s=0,$=0,S=0,m="",E=!1;for(const y of d){if(E===!0){m+=y,E=!1;continue}if(y==="\\"){m+=y,E=!0;continue}if(y==='"'){S=S===1?0:1,m+=y;continue}if(S===0){if(y==="[")s++;else if(y==="]"&&s>0)s--;else if(s===0){if(y==="(")$++;else if(y===")"&&$>0)$--;else if(y==="|"&&$===0){h.push(m),m="";continue}}}m+=y}return h.push(m),h},g=d=>{let h=!1;for(const s of d){if(h===!0){h=!1;continue}if(s==="\\"){h=!0;continue}if(/[?*+@!()[\]{}]/.test(s))return!1}return!0},T=d=>{let h=d.trim(),s=!0;for(;s===!0;)s=!1,/^@\([^\\()[\]{}|]+\)$/.test(h)&&(h=h.slice(2,-1),s=!0);if(g(h))return h.replace(/\\(.)/g,"$1")},C=d=>{const h=d.map(T).filter(Boolean);for(let s=0;s<h.length;s++)for(let $=s+1;$<h.length;$++){const S=h[s],m=h[$],E=S[0];if(!(!E||S!==E.repeat(S.length)||m!==E.repeat(m.length))&&(S===m||S.startsWith(m)||m.startsWith(S)))return!0}return!1},R=(d,h=!0)=>{if(d[0]!=="+"&&d[0]!=="*"||d[1]!=="(")return;let s=0,$=0,S=0,m=!1;for(let E=1;E<d.length;E++){const y=d[E];if(m===!0){m=!1;continue}if(y==="\\"){m=!0;continue}if(y==='"'){S=S===1?0:1;continue}if(S!==1){if(y==="["){s++;continue}if(y==="]"&&s>0){s--;continue}if(!(s>0)){if(y==="("){$++;continue}if(y===")"&&($--,$===0))return h===!0&&E!==d.length-1?void 0:{type:d[0],body:d.slice(2,E),end:E}}}}},L=d=>`${d.length===1?t.escapeRegex(d[0]):`[${d.map(h=>t.escapeRegex(h)).join("")}]`}*`,te=d=>{let h=0;const s=[];for(;h<d.length;){const $=R(d.slice(h),!1);if(!$||$.type!=="*")return;const S=_($.body).map(E=>E.trim());if(S.length!==1)return;const m=T(S[0]);if(!m||m.length!==1)return;s.push(m),h+=$.end+1}if(!(s.length<1))return s},W=d=>{let h=0,s=d.trim(),$=R(s);for(;$;)h++,s=$.body.trim(),$=R(s);return h},Z=(d,h)=>{if(h.maxExtglobRecursion===!1)return{risky:!1};const s=typeof h.maxExtglobRecursion=="number"?h.maxExtglobRecursion:e.DEFAULT_MAX_EXTGLOB_RECURSION,$=_(d).map(y=>y.trim());if($.length>1&&($.some(y=>y==="")||$.some(y=>/^[*?]+$/.test(y))||C($)))return{risky:!0};const S=[];let m=!1,E=!0;for(const y of $){const F=te(y);if(F){m=!0,S.push(...F);continue}const U=T(y);if(U&&U.length===1){S.push(U);continue}if(E=!1,W(y)>s)return{risky:!0}}return m?E?{risky:!0,safeOutput:L([...new Set(S)])}:{risky:!0}:{risky:!1}},M=(d,h)=>{if(typeof d!="string")throw new TypeError("Expected a string");d=l[d]||d;const s={...h},$=typeof s.maxLength=="number"?Math.min(o,s.maxLength):o;let S=d.length;if(S>$)throw new SyntaxError(`Input length: ${S}, exceeds maximum allowed length: ${$}`);const m={type:"bos",value:"",output:s.prepend||""},E=[m],y=s.capture?"":"?:",F=e.globChars(s.windows),U=e.extglobChars(F),{DOT_LITERAL:Y,PLUS_LITERAL:ae,SLASH_LITERAL:J,ONE_CHAR:z,DOTS_SLASH:ee,NO_DOT:pe,NO_DOT_SLASH:re,NO_DOTS_SLASH:oe,QMARK:D,QMARK_NO_DOT:ne,STAR:j,START_ANCHOR:ce}=F,q=c=>`(${y}(?:(?!${ce}${c.dot?ee:Y}).)*?)`,v=s.dot?"":pe,k=s.dot?D:ne;let X=s.bash===!0?q(s):j;s.capture&&(X=`(${X})`),typeof s.noext=="boolean"&&(s.noextglob=s.noext);const i={input:d,index:-1,start:0,dot:s.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:E};d=t.removePrefix(d,i),S=d.length;const I=[],B=[],fe=[];let r=m,u;const Q=()=>i.index===S-1,w=i.peek=(c=1)=>d[i.index+c],se=i.advance=()=>d[++i.index]||"",ue=()=>d.slice(i.index+1),V=(c="",P=0)=>{i.consumed+=c,i.index+=P},Ve=c=>{i.output+=c.output!=null?c.output:c.value,V(c.value)},Mt=()=>{let c=1;for(;w()==="!"&&(w(2)!=="("||w(3)==="?");)se(),i.start++,c++;return c%2===0?!1:(i.negated=!0,i.start++,!0)},Ye=c=>{i[c]++,fe.push(c)},ge=c=>{i[c]--,fe.pop()},A=c=>{if(r.type==="globstar"){const P=i.braces>0&&(c.type==="comma"||c.type==="brace"),p=c.extglob===!0||I.length&&(c.type==="pipe"||c.type==="paren");c.type!=="slash"&&c.type!=="paren"&&!P&&!p&&(i.output=i.output.slice(0,-r.output.length),r.type="star",r.value="*",r.output=X,i.output+=r.output)}if(I.length&&c.type!=="paren"&&(I[I.length-1].inner+=c.value),(c.value||c.output)&&Ve(c),r&&r.type==="text"&&c.type==="text"){r.output=(r.output||r.value)+c.value,r.value+=c.value;return}c.prev=r,E.push(c),r=c},Je=(c,P)=>{const p={...U[P],conditions:1,inner:""};p.prev=r,p.parens=i.parens,p.output=i.output,p.startIndex=i.index,p.tokensIndex=E.length;const x=(s.capture?"(":"")+p.open;Ye("parens"),A({type:c,value:P,output:i.output?"":z}),A({type:"paren",extglob:!0,value:se(),output:x}),I.push(p)},Bt=c=>{const P=d.slice(c.startIndex,i.index+1),p=d.slice(c.startIndex+2,i.index),x=Z(p,s);if((c.type==="plus"||c.type==="star")&&x.risky){const N=x.safeOutput?(c.output?"":z)+(s.capture?`(${x.safeOutput})`:x.safeOutput):void 0,ie=E[c.tokensIndex];ie.type="text",ie.value=P,ie.output=N||t.escapeRegex(P);for(let le=c.tokensIndex+1;le<E.length;le++)E[le].value="",E[le].output="",delete E[le].suffix;i.output=c.output+ie.output,i.backtrack=!0,A({type:"paren",extglob:!0,value:u,output:""}),ge("parens");return}let G=c.close+(s.capture?")":""),K;if(c.type==="negate"){let N=X;if(c.inner&&c.inner.length>1&&c.inner.includes("/")&&(N=q(s)),(N!==X||Q()||/^\)+$/.test(ue()))&&(G=c.close=`)$))${N}`),c.inner.includes("*")&&(K=ue())&&/^\.[^\\/.]+$/.test(K)){const ie=M(K,{...h,fastpaths:!1}).output;G=c.close=`)${ie})${N})`}c.prev.type==="bos"&&(i.negatedExtglob=!0)}A({type:"paren",extglob:!0,value:u,output:G}),ge("parens")};if(s.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(d)){let c=!1,P=d.replace(n,(p,x,G,K,N,ie)=>K==="\\"?(c=!0,p):K==="?"?x?x+K+(N?D.repeat(N.length):""):ie===0?k+(N?D.repeat(N.length):""):D.repeat(G.length):K==="."?Y.repeat(G.length):K==="*"?x?x+K+(N?X:""):X:x?p:`\\${p}`);return c===!0&&(s.unescape===!0?P=P.replace(/\\/g,""):P=P.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),P===d&&s.contains===!0?(i.output=d,i):(i.output=t.wrapOutput(P,i,h),i)}for(;!Q();){if(u=se(),u==="\0")continue;if(u==="\\"){const p=w();if(p==="/"&&s.bash!==!0||p==="."||p===";")continue;if(!p){u+="\\",A({type:"text",value:u});continue}const x=/^\\+/.exec(ue());let G=0;if(x&&x[0].length>2&&(G=x[0].length,i.index+=G,G%2!==0&&(u+="\\")),s.unescape===!0?u=se():u+=se(),i.brackets===0){A({type:"text",value:u});continue}}if(i.brackets>0&&(u!=="]"||r.value==="["||r.value==="[^")){if(s.posix!==!1&&u===":"){const p=r.value.slice(1);if(p.includes("[")&&(r.posix=!0,p.includes(":"))){const x=r.value.lastIndexOf("["),G=r.value.slice(0,x),K=r.value.slice(x+2),N=H[K];if(N){r.value=G+N,i.backtrack=!0,se(),!m.output&&E.indexOf(r)===1&&(m.output=z);continue}}}(u==="["&&w()!==":"||u==="-"&&w()==="]")&&(u=`\\${u}`),u==="]"&&(r.value==="["||r.value==="[^")&&(u=`\\${u}`),s.posix===!0&&u==="!"&&r.value==="["&&(u="^"),r.value+=u,Ve({value:u});continue}if(i.quotes===1&&u!=='"'){u=t.escapeRegex(u),r.value+=u,Ve({value:u});continue}if(u==='"'){i.quotes=i.quotes===1?0:1,s.keepQuotes===!0&&A({type:"text",value:u});continue}if(u==="("){Ye("parens"),A({type:"paren",value:u});continue}if(u===")"){if(i.parens===0&&s.strictBrackets===!0)throw new SyntaxError(a("opening","("));const p=I[I.length-1];if(p&&i.parens===p.parens+1){Bt(I.pop());continue}A({type:"paren",value:u,output:i.parens?")":"\\)"}),ge("parens");continue}if(u==="["){if(s.nobracket===!0||!ue().includes("]")){if(s.nobracket!==!0&&s.strictBrackets===!0)throw new SyntaxError(a("closing","]"));u=`\\${u}`}else Ye("brackets");A({type:"bracket",value:u});continue}if(u==="]"){if(s.nobracket===!0||r&&r.type==="bracket"&&r.value.length===1){A({type:"text",value:u,output:`\\${u}`});continue}if(i.brackets===0){if(s.strictBrackets===!0)throw new SyntaxError(a("opening","["));A({type:"text",value:u,output:`\\${u}`});continue}ge("brackets");const p=r.value.slice(1);if(r.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(u=`/${u}`),r.value+=u,Ve({value:u}),s.literalBrackets===!1||t.hasRegexChars(p))continue;const x=t.escapeRegex(r.value);if(i.output=i.output.slice(0,-r.value.length),s.literalBrackets===!0){i.output+=x,r.value=x;continue}r.value=`(${y}${x}|${r.value})`,i.output+=r.value;continue}if(u==="{"&&s.nobrace!==!0){Ye("braces");const p={type:"brace",value:u,output:"(",outputIndex:i.output.length,tokensIndex:i.tokens.length};B.push(p),A(p);continue}if(u==="}"){const p=B[B.length-1];if(s.nobrace===!0||!p){A({type:"text",value:u,output:u});continue}let x=")";if(p.dots===!0){const G=E.slice(),K=[];for(let N=G.length-1;N>=0&&(E.pop(),G[N].type!=="brace");N--)G[N].type!=="dots"&&K.unshift(G[N].value);x=f(K,s),i.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){const G=i.output.slice(0,p.outputIndex),K=i.tokens.slice(p.tokensIndex);p.value=p.output="\\{",u=x="\\}",i.output=G;for(const N of K)i.output+=N.output||N.value}A({type:"brace",value:u,output:x}),ge("braces"),B.pop();continue}if(u==="|"){I.length>0&&I[I.length-1].conditions++,A({type:"text",value:u});continue}if(u===","){let p=u;const x=B[B.length-1];x&&fe[fe.length-1]==="braces"&&(x.comma=!0,p="|"),A({type:"comma",value:u,output:p});continue}if(u==="/"){if(r.type==="dot"&&i.index===i.start+1){i.start=i.index+1,i.consumed="",i.output="",E.pop(),r=m;continue}A({type:"slash",value:u,output:J});continue}if(u==="."){if(i.braces>0&&r.type==="dot"){r.value==="."&&(r.output=Y);const p=B[B.length-1];r.type="dots",r.output+=u,r.value+=u,p.dots=!0;continue}if(i.braces+i.parens===0&&r.type!=="bos"&&r.type!=="slash"){A({type:"text",value:u,output:Y});continue}A({type:"dot",value:u,output:Y});continue}if(u==="?"){if(!(r&&r.value==="(")&&s.noextglob!==!0&&w()==="("&&w(2)!=="?"){Je("qmark",u);continue}if(r&&r.type==="paren"){const p=w();let x=u;(r.value==="("&&!/[!=<:]/.test(p)||p==="<"&&!/<([!=]|\w+>)/.test(ue()))&&(x=`\\${u}`),A({type:"text",value:u,output:x});continue}if(s.dot!==!0&&(r.type==="slash"||r.type==="bos")){A({type:"qmark",value:u,output:ne});continue}A({type:"qmark",value:u,output:D});continue}if(u==="!"){if(s.noextglob!==!0&&w()==="("&&(w(2)!=="?"||!/[!=<:]/.test(w(3)))){Je("negate",u);continue}if(s.nonegate!==!0&&i.index===0){Mt();continue}}if(u==="+"){if(s.noextglob!==!0&&w()==="("&&w(2)!=="?"){Je("plus",u);continue}if(r&&r.value==="("||s.regex===!1){A({type:"plus",value:u,output:ae});continue}if(r&&(r.type==="bracket"||r.type==="paren"||r.type==="brace")||i.parens>0){A({type:"plus",value:u});continue}A({type:"plus",value:ae});continue}if(u==="@"){if(s.noextglob!==!0&&w()==="("&&w(2)!=="?"){A({type:"at",extglob:!0,value:u,output:""});continue}A({type:"text",value:u});continue}if(u!=="*"){(u==="$"||u==="^")&&(u=`\\${u}`);const p=b.exec(ue());p&&(u+=p[0],i.index+=p[0].length),A({type:"text",value:u});continue}if(r&&(r.type==="globstar"||r.star===!0)){r.type="star",r.star=!0,r.value+=u,r.output=X,i.backtrack=!0,i.globstar=!0,V(u);continue}let c=ue();if(s.noextglob!==!0&&/^\([^?]/.test(c)){Je("star",u);continue}if(r.type==="star"){if(s.noglobstar===!0){V(u);continue}const p=r.prev,x=p.prev,G=p.type==="slash"||p.type==="bos",K=x&&(x.type==="star"||x.type==="globstar");if(s.bash===!0&&(!G||c[0]&&c[0]!=="/")){A({type:"star",value:u,output:""});continue}const N=i.braces>0&&(p.type==="comma"||p.type==="brace"),ie=I.length&&(p.type==="pipe"||p.type==="paren");if(!G&&p.type!=="paren"&&!N&&!ie){A({type:"star",value:u,output:""});continue}for(;c.slice(0,3)==="/**";){const le=d[i.index+4];if(le&&le!=="/")break;c=c.slice(3),V("/**",3)}if(p.type==="bos"&&Q()){r.type="globstar",r.value+=u,r.output=q(s),i.output=r.output,i.globstar=!0,V(u);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!K&&Q()){i.output=i.output.slice(0,-(p.output+r.output).length),p.output=`(?:${p.output}`,r.type="globstar",r.output=q(s)+(s.strictSlashes?")":"|$)"),r.value+=u,i.globstar=!0,i.output+=p.output+r.output,V(u);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&c[0]==="/"){const le=c[1]!==void 0?"|$":"";i.output=i.output.slice(0,-(p.output+r.output).length),p.output=`(?:${p.output}`,r.type="globstar",r.output=`${q(s)}${J}|${J}${le})`,r.value+=u,i.output+=p.output+r.output,i.globstar=!0,V(u+se()),A({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&c[0]==="/"){r.type="globstar",r.value+=u,r.output=`(?:^|${J}|${q(s)}${J})`,i.output=r.output,i.globstar=!0,V(u+se()),A({type:"slash",value:"/",output:""});continue}if(N&&c[0]==="/"){r.type="globstar",r.value+=u,r.output=`(?:^|${J}|${q(s)}${J})`,i.output+=r.output,i.globstar=!0,V(u+se()),A({type:"slash",value:"/",output:""});continue}i.output=i.output.slice(0,-r.output.length),r.type="globstar",r.output=q(s),r.value+=u,i.output+=r.output,i.globstar=!0,V(u);continue}const P={type:"star",value:u,output:X};if(s.bash===!0){P.output=".*?",(r.type==="bos"||r.type==="slash")&&(P.output=v+P.output),A(P);continue}if(r&&(r.type==="bracket"||r.type==="paren")&&s.regex===!0){P.output=u,A(P);continue}(i.index===i.start||r.type==="slash"||r.type==="dot")&&(r.type==="dot"?(i.output+=re,r.output+=re):s.dot===!0?(i.output+=oe,r.output+=oe):(i.output+=v,r.output+=v),w()!=="*"&&(i.output+=z,r.output+=z)),A(P)}for(;i.brackets>0;){if(s.strictBrackets===!0)throw new SyntaxError(a("closing","]"));i.output=t.escapeLast(i.output,"["),ge("brackets")}for(;i.parens>0;){if(s.strictBrackets===!0)throw new SyntaxError(a("closing",")"));i.output=t.escapeLast(i.output,"("),ge("parens")}for(;i.braces>0;){if(s.strictBrackets===!0)throw new SyntaxError(a("closing","}"));i.output=t.escapeLast(i.output,"{"),ge("braces")}if(s.strictSlashes!==!0&&(r.type==="star"||r.type==="bracket")&&A({type:"maybe_slash",value:"",output:`${J}?`}),i.backtrack===!0){i.output="";for(const c of i.tokens)i.output+=c.output!=null?c.output:c.value,c.suffix&&(i.output+=c.suffix)}return i};return M.fastpaths=(d,h)=>{const s={...h},$=typeof s.maxLength=="number"?Math.min(o,s.maxLength):o,S=d.length;if(S>$)throw new SyntaxError(`Input length: ${S}, exceeds maximum allowed length: ${$}`);d=l[d]||d;const{DOT_LITERAL:m,SLASH_LITERAL:E,ONE_CHAR:y,DOTS_SLASH:F,NO_DOT:U,NO_DOTS:Y,NO_DOTS_SLASH:ae,STAR:J,START_ANCHOR:z}=e.globChars(s.windows),ee=s.dot?Y:U,pe=s.dot?ae:U,re=s.capture?"":"?:",oe={negated:!1,prefix:""};let D=s.bash===!0?".*?":J;s.capture&&(D=`(${D})`);const ne=v=>v.noglobstar===!0?D:`(${re}(?:(?!${z}${v.dot?F:m}).)*?)`,j=v=>{switch(v){case"*":return`${ee}${y}${D}`;case".*":return`${m}${y}${D}`;case"*.*":return`${ee}${D}${m}${y}${D}`;case"*/*":return`${ee}${D}${E}${y}${pe}${D}`;case"**":return ee+ne(s);case"**/*":return`(?:${ee}${ne(s)}${E})?${pe}${y}${D}`;case"**/*.*":return`(?:${ee}${ne(s)}${E})?${pe}${D}${m}${y}${D}`;case"**/.*":return`(?:${ee}${ne(s)}${E})?${m}${y}${D}`;default:{const k=/^(.*?)\.(\w+)$/.exec(v);if(!k)return;const X=j(k[1]);return X?X+m+k[2]:void 0}}},ce=t.removePrefix(d,oe);let q=j(ce);return q&&s.strictSlashes!==!0&&(q+=`${E}?`),q},rt=M,rt}var nt,Et;function Fo(){if(Et)return nt;Et=1;const e=zo(),t=Ko(),o=tt(),H=et(),b=l=>l&&typeof l=="object"&&!Array.isArray(l),n=(l,f,a=!1)=>{if(Array.isArray(l)){const W=l.map(Z=>n(Z,f,a));return Z=>{for(const M of W){const d=M(Z);if(d)return d}return!1}}const _=b(l)&&l.tokens&&l.input;if(l===""||typeof l!="string"&&!_)throw new TypeError("Expected pattern to be a non-empty string");const g=f||{},T=g.windows,C=_?n.compileRe(l,f):n.makeRe(l,f,!1,!0),R=C.state;delete C.state;let L=()=>!1;if(g.ignore){const W={...f,ignore:null,onMatch:null,onResult:null};L=n(g.ignore,W,a)}const te=(W,Z=!1)=>{const{isMatch:M,match:d,output:h}=n.test(W,C,f,{glob:l,posix:T}),s={glob:l,state:R,regex:C,posix:T,input:W,output:h,match:d,isMatch:M};if(typeof g.onResult=="function"&&g.onResult(s),M===!1)return s.isMatch=!1,Z?s:!1;e:if(L(W)){if(typeof g.onIgnore=="function"&&g.onIgnore(s)===H.UNIGNORE){s.isMatch=!0;break e}return s.isMatch=!1,Z?s:!1}return typeof g.onMatch=="function"&&g.onMatch(s),Z?s:!0};return a&&(te.state=R),te};return n.test=(l,f,a,{glob:_,posix:g}={})=>{if(typeof l!="string")throw new TypeError("Expected input to be a string");if(l==="")return{isMatch:!1,output:""};const T=a||{},C=T.format||(g?o.toPosixSlashes:null);let R=l===_,L=R&&C?C(l):l;return R===!1&&(L=C?C(l):l,R=L===_),(R===!1||T.capture===!0)&&(T.matchBase===!0||T.basename===!0?R=n.matchBase(l,f,a,g):R=f.exec(L)),{isMatch:!!R,match:R,output:L}},n.matchBase=(l,f,a,_=a&&a.windows)=>(f instanceof RegExp?f:n.makeRe(f,a)).test(o.basename(l,{windows:_})),n.isMatch=(l,f,a)=>n(f,a)(l),n.parse=(l,f)=>Array.isArray(l)?l.map(a=>n.parse(a,f)):t(l,{...f,fastpaths:!1}),n.scan=(l,f)=>e(l,f),n.compileRe=(l,f,a=!1,_=!1)=>{if(a===!0)return l.output;const g=f||{},T=g.contains?"":"^",C=g.contains?"":"$";let R=`${T}(?:${l.output})${C}`;l&&l.negated===!0&&(R=`^(?!${R}).*$`);const L=n.toRegex(R,f);return _===!0&&(L.state=l),L},n.makeRe=(l,f={},a=!1,_=!1)=>{if(!l||typeof l!="string")throw new TypeError("Expected a non-empty string");let g={negated:!1,fastpaths:!0};return f.fastpaths!==!1&&(l[0]==="."||l[0]==="*")&&(g.output=t.fastpaths(l,f)),g.output||(g=t(l,f)),n.compileRe(g,f,a,_)},n.toRegex=(l,f)=>{try{const a=f||{};return new RegExp(l,a.flags||(a.nocase?"i":""))}catch(a){if(f&&f.debug===!0)throw a;return/$^/}},n.constants=H,nt=n,nt}var ut,_t;function Xo(){if(_t)return ut;_t=1;const e=Fo(),t=tt();function o(H,b,n=!1){return b&&(b.windows===null||b.windows===void 0)&&(b={...b,windows:t.isWindows()}),e(H,b,n)}return Object.assign(o,e),ut=o,ut}var jo=Xo();ct(jo);let qo;const Qo=e=>(qo??=O(import.meta.url))(e),we=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ze=e=>{if(typeof we<"u"&&we.versions&&we.versions.node){const[t,o]=we.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return we.getBuiltinModule(e)}return Qo(e)};Ze("fs");Ze("fs");Ze("path");Ze("url");const{createRequire:Wo}=Ze("module");var Rt=Wo(import.meta.url);try{Rt.resolve("picomatch"),Rt("picomatch")}catch{}var it,At;function Zo(){if(At)return it;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 it=function(e){if(typeof e!="string"||e==="")return!1;for(var t;t=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(t[2])return!0;e=e.slice(t.index+t[0].length)}return!1},it}var lt,Tt;function St(){if(Tt)return lt;Tt=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 e=Zo(),t={"{":"}","(":")","[":"]"},o=function(b){if(b[0]==="!")return!0;for(var n=0,l=-2,f=-2,a=-2,_=-2,g=-2;n<b.length;){if(b[n]==="*"||b[n+1]==="?"&&/[\].+)]/.test(b[n])||f!==-1&&b[n]==="["&&b[n+1]!=="]"&&(f<n&&(f=b.indexOf("]",n)),f>n&&(g===-1||g>f||(g=b.indexOf("\\",n),g===-1||g>f)))||a!==-1&&b[n]==="{"&&b[n+1]!=="}"&&(a=b.indexOf("}",n),a>n&&(g=b.indexOf("\\",n),g===-1||g>a))||_!==-1&&b[n]==="("&&b[n+1]==="?"&&/[:!=]/.test(b[n+2])&&b[n+3]!==")"&&(_=b.indexOf(")",n),_>n&&(g=b.indexOf("\\",n),g===-1||g>_))||l!==-1&&b[n]==="("&&b[n+1]!=="|"&&(l<n&&(l=b.indexOf("|",n)),l!==-1&&b[l+1]!==")"&&(_=b.indexOf(")",l),_>l&&(g=b.indexOf("\\",l),g===-1||g>_))))return!0;if(b[n]==="\\"){var T=b[n+1];n+=2;var C=t[T];if(C){var R=b.indexOf(C,n);R!==-1&&(n=R+1)}if(b[n]==="!")return!0}else n++}return!1},H=function(b){if(b[0]==="!")return!0;for(var n=0;n<b.length;){if(/[*?{}()[\]]/.test(b[n]))return!0;if(b[n]==="\\"){var l=b[n+1];n+=2;var f=t[l];if(f){var a=b.indexOf(f,n);a!==-1&&(n=a+1)}if(b[n]==="!")return!0}else n++}return!1};return lt=function(b,n){if(typeof b!="string"||b==="")return!1;if(e(b))return!0;var l=o;return n&&n.strict===!1&&(l=H),l(b)},lt}let Vo;const Yo=e=>(Vo??=O(import.meta.url))(e),ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ot=e=>{if(typeof ke<"u"&&ke.versions&&ke.versions.node){const[t,o]=ke.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return ke.getBuiltinModule(e)}return Yo(e)},Jo=Ot("path"),es=Ot("os");var at,xt;function ts(){if(xt)return at;xt=1;var e=St(),t=Jo.posix.dirname,o=es.platform()==="win32",H="/",b=/\\/g,n=/\\([!*?|[\](){}])/g;at=function(a,_){var g=Object.assign({flipBackslashes:!0},_);g.flipBackslashes&&o&&a.indexOf(H)<0&&(a=a.replace(b,H)),l(a)&&(a+=H),a+="a";do a=t(a);while(f(a));return a.replace(n,"$1")};function l(a){var _=a.slice(-1),g;switch(_){case"}":g="{";break;case"]":g="[";break;default:return!1}var T=a.indexOf(g);return T<0?!1:a.slice(T+1,-1).includes(H)}function f(a){return/\([^()]+$/.test(a)||a[0]==="{"||a[0]==="["||/[^\\][{[]/.test(a)?!0:e(a)}return at}var os=ts();ct(os);let ss;const rs=e=>(ss??=O(import.meta.url))(e),He=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ns=e=>{if(typeof He<"u"&&He.versions&&He.versions.node){const[t,o]=He.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return He.getBuiltinModule(e)}return rs(e)};ns("node:fs/promises");let us;const is=e=>(us??=O(import.meta.url))(e),Ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ls=e=>{if(typeof Ne<"u"&&Ne.versions&&Ne.versions.node){const[t,o]=Ne.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ne.getBuiltinModule(e)}return is(e)};ls("node:fs");var as=St();ct(as);let ps;const cs=e=>(ps??=O(import.meta.url))(e),Le=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,wt=e=>{if(typeof Le<"u"&&Le.versions&&Le.versions.node){const[t,o]=Le.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Le.getBuiltinModule(e)}return cs(e)};wt("node:fs/promises");wt("node:fs");let fs=class extends Error{constructor(t){super(`ENOENT: ${t}`)}get code(){return"ENOENT"}set code(t){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(t){throw new Error("Cannot overwrite name of NotFoundError")}},gs=class extends Error{constructor(t){super(`EPERM: Operation not permitted, ${t}`)}get code(){return"EPERM"}set code(t){throw new Error("Cannot overwrite code EPERM")}get name(){return"PermissionError"}set name(t){throw new Error("Cannot overwrite name of PermissionError")}};const ds=(e,t)=>{const o=e?.code;return o==="ENOENT"?new fs(`no such file or directory, open '${t}'`):o==="EACCES"||o==="EPERM"?new gs(`unable to read the non-readable file: ${t}`):e};let bs;const hs=e=>(bs??=O(import.meta.url))(e),Me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kt=e=>{if(typeof Me<"u"&&Me.versions&&Me.versions.node){const[t,o]=Me.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Me.getBuiltinModule(e)}return hs(e)},{readFile:ms}=kt("node:fs/promises"),{unzip:ys,brotliDecompress:vs}=kt("node:zlib"),$s={brotli:vs,gzip:ys,none:(e,t)=>{t(null,e)}},gr=async(e,t)=>{Yt(e),e=Vt(e);const{buffer:o,compression:H,encoding:b,flag:n}=t??{};let l;try{l=await ms(e,n?{flag:n}:{})}catch(f){throw ds(f,e)}return await new Promise((f,a)=>{$s[H??"none"](l,(_,g)=>{_?a(_):f(o?g:g.toString(b??"utf8"))})})};let Es;const _s=e=>(Es??=O(import.meta.url))(e),Be=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ht=e=>{if(typeof Be<"u"&&Be.versions&&Be.versions.node){const[t,o]=Be.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Be.getBuiltinModule(e)}return _s(e)};Ht("node:fs");Ht("node:zlib");let Rs;const As=e=>(Rs??=O(import.meta.url))(e),Ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ts=e=>{if(typeof Ie<"u"&&Ie.versions&&Ie.versions.node){const[t,o]=Ie.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ie.getBuiltinModule(e)}return As(e)},{createRequire:Nt}=Ts("node:module"),xs=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&xs.set("AggregateError",AggregateError);let Cs;const Ss=e=>(Cs??=Nt(import.meta.url))(e),Pe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Os=e=>{if(typeof Pe<"u"&&Pe.versions&&Pe.versions.node){const[t,o]=Pe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Pe.getBuiltinModule(e)}return Ss(e)};Os("node:util");let ws;const ks=e=>(ws??=Nt(import.meta.url))(e),De=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=e=>{if(typeof De<"u"&&De.versions&&De.versions.node){const[t,o]=De.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return De.getBuiltinModule(e)}return ks(e)};ft("node:fs");ft("node:path");ft("node:url");let Hs;const Ns=e=>(Hs??=O(import.meta.url))(e),Ge=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Lt=e=>{if(typeof Ge<"u"&&Ge.versions&&Ge.versions.node){const[t,o]=Ge.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ge.getBuiltinModule(e)}return Ns(e)};Lt("node:fs");Lt("node:fs/promises");let Ls;const Ms=e=>(Ls??=O(import.meta.url))(e),Ue=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Bs=e=>{if(typeof Ue<"u"&&Ue.versions&&Ue.versions.node){const[t,o]=Ue.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ue.getBuiltinModule(e)}return Ms(e)};Bs("node:fs");let Is;const Ps=e=>(Is??=O(import.meta.url))(e),ze=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ds=e=>{if(typeof ze<"u"&&ze.versions&&ze.versions.node){const[t,o]=ze.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return ze.getBuiltinModule(e)}return Ps(e)};Ds("node:fs/promises");let Gs;const Us=e=>(Gs??=O(import.meta.url))(e),Ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,zs=e=>{if(typeof Ke<"u"&&Ke.versions&&Ke.versions.node){const[t,o]=Ke.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ke.getBuiltinModule(e)}return Us(e)};zs("node:fs");let Ks;const Fs=e=>(Ks??=O(import.meta.url))(e),Fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xs=e=>{if(typeof Fe<"u"&&Fe.versions&&Fe.versions.node){const[t,o]=Fe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Fe.getBuiltinModule(e)}return Fs(e)};Xs("node:crypto");new TextEncoder;let js;const qs=e=>(js??=O(import.meta.url))(e),Xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Qs=e=>{if(typeof Xe<"u"&&Xe.versions&&Xe.versions.node){const[t,o]=Xe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Xe.getBuiltinModule(e)}return qs(e)};Qs("node:fs/promises");let Ws;const Zs=e=>(Ws??=O(import.meta.url))(e),je=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Vs=e=>{if(typeof je<"u"&&je.versions&&je.versions.node){const[t,o]=je.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return je.getBuiltinModule(e)}return Zs(e)};Vs("node:fs");let Ys;const Js=e=>(Ys??=O(import.meta.url))(e),qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,er=e=>{if(typeof qe<"u"&&qe.versions&&qe.versions.node){const[t,o]=qe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return qe.getBuiltinModule(e)}return Js(e)};er("node:fs/promises");let tr;const or=e=>(tr??=O(import.meta.url))(e),Qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,sr=e=>{if(typeof Qe<"u"&&Qe.versions&&Qe.versions.node){const[t,o]=Qe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Qe.getBuiltinModule(e)}return or(e)};sr("node:fs");let rr;const nr=e=>(rr??=O(import.meta.url))(e),We=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,gt=e=>{if(typeof We<"u"&&We.versions&&We.versions.node){const[t,o]=We.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return We.getBuiltinModule(e)}return nr(e)},ur=gt("fs"),ir=gt("os"),lr=gt("path");var pt={},Ct;function ar(){if(Ct)return pt;Ct=1;var e=Object.defineProperty,t=(g,T)=>e(g,"name",{value:T,configurable:!0}),o=ur,H=ir,b=lr;const n=t(g=>{let T="";for(let C=0;C<g.length;C+=1){const R=g[C],L=R.toUpperCase();T+=R===L?R.toLowerCase():L}return T},"invertCase"),l=new Map,f=t((g,T)=>{const C=b.join(g,`.is-fs-case-sensitive-test-${process.pid}`);try{return T.writeFileSync(C,""),!T.existsSync(n(C))}finally{try{T.unlinkSync(C)}catch{}}},"checkDirectoryCaseWithWrite"),a=t((g,T,C)=>{try{return f(g,C)}catch(R){if(T===void 0)return f(H.tmpdir(),C);throw R}},"checkDirectoryCaseWithFallback"),_=t((g,T=o,C=!0)=>{const R=g??process.cwd();if(C&&l.has(R))return l.get(R);let L;const te=n(R);return te!==R&&T.existsSync(R)?L=!T.existsSync(te):L=a(R,g,T),C&&l.set(R,L),L},"isFsCaseSensitive");return pt.isFsCaseSensitive=_,pt}ar();export{gr as q};
@@ -1 +0,0 @@
1
- import c from"./EmailError-CDvYwuqz.js";import v from"./RequiredOptionError-DU2lxzk3.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-CylyuRaN.js";import{i as g}from"./retry-CG9iT2wF.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-DjPzWncP.js";import{d as u}from"./address-formatter-BWR2Dddx.js";import{p as z}from"./attachment-processor-D1cbAhQi.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};
@@ -1,3 +0,0 @@
1
- import{createRequire as g}from"node:module";import o from"./EmailError-CDvYwuqz.js";let p;const m=e=>(p??=g(import.meta.url))(e),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 m(e)},{Buffer:d}=u("node:buffer"),{X509Certificate:S,createVerify:y}=u("node:crypto"),b={Notification:["Message","MessageId","Subject","Timestamp","TopicArn","Type"],SubscriptionConfirmation:["Message","MessageId","SubscribeURL","Timestamp","Token","TopicArn","Type"],UnsubscribeConfirmation:["Message","MessageId","SubscribeURL","Timestamp","Token","TopicArn","Type"]},h=/^sns\.[a-z0-9-]+\.amazonaws\.com(?:\.cn)?$/,w=/\.$/,T=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 h.test(s)},_=async e=>{if(!T(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=b[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},k=async(e,t={})=>{const{certificateResolver:s=_}=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 S(f).publicKey}catch(l){throw new o("webhooks","Failed to parse SNS signing certificate",{cause:l})}let c;try{c=y(r).update(i,"utf8").verify(a,d.from(e.Signature,"base64"))}catch{return{reason:"signature-malformed",valid:!1}}return c?{valid:!0}:{reason:"signature-mismatch",valid:!1}};export{T as isValidSigningCertUrl,k as verifySnsMessage};
@@ -1 +0,0 @@
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};
@@ -1 +0,0 @@
1
- import o from"./EmailError-CDvYwuqz.js";import f from"./RequiredOptionError-DU2lxzk3.js";import{e as g}from"./generate-message-id-gXAuMz4g.js";import{m as h}from"./make-request-CylyuRaN.js";import{i as y}from"./retry-CG9iT2wF.js";import{defineProvider as b}from"./defineProvider-C9q-7iwt.js";import{c as v}from"./attachment-processor-D1cbAhQi.js";import{h as w,P as T,c as A}from"./provider-base-DjPzWncP.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,p=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 u=>{const c=await v(u,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,p),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{E as default};
@@ -1 +0,0 @@
1
- import{defineProvider as l}from"./defineProvider-C9q-7iwt.js";import o from"./smtpProvider-CIXMxPu-.js";const s="mailcrab",u="localhost",n=1025,g=l((t={})=>{const e={debug:t.debug??!1,host:t.host??u,logger:t.logger,port:t.port??n,retries:t.retries,secure:t.secure??!1,timeout:t.timeout},a=o({debug:e.debug,host:e.host,logger:e.logger,port:e.port,retries:e.retries,secure:e.secure,timeout:e.timeout});return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){await a.initialize()},async isAvailable(){return a.isAvailable()},name:s,options:e,async sendEmail(i){const r=await a.sendEmail(i);return r.success&&r.data?{data:{...r.data,provider:s},success:!0}:r},async validateCredentials(){return a.validateCredentials?.()??!1}}});export{g as default};
@@ -1 +0,0 @@
1
- import c from"./EmailError-CDvYwuqz.js";import P from"./RequiredOptionError-DU2lxzk3.js";import{e as I}from"./generate-message-id-gXAuMz4g.js";import{s as T}from"./headers-to-record-De1Eg951.js";import{m as d}from"./make-request-CylyuRaN.js";import{i as g}from"./retry-CG9iT2wF.js";import{s as A,a as k}from"./sanitize-header-DtQwAnzg.js";import{f as z}from"./validate-email-options-mCM9dVug.js";import{defineProvider as j}from"./defineProvider-C9q-7iwt.js";import{P as E,h as f,c as C}from"./provider-base-DjPzWncP.js";import{j as u,g as h}from"./address-formatter-BWR2Dddx.js";const r="mailpace",M="https://app.mailpace.com/api/v1",S=3e4,q=3,R=j((o={})=>{if(!o.apiToken)throw new P(r,"apiToken");const s={apiToken:o.apiToken,debug:o.debug??!1,endpoint:o.endpoint??M,retries:o.retries??q,timeout:o.timeout??S,...o.logger&&{logger:o.logger}},l=new E,i=C(r,o.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!1},async getEmail(e){try{if(!e)return{error:new c(r,"Email ID is required to retrieve email details"),success:!1};await l.ensureInitialized(()=>this.initialize(),r);const a={Authorization:`Bearer ${s.apiToken}`,"Content-Type":"application/json"};i.debug("Retrieving email details",{id:e});const t=await g(async()=>d(`${s.endpoint}/emails/${e}`,{headers:a,method:"GET",timeout:s.timeout}),s.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(a){return{error:f(r,"retrieve email",a,i),success:!1}}},async initialize(){await l.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(r,"MailPace API not available or invalid API token");i.debug("Provider initialized successfully")},r)},async isAvailable(){try{const e={Authorization:`Bearer ${s.apiToken}`,"Content-Type":"application/json"};i.debug("Checking MailPace API availability");const a=await d(`${s.endpoint}/account`,{headers:e,method:"GET",timeout:s.timeout});return i.debug("MailPace API availability check response:",{error:a.error instanceof Error?a.error.message:void 0,statusCode:a.data?.statusCode,success:a.success}),!!(a.success&&a.data&&typeof a.data=="object"&&"statusCode"in a.data&&typeof a.data.statusCode=="number"&&a.data.statusCode>=200&&a.data.statusCode<300)}catch(e){return i.debug("Error checking availability:",e),!1}},name:r,options:s,async sendEmail(e){try{const a=z(e);if(a.length>0)return{error:new c(r,`Invalid email options: ${a.join(", ")}`),success:!1};await l.ensureInitialized(()=>this.initialize(),r);const t={from:h(e.from),subject:e.subject,to:u(e.to)};if(e.html&&(t.htmlbody=e.html),e.text&&(t.textbody=e.text),e.cc&&(t.cc=u(e.cc)),e.bcc&&(t.bcc=u(e.bcc)),e.replyTo&&(t.replyto=h(e.replyTo)),e.templateId&&(t.template_id=e.templateId,e.templateVariables&&(t.template_variables=e.templateVariables)),e.tags&&e.tags.length>0&&(t.tags=e.tags),e.listUnsubscribe&&(t.list_unsubscribe=e.listUnsubscribe),e.headers){const y=T(e.headers),p={};Object.entries(y).forEach(([v,w])=>{p[A(v)]=k(w)}),t.headers=p}e.attachments&&e.attachments.length>0&&(t.attachments=e.attachments),i.debug("Sending email via MailPace API",{subject:t.subject,to:t.to});const b={Authorization:`Bearer ${s.apiToken}`,"Content-Type":"application/json"},n=await g(async()=>d(`${s.endpoint}/send`,{headers:b,method:"POST",timeout:s.timeout},JSON.stringify(t)),s.retries);if(!n.success)return i.debug("API request failed when sending email",n.error),{error:n.error??new c(r,"Failed to send email"),success:!1};const m=n.data?.body?.id??I();return i.debug("Email sent successfully",{messageId:m}),{data:{messageId:m,provider:r,response:n.data,sent:!0,timestamp:new Date},success:!0}}catch(a){return{error:f(r,"send email",a,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{R as default};
@@ -1 +0,0 @@
1
- import p from"./EmailError-CDvYwuqz.js";import g from"./RequiredOptionError-DU2lxzk3.js";import{e as v}from"./generate-message-id-gXAuMz4g.js";import{s as b}from"./headers-to-record-De1Eg951.js";import{m as w}from"./make-request-CylyuRaN.js";import{i as K}from"./retry-CG9iT2wF.js";import{f as S}from"./validate-email-options-mCM9dVug.js";import{defineProvider as P}from"./defineProvider-C9q-7iwt.js";import{f as l,a as u}from"./address-formatter-BWR2Dddx.js";import{c as x}from"./attachment-processor-D1cbAhQi.js";import{h as A,P as T,c as j}from"./provider-base-DjPzWncP.js";const a="mailchannels",I="https://api.mailchannels.net/tx/v1/send",_=3e4,z=3,N=P((t={})=>{if(!t.apiKey)throw new g(a,"apiKey");const r={apiKey:t.apiKey,debug:t.debug??!1,endpoint:t.endpoint??I,logger:t.logger,retries:t.retries??z,timeout:t.timeout??_},f=new T,h=j(a,t.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){f.setInitialized()},async isAvailable(){return r.apiKey.length>0},name:a,options:r,async sendEmail(e){try{const s=S(e);if(s.length>0)return{error:new p(a,`Invalid email options: ${s.join(", ")}`),success:!1};const o=[];e.text&&o.push({type:"text/plain",value:e.text}),e.html&&o.push({type:"text/html",value:e.html});const c={to:l(e.to)};e.cc&&(c.cc=l(e.cc)),e.bcc&&(c.bcc=l(e.bcc));const n={content:o,from:u(e.from),personalizations:[c],subject:e.subject};e.replyTo&&(n.reply_to=u(e.replyTo)),e.headers&&(n.headers=b(e.headers)),e.attachments&&e.attachments.length>0&&(n.attachments=await Promise.all(e.attachments.map(async y=>{const m=await x(y,a);return{content:m.content,filename:m.filename,type:m.contentType}})));const i=await K(async()=>w(r.endpoint,{headers:{"Content-Type":"application/json","X-Api-Key":r.apiKey},method:"POST",timeout:r.timeout},JSON.stringify(n)),r.retries);if(!i.success)return{error:i.error??new p(a,"Failed to send email"),success:!1};const{body:d}=i.data;return{data:{messageId:d?.message_id??d?.request_id??v(),provider:a,response:i.data,sent:!0,timestamp:new Date},success:!0}}catch(s){return{error:A(a,"send email",s,h),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{N as default};
@@ -1 +0,0 @@
1
- import l from"./EmailError-CDvYwuqz.js";import y from"./RequiredOptionError-DU2lxzk3.js";import{e as b}from"./generate-message-id-gXAuMz4g.js";import{s as v}from"./headers-to-record-De1Eg951.js";import{m}from"./make-request-CylyuRaN.js";import{i as g}from"./retry-CG9iT2wF.js";import{f as w}from"./validate-email-options-mCM9dVug.js";import{defineProvider as I}from"./defineProvider-C9q-7iwt.js";import{P as A,h as f,c as T}from"./provider-base-DjPzWncP.js";import{f as u,a as k}from"./address-formatter-BWR2Dddx.js";import{p as P}from"./attachment-processor-D1cbAhQi.js";const r="mailersend",z="https://api.mailersend.com",C=3e4,S=3,O=I((n={})=>{if(!n.apiToken)throw new y(r,"apiToken");const i={apiToken:n.apiToken,debug:n.debug??!1,endpoint:n.endpoint??z,retries:n.retries??S,timeout:n.timeout??C,...n.logger&&{logger:n.logger}},c=new A,s=T(r,n.logger);return{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 l(r,"Email ID is required to retrieve email details"),success:!1};await c.ensureInitialized(()=>this.initialize(),r);const a={Authorization:`Bearer ${i.apiToken}`,"Content-Type":"application/json"};s.debug("Retrieving email details",{id:e});const t=await g(async()=>m(`${i.endpoint}/v1/activity/${e}`,{headers:a,method:"GET",timeout:i.timeout}),i.retries);return t.success?(s.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(s.debug("API request failed when retrieving email",t.error),{error:new l(r,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(a){return{error:f(r,"retrieve email",a,s),success:!1}}},async initialize(){await c.ensureInitialized(async()=>{if(!await this.isAvailable())throw new l(r,"MailerSend API not available or invalid API token");s.debug("Provider initialized successfully")},r)},async isAvailable(){try{const e={Authorization:`Bearer ${i.apiToken}`,"Content-Type":"application/json"};s.debug("Checking MailerSend API availability");const a=await m(`${i.endpoint}/v1/tokens/verify`,{headers:e,method:"GET",timeout:i.timeout});return s.debug("MailerSend API availability check response:",{error:a.error instanceof Error?a.error.message:void 0,statusCode:a.data?.statusCode,success:a.success}),!!(a.success&&a.data&&typeof a.data=="object"&&"statusCode"in a.data&&typeof a.data.statusCode=="number"&&a.data.statusCode>=200&&a.data.statusCode<300)}catch(e){return s.debug("Error checking availability:",e),!1}},name:r,options:i,async sendEmail(e){try{const a=w(e);if(a.length>0)return{error:new l(r,`Invalid email options: ${a.join(", ")}`),success:!1};await c.ensureInitialized(()=>this.initialize(),r);const t={from:{email:e.from.email,name:e.from.name},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.reply_to=k(e.replyTo)),e.templateId&&(t.template_id=e.templateId,e.templateVariables&&(t.variables=e.templateVariables)),e.personalization&&e.personalization.length>0&&(t.personalization=e.personalization),e.tags&&e.tags.length>0&&(t.tags=e.tags),e.scheduledAt&&(t.send_at=e.scheduledAt),e.domainId&&(t.domain_id=e.domainId),e.headers){const o=v(e.headers);t.headers=o}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async o=>({content:await P(o,r),filename:o.filename,...o.contentType&&{type:o.contentType},...o.cid&&{id:o.cid}})))),s.debug("Sending email via MailerSend API",{subject:t.subject,to:t.to});const h={Authorization:`Bearer ${i.apiToken}`,"Content-Type":"application/json"},d=await g(async()=>m(`${i.endpoint}/v1/email`,{headers:h,method:"POST",timeout:i.timeout},JSON.stringify(t)),i.retries);if(!d.success)return s.debug("API request failed when sending email",d.error),{error:d.error??new l(r,"Failed to send email"),success:!1};const p=d.data?.body?.message_id??b();return s.debug("Email sent successfully",{messageId:p}),{data:{messageId:p,provider:r,response:d.data,sent:!0,timestamp:new Date},success:!0}}catch(a){return{error:f(r,"send email",a,s),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{O as default};
@@ -1 +0,0 @@
1
- import{createRequire as I}from"node:module";import m from"./EmailError-CDvYwuqz.js";import w from"./RequiredOptionError-DU2lxzk3.js";import{e as _}from"./generate-message-id-gXAuMz4g.js";import{s as R}from"./headers-to-record-De1Eg951.js";import{m as h}from"./make-request-CylyuRaN.js";import{i as T}from"./retry-CG9iT2wF.js";import{f as S}from"./validate-email-options-mCM9dVug.js";import{defineProvider as z}from"./defineProvider-C9q-7iwt.js";import{P as E,h as j,c as q}from"./provider-base-DjPzWncP.js";import{e as b,g as k}from"./address-formatter-BWR2Dddx.js";import{a as U}from"./attachment-processor-D1cbAhQi.js";let A;const C=o=>(A??=I(import.meta.url))(o),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=o=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[r,n]=u.versions.node.split(".").map(Number);if(r>22||r===22&&n>=3||r===20&&n>=16)return u.getBuiltinModule(o)}return C(o)},{Buffer:y}=P("node:buffer"),a="mailgun",M="https://api.mailgun.net",K=3e4,B=3,x=o=>{const r=[];for(const[n,i]of Object.entries(o))if(i!=null)if(Array.isArray(i))for(const e of i)r.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(e))}`);else typeof i=="object"?r.push(`${encodeURIComponent(n)}=${encodeURIComponent(JSON.stringify(i))}`):r.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`);return r.join("&")},Y=z((o={})=>{if(!o.apiKey)throw new w(a,"apiKey");if(!o.domain)throw new w(a,"domain");const r={apiKey:o.apiKey,debug:o.debug??!1,domain:o.domain,endpoint:o.endpoint??M,retries:o.retries??B,timeout:o.timeout??K,...o.logger&&{logger:o.logger}},n=new E,i=q(a,o.logger);return{endpoint:r.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 m(a,"Email ID is required to retrieve email details"),success:!1};await n.ensureInitialized(()=>this.initialize(),a);const s={Authorization:`Basic ${y.from(`api:${r.apiKey}`).toString("base64")}`,"Content-Type":"application/json"};i.debug("Retrieving email details",{id:e});const t=await T(async()=>h(`${r.endpoint}/v3/${r.domain}/events?message-id=${encodeURIComponent(e)}&limit=1`,{headers:s,method:"GET",timeout:r.timeout}),r.retries);if(!t.success)return i.debug("API request failed when retrieving email",t.error),{error:new m(a,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1};i.debug("Email details retrieved successfully");const p=t.data?.items??[],g=p.length>0?p[0]:void 0;return{data:g?.message?.headers??g?.storage??void 0,success:!0}}catch(s){return{error:j(a,"retrieve email",s,i),success:!1}}},async initialize(){await n.ensureInitialized(async()=>{if(!await this.isAvailable())throw new m(a,"Mailgun API not available or invalid API key/domain");i.debug("Provider initialized successfully")},a)},async isAvailable(){try{const e={Authorization:`Basic ${y.from(`api:${r.apiKey}`).toString("base64")}`,"Content-Type":"application/json"};i.debug("Checking Mailgun API availability");const s=await h(`${r.endpoint}/v3/domains/${r.domain}`,{headers:e,method:"GET",timeout:r.timeout});if(i.debug("Mailgun API availability check response:",{error:s.error instanceof Error?s.error.message:void 0,statusCode:s.data?.statusCode,success:s.success}),!s.success||!s.data||typeof s.data!="object")return!1;const{statusCode:t}=s.data;return typeof t=="number"&&t>=200&&t<300}catch(e){return i.debug("Error checking availability:",e),!1}},name:a,options:r,async sendEmail(e){try{const s=S(e);if(s.length>0)return{error:new m(a,`Invalid email options: ${s.join(", ")}`),success:!1};await n.ensureInitialized(()=>this.initialize(),a);const t={from:k(e.from),to:b(e.to).join(",")};if(e.subject&&(t.subject=e.subject),e.cc&&(t.cc=b(e.cc).join(",")),e.bcc&&(t.bcc=b(e.bcc).join(",")),e.replyTo&&(t["h:Reply-To"]=k(e.replyTo)),e.html&&(t.html=e.html),e.text&&(t.text=e.text),e.template&&(t.template=e.template,e.templateVariables))for(const[d,c]of Object.entries(e.templateVariables))t[`v:${d}`]=c;if(e.tags&&e.tags.length>0&&(t["o:tag"]=e.tags),e.campaignId&&(t["o:campaign"]=e.campaignId),e.deliveryTime&&(t["o:deliverytime"]=typeof e.deliveryTime=="number"?new Date(e.deliveryTime*1e3).toUTCString():e.deliveryTime),e.clickTracking!==void 0&&(t["o:clicktracking"]=e.clickTracking?"yes":"no"),e.openTracking!==void 0&&(t["o:tracking"]=e.openTracking?"yes":"no"),e.unsubscribeTracking!==void 0&&(t["o:tracking-clicks"]=e.unsubscribeTracking?"yes":"no"),e.testMode&&(t["o:testmode"]="yes"),e.requireTls&&(t["o:require-tls"]="yes"),e.skipVerification&&(t["o:skip-verification"]="yes"),e.headers){const d=R(e.headers);for(const[c,f]of Object.entries(d))t[`h:${c}`]=f}if(e.attachments&&e.attachments.length>0){const d=await Promise.all(e.attachments.map((c,f)=>U(c,a,f)));for(const c of d)t[c.key]=c.content}i.debug("Sending email via Mailgun API",{subject:t.subject,to:t.to});const p={Authorization:`Basic ${y.from(`api:${r.apiKey}`).toString("base64")}`,"Content-Type":"application/x-www-form-urlencoded"},g=x(t),l=await T(async()=>h(`${r.endpoint}/v3/${r.domain}/messages`,{headers:p,method:"POST",timeout:r.timeout},g),r.retries);if(!l.success)return i.debug("API request failed when sending email",l.error),{error:l.error??new m(a,"Failed to send email"),success:!1};const v=l.data?.body?.id??_();return i.debug("Email sent successfully",{messageId:v}),{data:{messageId:v,provider:a,response:l.data,sent:!0,timestamp:new Date},success:!0}}catch(s){return{error:j(a,"send email",s,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{Y as default};
@@ -1 +0,0 @@
1
- import{createRequire as S}from"node:module";import u from"./EmailError-CDvYwuqz.js";import h from"./RequiredOptionError-DU2lxzk3.js";import{e as E}from"./generate-message-id-gXAuMz4g.js";import{s as M}from"./headers-to-record-De1Eg951.js";import{m as g}from"./make-request-CylyuRaN.js";import{i as b}from"./retry-CG9iT2wF.js";import{f as z}from"./validate-email-options-mCM9dVug.js";import{defineProvider as D}from"./defineProvider-C9q-7iwt.js";import{P as R,h as v,c as q}from"./provider-base-DjPzWncP.js";import{h as f,i as T}from"./address-formatter-BWR2Dddx.js";import{p as B}from"./attachment-processor-D1cbAhQi.js";let P;const A=i=>(P??=S(import.meta.url))(i),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=i=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[a,c]=d.versions.node.split(".").map(Number);if(a>22||a===22&&c>=3||a===20&&c>=16)return d.getBuiltinModule(i)}return A(i)},{Buffer:p}=_("node:buffer"),s="mailjet",k="https://api.mailjet.com",K=3e4,L=3,Y=D((i={})=>{if(!i.apiKey)throw new h(s,"apiKey");if(!i.apiSecret)throw new h(s,"apiSecret");const a={apiKey:i.apiKey,apiSecret:i.apiSecret,debug:i.debug??!1,endpoint:i.endpoint??k,retries:i.retries??L,timeout:i.timeout??K,...i.logger&&{logger:i.logger}},c=new R,o=q(s,i.logger);return{endpoint:a.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 u(s,"Email ID is required to retrieve email details"),success:!1};await c.ensureInitialized(()=>this.initialize(),s);const r={Authorization:`Basic ${p.from(`${a.apiKey}:${a.apiSecret}`).toString("base64")}`,"Content-Type":"application/json"};o.debug("Retrieving email details",{id:e});const t=await b(async()=>g(`${a.endpoint}/v3.1/REST/message/${e}`,{headers:r,method:"GET",timeout:a.timeout}),a.retries);return t.success?(o.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(o.debug("API request failed when retrieving email",t.error),{error:new u(s,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(r){return{error:v(s,"retrieve email",r,o),success:!1}}},async initialize(){await c.ensureInitialized(async()=>{if(!await this.isAvailable())throw new u(s,"Mailjet API not available or invalid API credentials");o.debug("Provider initialized successfully")},s)},async isAvailable(){try{const e={Authorization:`Basic ${p.from(`${a.apiKey}:${a.apiSecret}`).toString("base64")}`,"Content-Type":"application/json"};o.debug("Checking Mailjet API availability");const r=await g(`${a.endpoint}/v3.1/REST/user`,{headers:e,method:"GET",timeout:a.timeout});return o.debug("Mailjet API availability check response:",{error:r.error instanceof Error?r.error.message:void 0,statusCode:r.data?.statusCode,success:r.success}),!!(r.success&&r.data&&typeof r.data=="object"&&"statusCode"in r.data&&typeof r.data.statusCode=="number"&&r.data.statusCode>=200&&r.data.statusCode<300)}catch(e){return o.debug("Error checking availability:",e),!1}},name:s,options:a,async sendEmail(e){try{const r=z(e);if(r.length>0)return{error:new u(s,`Invalid email options: ${r.join(", ")}`),success:!1};await c.ensureInitialized(()=>this.initialize(),s);const t={From:T(e.from),Subject:e.subject,To:f(e.to)};if(e.html&&(t.HTMLPart=e.html),e.text&&(t.TextPart=e.text),e.cc&&(t.Cc=f(e.cc)),e.bcc&&(t.Bcc=f(e.bcc)),e.replyTo&&(t.ReplyTo=T(e.replyTo)),e.templateId&&(t.TemplateID=e.templateId,t.TemplateLanguage=e.templateLanguage??!0,e.templateVariables&&(t.Variables=e.templateVariables)),e.customId&&(t.CustomID=e.customId),e.eventPayload&&(t.EventPayload=e.eventPayload),e.campaign&&(t.Campaign=e.campaign),e.deduplicateCampaign!==void 0&&(t.DeduplicateCampaign=e.deduplicateCampaign),e.deliveryTime&&(t.Deliverytime=new Date(e.deliveryTime*1e3).toISOString()),e.priority!==void 0&&(t.Priority=e.priority),e.urlTags&&(t.URLTags=e.urlTags),e.tags&&e.tags.length>0&&(t.CustomCampaign=e.tags.join(",")),e.headers){const n=M(e.headers),m=[];for(const[C,I]of Object.entries(n))m.push({Name:C,Value:String(I)});m.length>0&&(t.Headers=m)}e.attachments&&e.attachments.length>0&&(t.Attachments=await Promise.all(e.attachments.map(async n=>({Base64Content:await B(n,s),ContentType:n.contentType??"application/octet-stream",Filename:n.filename,...n.cid&&{ContentID:n.cid}}))));const j={Messages:[t]};o.debug("Sending email via Mailjet API",{subject:t.Subject,to:t.To});const w={Authorization:`Basic ${p.from(`${a.apiKey}:${a.apiSecret}`).toString("base64")}`,"Content-Type":"application/json"},l=await b(async()=>g(`${a.endpoint}/v3.1/send`,{headers:w,method:"POST",timeout:a.timeout},JSON.stringify(j)),a.retries);if(!l.success)return o.debug("API request failed when sending email",l.error),{error:l.error??new u(s,"Failed to send email"),success:!1};const y=l.data?.body?.Messages?.[0]?.To?.[0]?.MessageID?.toString()??E();return o.debug("Email sent successfully",{messageId:y}),{data:{messageId:y,provider:s,response:l.data,sent:!0,timestamp:new Date},success:!0}}catch(r){return{error:v(s,"send email",r,o),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{Y as default};
@@ -1 +0,0 @@
1
- import c from"./EmailError-CDvYwuqz.js";import b from"./RequiredOptionError-DU2lxzk3.js";import{e as v}from"./generate-message-id-gXAuMz4g.js";import{s as w}from"./headers-to-record-De1Eg951.js";import{m as g}from"./make-request-CylyuRaN.js";import{i as f}from"./retry-CG9iT2wF.js";import{f as I}from"./validate-email-options-mCM9dVug.js";import{defineProvider as P}from"./defineProvider-C9q-7iwt.js";import{P as A,h,c as T}from"./provider-base-DjPzWncP.js";import{f as d,a as E}from"./address-formatter-BWR2Dddx.js";import{p as K}from"./attachment-processor-D1cbAhQi.js";const a="mailomat",S="https://api.mailomat.com",j=3e4,k=3,X=P((i={})=>{if(!i.apiKey)throw new b(a,"apiKey");const s={apiKey:i.apiKey,debug:i.debug??!1,endpoint:i.endpoint??S,retries:i.retries??k,timeout:i.timeout??j,...i.logger&&{logger:i.logger}},m=new A,r=T(a,i.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new c(a,"Email ID is required to retrieve email details"),success:!1};await m.ensureInitialized(()=>this.initialize(),a);const o={"Content-Type":"application/json","X-API-Key":s.apiKey};r.debug("Retrieving email details",{id:e});const t=await f(async()=>g(`${s.endpoint}/emails/${e}`,{headers:o,method:"GET",timeout:s.timeout}),s.retries);return t.success?(r.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(r.debug("API request failed when retrieving email",t.error),{error:new c(a,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(o){return{error:h(a,"retrieve email",o,r),success:!1}}},async initialize(){await m.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(a,"Mailomat API not available or invalid API key");r.debug("Provider initialized successfully")},a)},async isAvailable(){try{return r.debug("Checking Mailomat API availability"),!0}catch(e){return r.debug("Error checking availability:",e),!1}},name:a,options:s,async sendEmail(e){try{const o=I(e);if(o.length>0)return{error:new c(a,`Invalid email options: ${o.join(", ")}`),success:!1};await m.ensureInitialized(()=>this.initialize(),a);const t={from:{email:e.from.email,name:e.from.name},subject:e.subject,to:d(e.to)};if(e.html&&(t.html=e.html),e.text&&(t.text=e.text),e.cc&&(t.cc=d(e.cc)),e.bcc&&(t.bcc=d(e.bcc)),e.replyTo&&(t.replyTo=E(e.replyTo)),e.templateId&&(t.templateId=e.templateId,e.templateVariables&&(t.templateVariables=e.templateVariables)),e.tags&&e.tags.length>0&&(t.tags=e.tags),e.headers){const n=w(e.headers);t.headers=n}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async n=>({content:await K(n,a),contentType:n.contentType??"application/octet-stream",filename:n.filename,...n.cid&&{cid:n.cid}})))),r.debug("Sending email via Mailomat API",{subject:t.subject,to:t.to});const y={"Content-Type":"application/json","X-API-Key":s.apiKey},l=await f(async()=>g(`${s.endpoint}/send`,{headers:y,method:"POST",timeout:s.timeout},JSON.stringify(t)),s.retries);if(!l.success)return r.debug("API request failed when sending email",l.error),{error:l.error??new c(a,"Failed to send email"),success:!1};const u=l.data?.body,p=u?.messageId??u?.id??v();return r.debug("Email sent successfully",{messageId:p}),{data:{messageId:p,provider:a,response:l.data,sent:!0,timestamp:new Date},success:!0}}catch(o){return{error:h(a,"send email",o,r),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{X as default};
@@ -1 +0,0 @@
1
- import l from"./EmailError-CDvYwuqz.js";import b from"./RequiredOptionError-DU2lxzk3.js";import{e as y}from"./generate-message-id-gXAuMz4g.js";import{s as v}from"./headers-to-record-De1Eg951.js";import{m}from"./make-request-CylyuRaN.js";import{i as g}from"./retry-CG9iT2wF.js";import{f as w}from"./validate-email-options-mCM9dVug.js";import{defineProvider as T}from"./defineProvider-C9q-7iwt.js";import{P as k,h as f,c as A}from"./provider-base-DjPzWncP.js";import{f as u,a as I}from"./address-formatter-BWR2Dddx.js";import{p as P}from"./attachment-processor-D1cbAhQi.js";const r="mailtrap",C="https://send.api.mailtrap.io",E=3e4,j=3,F=T((o={})=>{if(!o.apiToken)throw new b(r,"apiToken");const i={apiToken:o.apiToken,debug:o.debug??!1,endpoint:o.endpoint??C,retries:o.retries??j,timeout:o.timeout??E,...o.logger&&{logger:o.logger}},d=new k,s=A(r,o.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new l(r,"Email ID is required to retrieve email details"),success:!1};await d.ensureInitialized(()=>this.initialize(),r);const a={"Api-Token":i.apiToken,"Content-Type":"application/json"};s.debug("Retrieving email details",{id:e});const t=await g(async()=>m(`${i.endpoint}/api/send/${e}`,{headers:a,method:"GET",timeout:i.timeout}),i.retries);return t.success?(s.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(s.debug("API request failed when retrieving email",t.error),{error:new l(r,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(a){return{error:f(r,"retrieve email",a,s),success:!1}}},async initialize(){await d.ensureInitialized(async()=>{if(!await this.isAvailable())throw new l(r,"Mailtrap API not available or invalid API token");s.debug("Provider initialized successfully")},r)},async isAvailable(){try{const e={"Api-Token":i.apiToken,"Content-Type":"application/json"};s.debug("Checking Mailtrap API availability");const a=await m(`${i.endpoint}/api/account`,{headers:e,method:"GET",timeout:i.timeout});return s.debug("Mailtrap API availability check response:",{error:a.error instanceof Error?a.error.message:void 0,statusCode:a.data?.statusCode,success:a.success}),!!(a.success&&a.data&&typeof a.data=="object"&&"statusCode"in a.data&&typeof a.data.statusCode=="number"&&a.data.statusCode>=200&&a.data.statusCode<300)}catch(e){return s.debug("Error checking availability:",e),!1}},name:r,options:i,async sendEmail(e){try{const a=w(e);if(a.length>0)return{error:new l(r,`Invalid email options: ${a.join(", ")}`),success:!1};await d.ensureInitialized(()=>this.initialize(),r);const t={from:{email:e.from.email,name:e.from.name},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.reply_to=I(e.replyTo)),e.templateUuid&&(t.template_uuid=e.templateUuid,e.templateVariables&&(t.template_variables=e.templateVariables)),e.category&&(t.category=e.category),e.customVariables&&(t.custom_variables=e.customVariables),e.tags&&e.tags.length>0&&(t.tags=e.tags),e.headers){const n=v(e.headers);t.headers=n}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async n=>({content:await P(n,r),filename:n.filename,type:n.contentType??"application/octet-stream",...n.cid&&{cid:n.cid}})))),s.debug("Sending email via Mailtrap API",{subject:t.subject,to:t.to});const h={"Api-Token":i.apiToken,"Content-Type":"application/json"},c=await g(async()=>m(`${i.endpoint}/api/send`,{headers:h,method:"POST",timeout:i.timeout},JSON.stringify(t)),i.retries);if(!c.success)return s.debug("API request failed when sending email",c.error),{error:c.error??new l(r,"Failed to send email"),success:!1};const p=c.data?.body?.message_ids?.[0]??y();return s.debug("Email sent successfully",{messageId:p}),{data:{messageId:p,provider:r,response:c.data,sent:!0,timestamp:new Date},success:!0}}catch(a){return{error:f(r,"send email",a,s),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{F as default};
@@ -1 +0,0 @@
1
- import d from"./EmailError-CDvYwuqz.js";const y=globalThis.Buffer!==void 0,E="ETIMEDOUT",T=async(i,s={},r)=>{const l=typeof i=="string"?new URL(i):i;try{const e=new Headers;s.headers&&Object.entries(s.headers).forEach(([t,u])=>{e.set(t,u)});const o={headers:e,method:s.method??(r?"POST":"GET")};r&&(typeof r=="string"||r instanceof Uint8Array?o.body=r:y&&r instanceof globalThis.Buffer?o.body=new Uint8Array(r):o.body=new Uint8Array(r));let c,a;s.timeout&&(c=new AbortController,a=setTimeout(()=>{c?.abort()},s.timeout),o.signal=c.signal);try{const t=await fetch(l.toString(),o);a&&clearTimeout(a);const u=(t.headers.get("content-type")??"").includes("application/json");let n;if(u)try{n=await t.json()}catch{n=await t.text()}else n=await t.text();const f=t.status>=200&&t.status<300,h={};return t.headers.forEach((m,w)=>{h[w]=m}),{data:{body:n,headers:h,statusCode:t.status},error:f?void 0:new d("http",`Request failed with status ${t.status}`,{code:t.status.toString()}),success:f}}catch(t){if(a&&clearTimeout(a),t instanceof Error&&t.name==="AbortError")return{error:new d("http",`Request timed out after ${s.timeout}ms`,{code:E}),success:!1};throw t}}catch(e){return{error:new d("http",`Request failed: ${e instanceof Error?e.message:String(e)}`,{cause:e instanceof Error?e:new Error(String(e))}),success:!1}}};export{E as R,T as m};
@@ -1 +0,0 @@
1
- import d from"./EmailError-CDvYwuqz.js";import P from"./RequiredOptionError-DU2lxzk3.js";import{e as C}from"./generate-message-id-gXAuMz4g.js";import{s as j}from"./headers-to-record-De1Eg951.js";import{m as g}from"./make-request-CylyuRaN.js";import{i as y}from"./retry-CG9iT2wF.js";import{a as h,s as I}from"./sanitize-header-DtQwAnzg.js";import{f as T}from"./validate-email-options-mCM9dVug.js";import{defineProvider as _}from"./defineProvider-C9q-7iwt.js";import{P as k,h as b,c as z}from"./provider-base-DjPzWncP.js";import{k as p}from"./address-formatter-BWR2Dddx.js";import{p as E}from"./attachment-processor-D1cbAhQi.js";const a="mandrill",S="https://mandrillapp.com/api/1.0",K=3e4,M=3,B=_((l={})=>{if(!l.apiKey)throw new P(a,"apiKey");const s={apiKey:l.apiKey,debug:l.debug??!1,endpoint:l.endpoint??S,retries:l.retries??M,timeout:l.timeout??K,...l.logger&&{logger:l.logger}},u=new k,i=z(a,l.logger);return{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(a,"Email ID is required to retrieve email details"),success:!1};await u.ensureInitialized(()=>this.initialize(),a),i.debug("Retrieving email details",{id:e});const n={id:e,key:s.apiKey},t={"Content-Type":"application/json"},o=await y(async()=>g(`${s.endpoint}/messages/info.json`,{headers:t,method:"POST",timeout:s.timeout},JSON.stringify(n)),s.retries);return o.success?(i.debug("Email details retrieved successfully"),{data:o.data?.body,success:!0}):(i.debug("API request failed when retrieving email",o.error),{error:new d(a,`Failed to retrieve email: ${o.error instanceof Error?o.error.message:"Unknown error"}`,{cause:o.error}),success:!1})}catch(n){return{error:b(a,"retrieve email",n,i),success:!1}}},async initialize(){await u.ensureInitialized(async()=>{if(!await this.isAvailable())throw new d(a,"Mandrill API not available or invalid API key");i.debug("Provider initialized successfully")},a)},async isAvailable(){try{i.debug("Checking Mandrill API availability");const e={key:s.apiKey},n={"Content-Type":"application/json"},t=await g(`${s.endpoint}/users/info.json`,{headers:n,method:"POST",timeout:s.timeout},JSON.stringify(e));return i.debug("Mandrill 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:a,options:s,async sendEmail(e){try{const n=T(e);if(n.length>0)return{error:new d(a,`Invalid email options: ${n.join(", ")}`),success:!1};await u.ensureInitialized(()=>this.initialize(),a);const t={from_email:e.from.email,html:e.html??"",subject:e.subject,text:e.text??"",...e.from.name&&{from_name:e.from.name},to:p(e.to,"to")};if(e.cc){const r=p(e.cc,"cc");for(const c of r)c.type="cc";t.to=[...t.to,...r]}if(e.bcc){const r=p(e.bcc,"bcc");for(const c of r)c.type="bcc";t.to=[...t.to,...r]}if(e.replyTo){const r=e.replyTo.name?`${h(e.replyTo.name)} <${e.replyTo.email}>`:e.replyTo.email;t.headers={"Reply-To":r}}if(e.headers){const r=j(e.headers),c={};Object.entries(r).forEach(([w,A])=>{c[I(w)]=h(A)}),t.headers={...t.headers,...c}}e.tags&&e.tags.length>0&&(t.tags=e.tags),e.metadata&&(t.metadata=e.metadata),(e.googleAnalyticsDomains||e.googleAnalyticsCampaign)&&(t.google_analytics_domains=e.googleAnalyticsDomains,t.google_analytics_campaign=e.googleAnalyticsCampaign),e.subaccount&&(t.subaccount=e.subaccount),e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async r=>({content:await E(r,a),name:r.filename,type:r.contentType??"application/octet-stream"}))));const o={key:s.apiKey,message:t};e.templateName&&(o.template_name=e.templateName,e.templateContent&&(o.template_content=e.templateContent),e.templateVariables&&(o.template_vars=e.templateVariables)),e.globalMergeVars&&(t.global_merge_vars=e.globalMergeVars),e.mergeVars&&(t.merge_vars=e.mergeVars),e.sendAt&&(o.send_at=e.sendAt),i.debug("Sending email via Mandrill API",{subject:t.subject,to:t.to});const v={"Content-Type":"application/json"},m=await y(async()=>g(`${s.endpoint}/messages/send.json`,{headers:v,method:"POST",timeout:s.timeout},JSON.stringify(o)),s.retries);if(!m.success)return i.debug("API request failed when sending email",m.error),{error:m.error??new d(a,"Failed to send email"),success:!1};const f=m.data?.body?.[0]?.id??C();return i.debug("Email sent successfully",{messageId:f}),{data:{messageId:f,provider:a,response:m.data,sent:!0,timestamp:new Date},success:!0}}catch(n){return{error:b(a,"send email",n,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{B as default};
@@ -1 +0,0 @@
1
- import d from"./EmailError-CDvYwuqz.js";import{c as E}from"./create-logger-BQTS3f-I.js";import{e as v}from"./generate-message-id-gXAuMz4g.js";import{f as S}from"./validate-email-options-mCM9dVug.js";import{defineProvider as I}from"./defineProvider-C9q-7iwt.js";const u="mock",p=new Map,D=()=>({debug:!1,delay:0,failureRate:0,randomDelayRange:{max:0,min:0},retries:0,simulateFailure:!1,timeout:0}),C=I((f={})=>{const c=`mock-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;p.has(c)||p.set(c,[]);const a=p.get(c);if(!a)throw new Error(`Storage not found for instance: ${c}`);let y=!1,g;const s={...D(),defaultResponse:f.defaultResponse,logger:f.logger,randomDelayRange:f.randomDelayRange??{max:0,min:0},...f},r=E(u,s.logger);return{clearSentMessages(){a.length=0,r.debug("Cleared all sent messages")},features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!1,tracking:!1},findMessageBy(e){return a.find(t=>e(t))},findMessagesBy(e){return a.filter(t=>e(t))},async getEmail(e){try{if(!e)return{error:new d(u,"Email ID is required to retrieve email details"),success:!1};const t=a.find(o=>o.id===e);return t?(r.debug("Retrieved email",{id:e}),{data:t,success:!0}):{error:new d(u,`Email with ID ${e} not found`),success:!1}}catch(t){return r.debug("Exception retrieving email",t),{error:new d(u,`Failed to retrieve email: ${t.message}`,{cause:t}),success:!1}}},getInstance(){return a},getLastSentMessage(){return a.at(-1)},getMessagesBySubject(e){return a.filter(t=>t.options.subject===e)},getMessagesTo(e){return a.filter(t=>{const o=Array.isArray(t.options.to)?t.options.to:[t.options.to];let i=[];t.options.cc&&(i=Array.isArray(t.options.cc)?t.options.cc:[t.options.cc]);let l=[];return t.options.bcc&&(l=Array.isArray(t.options.bcc)?t.options.bcc:[t.options.bcc]),[...o,...i,...l].some(w=>w.email===e)})},getSentEmails(){return[...a]},getSentMessages(){return[...a]},getSentMessagesCount(){return a.length},async initialize(){y||(s.delay>0&&await new Promise(e=>{setTimeout(e,s.delay)}),y=!0,r.debug("Mock provider initialized"))},async isAvailable(){return!0},name:u,options:s,reset(){a.length=0,g=void 0;const e=D();s.debug=e.debug,s.delay=e.delay,s.failureRate=e.failureRate,s.retries=e.retries,s.simulateFailure=e.simulateFailure,s.timeout=e.timeout,s.randomDelayRange={max:0,min:0},s.defaultResponse=void 0,r.debug("Mock provider reset to initial state")},async sendEmail(e){try{const t=S(e);if(t.length>0)return{error:new d(u,`Invalid email options: ${t.join(", ")}`),success:!1};y||await this.initialize();let o=s.delay;if(s.randomDelayRange&&s.randomDelayRange.max>0){const{max:n,min:m}=s.randomDelayRange;o=Math.floor(Math.random()*(n-m+1))+m}if(o>0&&await new Promise(n=>{setTimeout(n,o)}),g!==void 0){const n=g;if(g=void 0,!n.successful)return r.debug("Using next response (failure)",n),{error:new d(u,n.errorMessages.join(", ")),success:!1};const m=n.messageId||v(),b=n.timestamp||new Date,h={messageId:m,provider:n.provider??u,response:n.response,sent:!0,timestamp:b},x={id:m,options:e,result:h,timestamp:b};return a.push(x),r.debug("Email stored using next response",{messageId:m}),{data:h,success:!0}}if(s.simulateFailure||s.failureRate>0&&Math.random()<s.failureRate)return r.debug("Simulating email send failure"),{error:new d(u,"Simulated failure"),success:!1};const i=s.defaultResponse?.successful?s.defaultResponse.messageId:v(),l=s.defaultResponse?.successful&&s.defaultResponse.timestamp?s.defaultResponse.timestamp:new Date,w=s.defaultResponse&&"response"in s.defaultResponse?s.defaultResponse.response:void 0,R={messageId:i,provider:u,response:w??{mock:!0,stored:!0},sent:!0,timestamp:l},M={id:i,options:e,result:R,timestamp:l};return a.push(M),r.debug("Email stored in mock provider",{messageId:i,subject:e.subject,to:Array.isArray(e.to)?e.to.map(n=>n.email):e.to.email}),{data:R,success:!0}}catch(t){return r.debug("Exception sending email",t),{error:new d(u,`Failed to send email: ${t.message}`,{cause:t}),success:!1}}},setDefaultResponse(e){s.defaultResponse=e,r.debug("Set default response",{receipt:e})},setDelay(e){if(e<0)throw new RangeError("Delay must be non-negative");s.delay=e,s.randomDelayRange={max:0,min:0},r.debug("Set fixed delay",{milliseconds:e})},setFailureRate(e){if(e<0||e>1)throw new RangeError("Failure rate must be between 0.0 and 1.0");s.failureRate=e,r.debug("Set failure rate",{rate:e})},setNextResponse(e){g=e,r.debug("Set next response",{receipt:e})},setRandomDelay(e,t){if(e<0||t<0||e>t)throw new RangeError("Invalid delay range");s.delay=0,s.randomDelayRange={max:t,min:e},r.debug("Set random delay range",{max:t,min:e})},async shutdown(){a.length=0,p.delete(c),r.debug("Mock provider shutdown")},async validateCredentials(){return!0},async waitForMessage(e,t=5e3){const o=Date.now();for(;;){const i=a.find(l=>e(l));if(i)return i;if(Date.now()-o>t)throw new Error("Timeout waiting for message");await new Promise(l=>{setTimeout(l,10)})}},async waitForMessageCount(e,t=5e3){const o=Date.now();for(;a.length<e;){if(Date.now()-o>t)throw new Error(`Timeout waiting for ${e} messages (got ${a.length})`);await new Promise(i=>{setTimeout(i,10)})}}}});export{C as default};
@@ -1 +0,0 @@
1
- import p from"./EmailError-CDvYwuqz.js";import g from"./RequiredOptionError-DU2lxzk3.js";import{e as y}from"./generate-message-id-gXAuMz4g.js";import{m as v}from"./make-request-CylyuRaN.js";import{i as b}from"./retry-CG9iT2wF.js";import{f as w}from"./validate-email-options-mCM9dVug.js";import{defineProvider as P}from"./defineProvider-C9q-7iwt.js";import{P as I,h as A,c as z}from"./provider-base-DjPzWncP.js";import{a as l}from"./address-formatter-BWR2Dddx.js";import{c as K}from"./attachment-processor-D1cbAhQi.js";const a="netcore",S="https://emailapi.netcorecloud.net/v5.1",T=3e4,_=3,m=r=>[r].flat(),F=P((r={})=>{if(!r.apiKey)throw new g(a,"apiKey");const i={apiKey:r.apiKey,debug:r.debug??!1,endpoint:r.endpoint??S,logger:r.logger,retries:r.retries??_,timeout:r.timeout??T},d=new I,u=z(a,r.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async initialize(){await d.ensureInitialized(async()=>{if(!await this.isAvailable())throw new p(a,"Netcore API not available or invalid API key");u.debug("Provider initialized successfully")},a)},async isAvailable(){return i.apiKey.length>0},name:a,options:i,async sendEmail(t){try{const n=w(t);if(n.length>0)return{error:new p(a,`Invalid email options: ${n.join(", ")}`),success:!1};await d.ensureInitialized(()=>this.initialize(),a);const o={to:m(t.to).map(e=>l(e))};t.cc&&(o.cc=m(t.cc).map(e=>l(e))),t.bcc&&(o.bcc=m(t.bcc).map(e=>l(e)));const s={from:l(t.from),personalizations:[o],subject:t.subject};if(t.templateId)s.template_id=t.templateId,t.templateData&&(o.attributes=t.templateData);else{const e=[];t.html&&e.push({type:"html",value:t.html}),t.text&&e.push({type:"plain",value:t.text}),e.length>0&&(s.content=e)}if(t.replyTo){const e=m(t.replyTo)[0];e&&(s.reply_to=e.email)}t.attachments&&t.attachments.length>0&&(s.attachments=await Promise.all(t.attachments.map(async e=>{const h=await K(e,a);return{content:h.content,name:h.filename}})));const c=await b(async()=>v(`${i.endpoint}/mail/send`,{headers:{api_key:i.apiKey,"Content-Type":"application/json"},method:"POST",timeout:i.timeout},JSON.stringify(s)),i.retries);if(!c.success)return{error:c.error??new p(a,"Failed to send email"),success:!1};const{body:f}=c.data;return{data:{messageId:f?.data?.message_id??f?.message_id??y(),provider:a,response:c.data,sent:!0,timestamp:new Date},success:!0}}catch(n){return{error:A(a,"send email",n,u),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{F as default};
@@ -1 +0,0 @@
1
- import u from"nodemailer";import p from"./EmailError-CDvYwuqz.js";import y from"./RequiredOptionError-DU2lxzk3.js";import{e as w}from"./generate-message-id-gXAuMz4g.js";import{s as g}from"./headers-to-record-De1Eg951.js";import{f as $}from"./validate-email-options-mCM9dVug.js";import{defineProvider as v}from"./defineProvider-C9q-7iwt.js";const i="nodemailer",H=v((c={})=>{if(!c.transport)throw new y(i,"transport");let r;const m=t=>{const s=t??c.transport;return u.createTransport(s)};let l=!1;const f=async()=>{if(!l)try{r=m(),await r.verify(),l=!0}catch(t){throw new p(i,`Failed to initialize nodemailer transport: ${t instanceof Error?t.message:String(t)}`,{cause:t instanceof Error?t:new Error(String(t))})}},h=t=>{const s=e=>e.name?`${e.name} <${e.email}>`:e.email,a=e=>e.name?`${e.name} <${e.email}>`:e.email,d=c.defaultFrom??t.from,n={from:s(d),subject:t.subject,to:Array.isArray(t.to)?t.to.map(e=>a(e)):a(t.to)};return t.text&&(n.text=t.text),t.html&&(n.html=t.html),t.cc&&(n.cc=Array.isArray(t.cc)?t.cc.map(e=>a(e)):a(t.cc)),t.bcc&&(n.bcc=Array.isArray(t.bcc)?t.bcc.map(e=>a(e)):a(t.bcc)),t.replyTo&&(n.replyTo=t.replyTo.name?`${t.replyTo.name} <${t.replyTo.email}>`:t.replyTo.email),t.headers&&(n.headers=g(t.headers)),t.attachments&&t.attachments.length>0&&(n.attachments=t.attachments.map(e=>{const o={filename:e.filename};return e.raw!==void 0?o.content=e.raw:e.content!==void 0?o.content=e.content:e.path&&(o.path=e.path),e.contentType&&(o.contentType=e.contentType),e.contentDisposition&&(o.contentDisposition=e.contentDisposition),e.cid&&(o.cid=e.cid),e.encoding&&(o.encoding=e.encoding),e.headers&&(o.headers=e.headers),e.href&&(o.href=e.href),e.httpHeaders&&(o.httpHeaders=e.httpHeaders),o})),n};return{features:{attachments:!0,customHeaders:!0,html:!0,replyTo:!0},initialize:f,isAvailable:async()=>{try{return r??=m(),await r.verify(),!0}catch{return!1}},name:i,options:c,sendEmail:async t=>{const s=$(t);if(s.length>0)return{error:new p(i,`Validation failed: ${s.join(", ")}`),success:!1};try{if(l||await f(),!r)throw new p(i,"Transporter not initialized. Call initialize() first.");const a=t.transportOverride?m(t.transportOverride):r,d=h(t),n=await a.sendMail(d);return{data:{messageId:n.messageId||w(),provider:i,response:n,sent:!0,timestamp:new Date},success:!0}}catch(a){return{error:new p(i,`Failed to send email: ${a instanceof Error?a.message:String(a)}`,{cause:a instanceof Error?a:new Error(String(a))}),success:!1}}},shutdown:async()=>{r&&typeof r.close=="function"&&r.close(),r=void 0,l=!1},validateCredentials:async()=>{try{return r??=m(),await r.verify(),!0}catch{return!1}}}});export{H as default};
@@ -1 +0,0 @@
1
- const u=["re","fwd","fw","aw","wg","sv","vs"];class p{parent=new Map;find(e){if(!this.parent.has(e))return this.parent.set(e,e),e;let t=e,r=this.parent.get(t);for(;r!==void 0&&r!==t;)t=r,r=this.parent.get(t);return this.parent.set(e,t),t}union(e,t){const r=this.find(e),i=this.find(t);r!==i&&this.parent.set(r,i)}}const h=o=>o.replaceAll(/[<>]/g,"").trim(),d=o=>{let e=o.trim(),t=!0;for(;t;){t=!1;for(const r of u){if(!e.toLowerCase().startsWith(r))continue;const i=e.slice(r.length).trimStart();if(i.startsWith(":")){e=i.slice(1).trimStart(),t=!0;break}}}return e.replaceAll(/\s+/g," ").trim().toLowerCase()},g=o=>{const e=new p,t=new Map,r=(s,a)=>{if(s.messageId){const n=h(s.messageId);if(n!=="")return n}return`__index_${String(a)}`};o.forEach((s,a)=>{const n=r(s,a),f=[s.inReplyTo,...s.references].filter(c=>c!==void 0);for(const c of f)e.union(n,h(c));if(f.length===0&&s.subject){const c=d(s.subject);if(c){const l=t.get(c);l?e.union(n,l):t.set(c,n)}}});const i=new Map;return o.forEach((s,a)=>{const n=e.find(r(s,a)),f=i.get(n);f?f.push(s):i.set(n,[s])}),[...i.entries()].map(([s,a])=>({id:s,messages:a}))};export{h as normalizeMessageId,d as normalizeSubject,g as stitchThreads};
@@ -1 +0,0 @@
1
- import{d as k}from"./create-token-cache-D56KQGVQ.js";import{s as m}from"./headers-to-record-De1Eg951.js";const p=r=>{const{fetchToken:o,headerName:a="Authorization",now:n=Date.now,onToken:s,scheme:t="Bearer",skewMs:c=6e4}=r,h=k(async()=>{const e=await o();return s?.(e),e},{now:n,skewMs:c});return async(e,i)=>{const w=await h(),d=e.headers?m(e.headers):{};return i({...e,headers:{...d,[a]:`${t} ${w.accessToken}`}})}};export{p as oauth2Middleware};
@@ -1 +0,0 @@
1
- import{context as f,trace as h,SpanStatusCode as p}from"@opentelemetry/api";import m from"./EmailError-CDvYwuqz.js";import y from"./RequiredOptionError-DU2lxzk3.js";import{c as b}from"./create-logger-BQTS3f-I.js";import{defineProvider as E}from"./defineProvider-C9q-7iwt.js";const A=t=>typeof t=="function",S=t=>t!==null&&typeof t=="object"&&"sendEmail"in t&&"initialize"in t&&"isAvailable"in t,s="opentelemetry",x="email",z="email.send",d=t=>t?typeof t=="string"?t:Array.isArray(t)?t.map(i=>typeof i=="string"?i:i.email).join(", "):t.email:"",C=(t,i)=>{const a={"email.from":d(t.from),"email.subject":t.subject};return t.to&&(a["email.to"]=d(t.to)),t.cc&&(a["email.cc"]=d(t.cc)),t.bcc&&(a["email.bcc"]=d(t.bcc)),t.replyTo&&(a["email.reply_to"]=d(t.replyTo)),t.priority&&(a["email.priority"]=t.priority),t.tags&&t.tags.length>0&&(a["email.tags"]=t.tags.join(", ")),t.attachments&&t.attachments.length>0&&(a["email.attachments.count"]=t.attachments.length),i?(t.text&&(a["email.text.length"]=t.text.length),t.html&&(a["email.html.length"]=t.html.length)):(t.text&&(a["email.has_text"]=!0),t.html&&(a["email.has_html"]=!0)),a},F=E(t=>{if(!t?.provider)throw new y(s,"provider");const i={debug:t.debug??!1,logger:t.logger,provider:t.provider,recordContent:t.recordContent??!1,retries:t.retries??3,serviceName:t.serviceName??x,timeout:t.timeout??3e4,tracer:t.tracer};let a=!1,e;const c=b(s,t.logger),w=()=>i.tracer?i.tracer:h.getTracer(i.serviceName),u=async()=>{try{if(A(i.provider))e=i.provider({});else if(S(i.provider))e=i.provider;else throw new m(s,"Invalid provider: must be a Provider instance or ProviderFactory function");await e.initialize(),c.debug(`Initialized wrapped provider: ${e.name??"unknown"}`)}catch(o){throw new m(s,`Failed to initialize wrapped provider: ${o.message}`,{cause:o})}},v=()=>e?.features?e.features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1};return{get features(){return v()},getInstance(){if(!e)throw new m(s,"Provider not initialized. Call initialize() first.");return e},async initialize(){if(!a)try{await u(),a=!0,c.debug("OpenTelemetry provider initialized")}catch(o){throw new m(s,`Failed to initialize: ${o.message}`,{cause:o})}},async isAvailable(){try{return e||await u(),await e.isAvailable()}catch{return!1}},name:s,options:i,async sendEmail(o){const n=w().startSpan(z);try{e||await u();const l=C(o,i.recordContent);n.setAttributes(l),e.name&&n.setAttribute("email.provider",e.name);const r=await f.with(h.setSpan(f.active(),n),async()=>await e.sendEmail(o));if(r.success&&r.data)return n.setStatus({code:p.OK}),n.setAttribute("email.message_id",r.data.messageId),n.setAttribute("email.sent",!0),r.data.timestamp&&n.setAttribute("email.timestamp",r.data.timestamp.toISOString()),c.debug(`Email sent successfully via ${e.name??"unknown"}`),{data:{...r.data,provider:`${s}(${e.name??"unknown"})`},success:!0};const g=r.error instanceof Error?r.error.message:String(r.error??"Unknown error");return n.setStatus({code:p.ERROR,message:g}),n.setAttribute("email.sent",!1),n.recordException(r.error instanceof Error?r.error:new Error(g)),c.debug(`Failed to send email via ${e.name??"unknown"}:`,g),r}catch(l){const r=l instanceof Error?l.message:String(l);return n.setStatus({code:p.ERROR,message:r}),n.setAttribute("email.sent",!1),n.recordException(l instanceof Error?l:new Error(r)),c.debug("Exception sending email:",r),{error:new m(s,`Failed to send email: ${r}`,{cause:l}),success:!1}}finally{n.end()}},async shutdown(){e?.shutdown&&await e.shutdown(),a=!1},async validateCredentials(){try{return e||await u(),e.validateCredentials?await e.validateCredentials():await e.isAvailable()}catch{return!1}}}});export{F as default};
@@ -1 +0,0 @@
1
- import m from"./EmailError-CDvYwuqz.js";import{e as _}from"./generate-message-id-gXAuMz4g.js";import{m as S}from"./make-request-CylyuRaN.js";import{i as v}from"./retry-CG9iT2wF.js";import{f as A}from"./validate-email-options-mCM9dVug.js";import{defineProvider as C}from"./defineProvider-C9q-7iwt.js";import p from"./RequiredOptionError-DU2lxzk3.js";import{d as x}from"./create-token-cache-D56KQGVQ.js";import{c as M}from"./attachment-processor-D1cbAhQi.js";import{h as P,P as R,c as j}from"./provider-base-DjPzWncP.js";const b="https://login.microsoftonline.com",E=6e4,O=3e4,L=3,q=300,z="https://graph.microsoft.com/.default",D=["https://graph.microsoft.com/Mail.Send","offline_access"],F={accessToken:["clientId","clientSecret","refreshToken","tenantId"],clientCredentials:["refreshToken"],getAccessToken:["accessToken","clientId","clientSecret","refreshToken","tenantId"],refreshToken:[]},N=e=>{let t=e.length;for(;t>0&&e[t-1]==="/";)t-=1;return e.slice(0,t)},U=(e,t)=>{if(e.getAccessToken)return"getAccessToken";if(e.accessToken)return"accessToken";if(e.refreshToken)return"refreshToken";if(e.clientSecret)return"clientCredentials";throw new p(t,["accessToken","getAccessToken","clientSecret","refreshToken"])},B=(e,t,i)=>{const n=e.authMode??U(e,t),h=F[n].filter(a=>e[a]!==void 0);if(h.length>0&&i.warn(`The '${n}' auth mode ignores these configured options: ${h.join(", ")}. Set 'authMode' to pin the intended flow.`),n==="getAccessToken"){const{getAccessToken:a}=e;if(!a)throw new p(t,"getAccessToken");return{getToken:async()=>a(),mode:n}}if(n==="accessToken"){const{accessToken:a}=e;if(!a)throw new p(t,"accessToken");return{getToken:()=>Promise.resolve(a),mode:n}}const{clientId:f,clientSecret:r,refreshToken:c,tenantId:d}=e,o=[];if(d||o.push("tenantId"),f||o.push("clientId"),n==="clientCredentials"&&!r&&o.push("clientSecret"),n==="refreshToken"&&!c&&o.push("refreshToken"),!d||!f)throw new p(t,o);if(n==="clientCredentials"){if(!r)throw new p(t,o);return{clientId:f,clientSecret:r,mode:n,tenantId:d}}if(!c)throw new p(t,o);return{clientId:f,clientSecret:r,mode:n,refreshToken:c,tenantId:d}},H=(e,t,i)=>{if(typeof e!="object"||e===null)throw new m(t,`Token endpoint returned a non-JSON response (status ${String(i)})`);const n=e;if(typeof n.error=="string"){const h=typeof n.error_description=="string"?n.error_description:"no description provided";throw new m(t,`Token request failed: ${n.error} — ${h}`,{code:n.error,hint:"Check the tenantId, clientId and client secret / refresh token in the Azure app registration."})}if(typeof n.access_token!="string")throw new m(t,`Token endpoint response did not contain an access_token (status ${String(i)})`);return{accessToken:n.access_token,expiresIn:typeof n.expires_in=="number"?n.expires_in:q,refreshToken:typeof n.refresh_token=="string"?n.refresh_token:void 0}},J=e=>e===0||e===408||e===429||e>=500,$=(e,t,i,n)=>{if(e.mode==="accessToken"||e.mode==="getAccessToken")return e.getToken;const h=`${N(t.authority??b)}/${e.tenantId}/oauth2/v2.0/token`,f=t.timeout??O,r=t.retries??L,c=t.now??Date.now;let d=e.mode==="refreshToken"?e.refreshToken:void 0;const o=()=>{const s=new URLSearchParams({client_id:e.clientId,scope:(t.scopes??(e.mode==="clientCredentials"?[z]:D)).join(" ")});return e.clientSecret&&s.set("client_secret",e.clientSecret),e.mode==="clientCredentials"?s.set("grant_type","client_credentials"):(s.set("grant_type","refresh_token"),s.set("refresh_token",d)),s.toString()},a=s=>s.data?.statusCode??0,k=async()=>{const s=await S(h,{headers:{"Content-Type":"application/x-www-form-urlencoded"},method:"POST",timeout:f},o());return!s.success&&J(a(s))?s:{data:s.data,success:!0}},T=async s=>{if(d=s,!!t.onRefreshToken)try{await t.onRefreshToken(s)}catch(u){n.error(`Failed to persist the rotated refresh token — the stored token is stale and sending will fail after a restart: ${u instanceof Error?u.message:String(u)}`)}},g=x(async()=>{const s=await v(k,r),u=s.data?.body;if(!s.success&&(typeof u!="object"||u===null))throw s.error instanceof Error?s.error:new m(i,"Token request failed");const w=H(u,i,a(s));return w.refreshToken&&w.refreshToken!==d&&await T(w.refreshToken),{accessToken:w.accessToken,expiresAt:c()+w.expiresIn*1e3}},{now:c,skewMs:t.tokenRefreshSkewMs??E});return async()=>(await g()).accessToken},l="outlook365",G="https://graph.microsoft.com/v1.0",K=3e4,Q=3,y=e=>[e].flat(),I=e=>e.map(t=>({emailAddress:{address:t.email,...t.name?{name:t.name}:{}}})),V=e=>{if(e instanceof m)return e;const t=e instanceof Error?e.message:String(e);return new m(l,`Failed to obtain access token: ${t}`,{cause:e})},ae=C((e={})=>{const t=j(l,e.logger),i=B(e,l,t);if(i.mode==="clientCredentials"&&(e.userId===void 0||e.userId==="me"))throw new m(l,"The app-only (client credentials) flow requires an explicit 'userId'",{hint:"Set 'userId' to the sender's mailbox id or UPN — app-only tokens have no 'me' mailbox."});const n={authMode:i.mode,authority:e.authority??b,clientId:e.clientId,debug:e.debug??!1,endpoint:e.endpoint??G,logger:e.logger,now:e.now,retries:e.retries??Q,saveToSentItems:e.saveToSentItems??!0,scopes:e.scopes,tenantId:e.tenantId,timeout:e.timeout??K,tokenRefreshSkewMs:e.tokenRefreshSkewMs,userId:e.userId??"me"},h=new R,f=$(i,e,l,t);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){h.setInitialized()},async isAvailable(){return!0},name:l,options:n,async sendEmail(r){try{const c=A(r);if(c.length>0)return{error:new m(l,`Invalid email options: ${c.join(", ")}`),success:!1};let d;try{d=await f()}catch(T){return{error:V(T),success:!1}}const o={body:{content:r.html??r.text??"",contentType:r.html?"HTML":"Text"},subject:r.subject,toRecipients:I(y(r.to))};r.cc&&(o.ccRecipients=I(y(r.cc))),r.bcc&&(o.bccRecipients=I(y(r.bcc))),r.replyTo&&(o.replyTo=I(y(r.replyTo))),r.importance&&(o.importance=r.importance),r.attachments&&r.attachments.length>0&&(o.attachments=await Promise.all(r.attachments.map(async T=>{const g=await M(T,l);return{"@odata.type":"#microsoft.graph.fileAttachment",contentBytes:g.content,contentType:g.contentType,name:g.filename}})));const a=n.userId==="me"?"me":`users/${n.userId}`,k=await v(async()=>S(`${n.endpoint}/${a}/sendMail`,{headers:{Authorization:`Bearer ${d}`,"Content-Type":"application/json"},method:"POST",timeout:n.timeout},JSON.stringify({message:o,saveToSentItems:n.saveToSentItems})),n.retries);return k.success?{data:{messageId:_(),provider:l,response:k.data,sent:!0,timestamp:new Date},success:!0}:{error:k.error??new m(l,"Failed to send email"),success:!1}}catch(c){return{error:P(l,"send email",c,t),success:!1}}},async validateCredentials(){try{return await f(),!0}catch(r){return t.warn(`Credential validation failed: ${r instanceof Error?r.message:String(r)}`),!1}}}});export{ae as default};
@@ -1 +0,0 @@
1
- const o=/<[^<>]+>/g,f=/\s+/,a=/^"|"$/g,c=t=>{if(!(t===void 0||t.length===0))return t},l=t=>{if(!t)return;const r=t.trim();if(r.length===0)return;const e=r.lastIndexOf("<"),n=r.lastIndexOf(">");if(e!==-1&&n>e){const s=r.slice(e+1,n).trim(),i=r.slice(0,e).trim().replaceAll(a,"").trim();return i?{email:s,name:i}:{email:s}}return{email:r}},m=t=>{if(!t)return[];const r=[];let e="",n=!1;for(const s of t)s==='"'?(n=!n,e+=s):s===","&&!n?(r.push(e),e=""):e+=s;return e.trim()&&r.push(e),r.map(s=>l(s)).filter(s=>s!==void 0)},p=t=>{if(!t)return[];const r=t.match(o);return r?r.map(e=>e.trim()):t.split(f).map(e=>e.trim()).filter(e=>e.length>0)},u=t=>{const r={};if(!t)return r;for(const[e,n]of Object.entries(t))typeof n=="string"?r[e.toLowerCase()]=n:(typeof n=="number"||typeof n=="boolean")&&(r[e.toLowerCase()]=String(n));return r};export{u as lowercaseHeaders,c as nonEmpty,l as parseAddress,m as parseAddressList,p as parseReferences};
@@ -1,6 +0,0 @@
1
- const l="message/feedback-report",f=i=>{const e=i.replaceAll(`\r
2
- `,`
3
- `);let c=e;const n=e.toLowerCase().indexOf(l);if(n!==-1){const r=e.slice(n),o=r.indexOf(`
4
-
5
- `);c=o===-1?r:r.slice(o+2)}const t={};for(const r of c.split(`
6
- `)){if(r.trim()===""){if(Object.keys(t).length>0)break;continue}const o=r.indexOf(":");if(o===-1)continue;const s=r.slice(0,o).trim().toLowerCase(),a=r.slice(o+1).trim();s&&(t[s]=a)}return t},p=i=>{const e=f(i);return{arrivalDate:e["arrival-date"],feedbackType:e["feedback-type"],fields:e,originalMailFrom:e["original-mail-from"],originalRcptTo:e["original-rcpt-to"],reportedDomain:e["reported-domain"],sourceIp:e["source-ip"]}};export{p as parseArfReport};
@@ -1 +0,0 @@
1
- import{lowercaseHeaders as d,parseAddressList as r,nonEmpty as t,parseAddress as o,parseReferences as n}from"./parseAddress-DdbViBAJ.js";const p=s=>{const e=s.headers instanceof Headers?Object.fromEntries([...s.headers].map(([a,c])=>[a.toLowerCase(),c])):d(s.headers);return{attachments:[],bcc:[],cc:r(e.cc),from:o(s.from??e.from),headers:e,html:t(s.html),inReplyTo:e["in-reply-to"],messageId:e["message-id"],provider:"cloudflare",raw:s,references:n(e.references),replyTo:o(e["reply-to"]),subject:e.subject,text:t(s.text),to:r(s.to??e.to)}};export{p as default};
@@ -1 +0,0 @@
1
- const e=t=>{if(t)return t.split(",").map(r=>r.trim()).filter(r=>r.length>0)},a=t=>{if(t==="s")return"s";if(t==="r")return"r"},c=t=>{if(t==="none"||t==="quarantine"||t==="reject")return t},u=t=>{const r={},f=t.split(";").map(i=>i.trim()).find(i=>i.length>0);for(const i of t.split(";")){const n=i.indexOf("=");if(n===-1)continue;const s=i.slice(0,n).trim().toLowerCase(),p=i.slice(n+1).trim();s&&(r[s]=p)}const o=r.pct===void 0?void 0:Number.parseInt(r.pct,10);return{adkim:a(r.adkim),aspf:a(r.aspf),fo:r.fo,percent:o===void 0||Number.isNaN(o)?void 0:o,policy:c(r.p),rua:e(r.rua),ruf:e(r.ruf),subdomainPolicy:c(r.sp),tags:r,valid:f?.toLowerCase()==="v=dmarc1"}};export{u as parseDmarcRecord};
@@ -1 +0,0 @@
1
- import{parseAddressList as n,nonEmpty as o,parseAddress as c,parseReferences as i}from"./parseAddress-DdbViBAJ.js";const d=r=>{const e={};if(!r)return e;let t;if(typeof r=="string")try{t=JSON.parse(r)}catch{return e}else t=r;for(const[s,a]of t)s&&(e[s.toLowerCase()]=a);return e},p=r=>{if(!r)return;const e=r.trim();return e.startsWith("<")&&e.endsWith(">")?e:`<${e}>`},f=r=>{const e=d(r["message-headers"]);return{attachments:[],bcc:[],cc:n(r.cc),from:c(r.from??r.sender),headers:e,html:o(r["body-html"]),inReplyTo:e["in-reply-to"],messageId:p(r["Message-Id"]??e["message-id"]),provider:"mailgun",raw:r,references:i(e.references),replyTo:c(e["reply-to"]),subject:r.subject,text:o(r["stripped-text"]??r["body-plain"]),to:n(r.To??r.recipient)}};export{f as default};
@@ -1 +0,0 @@
1
- import{nonEmpty as n}from"./parseAddress-DdbViBAJ.js";const m=e=>{if(e?.Email)return e.Name?{email:e.Email,name:e.Name}:{email:e.Email}},a=e=>(e??[]).map(t=>m(t)).filter(t=>t!==void 0),s=e=>{const t={};for(const o of e.Headers??[])o.Name&&(t[o.Name.toLowerCase()]=o.Value??"");const l=(t.references??"").match(/<[^<>]+>/g)??[];return{attachments:(e.Attachments??[]).map(o=>({cid:o.ContentID,content:o.Content,contentType:o.ContentType,filename:o.Name??"attachment",size:o.ContentLength})),bcc:a(e.BccFull),cc:a(e.CcFull),from:m(e.FromFull),headers:t,html:n(e.HtmlBody),inReplyTo:t["in-reply-to"],messageId:t["message-id"]??(e.MessageID?`<${e.MessageID}>`:void 0),provider:"postmark",raw:e,references:l,replyTo:e.ReplyTo?{email:e.ReplyTo}:void 0,subject:e.Subject,text:n(e.TextBody),to:a(e.ToFull)}};export{s as default};
@@ -1,4 +0,0 @@
1
- import{parseAddressList as c,nonEmpty as i,parseAddress as n,parseReferences as a}from"./parseAddress-DdbViBAJ.js";const m=t=>{const e={};if(!t)return e;let s;for(const r of t.replaceAll(`\r
2
- `,`
3
- `).split(`
4
- `)){if((r.startsWith(" ")||r.startsWith(" "))&&s!==void 0){e[s]=`${e[s]??""} ${r.trim()}`.trim();continue}const o=r.indexOf(":");o>0&&(s=r.slice(0,o).trim().toLowerCase(),e[s]=r.slice(o+1).trim())}return e},l=t=>{const e=m(t.headers);return{attachments:[],bcc:[],cc:c(t.cc),from:n(t.from),headers:e,html:i(t.html),inReplyTo:e["in-reply-to"],messageId:e["message-id"],provider:"sendgrid",raw:t,references:a(e.references),replyTo:n(e["reply-to"]),subject:t.subject,text:i(t.text),to:c(t.to)}};export{l as default};
@@ -1 +0,0 @@
1
- import{parseAddressList as t,nonEmpty as c,parseAddress as m,parseReferences as n}from"./parseAddress-DdbViBAJ.js";const p=o=>{const r=o.mail??{},s=r.commonHeaders??{},a={};for(const e of r.headers??[])e.name&&(a[e.name.toLowerCase()]=e.value??"");return{attachments:[],bcc:[],cc:(s.cc??[]).flatMap(e=>t(e)),from:m(s.from?.[0]??r.source),headers:a,html:c(o.html),inReplyTo:a["in-reply-to"],messageId:s.messageId??a["message-id"]??(r.messageId?`<${r.messageId}>`:void 0),provider:"ses",raw:o,references:n(a.references),replyTo:m(s.replyTo?.[0]),subject:s.subject,text:c(o.text),to:(s.to??[]).flatMap(e=>t(e))}};export{p as default};
@@ -1 +0,0 @@
1
- const n=o=>{const t={};for(const e of o.split(";")){const r=e.indexOf("=");if(r===-1)continue;const s=e.slice(0,r).trim().toLowerCase();s&&(t[s]=e.slice(r+1).trim())}return{rua:(t.rua??"").split(",").map(e=>e.trim()).filter(e=>e.length>0),valid:(t.v??"")==="TLSRPTv1",version:t.v}},i=o=>{const t=typeof o=="string"?JSON.parse(o):o,e=t.policies??[];let r=0,s=0;for(const a of e)r+=a.summary?.["total-successful-session-count"]??0,s+=a.summary?.["total-failure-session-count"]??0;return{endDate:t["date-range"]?.["end-datetime"],organizationName:t["organization-name"],policies:e,reportId:t["report-id"],startDate:t["date-range"]?.["start-datetime"],totalFailure:s,totalSuccessful:r}};export{i as parseTlsReport,n as parseTlsRptRecord};
@@ -1 +0,0 @@
1
- import m from"./EmailError-CDvYwuqz.js";import P from"./RequiredOptionError-DU2lxzk3.js";import{e as y}from"./generate-message-id-gXAuMz4g.js";import{s as A}from"./headers-to-record-De1Eg951.js";import{m as b}from"./make-request-CylyuRaN.js";import{i as g}from"./retry-CG9iT2wF.js";import{s as k,a as z}from"./sanitize-header-DtQwAnzg.js";import{f as j}from"./validate-email-options-mCM9dVug.js";import{defineProvider as E}from"./defineProvider-C9q-7iwt.js";import{P as T,h,c as K}from"./provider-base-DjPzWncP.js";import{p as x}from"./attachment-processor-D1cbAhQi.js";const r="plunk",_="https://api.useplunk.com/v1",S=3e4,q=3,U=E((n={})=>{if(!n.apiKey)throw new P(r,"apiKey");const a={apiKey:n.apiKey,debug:n.debug??!1,endpoint:n.endpoint??_,logger:n.logger,retries:n.retries??q,timeout:n.timeout??S},p=new T,i=K(r,n.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new m(r,"Email ID is required to retrieve email details"),success:!1};await p.ensureInitialized(()=>this.initialize(),r);const l={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"};i.debug("Retrieving email details",{id:e});const s=await g(async()=>b(`${a.endpoint}/emails/${e}`,{headers:l,method:"GET",timeout:a.timeout}),a.retries);return s.success?(i.debug("Email details retrieved successfully"),{data:s.data?.body,success:!0}):(i.debug("API request failed when retrieving email",s.error),{error:new m(r,`Failed to retrieve email: ${s.error instanceof Error?s.error.message:"Unknown error"}`,{cause:s.error}),success:!1})}catch(l){return{error:h(r,"retrieve email",l,i),success:!1}}},async initialize(){await p.ensureInitialized(async()=>{if(!await this.isAvailable())throw new m(r,"Plunk API not available or invalid API key");i.debug("Provider initialized successfully")},r)},async isAvailable(){try{return a.apiKey&&a.apiKey.length>0?(i.debug("API key exists, assuming Plunk is available"),!0):!1}catch(e){return i.debug("Error checking availability:",e),!1}},name:r,options:a,async sendEmail(e){try{const l=j(e);if(l.length>0)return{error:new m(r,`Invalid email options: ${l.join(", ")}`),success:!1};await p.ensureInitialized(()=>this.initialize(),r);const s=o=>Array.isArray(o)?o.map(d=>d.email):[o.email],t={to:e.subscriber??(Array.isArray(e.to)?e.to[0]?.email:e.to.email)};if(e.from&&(t.from=e.from.email,e.from.name&&(t.from_name=e.from.name)),e.subject&&(t.subject=e.subject),e.html?t.body=e.html:e.text&&(t.body=e.text),e.html&&e.text&&(t.text=e.text),e.cc&&(t.cc=s(e.cc)),e.bcc&&(t.bcc=s(e.bcc)),e.replyTo&&(t.reply_to=e.replyTo.email,e.replyTo.name&&(t.reply_to_name=e.replyTo.name)),e.templateId&&(t.template=e.templateId),e.data&&(t.data=e.data),e.subscriberId&&(t.subscriber_id=e.subscriberId),e.headers){const o=A(e.headers),d={};Object.entries(o).forEach(([w,I])=>{d[k(w)]=z(I)}),t.headers=d}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async o=>({content:await x(o,r),filename:o.filename,type:o.contentType??"application/octet-stream"})))),i.debug("Sending email via Plunk API",{subject:t.subject,to:t.to});const v={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},c=await g(async()=>b(`${a.endpoint}/send`,{headers:v,method:"POST",timeout:a.timeout},JSON.stringify(t)),a.retries);if(!c.success)return i.debug("API request failed when sending email",c.error),{error:c.error??new m(r,"Failed to send email"),success:!1};const u=c.data,f=u?.body&&typeof u.body=="object"?u.body.id??u.body.messageId??y():y();return i.debug("Email sent successfully",{messageId:f}),{data:{messageId:f,provider:r,response:c.data,sent:!0,timestamp:new Date},success:!0}}catch(l){return{error:h(r,"send email",l,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{U as default};
@@ -1 +0,0 @@
1
- import l from"./EmailError-CDvYwuqz.js";import g from"./RequiredOptionError-DU2lxzk3.js";import{e as w}from"./generate-message-id-gXAuMz4g.js";import{s as P}from"./headers-to-record-De1Eg951.js";import{m}from"./make-request-CylyuRaN.js";import{i as f}from"./retry-CG9iT2wF.js";import{f as I}from"./validate-email-options-mCM9dVug.js";import{defineProvider as A}from"./defineProvider-C9q-7iwt.js";import{P as C,c as E}from"./provider-base-DjPzWncP.js";import{l as u,m as h}from"./address-formatter-BWR2Dddx.js";import{p as T}from"./attachment-processor-D1cbAhQi.js";const a="postal",j=3e4,K=3,R=A((r={})=>{if(!r.host)throw new g(a,"host");if(!r.apiKey)throw new g(a,"apiKey");const y=r.endpoint??`https://${r.host}/api/v1`,i={apiKey:r.apiKey,debug:r.debug??!1,endpoint:y,host:r.host,retries:r.retries??K,timeout:r.timeout??j,...r.logger&&{logger:r.logger}},d=new C,o=E(a,r.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new l(a,"Email ID is required to retrieve email details"),success:!1};await d.ensureInitialized(()=>this.initialize(),a);const t={"Content-Type":"application/json","X-Server-API-Key":i.apiKey};o.debug("Retrieving email details",{id:e});const s=await f(async()=>m(`${i.endpoint}/messages/${e}`,{headers:t,method:"GET",timeout:i.timeout}),i.retries);return s.success?(o.debug("Email details retrieved successfully"),{data:s.data?.body,success:!0}):(o.debug("API request failed when retrieving email",s.error),{error:new l(a,`Failed to retrieve email: ${s.error instanceof Error?s.error.message:"Unknown error"}`,{cause:s.error}),success:!1})}catch(t){return o.debug("Exception retrieving email",t),{error:new l(a,`Failed to retrieve email: ${t.message}`,{cause:t}),success:!1}}},async initialize(){await d.ensureInitialized(async()=>{if(!await this.isAvailable())throw new l(a,"Postal API not available or invalid API key");o.debug("Provider initialized successfully")},a)},async isAvailable(){try{const e={"Content-Type":"application/json","X-Server-API-Key":i.apiKey};o.debug("Checking Postal API availability");const t=await m(`${i.endpoint}/server`,{headers:e,method:"GET",timeout:i.timeout});return o.debug("Postal 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 o.debug("Error checking availability:",e),!1}},name:a,options:i,async sendEmail(e){try{const t=I(e);if(t.length>0)return{error:new l(a,`Invalid email options: ${t.join(", ")}`),success:!1};await d.ensureInitialized(()=>this.initialize(),a);const s={from:h(e.from).address,subject:e.subject,to:u(e.to).map(n=>n.address)};if(e.html&&(s.html_body=e.html),e.text&&(s.plain_body=e.text),e.cc&&(s.cc=u(e.cc).map(n=>n.address)),e.bcc&&(s.bcc=u(e.bcc).map(n=>n.address)),e.replyTo&&(s.reply_to=h(e.replyTo).address),e.templateId&&(s.template_id=e.templateId,e.templateVariables&&(s.template_variables=e.templateVariables)),e.tags&&e.tags.length>0&&(s.tag=e.tags.join(",")),e.headers){const n=P(e.headers);s.headers=n}e.attachments&&e.attachments.length>0&&(s.attachments=await Promise.all(e.attachments.map(async n=>{const v=await T(n,a);return{content_type:n.contentType??"application/octet-stream",data:v,name:n.filename}}))),o.debug("Sending email via Postal API",{subject:s.subject,to:s.to});const b={"Content-Type":"application/json","X-Server-API-Key":i.apiKey},c=await f(async()=>m(`${i.endpoint}/send/message`,{headers:b,method:"POST",timeout:i.timeout},JSON.stringify(s)),i.retries);if(!c.success)return o.debug("API request failed when sending email",c.error),{error:c.error??new l(a,"Failed to send email"),success:!1};const p=c.data?.body?.message_id?.toString()??w();return o.debug("Email sent successfully",{messageId:p}),{data:{messageId:p,provider:a,response:c.data,sent:!0,timestamp:new Date},success:!0}}catch(t){return o.debug("Exception sending email",t),{error:new l(a,`Failed to send email: ${t.message}`,{cause:t}),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{R as default};
@@ -1 +0,0 @@
1
- import d from"./EmailError-CDvYwuqz.js";import T from"./RequiredOptionError-DU2lxzk3.js";import{e as P}from"./generate-message-id-gXAuMz4g.js";import{s as w}from"./headers-to-record-De1Eg951.js";import{m as u}from"./make-request-CylyuRaN.js";import{i as f}from"./retry-CG9iT2wF.js";import{a as I,s as A}from"./sanitize-header-DtQwAnzg.js";import{f as C}from"./validate-email-options-mCM9dVug.js";import{defineProvider as S}from"./defineProvider-C9q-7iwt.js";import{P as j,h,c as E}from"./provider-base-DjPzWncP.js";import{e as p,g as v}from"./address-formatter-BWR2Dddx.js";import{b as z}from"./attachment-processor-D1cbAhQi.js";const r="postmark",M="https://api.postmarkapp.com",O=3e4,H=3,U=S((o={})=>{if(!o.serverToken)throw new T(r,"serverToken");const s={debug:o.debug??!1,endpoint:o.endpoint??M,retries:o.retries??H,serverToken:o.serverToken,timeout:o.timeout??O,...o.logger&&{logger:o.logger}},m=new j,i=E(r,o.logger);return{endpoint:s.endpoint,features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,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 m.ensureInitialized(()=>this.initialize(),r);const a={"Content-Type":"application/json","X-Postmark-Server-Token":s.serverToken};i.debug("Retrieving email details",{id:e});const t=await f(async()=>u(`${s.endpoint}/messages/outbound/${e}/details`,{headers:a,method:"GET",timeout:s.timeout}),s.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 d(r,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(a){return{error:h(r,"retrieve email",a,i),success:!1}}},async initialize(){await m.ensureInitialized(async()=>{if(!await this.isAvailable())throw new d(r,"Postmark API not available or invalid server token");i.debug("Provider initialized successfully")},r)},async isAvailable(){try{const e={"Content-Type":"application/json","X-Postmark-Server-Token":s.serverToken};i.debug("Checking Postmark API availability");const a=await u(`${s.endpoint}/server`,{headers:e,method:"GET",timeout:s.timeout});return i.debug("Postmark API availability check response:",{error:a.error instanceof Error?a.error.message:void 0,statusCode:a.data?.statusCode,success:a.success}),!!(a.success&&a.data&&typeof a.data=="object"&&"statusCode"in a.data&&typeof a.data.statusCode=="number"&&a.data.statusCode>=200&&a.data.statusCode<300)}catch(e){return i.debug("Error checking availability:",e),!1}},name:r,options:s,async sendEmail(e){try{const a=C(e);if(a.length>0)return{error:new d(r,`Invalid email options: ${a.join(", ")}`),success:!1};await m.ensureInitialized(()=>this.initialize(),r);const t={From:v(e.from),Subject:e.subject,To:p(e.to).join(",")};if(e.html&&(t.HtmlBody=e.html),e.text&&(t.TextBody=e.text),e.cc&&(t.Cc=p(e.cc).join(",")),e.bcc&&(t.Bcc=p(e.bcc).join(",")),e.replyTo&&(t.ReplyTo=v(e.replyTo)),e.templateId?(t.TemplateId=e.templateId,e.templateModel&&(t.TemplateModel=e.templateModel)):e.templateAlias&&(t.TemplateAlias=e.templateAlias,e.templateModel&&(t.TemplateModel=e.templateModel)),e.trackOpens!==void 0&&(t.TrackOpens=e.trackOpens),e.trackLinks!==void 0&&(t.TrackLinks=e.trackLinks),e.inlineCss!==void 0&&(t.InlineCss=e.inlineCss),e.messageStream&&(t.MessageStream=e.messageStream),e.metadata&&(t.Metadata=e.metadata),e.tags&&e.tags.length>0){const[l]=e.tags;t.Tag=l}if(e.headers){const l=w(e.headers),c=[];for(const[b,y]of Object.entries(l))c.push({Name:A(b),Value:I(String(y))});c.length>0&&(t.Headers=c)}e.attachments&&e.attachments.length>0&&(t.Attachments=await Promise.all(e.attachments.map(async l=>z(l,r)))),i.debug("Sending email via Postmark API",{subject:t.Subject,to:t.To});const k={"Content-Type":"application/json","X-Postmark-Server-Token":s.serverToken},n=await f(async()=>u(`${s.endpoint}/email`,{headers:k,method:"POST",timeout:s.timeout},JSON.stringify(t)),s.retries);if(!n.success)return i.debug("API request failed when sending email",n.error),{error:n.error??new d(r,"Failed to send email"),success:!1};const g=n.data?.body?.MessageID??P();return i.debug("Email sent successfully",{messageId:g}),{data:{messageId:g,provider:r,response:n.data,sent:!0,timestamp:new Date},success:!0}}catch(a){return{error:h(r,"send email",a,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{U as default};
@@ -1 +0,0 @@
1
- import r from"./EmailError-CDvYwuqz.js";import{c as n}from"./create-logger-BQTS3f-I.js";class l{isInitialized=!1;get initialized(){return this.isInitialized}setInitialized(){this.isInitialized=!0}async ensureInitialized(i,e){if(!this.isInitialized)try{await i(),this.isInitialized=!0}catch(t){throw new r(e,`Failed to initialize: ${t.message}`,{cause:t})}}}const c=(a,i)=>n(a,i),z=(a,i,e,t)=>{const s=`Failed to ${i}: ${e.message}`;return t&&t.debug(`Exception ${i}`,e),new r(a,s,{cause:e})};export{l as P,c,z as h};
@@ -1,7 +0,0 @@
1
- const f=globalThis.Buffer!==void 0,c=/^[\da-f]{2}$/i,p=r=>f?Uint8Array.from(Buffer.from(r,"utf8")):new TextEncoder().encode(r),u=r=>f?Buffer.from(r).toString("utf8"):new TextDecoder().decode(r),s=r=>`=${r.toString(16).toUpperCase().padStart(2,"0")}`,h=r=>{const e=[];for(let o=0;o<r.length;o+=1){const t=r[o],n=o===r.length-1;t===9||t===32?e.push(n?s(t):String.fromCodePoint(t)):t>=33&&t<=126&&t!==61?e.push(String.fromCodePoint(t)):e.push(s(t))}return e},i=r=>{let e="";const o=[];for(const t of r)e.length+t.length>75&&(o.push(`${e}=`),e=""),e+=t;return o.push(e),o.join(`\r
2
- `)},a=r=>r.replaceAll(`\r
3
- `,`
4
- `).replaceAll("\r",`
5
- `).split(`
6
- `).map(e=>i(h(p(e)))).join(`\r
7
- `),d=r=>{const e=r.replaceAll(/=\r?\n/g,""),o=[];for(let t=0;t<e.length;t+=1){const n=e[t];if(n==="="&&t+2<e.length){const l=e.slice(t+1,t+3);c.test(l)?(o.push(Number.parseInt(l,16)),t+=2):o.push(n.charCodeAt(0))}else o.push(n.charCodeAt(0))}return u(Uint8Array.from(o))};export{a as f,d as p};
@@ -1 +0,0 @@
1
- import c from"./EmailError-CDvYwuqz.js";import w from"./RequiredOptionError-DU2lxzk3.js";import{e as I}from"./generate-message-id-gXAuMz4g.js";import{s as P}from"./headers-to-record-De1Eg951.js";import{m as p}from"./make-request-CylyuRaN.js";import{i as y}from"./retry-CG9iT2wF.js";import{f as j}from"./validate-email-options-mCM9dVug.js";import{defineProvider as C}from"./defineProvider-C9q-7iwt.js";import{P as E,h as f,c as T}from"./provider-base-DjPzWncP.js";import{e as z,g as b,d as v}from"./address-formatter-BWR2Dddx.js";import{p as k}from"./attachment-processor-D1cbAhQi.js";const i="resend",S="https://api.resend.com",K=3e4,R=3,_=r=>{const a=[],d=/^[\w-]+$/;return d.test(r.name)||a.push(`Tag name '${r.name}' must only contain ASCII letters, numbers, underscores, or dashes`),r.name.length>256&&a.push(`Tag name '${r.name}' exceeds maximum length of 256 characters`),d.test(r.value)||a.push(`Tag value '${r.value}' for tag '${r.name}' must only contain ASCII letters, numbers, underscores, or dashes`),a},U=C((r={})=>{if(!r.apiKey)throw new w(i,"apiKey");const a={apiKey:r.apiKey,debug:r.debug??!1,endpoint:r.endpoint??S,logger:r.logger,retries:r.retries??R,timeout:r.timeout??K},d=new E,n=T(i,r.logger);return{endpoint:a.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 c(i,"Email ID is required to retrieve email details"),success:!1};await d.ensureInitialized(()=>this.initialize(),i);const t={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"};n.debug("Retrieving email details",{id:e});const s=await y(async()=>p(`${a.endpoint}/emails/${e}`,{headers:t,method:"GET",timeout:a.timeout}),a.retries);return s.success?(n.debug("Email details retrieved successfully"),{data:s.data?.body,success:!0}):(n.debug("API request failed when retrieving email",s.error),{error:new c(i,`Failed to retrieve email: ${s.error instanceof Error?s.error.message:"Unknown error"}`,{cause:s.error}),success:!1})}catch(t){return{error:f(i,"retrieve email",t,n),success:!1}}},async initialize(){await d.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(i,"Resend API not available or invalid API key");n.debug("Provider initialized successfully")},i)},async isAvailable(){try{if(a.apiKey&&a.apiKey.startsWith("re_"))return n.debug("API key format is valid, assuming Resend is available"),!0;const e={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"};n.debug("Checking Resend API availability");const t=await p(`${a.endpoint}/domains`,{headers:e,method:"GET",timeout:a.timeout});return t.data&&typeof t.data=="object"&&"body"in t.data&&t.data.body&&typeof t.data.body=="object"&&"name"in t.data.body&&t.data.body.name==="restricted_api_key"?(n.debug("API key is valid but restricted to only sending emails"),!0):(n.debug("Resend 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 n.debug("Error checking availability:",e),!1}},name:i,options:a,async sendEmail(e){try{const t=j(e);if(t.length>0)return{error:new c(i,`Invalid email options: ${t.join(", ")}`),success:!1};await d.ensureInitialized(()=>this.initialize(),i);const s={from:b(e.from),headers:e.headers?P(e.headers):{},html:e.html,subject:e.subject,text:e.text,to:z(e.to)};if(e.cc&&(s.cc=v(e.cc)),e.bcc&&(s.bcc=v(e.bcc)),e.replyTo&&(s.reply_to=b(e.replyTo)),e.templateId&&(s.template=e.templateId,e.templateData&&(s.data=e.templateData)),e.scheduledAt&&(s.scheduled_at=typeof e.scheduledAt=="string"?e.scheduledAt:e.scheduledAt.toISOString()),e.tags&&e.tags.length>0){const o=[];if(e.tags.forEach(m=>{const g=_(m);g.length>0&&o.push(...g)}),o.length>0)return{error:new c(i,`Invalid email tags: ${o.join(", ")}`),success:!1};s.tags=e.tags.map(m=>({name:m.name,value:m.value}))}e.attachments&&e.attachments.length>0&&(s.attachments=await Promise.all(e.attachments.map(async o=>({content:await k(o,i),content_type:o.contentType,filename:o.filename,...o.path&&{path:o.path}})))),n.debug("Sending email via Resend API",{subject:s.subject,to:s.to});const A={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},l=await y(async()=>p(`${a.endpoint}/emails`,{headers:A,method:"POST",timeout:a.timeout},JSON.stringify(s)),a.retries);if(!l.success)return n.debug("API request failed when sending email",l.error),{error:l.error??new c(i,"Failed to send email"),success:!1};const u=l.data,h=u?.body&&typeof u.body=="object"&&u.body.id?u.body.id:I();return n.debug("Email sent successfully",{messageId:h}),{data:{messageId:h,provider:i,response:l.data,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:f(i,"send email",t,n),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{U as default};
@@ -1 +0,0 @@
1
- import c from"./EmailError-CDvYwuqz.js";import{R as i}from"./make-request-CylyuRaN.js";const m=new Set([408,429,503]),u=r=>{const{statusCode:t}=r.data??{};return t!==void 0?m.has(t):!(r.error instanceof c&&r.error.code===i)},a=async(r,t=3,s=300,e=u)=>{try{const o=await r();return o.success||t<=0||!e(o)?o:(await new Promise(n=>{setTimeout(()=>{n()},s)}),a(r,t-1,s*2,e))}catch(o){return t<=0?{error:o instanceof Error?o:new Error(String(o)),success:!1}:(await new Promise(n=>{setTimeout(()=>{n()},s)}),a(r,t-1,s*2,e))}};export{a as i};
@@ -1 +0,0 @@
1
- const w=t=>new Promise(s=>{setTimeout(s,t)}),f=(t={})=>{const{baseDelay:s=200,onDeadLetter:a,retries:n=3,shouldRetry:i=()=>!0,sleep:l=w}=t;return async(o,c)=>{let e={error:new Error("retry middleware ran with retries < 1"),success:!1};for(let r=0;r<n;r+=1){if(e=await c(o),e.success)return e;if(!i(e)||r===n-1)break;const d=s*2**r,u=Math.floor(Math.random()*d);await l(u)}return a&&await a(o,e),e}};export{f as retryMiddleware};
@@ -1 +0,0 @@
1
- import g from"./EmailError-CDvYwuqz.js";import y from"./RequiredOptionError-DU2lxzk3.js";import{c as $}from"./create-logger-BQTS3f-I.js";import{defineProvider as E}from"./defineProvider-C9q-7iwt.js";import{d as A}from"./aggregate-features-BqEjPd42.js";const k=i=>typeof i=="function",z=i=>i!=null&&typeof i=="object"&&"sendEmail"in i&&"initialize"in i&&"isAvailable"in i,o="roundrobin",R=E((i={})=>{if(!i.mailers||i.mailers.length===0)throw new y(o,"mailers");const f={debug:i.debug??!1,logger:i.logger,mailers:i.mailers,retries:i.retries??3,retryAfter:i.retryAfter??60,timeout:i.timeout??3e4};let v=!1;const r=[];let a=0;const n=$(o,i.logger),m=async()=>{r.length=0;for(const t of f.mailers)try{let e;if(k(t))e=t({});else if(z(t))e=t;else{n.debug(`Skipping invalid mailer: ${t}`);continue}try{await e.initialize(),r.push(e),n.debug(`Initialized provider: ${e.name??"unknown"}`)}catch(s){n.debug(`Failed to initialize provider ${e.name??"unknown"}:`,s)}}catch(e){n.debug("Error processing mailer:",e)}if(r.length===0)throw new g(o,"No providers could be initialized");a=Math.floor(Math.random()*r.length),n.debug(`Round robin starting at index ${a} (${r[a]?.name??"unknown"})`)},p=async()=>{if(r.length===0)return;const t=a;let e=0;for(;e<r.length;){const s=r[a];if(!s){a=(a+1)%r.length,e+=1;continue}const d=s.name??`provider-${a+1}`;try{if(await s.isAvailable())return a=(a+1)%r.length,n.debug(`Selected provider: ${d} (index ${a===0?r.length-1:a-1})`),s}catch{}a=(a+1)%r.length,e+=1,e<r.length&&f.retryAfter>0&&await new Promise(l=>{setTimeout(()=>{l(void 0)},f.retryAfter)})}return n.debug(`No available providers found, using provider at index ${t}`),r[t]??void 0};return{features:A(f.mailers),async initialize(){if(!v)try{await m(),v=!0,n.debug(`Round robin provider initialized with ${r.length} provider(s)`)}catch(t){throw new g(o,`Failed to initialize: ${t.message}`,{cause:t})}},async isAvailable(){try{return r.length===0&&await m(),(await Promise.allSettled(r.map(t=>t.isAvailable()))).some(t=>t.status==="fulfilled"&&t.value)}catch{return!1}},name:o,options:f,async sendEmail(t){try{if(r.length===0&&await m(),r.length===0)return{error:new g(o,"No providers available"),success:!1};const e=await p();if(!e)return{error:new g(o,"No available providers found"),success:!1};const s=e.name??"unknown";n.debug(`Sending email via ${s}`);const d=await e.sendEmail(t);if(d.success)return n.debug(`Email sent successfully via ${s}`),{data:{...d.data,provider:`${o}(${s})`},success:!0};n.debug(`Failed to send via ${s}, trying next provider`);const l=[];d.error&&l.push(d.error);let w=0;for(;w<r.length-1;){const u=await p();if(!u||u===e)break;const h=u.name??"unknown";n.debug(`Retrying with ${h}`);try{const c=await u.sendEmail(t);if(c.success)return n.debug(`Email sent successfully via ${h} (after retry)`),{data:{...c.data,provider:`${o}(${h})`},success:!0};c.error&&l.push(c.error)}catch(c){l.push(c instanceof Error?c:new Error(String(c)))}w+=1}const b=l.map(u=>u instanceof Error?u.message:String(u)).join("; ");return{error:new g(o,`Failed to send email via all providers. Errors: ${b}`,{cause:l[0]instanceof Error?l[0]:new Error(String(l[0]))}),success:!1}}catch(e){return{error:new g(o,`Failed to send email: ${e.message}`,{cause:e}),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{R as default};
@@ -1 +0,0 @@
1
- const r=/[\r\n]/,s=e=>{const a=e.search(r);return a===-1?e:e.slice(0,a)},n=e=>e.replaceAll(/[\r\n]/g,"");export{s as a,n as s};
@@ -1 +0,0 @@
1
- import c from"./EmailError-CDvYwuqz.js";import p from"./RequiredOptionError-DU2lxzk3.js";import{e as w}from"./generate-message-id-gXAuMz4g.js";import{s as v}from"./headers-to-record-De1Eg951.js";import{m as f}from"./make-request-CylyuRaN.js";import{i as g}from"./retry-CG9iT2wF.js";import{f as I}from"./validate-email-options-mCM9dVug.js";import{defineProvider as A}from"./defineProvider-C9q-7iwt.js";import{P,h,c as j}from"./provider-base-DjPzWncP.js";import{f as d,a as T}from"./address-formatter-BWR2Dddx.js";import{p as S}from"./attachment-processor-D1cbAhQi.js";const r="scaleway",k="https://api.scaleway.com/transactional-email/v1alpha1",E=3e4,z=3,H=A((a={})=>{if(!a.apiKey)throw new p(r,"apiKey");if(!a.region)throw new p(r,"region");const y=a.endpoint??k,i={apiKey:a.apiKey,debug:a.debug??!1,endpoint:y,region:a.region,retries:a.retries??z,timeout:a.timeout??E,...a.logger&&{logger:a.logger}},m=new P,s=j(r,a.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!0,tracking:!1},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={"Content-Type":"application/json","X-Auth-Token":i.apiKey};s.debug("Retrieving email details",{id:e});const t=await g(async()=>f(`${i.endpoint}/regions/${i.region}/emails/${e}`,{headers:n,method:"GET",timeout:i.timeout}),i.retries);return t.success?(s.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(s.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:h(r,"retrieve email",n,s),success:!1}}},async initialize(){await m.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(r,"Scaleway API not available or invalid API key");s.debug("Provider initialized successfully")},r)},async isAvailable(){try{return s.debug("Checking Scaleway API availability"),!0}catch(e){return s.debug("Error checking availability:",e),!1}},name:r,options:i,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:{email:e.from.email,...e.from.name&&{name:e.from.name}},subject:e.subject,to:d(e.to)};if(e.html&&(t.html=e.html),e.text&&(t.text=e.text),e.cc&&(t.cc=d(e.cc)),e.bcc&&(t.bcc=d(e.bcc)),e.replyTo&&(t.replyTo=T(e.replyTo)),e.templateId&&(t.templateId=e.templateId,e.templateVariables&&(t.templateVariables=e.templateVariables)),e.projectId&&(t.projectId=e.projectId),e.headers){const l=v(e.headers);t.headers=l}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async l=>({content:await S(l,r),name:l.filename,type:l.contentType??"application/octet-stream"})))),s.debug("Sending email via Scaleway API",{subject:t.subject,to:t.to});const b={"Content-Type":"application/json","X-Auth-Token":i.apiKey},o=await g(async()=>f(`${i.endpoint}/regions/${i.region}/emails`,{headers:b,method:"POST",timeout:i.timeout},JSON.stringify(t)),i.retries);if(!o.success)return s.debug("API request failed when sending email",o.error),{error:o.error??new c(r,"Failed to send email"),success:!1};const u=o.data?.body?.id??w();return s.debug("Email sent successfully",{messageId:u}),{data:{messageId:u,provider:r,response:o.data,sent:!0,timestamp:new Date},success:!0}}catch(n){return{error:h(r,"send email",n,s),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{H as default};
@@ -1 +0,0 @@
1
- import l from"./EmailError-CDvYwuqz.js";import A from"./RequiredOptionError-DU2lxzk3.js";import{e as P}from"./generate-message-id-gXAuMz4g.js";import{s as S}from"./headers-to-record-De1Eg951.js";import{m as h}from"./make-request-CylyuRaN.js";import{i as b}from"./retry-CG9iT2wF.js";import{f as j}from"./validate-email-options-mCM9dVug.js";import{defineProvider as G}from"./defineProvider-C9q-7iwt.js";import{P as k,h as v,c as z}from"./provider-base-DjPzWncP.js";import{f,a as I}from"./address-formatter-BWR2Dddx.js";import{d as C}from"./attachment-processor-D1cbAhQi.js";const s="sendgrid",E="https://api.sendgrid.com/v3",_=3e4,T=3,L=G((o={})=>{if(!o.apiKey)throw new A(s,"apiKey");const a={apiKey:o.apiKey,debug:o.debug??!1,endpoint:o.endpoint??E,...o.logger&&{logger:o.logger},retries:o.retries??T,timeout:o.timeout??_},p=new k,i=z(s,o.logger);return{endpoint:a.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 l(s,"Email ID is required to retrieve email details"),success:!1};await p.ensureInitialized(()=>this.initialize(),s);const t={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"};i.debug("Retrieving email details",{id:e});const r=await b(async()=>h(`${a.endpoint}/messages/${e}`,{headers:t,method:"GET",timeout:a.timeout}),a.retries);return r.success?(i.debug("Email details retrieved successfully"),{data:r.data?.body,success:!0}):(i.debug("API request failed when retrieving email",r.error),{error:new l(s,`Failed to retrieve email: ${r.error instanceof Error?r.error.message:"Unknown error"}`,{cause:r.error}),success:!1})}catch(t){return{error:v(s,"retrieve email",t,i),success:!1}}},async initialize(){await p.ensureInitialized(async()=>{if(!await this.isAvailable())throw new l(s,"SendGrid API not available or invalid API key");i.debug("Provider initialized successfully")},s)},async isAvailable(){try{if(a.apiKey&&a.apiKey.startsWith("SG."))return i.debug("API key format is valid, assuming SendGrid is available"),!0;const e={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"};i.debug("Checking SendGrid API availability");const t=await h(`${a.endpoint}/user/profile`,{headers:e,method:"GET",timeout:a.timeout});return i.debug("SendGrid 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:s,options:a,async sendEmail(e){try{const t=j(e);if(t.length>0)return{error:new l(s,`Invalid email options: ${t.join(", ")}`),success:!1};await p.ensureInitialized(()=>this.initialize(),s);const r={to:f(e.to)};if(e.cc&&(r.cc=f(e.cc)),e.bcc&&(r.bcc=f(e.bcc)),e.subject&&(r.subject=e.subject),e.tags&&e.tags.length>0){const d={};for(let m=0;m<e.tags.length;m+=1)d[`tag_${m}`]=e.tags[m];r.customArgs=d}const n={from:I(e.from),personalizations:[r]},u=[];if(e.html&&u.push({type:"text/html",value:e.html}),e.text&&u.push({type:"text/plain",value:e.text}),u.length>0&&(n.content=u),e.replyTo&&(n.reply_to=I(e.replyTo)),e.subject&&(n.subject=e.subject),e.templateId&&(n.template_id=e.templateId,e.templateData&&(r.dynamicTemplateData=e.templateData)),e.sendAt&&(r.send_at=e.sendAt),e.batchId&&(n.batch_id=e.batchId),e.asmGroupId&&(n.asm={group_id:e.asmGroupId}),e.ipPoolName&&(n.ip_pool_name=e.ipPoolName),e.mailSettings&&(n.mail_settings=e.mailSettings),e.trackingSettings&&(n.tracking_settings=e.trackingSettings),e.headers){const d=S(e.headers);n.headers=d}e.attachments&&e.attachments.length>0&&(n.attachments=await Promise.all(e.attachments.map(async d=>C(d,s)))),i.debug("Sending email via SendGrid API",{subject:n.subject,to:r.to});const w={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},c=await b(async()=>h(`${a.endpoint}/mail/send`,{headers:w,method:"POST",timeout:a.timeout},JSON.stringify(n)),a.retries);if(!c.success)return i.debug("API request failed when sending email",c.error),{error:c.error??new l(s,"Failed to send email"),success:!1};const g=c.data?.headers,y=(g&&g instanceof Headers?g.get("X-Message-Id"):void 0)??P();return i.debug("Email sent successfully",{messageId:y}),{data:{messageId:y,provider:s,response:c.data,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:v(s,"send email",t,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{L as default};