@opencode-ai/cli-linux-x64 0.0.0-beta-202606070135 → 0.0.0-beta-202606070341

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 (157) hide show
  1. package/bin/{chunk-batbn700.js.map → chunk-05fp9qhj.js.map} +1 -1
  2. package/bin/{chunk-2xg3r6tg.js.map → chunk-0rt5fa6a.js.map} +1 -1
  3. package/bin/{chunk-f9y6s5dn.js.map → chunk-10qv9deg.js.map} +1 -1
  4. package/bin/{chunk-5nrsp9q6.js.map → chunk-1cgdjn8m.js.map} +1 -1
  5. package/bin/{chunk-3n9pdrx3.js.map → chunk-2fd2ek5e.js.map} +1 -1
  6. package/bin/{chunk-bn24wn97.js.map → chunk-2gb8zd2b.js.map} +1 -1
  7. package/bin/{chunk-450wf5my.js.map → chunk-3h4x50b1.js.map} +3 -5
  8. package/bin/{chunk-1jjzc8en.js.map → chunk-3qt4ycsw.js.map} +1 -1
  9. package/bin/{chunk-58vn4c6w.js.map → chunk-3y5pdhm2.js.map} +1 -1
  10. package/bin/{chunk-pvzmxwq4.js.map → chunk-3z95atyh.js.map} +2 -2
  11. package/bin/{chunk-c8d6exp6.js.map → chunk-48e21wbj.js.map} +1 -1
  12. package/bin/{chunk-4ms773bs.js.map → chunk-48yrbn32.js.map} +1 -1
  13. package/bin/{chunk-ph9dmmvn.js.map → chunk-499aev4j.js.map} +1 -1
  14. package/bin/{chunk-ja4gvevm.js.map → chunk-4gka4qwt.js.map} +2 -2
  15. package/bin/{chunk-gkp105m1.js.map → chunk-4qmff4a3.js.map} +2 -2
  16. package/bin/{chunk-by396bn8.js.map → chunk-4tmqmq5d.js.map} +2 -2
  17. package/bin/{chunk-1t0z2045.js.map → chunk-4wpwdxpa.js.map} +1 -1
  18. package/bin/{chunk-js7k34h1.js.map → chunk-4y9wtqet.js.map} +1 -1
  19. package/bin/{chunk-2smkzsm0.js.map → chunk-55psbhx5.js.map} +1 -1
  20. package/bin/{chunk-nt4j4qn7.js.map → chunk-5aaaxhz7.js.map} +3 -46
  21. package/bin/{chunk-1wmx8tsn.js.map → chunk-5f3d160g.js.map} +1 -1
  22. package/bin/{chunk-486k26x4.js.map → chunk-5ftm28vq.js.map} +1 -1
  23. package/bin/{chunk-v1acxjrb.js.map → chunk-5kwnbv5g.js.map} +1 -1
  24. package/bin/{chunk-7zf65mwn.js.map → chunk-5kxrvphv.js.map} +1 -1
  25. package/bin/{chunk-fagcz4bm.js.map → chunk-5pacvbkg.js.map} +1 -1
  26. package/bin/{chunk-7ncbpxpg.js.map → chunk-5pndz20y.js.map} +1 -1
  27. package/bin/{chunk-qpq4dt1k.js.map → chunk-5ydpqxww.js.map} +1 -1
  28. package/bin/{chunk-y6a29a3y.js.map → chunk-6q85vzzj.js.map} +2 -2
  29. package/bin/{chunk-crtva7a7.js.map → chunk-6qa7ykvy.js.map} +1 -1
  30. package/bin/{chunk-dchn9wc0.js.map → chunk-7948j39q.js.map} +2 -2
  31. package/bin/{chunk-d9ay6qca.js.map → chunk-7bpk4cqn.js.map} +1 -1
  32. package/bin/{chunk-f1qyv4kk.js.map → chunk-7ggvm323.js.map} +2 -2
  33. package/bin/{chunk-k8aw4xj3.js.map → chunk-7r380v9f.js.map} +1 -1
  34. package/bin/{chunk-44j7qpyj.js.map → chunk-81mnkg86.js.map} +1 -1
  35. package/bin/{chunk-zvpzr2js.js.map → chunk-87n0jkba.js.map} +2 -2
  36. package/bin/{chunk-gwxy1wg6.js.map → chunk-8xb96qzm.js.map} +1 -1
  37. package/bin/{chunk-v6cygzb1.js.map → chunk-909tgy1d.js.map} +1 -1
  38. package/bin/{chunk-6rg8mz6n.js.map → chunk-90fg4snn.js.map} +1 -1
  39. package/bin/{chunk-aj3x1xcd.js.map → chunk-939bqrs1.js.map} +2 -2
  40. package/bin/{chunk-5xwb5vn4.js.map → chunk-96er5cxq.js.map} +2 -2
  41. package/bin/{chunk-1y9ks4m5.js.map → chunk-9726hg59.js.map} +2 -2
  42. package/bin/{chunk-9cpbbkbt.js.map → chunk-9gf2rcv2.js.map} +1 -1
  43. package/bin/{chunk-g06twqwt.js.map → chunk-9m8rrkwg.js.map} +1 -1
  44. package/bin/{chunk-xjz65pxd.js.map → chunk-9trd2zkq.js.map} +1 -1
  45. package/bin/{chunk-tergaht9.js.map → chunk-a30gdgc2.js.map} +1 -1
  46. package/bin/{chunk-8yjmjvhy.js.map → chunk-a8prqfgz.js.map} +1 -1
  47. package/bin/{chunk-yerk1fzb.js.map → chunk-aq2f37cy.js.map} +1 -1
  48. package/bin/{chunk-zqryz83b.js.map → chunk-b05rf252.js.map} +1 -1
  49. package/bin/{chunk-ft5qxnpv.js.map → chunk-bqpg7gvj.js.map} +2 -2
  50. package/bin/{chunk-bjtanfsz.js.map → chunk-br7g6m34.js.map} +1 -1
  51. package/bin/chunk-brrh8yjw.js.map +9 -0
  52. package/bin/{chunk-qgadgd0b.js.map → chunk-btjc5b7c.js.map} +1 -1
  53. package/bin/{chunk-nczqpjnh.js.map → chunk-c16y8gcj.js.map} +1 -1
  54. package/bin/{chunk-j7nfke6k.js.map → chunk-c2g1t122.js.map} +1 -1
  55. package/bin/chunk-c5fx9pay.js.map +11 -0
  56. package/bin/{chunk-sdcb4sn6.js.map → chunk-c5qj3e1d.js.map} +2 -2
  57. package/bin/{chunk-8ah9fn8w.js.map → chunk-cm5xvm32.js.map} +20 -259
  58. package/bin/{chunk-wpz2wytm.js.map → chunk-cx1kjnz8.js.map} +1 -1
  59. package/bin/{chunk-ge25qpx1.js.map → chunk-djyvvajf.js.map} +2 -2
  60. package/bin/{chunk-2bj59myd.js.map → chunk-dpk8gznc.js.map} +1 -1
  61. package/bin/{chunk-p0sfa7kg.js.map → chunk-dpmejjdk.js.map} +1 -1
  62. package/bin/{chunk-cg5eyefy.js.map → chunk-dv1a5221.js.map} +2 -2
  63. package/bin/{chunk-r30r82nt.js.map → chunk-dzcrh1de.js.map} +2 -2
  64. package/bin/chunk-e3f6jnbg.js.map +9 -0
  65. package/bin/{chunk-8y0z37en.js.map → chunk-e6vaj7yk.js.map} +1 -1
  66. package/bin/{chunk-hsjd5vq9.js.map → chunk-ee6am2zx.js.map} +2 -2
  67. package/bin/chunk-ee8dnwg2.js.map +9 -0
  68. package/bin/chunk-ez99znk3.js.map +9 -0
  69. package/bin/{chunk-dj3n1gz9.js.map → chunk-f61g49n7.js.map} +1 -1
  70. package/bin/{chunk-aj0knqvs.js.map → chunk-fsmpsxxr.js.map} +1 -1
  71. package/bin/{chunk-qyz33fk4.js.map → chunk-g5zy822d.js.map} +2 -2
  72. package/bin/{chunk-v0vac3qg.js.map → chunk-h7wjmzqp.js.map} +1 -1
  73. package/bin/chunk-hcm4f293.js.map +10 -0
  74. package/bin/{chunk-wyyfrvey.js.map → chunk-he0bhzn7.js.map} +2 -2
  75. package/bin/{chunk-rtdfgszz.js.map → chunk-hnegzh4v.js.map} +1 -1
  76. package/bin/{chunk-np19gw2e.js.map → chunk-hrbn78d7.js.map} +1 -1
  77. package/bin/{chunk-pyxc7s1n.js.map → chunk-hscdbysq.js.map} +1 -1
  78. package/bin/{chunk-b8wv1019.js.map → chunk-hzezyeyw.js.map} +2 -2
  79. package/bin/{chunk-2d69p4k2.js.map → chunk-hzqdreq7.js.map} +1 -1
  80. package/bin/{chunk-q8x5h461.js.map → chunk-j91tz9rm.js.map} +1 -1
  81. package/bin/{chunk-q3zwjyfs.js.map → chunk-j9r4h5bb.js.map} +1 -1
  82. package/bin/chunk-jkev33xw.js.map +9 -0
  83. package/bin/{chunk-rgmb1xqh.js.map → chunk-jm6tkz5f.js.map} +1 -1
  84. package/bin/chunk-k01b2gy8.js.map +9 -0
  85. package/bin/{chunk-hx4hrnc1.js.map → chunk-kkzyajcv.js.map} +1 -1
  86. package/bin/{chunk-6rh497a8.js.map → chunk-kybvcz3m.js.map} +2 -2
  87. package/bin/{chunk-d35vqxtw.js.map → chunk-kz9hh383.js.map} +1 -1
  88. package/bin/{chunk-246az8th.js.map → chunk-m55hbzq0.js.map} +1 -1
  89. package/bin/{chunk-4z9x1zr9.js.map → chunk-m7c110kc.js.map} +1 -1
  90. package/bin/{chunk-dz7a5fyh.js.map → chunk-mtybk1nf.js.map} +1 -1
  91. package/bin/chunk-ncn019v2.js.map +9 -0
  92. package/bin/{chunk-s443c557.js.map → chunk-ndj7nh0w.js.map} +1 -1
  93. package/bin/{chunk-sr1stzc8.js.map → chunk-ndk4gwrm.js.map} +1 -1
  94. package/bin/{chunk-6htwbfva.js.map → chunk-nnsvtet8.js.map} +1 -1
  95. package/bin/{chunk-5xb90022.js.map → chunk-nt1c5mqb.js.map} +1 -1
  96. package/bin/{chunk-rect24wp.js.map → chunk-p1d9trz2.js.map} +1 -1
  97. package/bin/{chunk-m079q5wy.js.map → chunk-p5afyz25.js.map} +2 -2
  98. package/bin/{chunk-hp5q16b5.js.map → chunk-phfqfc4t.js.map} +1 -1
  99. package/bin/{chunk-bya07nz0.js.map → chunk-pvkeyh1p.js.map} +2 -2
  100. package/bin/{chunk-8dxqz4vx.js.map → chunk-pw9ct81w.js.map} +1 -1
  101. package/bin/{chunk-3k9dpvrx.js.map → chunk-qt51te01.js.map} +1 -1
  102. package/bin/{chunk-ssx3czmy.js.map → chunk-qy6gjyw5.js.map} +1 -1
  103. package/bin/{chunk-dhr2x6qc.js.map → chunk-qz5vnm3c.js.map} +1 -1
  104. package/bin/chunk-r6yrvg5j.js.map +9 -0
  105. package/bin/{chunk-8wpfm04w.js.map → chunk-r9wp1afs.js.map} +1 -1
  106. package/bin/chunk-rjfqk79v.js.map +52 -0
  107. package/bin/chunk-rpd6vmne.js.map +9 -0
  108. package/bin/{chunk-mgnakf8s.js.map → chunk-s0awhweq.js.map} +1 -1
  109. package/bin/{chunk-0yq28232.js.map → chunk-s5c4sfp5.js.map} +1 -1
  110. package/bin/{chunk-3qk1pb08.js.map → chunk-s657e3ke.js.map} +1 -1
  111. package/bin/{chunk-3brw1pw4.js.map → chunk-sncx1k0z.js.map} +1 -1
  112. package/bin/{chunk-tavtxn5h.js.map → chunk-sreqhwz9.js.map} +1 -1
  113. package/bin/{chunk-vpvnvwmt.js.map → chunk-sz631sne.js.map} +1 -1
  114. package/bin/{chunk-f9tdbqgp.js.map → chunk-t00n3rnx.js.map} +1 -1
  115. package/bin/{chunk-fq7bynm6.js.map → chunk-t2td1sc9.js.map} +1 -1
  116. package/bin/chunk-t4nkeekn.js.map +9 -0
  117. package/bin/chunk-t4tqngvv.js.map +9 -0
  118. package/bin/{chunk-ppfx93e4.js.map → chunk-t6czxcqq.js.map} +1 -1
  119. package/bin/{chunk-0nd737ze.js.map → chunk-thfw2jz7.js.map} +2 -2
  120. package/bin/{chunk-563dfx2j.js.map → chunk-tk75chdk.js.map} +1 -1
  121. package/bin/{chunk-0793sf45.js.map → chunk-ttfd0sfs.js.map} +1 -1
  122. package/bin/{chunk-ds933zn3.js.map → chunk-tyywhdv4.js.map} +1 -1
  123. package/bin/{chunk-ravdtrkh.js.map → chunk-v1y7arsq.js.map} +1 -1
  124. package/bin/{chunk-wz3xs8cy.js.map → chunk-vh8jxepn.js.map} +1 -1
  125. package/bin/{chunk-k3ts9xpy.js.map → chunk-vky181th.js.map} +1 -1
  126. package/bin/chunk-w1tn935z.js.map +249 -0
  127. package/bin/chunk-w2fwsby9.js.map +9 -0
  128. package/bin/{chunk-2hks567y.js.map → chunk-wg7e48sv.js.map} +1 -1
  129. package/bin/{chunk-28s2mk7f.js.map → chunk-wk8c66se.js.map} +1 -1
  130. package/bin/{chunk-9c7xnc0x.js.map → chunk-wkmy91yj.js.map} +2 -2
  131. package/bin/{chunk-6253rdsr.js.map → chunk-ws5m6p05.js.map} +1 -1
  132. package/bin/{chunk-8bxm2kba.js.map → chunk-wxbka4wt.js.map} +2 -2
  133. package/bin/{chunk-29kb6j3j.js.map → chunk-xg79ex3h.js.map} +2 -2
  134. package/bin/{chunk-6w6d1n0t.js.map → chunk-xh7gkqch.js.map} +1 -1
  135. package/bin/{chunk-tz8qtdwa.js.map → chunk-y8skr3xe.js.map} +1 -1
  136. package/bin/{chunk-094xfckf.js.map → chunk-yn8a5j0g.js.map} +1 -1
  137. package/bin/{chunk-xvws3mwn.js.map → chunk-ytrxyzwz.js.map} +1 -1
  138. package/bin/{chunk-4054rvaa.js.map → chunk-yyvwx773.js.map} +1 -1
  139. package/bin/{chunk-kmekc1yp.js.map → chunk-zw6185y4.js.map} +1 -1
  140. package/bin/chunk-zyh71mnn.js.map +9 -0
  141. package/bin/index.js.map +2 -2
  142. package/bin/lildax +0 -0
  143. package/package.json +1 -1
  144. package/bin/chunk-6s3csv0j.js.map +0 -9
  145. package/bin/chunk-74b9ws32.js.map +0 -9
  146. package/bin/chunk-8gm05p8e.js.map +0 -9
  147. package/bin/chunk-9tkjjdfk.js.map +0 -9
  148. package/bin/chunk-akzq0e1c.js.map +0 -9
  149. package/bin/chunk-b2qe4te3.js.map +0 -9
  150. package/bin/chunk-ddyf549n.js.map +0 -9
  151. package/bin/chunk-dk0n091y.js.map +0 -9
  152. package/bin/chunk-e68nzs1t.js.map +0 -9
  153. package/bin/chunk-s9hm0vet.js.map +0 -9
  154. package/bin/chunk-taf0vcvn.js.map +0 -9
  155. package/bin/chunk-vhjc1xhb.js.map +0 -9
  156. package/bin/chunk-zzxk5t69.js.map +0 -9
  157. /package/bin/{chunk-tf648vq4.js.map → chunk-d041wxv6.js.map} +0 -0
@@ -0,0 +1,52 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/Etag.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/Cookies.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/Headers.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpClientError.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/UrlParams.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpBody.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpMethod.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpClientRequest.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpIncomingMessage.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpClientResponse.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpTraceContext.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpClient.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/ErrorReporter.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/Template.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpServerResponse.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpPlatform.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpServer.js", "../../node_modules/.bun/find-my-way-ts@0.1.6/node_modules/find-my-way-ts/dist/esm/QueryString.js", "../../node_modules/.bun/find-my-way-ts@0.1.6/node_modules/find-my-way-ts/dist/esm/internal/router.js", "../../node_modules/.bun/find-my-way-ts@0.1.6/node_modules/find-my-way-ts/dist/esm/index.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpServerRespondable.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpServerError.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/socket/Socket.js", "../../node_modules/.bun/multipasta@0.2.7/node_modules/multipasta/dist/esm/internal/contentType.js", "../../node_modules/.bun/multipasta@0.2.7/node_modules/multipasta/dist/esm/internal/headers.js", "../../node_modules/.bun/multipasta@0.2.7/node_modules/multipasta/dist/esm/internal/search.js", "../../node_modules/.bun/multipasta@0.2.7/node_modules/multipasta/dist/esm/internal/multipart.js", "../../node_modules/.bun/multipasta@0.2.7/node_modules/multipasta/dist/esm/index.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/Multipart.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpServerRequest.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/internal/preResponseHandler.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpMiddleware.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpEffect.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/HttpRouter.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/unstable/http/FetchHttpClient.js", "../core/src/global.ts", "../../node_modules/.bun/xdg-basedir@5.1.0/node_modules/xdg-basedir/index.js", "../core/src/util/flock.ts", "../core/src/util/hash.ts", "../core/src/flag/flag.ts", "../core/src/installation/version.ts", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/Stdio.js", "../../node_modules/.bun/effect@4.0.0-beta.74/node_modules/effect/dist/Terminal.js"],
4
+ "sourcesContent": [
5
+ "/**\n * HTTP entity tag values and metadata-based generator layers.\n *\n * ETags are validators for a specific representation of a resource. Servers put\n * them in `ETag` response headers so clients and intermediaries can revalidate\n * cached content with `If-None-Match`, or protect writes with preconditions such\n * as `If-Match`.\n *\n * **Mental model**\n *\n * A strong ETag represents byte-for-byte identity for the selected\n * representation. A weak ETag represents a validator that is useful for cache\n * revalidation but not for operations that require exact byte identity. The\n * `Weak` and `Strong` models store the raw tag value; `toString` adds the\n * required quotes and the `W/` prefix for weak tags.\n *\n * **Common tasks**\n *\n * - Format an `Etag` value for an HTTP header with `toString`.\n * - Provide a `Generator` service with `layer` for strong metadata-derived tags.\n * - Use `layerWeak` when size and modification time are good cache validators\n * but not a byte-for-byte guarantee.\n *\n * **Gotchas**\n *\n * The built-in generator derives tags only from file size and modification time.\n * Choose the strong layer only when that metadata changes for every byte-level\n * content change. This module formats ETags but does not parse incoming ETag\n * headers or implement conditional request logic.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\n/**\n * Formats an `Etag` as an HTTP header value, including quotes and the `W/` prefix for weak tags.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toString = self => {\n switch (self._tag) {\n case \"Weak\":\n return `W/\"${self.value}\"`;\n case \"Strong\":\n return `\"${self.value}\"`;\n }\n};\n/**\n * Service for generating ETags from filesystem file information or Web `File`-like metadata.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Generator extends /*#__PURE__*/Context.Service()(\"effect/http/Etag/Generator\") {}\nconst fromFileInfo = info => {\n const mtime = Option.match(info.mtime, {\n onNone: () => \"0\",\n onSome: mtime => mtime.getTime().toString(16)\n });\n return `${info.size.toString(16)}-${mtime}`;\n};\nconst fromFileWeb = file => {\n return `${file.size.toString(16)}-${file.lastModified.toString(16)}`;\n};\n/**\n * Layer that provides a `Generator` which produces strong ETags from file size\n * and modification time metadata.\n *\n * **When to use**\n *\n * Use when file size and modification time reliably change for every byte-level\n * change and the consuming HTTP code needs strong ETags from the `Generator`\n * service.\n *\n * **Gotchas**\n *\n * This layer marks metadata-derived tags as strong. If the underlying storage\n * can update file contents without changing the recorded size or modification\n * time, those tags can stop representing byte-for-byte identity.\n *\n * @see {@link layerWeak} for weak metadata-derived ETags when byte-for-byte identity is not required\n * @see {@link Generator} for the service provided by this layer\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.succeed(Generator)({\n fromFileInfo(info) {\n return Effect.sync(() => ({\n _tag: \"Strong\",\n value: fromFileInfo(info)\n }));\n },\n fromFileWeb(file) {\n return Effect.sync(() => ({\n _tag: \"Strong\",\n value: fromFileWeb(file)\n }));\n }\n});\n/**\n * Layer that provides a `Generator` which produces weak ETags from file size and modification time metadata.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWeak = /*#__PURE__*/Layer.succeed(Generator)({\n fromFileInfo(info) {\n return Effect.sync(() => ({\n _tag: \"Weak\",\n value: fromFileInfo(info)\n }));\n },\n fromFileWeb(file) {\n return Effect.sync(() => ({\n _tag: \"Weak\",\n value: fromFileWeb(file)\n }));\n }\n});\n//# sourceMappingURL=Etag.js.map",
6
+ "/**\n * Immutable HTTP cookie values and collections for request and response\n * workflows.\n *\n * The module models a validated {@link Cookie}, an immutable {@link Cookies}\n * collection keyed by cookie name, and the conversions needed around HTTP\n * headers. Use it to read request `Cookie` headers, build cookies with standard\n * attributes, merge or remove cookies immutably, expire cookies, and emit\n * response `Set-Cookie` headers.\n *\n * **Mental model**\n *\n * - A `Cookie` stores both the decoded `value` and the encoded `valueEncoded`\n * used in headers\n * - A `Cookies` collection contains at most one cookie per name; later writes,\n * merges, and iterable inputs replace earlier cookies with the same name\n * - `Cookie` request headers carry name/value pairs, while `Set-Cookie`\n * response headers carry one cookie plus optional attributes\n * - Safe constructors return `Result` failures for invalid names, values,\n * domains, paths, or infinite `Max-Age` values\n *\n * **Common tasks**\n *\n * - Create cookies: {@link makeCookie}, {@link makeCookieUnsafe}\n * - Build collections: {@link empty}, {@link fromIterable},\n * {@link fromSetCookie}, {@link fromReadonlyRecord}\n * - Read values: {@link get}, {@link getValue}, {@link toRecord},\n * {@link isEmpty}\n * - Update collections: {@link set}, {@link setUnsafe}, {@link setAll},\n * {@link setCookie}, {@link setAllCookie}, {@link remove}, {@link merge}\n * - Expire cookies: {@link expireCookie}, {@link expireCookieUnsafe}\n * - Encode and decode headers: {@link toCookieHeader},\n * {@link toSetCookieHeaders}, {@link serializeCookie}, {@link parseHeader}\n *\n * **Gotchas**\n *\n * - Use {@link toCookieHeader} for an outbound request `Cookie` header and\n * {@link toSetCookieHeaders} for response `Set-Cookie` headers.\n * - Parsing is intentionally tolerant: malformed `Set-Cookie` input can be\n * ignored, unsupported attributes are skipped, and percent-decoding falls\n * back to the original text.\n * - Security attributes such as `HttpOnly`, `Secure`, `SameSite`, and\n * `Partitioned` are serialized when present, but browser policy enforces\n * their final behavior.\n *\n * **Example** (Serializing a session cookie)\n *\n * ```ts\n * import { Cookies } from \"effect/unstable/http\"\n *\n * const cookies = Cookies.setUnsafe(Cookies.empty, \"session\", \"abc123\", {\n * httpOnly: true,\n * path: \"/\",\n * sameSite: \"lax\",\n * secure: true\n * })\n *\n * console.log(Cookies.toSetCookieHeaders(cookies))\n * // [\"session=abc123; Path=/; HttpOnly; Secure; SameSite=Lax\"]\n * ```\n *\n * @since 4.0.0\n */\nimport * as Data from \"../../Data.js\";\nimport * as Duration from \"../../Duration.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Record from \"../../Record.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Transformation from \"../../SchemaTransformation.js\";\nconst TypeId = \"~effect/http/Cookies\";\n/**\n * Returns `true` when a value is a `Cookies` collection.\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isCookies = u => Predicate.hasProperty(u, TypeId);\n/**\n * Schema for `Cookies` collections.\n *\n * **Details**\n *\n * JSON encoding uses `Set-Cookie` header strings, while isomorphic encoding uses\n * a readonly record of cookie values.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const CookiesSchema = /*#__PURE__*/Schema.declare(isCookies, {\n typeConstructor: {\n _tag: \"effect/http/Cookies\"\n },\n generation: {\n runtime: `Cookies.CookiesSchema`,\n Type: `Cookies.Cookies`,\n Encoded: `typeof Cookies.CookiesSchema[\"Encoded\"]`,\n importDeclaration: `import * as Cookies from \"effect/unstable/http/Cookies\"`\n },\n expected: \"Cookies\",\n toCodecJson: () => Schema.link()(Schema.Array(Schema.String), Transformation.transform({\n decode: input => fromSetCookie(input),\n encode: cookies => toSetCookieHeaders(cookies)\n })),\n toCodecIso: () => Schema.link()(Schema.Record(Schema.String, CookieSchema), Transformation.transform({\n decode: input => fromReadonlyRecord(input),\n encode: cookies => cookies.cookies\n }))\n});\nconst CookieTypeId = \"~effect/http/Cookies/Cookie\";\n/**\n * Returns `true` when a value is a `Cookie`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isCookie = u => Predicate.hasProperty(u, CookieTypeId);\n/**\n * Schema for `Cookie` values.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const CookieSchema = /*#__PURE__*/Schema.declare(isCookie, {\n typeConstructor: {\n _tag: \"effect/http/Cookie\"\n },\n generation: {\n runtime: `Cookies.CookieSchema`,\n Type: `Cookies.Cookie`,\n importDeclaration: `import * as Cookie from \"effect/unstable/http/Cookies\"`\n },\n expected: \"Cookie\"\n});\nconst CookieErrorTypeId = \"~effect/http/Cookies/CookieError\";\n/**\n * Error reason describing why cookie construction failed, such as invalid name,\n * value, domain, path, or infinite max-age.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class CookiesErrorReason extends Data.Error {}\n/**\n * Error returned when a cookie name, value, domain, path, or max-age option is invalid.\n *\n * **Details**\n *\n * Inspect `reason` to determine the specific validation failure.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class CookiesError extends /*#__PURE__*/Data.TaggedError(\"CookieError\") {\n /**\n * Creates a cookie error from a reason tag and optional cause.\n *\n * @since 4.0.0\n */\n static fromReason(reason, cause) {\n return new CookiesError({\n reason: new CookiesErrorReason({\n _tag: reason,\n cause\n })\n });\n }\n /**\n * Marks this value as a cookie validation error for runtime guards.\n *\n * @since 4.0.0\n */\n [CookieErrorTypeId] = CookieErrorTypeId;\n /**\n * Uses the concrete cookie error reason as the public message.\n *\n * @since 4.0.0\n */\n get message() {\n return this.reason._tag;\n }\n}\nconst Proto = {\n [TypeId]: TypeId,\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"effect/Cookies\",\n cookies: Record.map(this.cookies, cookie => cookie.toJSON())\n };\n },\n pipe() {\n return pipeArguments(this, arguments);\n }\n};\n/**\n * Creates a `Cookies` collection from an existing readonly record of cookies keyed by cookie name.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromReadonlyRecord = cookies => {\n const self = Object.create(Proto);\n self.cookies = cookies;\n return self;\n};\n/**\n * Create a Cookies object from an Iterable\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromIterable = cookies => {\n const record = {};\n for (const cookie of cookies) {\n record[cookie.name] = cookie;\n }\n return fromReadonlyRecord(record);\n};\n/**\n * Create a Cookies object from a set of Set-Cookie headers\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromSetCookie = headers => {\n const arrayHeaders = typeof headers === \"string\" ? [headers] : headers;\n const cookies = [];\n for (const header of arrayHeaders) {\n const cookie = parseSetCookie(header.trim());\n if (cookie) {\n cookies.push(cookie);\n }\n }\n return fromIterable(cookies);\n};\nfunction parseSetCookie(header) {\n const parts = header.split(\";\").map(_ => _.trim()).filter(_ => _ !== \"\");\n if (parts.length === 0) {\n return undefined;\n }\n const firstEqual = parts[0].indexOf(\"=\");\n if (firstEqual === -1) {\n return undefined;\n }\n const name = parts[0].slice(0, firstEqual);\n if (!fieldContentRegExp.test(name)) {\n return undefined;\n }\n const valueEncoded = parts[0].slice(firstEqual + 1);\n const value = tryDecodeURIComponent(valueEncoded);\n if (parts.length === 1) {\n return Object.assign(Object.create(CookieProto), {\n name,\n value,\n valueEncoded\n });\n }\n const options = {};\n for (let i = 1; i < parts.length; i++) {\n const part = parts[i];\n const equalIndex = part.indexOf(\"=\");\n const key = equalIndex === -1 ? part : part.slice(0, equalIndex).trim();\n const value = equalIndex === -1 ? undefined : part.slice(equalIndex + 1).trim();\n switch (key.toLowerCase()) {\n case \"domain\":\n {\n if (value === undefined) {\n break;\n }\n const domain = value.trim().replace(/^\\./, \"\");\n if (domain) {\n options.domain = domain;\n }\n break;\n }\n case \"expires\":\n {\n if (value === undefined) {\n break;\n }\n const date = new Date(value);\n if (!isNaN(date.getTime())) {\n options.expires = date;\n }\n break;\n }\n case \"max-age\":\n {\n if (value === undefined) {\n break;\n }\n const maxAge = parseInt(value, 10);\n if (!isNaN(maxAge)) {\n options.maxAge = Duration.seconds(maxAge);\n }\n break;\n }\n case \"path\":\n {\n if (value === undefined) {\n break;\n }\n if (value[0] === \"/\") {\n options.path = value;\n }\n break;\n }\n case \"priority\":\n {\n if (value === undefined) {\n break;\n }\n switch (value.toLowerCase()) {\n case \"low\":\n options.priority = \"low\";\n break;\n case \"medium\":\n options.priority = \"medium\";\n break;\n case \"high\":\n options.priority = \"high\";\n break;\n }\n break;\n }\n case \"httponly\":\n {\n options.httpOnly = true;\n break;\n }\n case \"secure\":\n {\n options.secure = true;\n break;\n }\n case \"partitioned\":\n {\n options.partitioned = true;\n break;\n }\n case \"samesite\":\n {\n if (value === undefined) {\n break;\n }\n switch (value.toLowerCase()) {\n case \"lax\":\n options.sameSite = \"lax\";\n break;\n case \"strict\":\n options.sameSite = \"strict\";\n break;\n case \"none\":\n options.sameSite = \"none\";\n break;\n }\n break;\n }\n }\n }\n return Object.assign(Object.create(CookieProto), {\n name,\n value,\n valueEncoded,\n options: Object.keys(options).length > 0 ? options : undefined\n });\n}\n/**\n * An empty Cookies object\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/fromIterable([]);\n/**\n * Returns `true` when the `Cookies` collection contains no cookies.\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isEmpty = self => Record.isEmptyRecord(self.cookies);\n// oxlint-disable-next-line no-control-regex\nconst fieldContentRegExp = /^[\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+$/;\nconst CookieProto = {\n [CookieTypeId]: CookieTypeId,\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"effect/Cookies/Cookie\",\n name: this.name,\n value: this.value,\n options: this.options\n };\n }\n};\n/**\n * Creates a cookie, validating the name, encoded value, domain, path, and finite `maxAge`.\n *\n * **Details**\n *\n * Returns a `CookiesError` in the `Result` failure channel when validation fails.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeCookie(name, value, options) {\n if (!fieldContentRegExp.test(name)) {\n return Result.fail(CookiesError.fromReason(\"InvalidCookieName\"));\n }\n const encodedValue = encodeURIComponent(value);\n if (encodedValue && !fieldContentRegExp.test(encodedValue)) {\n return Result.fail(CookiesError.fromReason(\"InvalidCookieValue\"));\n }\n if (options !== undefined) {\n if (options.domain !== undefined && !fieldContentRegExp.test(options.domain)) {\n return Result.fail(CookiesError.fromReason(\"InvalidCookieDomain\"));\n }\n if (options.path !== undefined && !fieldContentRegExp.test(options.path)) {\n return Result.fail(CookiesError.fromReason(\"InvalidCookiePath\"));\n }\n if (options.maxAge !== undefined && !Duration.isFinite(Duration.fromInputUnsafe(options.maxAge))) {\n return Result.fail(CookiesError.fromReason(\"CookieInfinityMaxAge\"));\n }\n }\n return Result.succeed(Object.assign(Object.create(CookieProto), {\n name,\n value,\n valueEncoded: encodedValue,\n options\n }));\n}\n/**\n * Create a new cookie, throwing an error if invalid\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeCookieUnsafe = (name, value, options) => Result.getOrThrow(makeCookie(name, value, options));\n/**\n * Adds a cookie to a Cookies object\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookie = /*#__PURE__*/dual(2, (self, cookie) => fromReadonlyRecord(Record.set(self.cookies, cookie.name, cookie)));\n/**\n * Adds multiple cookies to a Cookies object\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAllCookie = /*#__PURE__*/dual(2, (self, cookies) => {\n const record = {\n ...self.cookies\n };\n for (const cookie of cookies) {\n record[cookie.name] = cookie;\n }\n return fromReadonlyRecord(record);\n});\n/**\n * Combines two Cookies objects, removing duplicates from the first\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const merge = /*#__PURE__*/dual(2, (self, that) => fromReadonlyRecord({\n ...self.cookies,\n ...that.cookies\n}));\n/**\n * Removes a cookie by name\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const remove = /*#__PURE__*/dual(2, (self, name) => fromReadonlyRecord(Record.remove(self.cookies, name)));\n/**\n * Gets a cookie from a Cookies object safely.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name) => Option.fromUndefinedOr(self.cookies[name]));\n/**\n * Gets the decoded value of a cookie by name safely.\n *\n * **Details**\n *\n * Returns `Option.none()` when the cookie is not present.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getValue = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name) => Option.map(get(self, name), cookie => cookie.value));\n/**\n * Creates and adds a cookie safely by name and value.\n *\n * **Details**\n *\n * The cookie fields are validated first; invalid input returns a `CookiesError` in the `Result` failure channel.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const set = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, value, options) => Result.map(makeCookie(name, value, options), cookie => fromReadonlyRecord(Record.set(self.cookies, name, cookie))));\n/**\n * Creates and adds a cookie by name and value, throwing if the cookie fields are invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setUnsafe = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, value, options) => fromReadonlyRecord(Record.set(self.cookies, name, makeCookieUnsafe(name, value, options))));\n/**\n * Adds an expired cookie safely with an empty value, `Max-Age=0`, and an epoch `Expires` value.\n *\n * **Details**\n *\n * Returns a `CookiesError` in the `Result` failure channel when the name or options are invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookie = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, options) => set(self, name, \"\", {\n ...options,\n maxAge: 0,\n expires: new Date(0)\n}));\n/**\n * Adds an expired cookie to a Cookies object, throwing an error if invalid\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookieUnsafe = /*#__PURE__*/dual(args => isCookies(args[0]), (self, name, options) => setUnsafe(self, name, \"\", {\n ...options,\n maxAge: 0,\n expires: new Date(0)\n}));\n/**\n * Creates and adds multiple cookies safely from name/value/options tuples.\n *\n * **Details**\n *\n * If any tuple is invalid, returns the first `CookiesError` and leaves the original collection unchanged.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAll = /*#__PURE__*/dual(2, (self, cookies) => {\n const record = {\n ...self.cookies\n };\n for (const [name, value, options] of cookies) {\n const result = makeCookie(name, value, options);\n if (Result.isFailure(result)) {\n return result;\n }\n record[name] = result.success;\n }\n return Result.succeed(fromReadonlyRecord(record));\n});\n/**\n * Adds multiple cookies to a Cookies object, throwing an error if invalid\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAllUnsafe = /*#__PURE__*/dual(2, (self, cookies) => Result.getOrThrow(setAll(self, cookies)));\n/**\n * Serializes a cookie into a string.\n *\n * **Details**\n *\n * Adapted from https://github.com/fastify/fastify-cookie under MIT License\n *\n * @category encoding\n * @since 4.0.0\n */\nexport function serializeCookie(self) {\n let str = self.name + \"=\" + self.valueEncoded;\n if (self.options === undefined) {\n return str;\n }\n const options = self.options;\n if (options.maxAge !== undefined) {\n const maxAge = Duration.toSeconds(Duration.fromInputUnsafe(options.maxAge));\n str += \"; Max-Age=\" + Math.trunc(maxAge);\n }\n if (options.domain !== undefined) {\n str += \"; Domain=\" + options.domain;\n }\n if (options.path !== undefined) {\n str += \"; Path=\" + options.path;\n }\n if (options.priority !== undefined) {\n switch (options.priority) {\n case \"low\":\n str += \"; Priority=Low\";\n break;\n case \"medium\":\n str += \"; Priority=Medium\";\n break;\n case \"high\":\n str += \"; Priority=High\";\n break;\n }\n }\n if (options.expires !== undefined) {\n str += \"; Expires=\" + options.expires.toUTCString();\n }\n if (options.httpOnly) {\n str += \"; HttpOnly\";\n }\n if (options.secure) {\n str += \"; Secure\";\n }\n // Draft implementation to support Chrome from 2024-Q1 forward.\n // See https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1\n if (options.partitioned) {\n str += \"; Partitioned\";\n }\n if (options.sameSite !== undefined) {\n switch (options.sameSite) {\n case \"lax\":\n str += \"; SameSite=Lax\";\n break;\n case \"strict\":\n str += \"; SameSite=Strict\";\n break;\n case \"none\":\n str += \"; SameSite=None\";\n break;\n }\n }\n return str;\n}\n/**\n * Serializes a `Cookies` object into a Cookie header.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toCookieHeader = self => Object.values(self.cookies).map(cookie => `${cookie.name}=${cookie.valueEncoded}`).join(\"; \");\n/**\n * Converts a `Cookies` collection to a record of decoded cookie values keyed by cookie name.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toRecord = self => {\n const record = {};\n const cookies = Object.values(self.cookies);\n for (let index = 0; index < cookies.length; index++) {\n const cookie = cookies[index];\n record[cookie.name] = cookie.value;\n }\n return record;\n};\n/**\n * Schema for transforming `Cookies` into records of decoded string values keyed\n * by cookie name.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaRecord = /*#__PURE__*/CookiesSchema.pipe(/*#__PURE__*/Schema.decodeTo(/*#__PURE__*/Schema.Record(Schema.String, Schema.String), /*#__PURE__*/Transformation.transform({\n decode: toRecord,\n encode: self => fromIterable(Object.entries(self).map(([name, value]) => makeCookieUnsafe(name, value)))\n})));\n/**\n * Serializes a `Cookies` collection into an array of `Set-Cookie` header values.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toSetCookieHeaders = self => Object.values(self.cookies).map(serializeCookie);\n/**\n * Parses a cookie header into a record of key-value pairs\n *\n * **Details**\n *\n * Adapted from https://github.com/fastify/fastify-cookie under MIT License\n *\n * @category decoding\n * @since 4.0.0\n */\nexport function parseHeader(header) {\n const result = {};\n const strLen = header.length;\n let pos = 0;\n let terminatorPos = 0;\n while (true) {\n if (terminatorPos === strLen) break;\n terminatorPos = header.indexOf(\";\", pos);\n if (terminatorPos === -1) terminatorPos = strLen; // This is the last pair\n let eqIdx = header.indexOf(\"=\", pos);\n if (eqIdx === -1) break; // No key-value pairs left\n if (eqIdx > terminatorPos) {\n // Malformed key-value pair\n pos = terminatorPos + 1;\n continue;\n }\n const key = header.substring(pos, eqIdx++).trim();\n if (result[key] === undefined) {\n const val = header.charCodeAt(eqIdx) === 0x22 ? header.substring(eqIdx + 1, terminatorPos - 1).trim() : header.substring(eqIdx, terminatorPos).trim();\n result[key] = !(val.indexOf(\"%\") === -1) ? tryDecodeURIComponent(val) : val;\n }\n pos = terminatorPos + 1;\n }\n return result;\n}\nconst tryDecodeURIComponent = str => {\n try {\n return decodeURIComponent(str);\n // oxlint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (_) {\n return str;\n }\n};\n//# sourceMappingURL=Cookies.js.map",
7
+ "/**\n * Immutable HTTP header collections for the unstable HTTP modules.\n *\n * This module defines the `Headers` data type used by HTTP client and server\n * request / response models. It converts records or iterables into a\n * predictable lowercase map, provides pipeable operations for reading and\n * updating header values, and integrates with inspection redaction so sensitive\n * header names can be masked before logging or serialization.\n *\n * ## Mental model\n *\n * A `Headers` value is a plain immutable record whose keys are normalized\n * header names and whose values are strings. Safe constructors and lookups\n * lowercase names because HTTP header names are case-insensitive, and\n * combinators return new `Headers` values instead of mutating the original\n * collection.\n *\n * ## Common tasks\n *\n * - Build headers from records or entry iterables with {@link fromInput}.\n * - Read values with {@link get} or check presence with {@link has}.\n * - Add, replace, merge, or remove headers with {@link set}, {@link setAll},\n * {@link merge}, {@link remove}, and {@link removeMany}.\n * - Mask sensitive names before inspection with {@link redact} and\n * {@link CurrentRedactedNames}.\n *\n * ## Gotchas\n *\n * Each lowercase header name stores one string. Record array values are joined\n * with `\", \"`, iterable input keeps the last value for duplicate names, and\n * later set / merge operations replace earlier values. This is convenient for\n * most headers but does not preserve repeated field lines such as `Set-Cookie`;\n * use cookie-specific HTTP modules when cookie multiplicity matters.\n *\n * **Example** (Normalize and update headers)\n *\n * ```ts\n * import { Option } from \"effect\"\n * import { Headers } from \"effect/unstable/http\"\n *\n * const headers = Headers.fromInput({\n * \"Content-Type\": \"application/json\",\n * accept: [\"application/json\", \"text/plain\"]\n * })\n *\n * const contentType = Headers.get(headers, \"content-type\")\n * if (Option.isSome(contentType)) {\n * console.log(contentType.value)\n * }\n *\n * const next = Headers.set(headers, \"authorization\", \"Bearer token\")\n * console.log(Headers.has(next, \"Authorization\")) // true\n * ```\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Equal from \"../../Equal.js\";\nimport * as Equ from \"../../Equivalence.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Hash from \"../../Hash.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Record from \"../../Record.js\";\nimport * as Redactable from \"../../Redactable.js\";\nimport * as Redacted from \"../../Redacted.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Transformation from \"../../SchemaTransformation.js\";\n/**\n * Runtime type identifier for `Headers` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = /*#__PURE__*/Symbol.for(\"~effect/http/Headers\");\n/**\n * Returns `true` if the provided value is a `Headers` value.\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isHeaders = u => Predicate.hasProperty(u, TypeId);\nconst Proto = /*#__PURE__*/Object.create(null);\nObject.defineProperties(Proto, {\n [TypeId]: {\n value: TypeId\n },\n [Redactable.symbolRedactable]: {\n value(context) {\n return redact(this, Context.get(context, CurrentRedactedNames));\n }\n },\n toJSON: {\n value() {\n return Redactable.redact(this);\n }\n },\n [Equal.symbol]: {\n value(that) {\n return Equivalence(this, that);\n }\n },\n [Hash.symbol]: {\n value() {\n return Hash.structure(this);\n }\n },\n toString: {\n value: Inspectable.BaseProto.toString\n },\n [Inspectable.NodeInspectSymbol]: {\n value: Inspectable.BaseProto[Inspectable.NodeInspectSymbol]\n }\n});\nconst make = input => Object.assign(Object.create(Proto), input);\n/**\n * Provides an `Equivalence` instance that compares `Headers` by header names\n * and string values.\n *\n * @category instances\n * @since 4.0.0\n */\nexport const Equivalence = /*#__PURE__*/Record.makeEquivalence(/*#__PURE__*/Equ.strictEqual());\n/**\n * Schema for `Headers` values encoded as records of string header values.\n *\n * **Details**\n *\n * Decoding normalizes header names through `fromInput`; encoding returns a plain record.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const HeadersSchema = /*#__PURE__*/Schema.declare(isHeaders, {\n typeConstructor: {\n _tag: \"effect/http/Headers\"\n },\n generation: {\n runtime: `Headers.HeadersSchema`,\n Type: `Headers.Headers`,\n Encoded: `typeof Headers.HeadersSchema[\"Encoded\"]`,\n importDeclaration: `import * as Headers from \"effect/unstable/http/Headers\"`\n },\n expected: \"Headers\",\n toEquivalence: () => Equivalence,\n toCodec: () => Schema.link()(Schema.Record(Schema.String, Schema.String), Transformation.transform({\n decode: input => fromInput(input),\n encode: headers => ({\n ...headers\n })\n }))\n});\n/**\n * An empty `Headers` collection.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/Object.create(Proto);\n/**\n * Creates `Headers` from a record or iterable of header entries.\n *\n * **Details**\n *\n * Header names are normalized to lowercase. Array values in record input are joined with `\", \"`, and `undefined` values are omitted.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromInput = input => {\n if (input === undefined) {\n return empty;\n } else if (Symbol.iterator in input) {\n const out = Object.create(Proto);\n for (const [k, v] of input) {\n out[k.toLowerCase()] = v;\n }\n return out;\n }\n const out = Object.create(Proto);\n for (const [k, v] of Object.entries(input)) {\n if (Array.isArray(v)) {\n out[k.toLowerCase()] = v.join(\", \");\n } else if (v !== undefined) {\n out[k.toLowerCase()] = v;\n }\n }\n return out;\n};\n/**\n * Treats an existing record as `Headers` unsafely.\n *\n * **Gotchas**\n *\n * This mutates the record's prototype and does not normalize header names; callers must provide the expected lowercase keys.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromRecordUnsafe = input => Object.setPrototypeOf(input, Proto);\n/**\n * Returns `true` when a header with the given name is present.\n *\n * **Details**\n *\n * The lookup lowercases the provided header name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const has = /*#__PURE__*/dual(2, (self, key) => key.toLowerCase() in self);\n/**\n * Gets a header value by name safely.\n *\n * **Details**\n *\n * The lookup lowercases the provided header name and returns `Option.none()` when absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/dual(2, (self, key) => Option.fromUndefinedOr(self[key.toLowerCase()]));\n/**\n * Returns a new `Headers` collection with the given header set.\n *\n * **Details**\n *\n * The header name is normalized to lowercase.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const set = /*#__PURE__*/dual(3, (self, key, value) => {\n const out = make(self);\n out[key.toLowerCase()] = value;\n return out;\n});\n/**\n * Returns a new `Headers` collection with all provided headers set.\n *\n * **Details**\n *\n * Input headers are normalized with `fromInput` and override existing headers with the same lowercase name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAll = /*#__PURE__*/dual(2, (self, headers) => make({\n ...self,\n ...fromInput(headers)\n}));\n/**\n * Returns a new `Headers` collection containing headers from both collections.\n *\n * **Details**\n *\n * Headers from the second collection override headers from the first collection with the same name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const merge = /*#__PURE__*/dual(2, (self, headers) => {\n const out = make(self);\n Object.assign(out, headers);\n return out;\n});\n/**\n * Returns a new `Headers` collection with the named header removed.\n *\n * **Details**\n *\n * The provided header name is normalized to lowercase before removal.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const remove = /*#__PURE__*/dual(2, (self, key) => {\n const out = make(self);\n delete out[key.toLowerCase()];\n return out;\n});\n/**\n * Returns a new `Headers` collection with each named header removed.\n *\n * **Details**\n *\n * Each provided header name is normalized to lowercase before removal.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const removeMany = /*#__PURE__*/dual(2, (self, keys) => {\n const out = make(self);\n for (const key of keys) {\n delete out[key.toLowerCase()];\n }\n return out;\n});\n/**\n * Returns a plain record with selected header values wrapped in `Redacted`.\n *\n * **Details**\n *\n * String keys are normalized to lowercase before matching; regular expressions are tested against the stored header names.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const redact = /*#__PURE__*/dual(2, (self, key) => {\n const out = {\n ...self\n };\n const modify = key => {\n if (typeof key === \"string\") {\n const k = key.toLowerCase();\n if (k in self) {\n out[k] = Redacted.make(self[k]);\n }\n } else {\n for (const name in self) {\n if (key.test(name)) {\n out[name] = Redacted.make(self[name]);\n }\n }\n }\n };\n if (Array.isArray(key)) {\n for (let i = 0; i < key.length; i++) {\n modify(key[i]);\n }\n } else {\n modify(key);\n }\n return out;\n});\n/**\n * Context reference listing header names or patterns that should be redacted when `Headers` are inspected or rendered.\n *\n * **Details**\n *\n * Defaults include `authorization`, `cookie`, `set-cookie`, and `x-api-key`.\n *\n * @category fiber refs\n * @since 4.0.0\n */\nexport const CurrentRedactedNames = /*#__PURE__*/Context.Reference(\"effect/Headers/CurrentRedactedNames\", {\n defaultValue: () => [\"authorization\", \"cookie\", \"set-cookie\", \"x-api-key\"]\n});\n//# sourceMappingURL=Headers.js.map",
8
+ "/**\n * Typed failure model for Effect HTTP client operations.\n *\n * HTTP clients wrap request construction, transport, status-code validation, and\n * response decoding failures in `HttpClientError`. The wrapper keeps the failed\n * request and the specific failure reason together, so callers can handle client\n * failures uniformly while still matching on the reason `_tag` for retry\n * policy, logging, metrics, and user-facing messages.\n *\n * **Mental model**\n *\n * A client error reason belongs to one of two families. Request errors happen\n * before a response exists: `TransportError`, `EncodeError`, and\n * `InvalidUrlError`. Response errors include the response that triggered them:\n * `StatusCodeError`, `DecodeError`, and `EmptyBodyError`.\n *\n * **Common tasks**\n *\n * - Use `isHttpClientError` at untyped boundaries.\n * - Read `request` for the method and URL associated with any client failure.\n * - Match on `reason._tag` when different failures need different recovery.\n * - Read `response` only for response errors or after checking that it exists.\n *\n * **Gotchas**\n *\n * `response` is `undefined` for transport, encoding, and invalid URL failures.\n * Preserve the original `cause` when constructing reason classes so lower-level\n * platform or decoding details are not lost.\n *\n * @since 4.0.0\n */\nimport * as Data from \"../../Data.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as Schema from \"../../Schema.js\";\nconst TypeId = \"~effect/http/HttpClientError\";\n/**\n * Returns `true` when a value is an `HttpClientError`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpClientError = u => hasProperty(u, TypeId);\n/**\n * Error wrapper for HTTP client failures, exposing the failed request and the optional response through its `reason`.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class HttpClientError extends /*#__PURE__*/Data.TaggedError(\"HttpClientError\") {\n constructor(props) {\n if (\"cause\" in props.reason) {\n super({\n ...props,\n cause: props.reason.cause\n });\n } else {\n super(props);\n }\n }\n /**\n * Marks this value as an HTTP client error for runtime guards.\n *\n * @since 4.0.0\n */\n [TypeId] = TypeId;\n /**\n * HTTP request associated with the client failure.\n *\n * @since 4.0.0\n */\n get request() {\n return this.reason.request;\n }\n /**\n * HTTP response associated with the client failure, when one was received.\n *\n * @since 4.0.0\n */\n get response() {\n return \"response\" in this.reason ? this.reason.response : undefined;\n }\n get message() {\n return this.reason.message;\n }\n}\nconst formatReason = tag => tag.endsWith(\"Error\") ? tag.slice(0, -5) : tag;\nconst formatMessage = (reason, description, info) => description ? `${reason}: ${description} (${info})` : `${reason} error (${info})`;\n/**\n * Error describing transport-level failures that occur while sending an HTTP request.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class TransportError extends /*#__PURE__*/Data.TaggedError(\"TransportError\") {\n /**\n * Formats the request method and URL for transport error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the transport error message from the optional description and request details.\n *\n * @since 4.0.0\n */\n get message() {\n return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);\n }\n}\n/**\n * Error describing failures while encoding an HTTP request body.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class EncodeError extends /*#__PURE__*/Data.TaggedError(\"EncodeError\") {\n /**\n * Formats the request method and URL for request encoding error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the request encoding error message from the optional description and request details.\n *\n * @since 4.0.0\n */\n get message() {\n return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);\n }\n}\n/**\n * Error describing failures while constructing a URL from an HTTP client request.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class InvalidUrlError extends /*#__PURE__*/Data.TaggedError(\"InvalidUrlError\") {\n /**\n * Formats the request method and URL for invalid URL error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the invalid URL error message from the optional description and request details.\n *\n * @since 4.0.0\n */\n get message() {\n return formatMessage(formatReason(this._tag), this.description, this.methodAndUrl);\n }\n}\n/**\n * Response error for HTTP responses rejected because of their status code.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class StatusCodeError extends /*#__PURE__*/Data.TaggedError(\"StatusCodeError\") {\n /**\n * Formats the request method and URL for status code error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the status code error message from the response status, optional description, and request details.\n *\n * @since 4.0.0\n */\n get message() {\n const info = `${this.response.status} ${this.methodAndUrl}`;\n return formatMessage(formatReason(this._tag), this.description, info);\n }\n}\n/**\n * Response error for failures while decoding an HTTP response body.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class DecodeError extends /*#__PURE__*/Data.TaggedError(\"DecodeError\") {\n /**\n * Formats the request method and URL for response decoding error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the response decoding error message from the response status, optional description, and request details.\n *\n * @since 4.0.0\n */\n get message() {\n const info = `${this.response.status} ${this.methodAndUrl}`;\n return formatMessage(formatReason(this._tag), this.description, info);\n }\n}\n/**\n * Response error for operations that expected a response body but received an empty body.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class EmptyBodyError extends /*#__PURE__*/Data.TaggedError(\"EmptyBodyError\") {\n /**\n * Formats the request method and URL for empty response body error messages.\n *\n * @since 4.0.0\n */\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n /**\n * Builds the empty body error message from the response status, optional description, and request details.\n *\n * @since 4.0.0\n */\n get message() {\n const info = `${this.response.status} ${this.methodAndUrl}`;\n return formatMessage(formatReason(this._tag), this.description, info);\n }\n}\n/**\n * Schema for serializable HTTP client errors, preserving the specific error kind\n * and cause.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport class HttpClientErrorSchema extends /*#__PURE__*/Schema.ErrorClass(TypeId)({\n _tag: /*#__PURE__*/Schema.tag(\"HttpError\"),\n kind: /*#__PURE__*/Schema.Literals([\"EncodeError\", \"DecodeError\", \"TransportError\", \"InvalidUrlError\", \"StatusCodeError\", \"EmptyBodyError\"]),\n cause: /*#__PURE__*/Schema.optional(Schema.Defect)\n}) {\n /**\n * Builds the serializable schema representation for an HTTP client error.\n *\n * @since 4.0.0\n */\n static fromHttpClientError(error) {\n return new HttpClientErrorSchema({\n _tag: \"HttpError\",\n kind: error.reason._tag,\n cause: error.reason\n });\n }\n}\n//# sourceMappingURL=HttpClientError.js.map",
9
+ "/**\n * Immutable URL query parameters represented as ordered string pairs.\n *\n * This module is the shared query-parameter model for HTTP client request\n * queries, URL-encoded form bodies, and server-side decoding. A `UrlParams`\n * value can be built from records, iterables, or native `URLSearchParams`, then\n * inspected, appended, replaced, removed, serialized, converted to a `URL`, or\n * decoded with schemas.\n *\n * **Mental model**\n *\n * The core representation is a list of `[key, value]` string pairs. Duplicate\n * keys and pair order are preserved by `make`, `fromInput`, iteration, and\n * append-style operations. Record input is a convenience layer: primitive values\n * become strings, arrays become repeated parameters, nested records use bracket\n * notation, and `undefined` fields are skipped.\n *\n * **Common tasks**\n *\n * - Build query parameters from plain records, tuples, or `URLSearchParams`.\n * - Read the first, last, or all values for a key.\n * - Replace, append, transform, or remove keys without mutating the original.\n * - Serialize a query string, merge parameters into a URL, or decode records and\n * JSON fields with schemas.\n *\n * **Gotchas**\n *\n * Use `getAll` when every duplicate value matters. `set` and `setAll` replace\n * existing values for matching keys, while `append` and `appendAll` preserve\n * them. Serialization through `toString` and `makeUrl` delegates to the platform\n * `URLSearchParams` / `URL` implementations, so pass decoded strings rather\n * than pre-encoded query fragments. Record-based and schema-based conversions\n * collapse repeated keys into string arrays and do not preserve the full global\n * pair ordering; `schemaJsonField` reads the first matching value for the\n * selected field.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"../../Array.js\";\nimport * as Data from \"../../Data.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Equal from \"../../Equal.js\";\nimport * as Equ from \"../../Equivalence.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Hash from \"../../Hash.js\";\nimport { PipeInspectableProto } from \"../../internal/core.js\";\nimport * as Option from \"../../Option.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Issue from \"../../SchemaIssue.js\";\nimport * as Transformation from \"../../SchemaTransformation.js\";\nimport * as Tuple from \"../../Tuple.js\";\nconst TypeId = \"~effect/http/UrlParams\";\n/**\n * Returns `true` when a value is a `UrlParams` instance.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isUrlParams = u => hasProperty(u, TypeId);\nconst Proto = {\n ...PipeInspectableProto,\n [TypeId]: TypeId,\n [Symbol.iterator]() {\n return this.params[Symbol.iterator]();\n },\n toJSON() {\n return {\n _id: \"UrlParams\",\n params: Object.fromEntries(this.params)\n };\n },\n [Equal.symbol](that) {\n return Equivalence(this, that);\n },\n [Hash.symbol]() {\n return Hash.array(this.params.flat());\n }\n};\n/**\n * Creates `UrlParams` from ordered string key-value pairs.\n *\n * **Details**\n *\n * The input pairs are used as-is and are not coerced or normalized.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = params => {\n const self = Object.create(Proto);\n self.params = params;\n return self;\n};\n/**\n * Creates `UrlParams` from a supported input shape.\n *\n * **Details**\n *\n * Primitive values are converted to strings, arrays produce repeated parameters,\n * nested records use bracket notation, and `undefined` values are omitted.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromInput = input => {\n const parsed = fromInputNested(input);\n const out = [];\n for (let i = 0; i < parsed.length; i++) {\n if (Array.isArray(parsed[i][0])) {\n const [keys, value] = parsed[i];\n out.push([`${keys[0]}[${keys.slice(1).join(\"][\")}]`, value]);\n } else {\n out.push(parsed[i]);\n }\n }\n return make(out);\n};\nconst fromInputNested = input => {\n const entries = typeof input[Symbol.iterator] === \"function\" ? Arr.fromIterable(input) : Object.entries(input);\n const out = [];\n for (const [key, value] of entries) {\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n if (value[i] !== undefined) {\n out.push([key, String(value[i])]);\n }\n }\n } else if (typeof value === \"object\") {\n const nested = fromInputNested(value);\n for (const [k, v] of nested) {\n out.push([[key, ...(typeof k === \"string\" ? [k] : k)], v]);\n }\n } else if (value !== undefined) {\n out.push([key, String(value)]);\n }\n }\n return out;\n};\n/**\n * Provides an order-sensitive `Equivalence` instance for `UrlParams`.\n *\n * **Details**\n *\n * Two values are equivalent when they contain the same key-value pairs in the same\n * order.\n *\n * @category instances\n * @since 4.0.0\n */\nexport const Equivalence = /*#__PURE__*/Equ.make((a, b) => arrayEquivalence(a.params, b.params));\nconst arrayEquivalence = /*#__PURE__*/Arr.makeEquivalence(/*#__PURE__*/Tuple.makeEquivalence([/*#__PURE__*/Equ.strictEqual(), /*#__PURE__*/Equ.strictEqual()]));\n/**\n * Schema for `UrlParams`.\n *\n * **Details**\n *\n * The encoded representation is an array of string key-value tuples.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const UrlParamsSchema = /*#__PURE__*/Schema.declare(isUrlParams, {\n typeConstructor: {\n _tag: \"effect/http/UrlParams\"\n },\n generation: {\n runtime: `UrlParams.UrlParamsSchema`,\n Type: `UrlParams.UrlParams`,\n Encoded: `typeof UrlParams.UrlParamsSchema[\"Encoded\"]`,\n importDeclaration: `import * as UrlParams from \"effect/unstable/http/UrlParams\"`\n },\n expected: \"UrlParams\",\n toEquivalence: () => Equivalence,\n toCodec: () => Schema.link()(Schema.Array(Schema.Tuple([Schema.String, Schema.String])), Transformation.transform({\n decode: make,\n encode: self => self.params\n }))\n});\n/**\n * An empty `UrlParams` value.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/make([]);\n/**\n * Returns all values for a query parameter key in insertion order.\n *\n * **Details**\n *\n * Returns an empty array when the key is absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getAll = /*#__PURE__*/dual(2, (self, key) => Arr.reduce(self.params, [], (acc, [k, value]) => {\n if (k === key) {\n acc.push(value);\n }\n return acc;\n}));\n/**\n * Returns the first value for a query parameter key safely.\n *\n * **Details**\n *\n * Returns `Option.none` when the key is absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getFirst = /*#__PURE__*/dual(2, (self, key) => Arr.findFirst(self.params, ([k]) => k === key).pipe(Option.map(([, value]) => value)));\n/**\n * Returns the last value for a query parameter key safely.\n *\n * **Details**\n *\n * Returns `Option.none` when the key is absent.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const getLast = /*#__PURE__*/dual(2, (self, key) => Arr.findLast(self.params, ([k]) => k === key).pipe(Option.map(([, value]) => value)));\n/**\n * Sets a query parameter to a single value.\n *\n * **Details**\n *\n * Existing values for the same key are removed, and the new value is appended to\n * the end.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const set = /*#__PURE__*/dual(3, (self, key, value) => make(Arr.append(Arr.filter(self.params, ([k]) => k !== key), [key, String(value)])));\n/**\n * Transforms the underlying ordered key-value pairs of `UrlParams`.\n *\n * **Details**\n *\n * The result is wrapped in a new `UrlParams` value.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const transform = /*#__PURE__*/dual(2, (self, f) => make(f(self.params)));\n/**\n * Sets multiple query parameters from input.\n *\n * **Details**\n *\n * Keys present in the input replace existing values for those keys, while\n * unmentioned existing parameters are preserved.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setAll = /*#__PURE__*/dual(2, (self, input) => {\n const out = fromInput(input);\n const params = out.params;\n const keys = new Set();\n for (let i = 0; i < params.length; i++) {\n keys.add(params[i][0]);\n }\n for (let i = 0; i < self.params.length; i++) {\n if (keys.has(self.params[i][0])) continue;\n params.push(self.params[i]);\n }\n return out;\n});\n/**\n * Appends a query parameter value without removing existing values for the key.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const append = /*#__PURE__*/dual(3, (self, key, value) => make(Arr.append(self.params, [key, String(value)])));\n/**\n * Appends all query parameters produced from the supplied input.\n *\n * **Details**\n *\n * Existing parameters are preserved.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const appendAll = /*#__PURE__*/dual(2, (self, input) => transform(self, Arr.appendAll(fromInput(input).params)));\n/**\n * Removes all query parameter values for the specified key.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const remove = /*#__PURE__*/dual(2, (self, key) => transform(self, Arr.filter(([k]) => k !== key)));\n/**\n * Error returned when constructing a `URL` from `UrlParams` fails.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class UrlParamsError extends /*#__PURE__*/Data.TaggedError(\"UrlParamsError\") {}\n/**\n * Creates a `URL` safely by appending `UrlParams` and an optional hash to a URL string.\n *\n * **Details**\n *\n * Returns a `Result` that fails with `UrlParamsError` if the URL cannot be\n * constructed.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const makeUrl = (url, params, hash) => {\n try {\n const urlInstance = new URL(url, baseUrl());\n for (let i = 0; i < params.params.length; i++) {\n const [key, value] = params.params[i];\n if (value !== undefined) {\n urlInstance.searchParams.append(key, value);\n }\n }\n if (hash !== undefined) {\n urlInstance.hash = hash;\n }\n return Result.succeed(urlInstance);\n } catch (e) {\n return Result.fail(new UrlParamsError({\n cause: e\n }));\n }\n};\n/**\n * Serializes `UrlParams` to a URL query string without a leading question mark.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toString = self => new URLSearchParams(self.params).toString();\nconst baseUrl = () => {\n if (\"location\" in globalThis && globalThis.location !== undefined && globalThis.location.origin !== undefined && globalThis.location.pathname !== undefined) {\n return location.origin + location.pathname;\n }\n return undefined;\n};\n/**\n * Builds a `Record` containing all the key-value pairs in the given `UrlParams`\n * as `string` (if only one value for a key) or a `NonEmptyArray<string>`\n * (when more than one value for a key)\n *\n * **Example** (Converting parameters to a record)\n *\n * ```ts\n * import { UrlParams } from \"effect/unstable/http\"\n * import * as assert from \"node:assert\"\n *\n * const urlParams = UrlParams.fromInput({\n * a: 1,\n * b: true,\n * c: \"string\",\n * e: [1, 2, 3]\n * })\n * const result = UrlParams.toRecord(urlParams)\n *\n * assert.deepStrictEqual(\n * result,\n * { \"a\": \"1\", \"b\": \"true\", \"c\": \"string\", \"e\": [\"1\", \"2\", \"3\"] }\n * )\n * ```\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toRecord = self => {\n const out = {};\n for (const [k, value] of self.params) {\n const curr = out[k];\n if (curr === undefined) {\n out[k] = value;\n } else if (typeof curr === \"string\") {\n out[k] = [curr, value];\n } else {\n curr.push(value);\n }\n }\n return out;\n};\n/**\n * Builds a readonly record from `UrlParams`.\n *\n * **Details**\n *\n * Keys with one value map to a string, and keys with multiple values map to a\n * non-empty readonly array of strings.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toReadonlyRecord = toRecord;\n/**\n * Extracts a JSON value from the first occurrence of the given `field` in the\n * `UrlParams`.\n *\n * **Example** (Decoding JSON parameter fields)\n *\n * ```ts\n * import { Schema } from \"effect\"\n * import { UrlParams } from \"effect/unstable/http\"\n *\n * const extractFoo = UrlParams.schemaJsonField(\"foo\").pipe(\n * Schema.decodeTo(Schema.Struct({\n * some: Schema.String,\n * number: Schema.Number\n * }))\n * )\n *\n * console.log(\n * Schema.decodeSync(extractFoo)(UrlParams.fromInput({\n * foo: JSON.stringify({ some: \"bar\", number: 42 }),\n * baz: \"qux\"\n * }))\n * )\n * ```\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaJsonField = field => UrlParamsSchema.pipe(Schema.decodeTo(Schema.UnknownFromJsonString, Transformation.transformOrFail({\n decode: params => Option.match(getFirst(params, field), {\n onNone: () => Effect.fail(new Issue.Pointer([field], new Issue.MissingKey(undefined))),\n onSome: Effect.succeed\n }),\n encode: value => Effect.succeed(make([[field, value]]))\n})));\n/**\n * Schema that decodes `UrlParams` into a record of key-value pairs.\n *\n * **Details**\n *\n * Keys with one value decode to a string, and keys with multiple values decode to\n * a non-empty readonly array of strings.\n *\n * **Example** (Decoding URL parameters to a record)\n *\n * ```ts\n * import { Schema } from \"effect\"\n * import { UrlParams } from \"effect/unstable/http\"\n *\n * const toStruct = UrlParams.schemaRecord.pipe(\n * Schema.decodeTo(Schema.Struct({\n * some: Schema.String,\n * number: Schema.FiniteFromString\n * }))\n * )\n *\n * console.log(\n * Schema.decodeSync(toStruct)(UrlParams.fromInput({\n * some: \"value\",\n * number: 42\n * }))\n * )\n * ```\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaRecord = /*#__PURE__*/UrlParamsSchema.pipe(/*#__PURE__*/Schema.decodeTo(/*#__PURE__*/Schema.Record(Schema.String, /*#__PURE__*/Schema.Union([Schema.String, /*#__PURE__*/Schema.NonEmptyArray(Schema.String)])), /*#__PURE__*/Transformation.transform({\n decode: toReadonlyRecord,\n encode: fromInput\n})));\n//# sourceMappingURL=UrlParams.js.map",
10
+ "/**\n * Describes the body attached to outgoing HTTP requests and server responses.\n *\n * `HttpBody` is the transport-facing representation used by the HTTP modules\n * before a platform adapter turns a request or response into a concrete Web,\n * Node, or other runtime value. Each body variant carries the payload plus the\n * metadata an adapter can safely know ahead of time, such as `contentType` and\n * `contentLength`.\n *\n * **Mental model**\n *\n * - {@link empty} represents an absent body.\n * - {@link uint8Array}, {@link text}, {@link jsonUnsafe}, {@link json}, and\n * {@link urlParams} build in-memory byte bodies with content metadata.\n * - {@link formData} and {@link formDataRecord} keep multipart data as\n * `FormData` so the runtime can generate the boundary.\n * - {@link stream} represents a stream of `Uint8Array` chunks and may omit the\n * content length when the final size is not known.\n * - {@link raw} is the escape hatch for platform-specific body values that an\n * adapter already knows how to send.\n *\n * **Common tasks**\n *\n * - Send text, bytes, JSON, URL-encoded data, multipart forms, or files.\n * - Use {@link json} or {@link jsonSchema} when JSON encoding failures should\n * be represented as `HttpBodyError` values.\n * - Use {@link file} or {@link fileFromInfo} when file metadata should become\n * `contentType` / `contentLength` metadata for the adapter.\n * - Use {@link isHttpBody} when accepting unknown values at an integration\n * boundary.\n *\n * **Gotchas**\n *\n * - {@link jsonUnsafe} calls `JSON.stringify` directly and can throw; prefer\n * {@link json} in effectful code.\n * - `FormData` bodies intentionally leave `contentType` unset because setting a\n * multipart header without the generated boundary produces invalid requests.\n * - Stream bodies may not have a `contentLength`; code that requires one must\n * provide it explicitly when constructing the stream body.\n *\n * **Example** (Creating common body variants)\n *\n * ```ts\n * import { HttpBody, UrlParams } from \"effect/unstable/http\"\n * import * as assert from \"node:assert\"\n *\n * const textBody = HttpBody.text(\"hello\")\n * const jsonBody = HttpBody.jsonUnsafe({ name: \"Ada\" })\n * const formBody = HttpBody.urlParams(UrlParams.fromInput({ q: \"effect\" }))\n *\n * assert.equal(textBody.contentType, \"text/plain\")\n * assert.equal(jsonBody.contentType, \"application/json\")\n * assert.equal(formBody.contentType, \"application/x-www-form-urlencoded\")\n * ```\n *\n * @since 4.0.0\n */\nimport * as Data from \"../../Data.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { format } from \"../../Formatter.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Parser from \"../../SchemaParser.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nconst TypeId = \"~effect/http/HttpBody\";\n/**\n * Returns `true` if the provided value is an `HttpBody`.\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isHttpBody = u => Predicate.hasProperty(u, TypeId);\nconst HttpBodyErrorTypeId = \"~effect/http/HttpBody/HttpBodyError\";\n/**\n * Error produced while constructing an HTTP body from JSON or schema-encoded input.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class HttpBodyError extends /*#__PURE__*/Data.TaggedError(\"HttpBodyError\") {\n /**\n * Marks this value as an HTTP body error for runtime guards.\n *\n * @since 4.0.0\n */\n [HttpBodyErrorTypeId] = HttpBodyErrorTypeId;\n}\nclass Proto {\n [TypeId];\n constructor() {\n this[TypeId] = TypeId;\n }\n [Inspectable.NodeInspectSymbol]() {\n return this.toJSON();\n }\n toString() {\n return format(this, {\n ignoreToString: true\n });\n }\n}\n/**\n * HTTP body variant representing the absence of request content.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Empty extends Proto {\n _tag = \"Empty\";\n toJSON() {\n return {\n _id: \"effect/HttpBody\",\n _tag: \"Empty\"\n };\n }\n}\n/**\n * Provides the singleton empty HTTP body.\n *\n * **When to use**\n *\n * Use when you need an HTTP body value that represents no body content.\n *\n * @category constants\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/new Empty();\n/**\n * HTTP body variant containing an arbitrary runtime body value with optional content metadata.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Raw extends Proto {\n _tag = \"Raw\";\n body;\n contentType;\n contentLength;\n constructor(body, contentType, contentLength) {\n super();\n this.body = body;\n this.contentType = contentType;\n this.contentLength = contentLength;\n }\n toJSON() {\n return {\n _id: \"effect/HttpBody\",\n _tag: \"Raw\",\n body: this.body,\n contentType: this.contentType,\n contentLength: this.contentLength\n };\n }\n}\n/**\n * Creates a raw HTTP body from an arbitrary value and optional `contentType` and `contentLength` metadata.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const raw = (body, options) => new Raw(body, options?.contentType, options?.contentLength);\n/**\n * HTTP body variant backed by a `Uint8Array`.\n *\n * **Details**\n *\n * It stores the bytes, content type, and byte length.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Uint8Array extends Proto {\n _tag = \"Uint8Array\";\n body;\n contentType;\n contentLength;\n constructor(body, contentType, contentLength) {\n super();\n this.body = body;\n this.contentType = contentType;\n this.contentLength = contentLength;\n }\n toJSON() {\n const toString = this.contentType.startsWith(\"text/\") || this.contentType.endsWith(\"json\");\n return {\n _id: \"effect/HttpBody\",\n _tag: \"Uint8Array\",\n body: toString ? new TextDecoder().decode(this.body) : `Uint8Array(${this.body.length})`,\n contentType: this.contentType,\n contentLength: this.contentLength\n };\n }\n}\n/**\n * Creates a byte-array HTTP body.\n *\n * **Details**\n *\n * The content type defaults to `application/octet-stream`, and the content length is the byte array length.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const uint8Array = (body, contentType) => new Uint8Array(body, contentType ?? \"application/octet-stream\", body.length);\nconst encoder = /*#__PURE__*/new TextEncoder();\n/**\n * Creates a UTF-8 encoded text HTTP body.\n *\n * **Details**\n *\n * The content type defaults to `text/plain`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const text = (body, contentType) => uint8Array(encoder.encode(body), contentType ?? \"text/plain\");\n/**\n * Creates a JSON HTTP body using `JSON.stringify`, throwing if serialization fails.\n *\n * **Details**\n *\n * The content type defaults to `application/json`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const jsonUnsafe = (body, contentType) => text(JSON.stringify(body), contentType ?? \"application/json\");\n/**\n * Creates a JSON HTTP body in an `Effect`.\n *\n * **Details**\n *\n * `JSON.stringify` failures are captured as `HttpBodyError` values, and the content type defaults to `application/json`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const json = (body, contentType) => Effect.try({\n try: () => text(JSON.stringify(body), contentType ?? \"application/json\"),\n catch: cause => new HttpBodyError({\n reason: {\n _tag: \"JsonError\"\n },\n cause\n })\n});\n/**\n * Creates a JSON body constructor that first encodes values with the schema's JSON codec.\n *\n * **Details**\n *\n * Schema encoding issues and JSON serialization failures are returned as `HttpBodyError` values.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const jsonSchema = (schema, options) => {\n const encode = Parser.encodeUnknownEffect(Schema.toCodecJson(schema));\n return (body, contentType) => encode(body, options).pipe(Effect.mapError(issue => new HttpBodyError({\n reason: {\n _tag: \"SchemaError\",\n issue\n },\n cause: issue\n })), Effect.flatMap(body => json(body, contentType)));\n};\n/**\n * Creates an `application/x-www-form-urlencoded` HTTP body from `UrlParams`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const urlParams = (urlParams, contentType) => text(UrlParams.toString(urlParams), contentType ?? \"application/x-www-form-urlencoded\");\n/**\n * HTTP body variant backed by Web `FormData`.\n *\n * **Details**\n *\n * The content type and content length are left unset so the runtime can supply multipart boundaries.\n *\n * @category models\n * @since 4.0.0\n */\nexport class FormData extends Proto {\n _tag = \"FormData\";\n contentType = undefined;\n contentLength = undefined;\n formData;\n constructor(formData) {\n super();\n this.formData = formData;\n }\n toJSON() {\n return {\n _id: \"effect/HttpBody\",\n _tag: \"FormData\",\n formData: this.formData\n };\n }\n}\n/**\n * Wraps a Web `FormData` value as an HTTP body.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const formData = body => new FormData(body);\nconst appendFormDataValue = (formData, key, value) => {\n if (value == null) {\n return;\n }\n if (typeof value === \"object\") {\n formData.append(key, value);\n return;\n }\n formData.append(key, String(value));\n};\n/**\n * Creates a `FormData` HTTP body from a record.\n *\n * **Details**\n *\n * Array fields append each item under the same key; primitive values are stringified, `File` and `Blob` values are appended directly, and nullish values are skipped.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const formDataRecord = entries => {\n const data = new globalThis.FormData();\n for (const [key, value] of Object.entries(entries)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n appendFormDataValue(data, key, item);\n }\n } else {\n appendFormDataValue(data, key, value);\n }\n }\n return formData(data);\n};\n/**\n * HTTP body variant backed by a stream of `Uint8Array` chunks.\n *\n * @category models\n * @since 4.0.0\n */\nexport class Stream extends Proto {\n _tag = \"Stream\";\n stream;\n contentType;\n contentLength;\n constructor(stream, contentType, contentLength) {\n super();\n this.stream = stream;\n this.contentType = contentType;\n this.contentLength = contentLength;\n }\n toJSON() {\n return {\n _id: \"effect/HttpBody\",\n _tag: \"Stream\",\n contentType: this.contentType,\n contentLength: this.contentLength\n };\n }\n}\n/**\n * Creates a streaming HTTP body from a stream of byte chunks.\n *\n * **Details**\n *\n * The content type defaults to `application/octet-stream`; content length is optional.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const stream = (body, contentType, contentLength) => new Stream(body, contentType ?? \"application/octet-stream\", contentLength);\n/**\n * Creates a streaming HTTP body for a file path.\n *\n * **Details**\n *\n * The effect requires `FileSystem`, stats the file to set the content length, and can fail with `PlatformError`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const file = (path, options) => Effect.flatMap(FileSystem.FileSystem, fs => Effect.map(fs.stat(path), info => stream(fs.stream(path, options), options?.contentType, Number(info.size))));\n/**\n * Creates a streaming HTTP body for a file path using already-known file information.\n *\n * **Details**\n *\n * The effect requires `FileSystem`, uses the provided file size as the content length, and can fail with `PlatformError`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileFromInfo = (path, info, options) => Effect.map(FileSystem.FileSystem, fs => stream(fs.stream(path, options), options?.contentType, Number(info.size)));\n//# sourceMappingURL=HttpBody.js.map",
11
+ "/**\n * HTTP method literals and helpers shared by the unstable HTTP client, server,\n * and routing APIs.\n *\n * This module keeps the supported method vocabulary in one place: the\n * {@link HttpMethod} union, {@link all} set, {@link allShort} mapping,\n * {@link hasBody} body classification helper, and {@link isHttpMethod} runtime\n * refinement. Values are uppercase string literals such as `\"GET\"` and\n * `\"POST\"`, matching the method tokens used by the HTTP APIs in this package.\n *\n * **Mental model**\n *\n * {@link HttpMethod} is the complete set this module recognizes.\n * {@link HttpMethod.NoBody} is the subset treated as bodyless (`GET`, `HEAD`,\n * `OPTIONS`, and `TRACE`), and {@link HttpMethod.WithBody} is the remaining\n * subset accepted by request builders that can carry a body.\n *\n * **Common tasks**\n *\n * Use {@link isHttpMethod} before accepting an unknown value as an HTTP method,\n * {@link hasBody} to narrow a method before attaching a body, {@link all} for\n * membership checks or iteration, and {@link allShort} when deriving the short\n * constructor names used by request helpers.\n *\n * **Gotchas**\n *\n * Lowercase method names are not valid {@link HttpMethod} values. The body\n * split is a typed helper convention, not a full statement of every\n * wire-protocol edge case: `DELETE` is treated as able to carry a body, while\n * `GET` helpers are treated as bodyless even though some systems may send a\n * body on the wire.\n *\n * @since 4.0.0\n */\n/**\n * Returns `true` when a method can carry a request body and narrows it to `HttpMethod.WithBody`.\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const hasBody = method => method !== \"GET\" && method !== \"HEAD\" && method !== \"OPTIONS\" && method !== \"TRACE\";\n/**\n * Provides a readonly set containing every supported `HttpMethod` literal.\n *\n * **When to use**\n *\n * Use when you need to iterate over or test membership against every supported\n * HTTP method literal.\n *\n * @category constants\n * @since 4.0.0\n */\nexport const all = /*#__PURE__*/new Set([\"GET\", \"POST\", \"PUT\", \"DELETE\", \"PATCH\", \"HEAD\", \"OPTIONS\", \"TRACE\"]);\n/**\n * Provides tuples mapping each supported HTTP method to its short\n * request-constructor name.\n *\n * **When to use**\n *\n * Use when you need the mapping from supported HTTP method literals to their\n * short request-constructor names.\n *\n * @category constants\n * @since 4.0.0\n */\nexport const allShort = [[\"GET\", \"get\"], [\"POST\", \"post\"], [\"PUT\", \"put\"], [\"DELETE\", \"del\"], [\"PATCH\", \"patch\"], [\"HEAD\", \"head\"], [\"OPTIONS\", \"options\"], [\"TRACE\", \"trace\"]];\n/**\n * Checks whether a value is a `HttpMethod`.\n *\n * **Example** (Checking HTTP method values)\n *\n * ```ts\n * import { HttpMethod } from \"effect/unstable/http\"\n *\n * console.log(HttpMethod.isHttpMethod(\"GET\"))\n * // true\n * console.log(HttpMethod.isHttpMethod(\"get\"))\n * // false\n * console.log(HttpMethod.isHttpMethod(1))\n * // false\n * ```\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isHttpMethod = u => all.has(u);\n//# sourceMappingURL=HttpMethod.js.map",
12
+ "/**\n * Immutable outgoing HTTP client requests.\n *\n * `HttpClientRequest` is the request model shared by Effect HTTP clients and\n * platform adapters. A request stores its method, URL, query parameters, hash,\n * headers, and body as structured data, and this module provides constructors,\n * pipeable update helpers, body encoders, and Web `Request` conversions.\n *\n * **Mental model**\n *\n * Request builders start from {@link empty} and return a new request for every\n * change. The base URL, query parameters, and hash stay separate until\n * conversion, so code can update them independently before calling\n * {@link toUrl}, {@link toWebResult}, or {@link toWeb}. Body helpers delegate to\n * `HttpBody` and update `Content-Type` and `Content-Length` when the selected\n * body carries that metadata.\n *\n * **Common tasks**\n *\n * - Start a request with {@link get}, {@link post}, {@link put},\n * {@link patch}, or another method constructor.\n * - Add authentication or accepted media types with {@link basicAuth},\n * {@link bearerToken}, {@link accept}, or {@link acceptJson}.\n * - Change URL parts with {@link setUrl}, {@link prependUrl},\n * {@link appendUrl}, {@link setUrlParam}, {@link appendUrlParam}, and\n * {@link setHash}.\n * - Attach payloads with {@link bodyJson}, {@link bodyUrlParams},\n * {@link bodyFormData}, {@link bodyStream}, or {@link bodyFile}.\n * - Bridge Web platform values with {@link fromWeb}, {@link toWebResult}, and\n * {@link toWeb}.\n *\n * **Gotchas**\n *\n * Passing a `URL` extracts its search parameters and fragment into structured\n * fields, while a string URL is kept as provided. Use the `setUrlParam` helpers\n * to replace query values, and the `appendUrlParam` helpers when repeated keys\n * should be preserved. `FormData` bodies intentionally leave multipart boundary\n * headers to the runtime, so `setBody` removes explicit content headers for\n * them.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport { stringOrRedacted } from \"../../internal/redacted.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport { redact } from \"../../Redactable.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as HttpBody from \"./HttpBody.js\";\nimport { hasBody } from \"./HttpMethod.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nconst TypeId = \"~effect/http/HttpClientRequest\";\n/**\n * Returns `true` when a value is an `HttpClientRequest`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpClientRequest = u => hasProperty(u, TypeId);\nconst Proto = {\n [TypeId]: TypeId,\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"HttpClientRequest\",\n method: this.method,\n url: this.url,\n urlParams: this.urlParams,\n hash: this.hash,\n headers: redact(this.headers),\n body: this.body.toJSON()\n };\n },\n pipe() {\n return pipeArguments(this, arguments);\n }\n};\n/**\n * Constructs an `HttpClientRequest` from fully normalized request components.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function makeWith(method, url, urlParams, hash, headers, body) {\n const self = Object.create(Proto);\n self.method = method;\n self.url = url;\n self.urlParams = urlParams;\n self.hash = hash;\n self.headers = headers;\n self.body = body;\n return self;\n}\n/**\n * An empty `GET` request with no URL, query parameters, hash, headers, or body.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = /*#__PURE__*/makeWith(\"GET\", \"\", UrlParams.empty, /*#__PURE__*/Option.none(), Headers.empty, HttpBody.empty);\n/**\n * Creates a request constructor for the specified HTTP method.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = method => (url, options) => modify(empty, {\n method,\n url,\n ...(options ?? undefined)\n});\n/**\n * Creates a `GET` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/make(\"GET\");\n/**\n * Creates a `POST` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const post = /*#__PURE__*/make(\"POST\");\n/**\n * Creates a `PATCH` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const patch = /*#__PURE__*/make(\"PATCH\");\n/**\n * Creates a `PUT` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const put = /*#__PURE__*/make(\"PUT\");\nconst del = /*#__PURE__*/make(\"DELETE\");\nexport {\n/**\n * Creates a `DELETE` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\ndel as delete };\n/**\n * Creates a `HEAD` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const head = /*#__PURE__*/make(\"HEAD\");\n/**\n * Creates an `OPTIONS` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const options = /*#__PURE__*/make(\"OPTIONS\");\n/**\n * Creates a `TRACE` request for the specified URL.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const trace = /*#__PURE__*/make(\"TRACE\");\n/**\n * Applies request options to an `HttpClientRequest`, returning a new request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const modify = /*#__PURE__*/dual(2, (self, options) => {\n let result = self;\n if (options.method) {\n result = setMethod(result, options.method);\n }\n if (options.url) {\n result = setUrl(result, options.url);\n }\n if (options.headers) {\n result = setHeaders(result, options.headers);\n }\n if (options.urlParams) {\n result = setUrlParams(result, options.urlParams);\n }\n if (options.hash) {\n result = setHash(result, options.hash);\n }\n if (options.body) {\n result = setBody(result, options.body);\n }\n if (options.accept) {\n result = accept(result, options.accept);\n }\n if (options.acceptJson) {\n result = acceptJson(result);\n }\n return result;\n});\n/**\n * Sets the HTTP method on a request, returning a new request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setMethod = /*#__PURE__*/dual(2, (self, method) => makeWith(method, self.url, self.urlParams, self.hash, self.headers, self.body));\n/**\n * Sets a single request header, replacing any existing value for that header.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHeader = /*#__PURE__*/dual(3, (self, key, value) => makeWith(self.method, self.url, self.urlParams, self.hash, Headers.set(self.headers, key, value), self.body));\n/**\n * Sets multiple request headers from an input collection, replacing existing values with matching names.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHeaders = /*#__PURE__*/dual(2, (self, input) => makeWith(self.method, self.url, self.urlParams, self.hash, Headers.setAll(self.headers, input), self.body));\n/**\n * Sets the `Authorization` header using HTTP Basic authentication credentials.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const basicAuth = /*#__PURE__*/dual(3, (self, username, password) => setHeader(self, \"Authorization\", `Basic ${btoa(`${stringOrRedacted(username)}:${stringOrRedacted(password)}`)}`));\n/**\n * Sets the `Authorization` header using a bearer token.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bearerToken = /*#__PURE__*/dual(2, (self, token) => setHeader(self, \"Authorization\", `Bearer ${stringOrRedacted(token)}`));\n/**\n * Sets the `Accept` header to the specified media type.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const accept = /*#__PURE__*/dual(2, (self, mediaType) => setHeader(self, \"Accept\", mediaType));\n/**\n * Sets the `Accept` header to `application/json`.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const acceptJson = /*#__PURE__*/accept(\"application/json\");\n/**\n * Sets the request URL. When given a `URL`, its search parameters and hash are extracted into the request's structured fields.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setUrl = /*#__PURE__*/dual(2, (self, url) => {\n if (typeof url === \"string\") {\n return makeWith(self.method, url, self.urlParams, self.hash, self.headers, self.body);\n }\n const clone = new URL(url.toString());\n const urlParams = UrlParams.fromInput(clone.searchParams);\n const hash = Option.fromNullishOr(clone.hash === \"\" ? undefined : clone.hash.slice(1));\n clone.search = \"\";\n clone.hash = \"\";\n return makeWith(self.method, clone.toString(), urlParams, hash, self.headers, self.body);\n});\n/**\n * Prepends a URL segment to the request URL, inserting or trimming one slash as needed.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const prependUrl = /*#__PURE__*/dual(2, (self, path) => {\n if (path === \"\") return self;\n return makeWith(self.method, joinSegments(path, self.url), self.urlParams, self.hash, self.headers, self.body);\n});\n/**\n * Appends a URL segment to the request URL, inserting or trimming one slash as needed.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const appendUrl = /*#__PURE__*/dual(2, (self, path) => {\n if (path === \"\") return self;\n return makeWith(self.method, joinSegments(self.url, path), self.urlParams, self.hash, self.headers, self.body);\n});\nconst joinSegments = (first, second) => {\n const endsWithSlash = first.endsWith(\"/\");\n const startsWithSlash = second.startsWith(\"/\");\n const needsTrim = endsWithSlash && startsWithSlash;\n const needsSlash = !endsWithSlash && !startsWithSlash;\n return needsTrim ? first + second.slice(1) : needsSlash ? first + \"/\" + second : first + second;\n};\n/**\n * Updates the request URL by applying a function to the current URL string.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const updateUrl = /*#__PURE__*/dual(2, (self, f) => makeWith(self.method, f(self.url), self.urlParams, self.hash, self.headers, self.body));\n/**\n * Sets one query parameter, replacing existing values for that parameter name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setUrlParam = /*#__PURE__*/dual(3, (self, key, value) => makeWith(self.method, self.url, UrlParams.set(self.urlParams, key, value), self.hash, self.headers, self.body));\n/**\n * Sets query parameters from an input collection, replacing existing values for matching names.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setUrlParams = /*#__PURE__*/dual(2, (self, input) => makeWith(self.method, self.url, UrlParams.setAll(self.urlParams, input), self.hash, self.headers, self.body));\n/**\n * Appends one query parameter value without removing existing values for the same name.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const appendUrlParam = /*#__PURE__*/dual(3, (self, key, value) => makeWith(self.method, self.url, UrlParams.append(self.urlParams, key, value), self.hash, self.headers, self.body));\n/**\n * Appends query parameters from an input collection without removing existing values for matching names.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const appendUrlParams = /*#__PURE__*/dual(2, (self, input) => makeWith(self.method, self.url, UrlParams.appendAll(self.urlParams, input), self.hash, self.headers, self.body));\n/**\n * Sets the URL fragment on a request without the leading `#`.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHash = /*#__PURE__*/dual(2, (self, hash) => makeWith(self.method, self.url, self.urlParams, Option.some(hash), self.headers, self.body));\n/**\n * Removes the URL fragment from a request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const removeHash = self => makeWith(self.method, self.url, self.urlParams, Option.none(), self.headers, self.body);\n/**\n * Sets the request body and updates `Content-Type` and `Content-Length` headers from the body metadata when available.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setBody = /*#__PURE__*/dual(2, (self, body) => {\n let headers = self.headers;\n if (body._tag === \"Empty\" || body._tag === \"FormData\") {\n headers = Headers.remove(Headers.remove(headers, \"Content-Type\"), \"Content-length\");\n } else {\n if (body.contentType) {\n headers = Headers.set(headers, \"content-type\", body.contentType);\n }\n if (body.contentLength !== undefined) {\n headers = Headers.set(headers, \"content-length\", body.contentLength.toString());\n }\n }\n return makeWith(self.method, self.url, self.urlParams, self.hash, headers, body);\n});\n/**\n * Sets a `Uint8Array` request body with an optional content type.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyUint8Array = /*#__PURE__*/dual(args => isHttpClientRequest(args[0]), (self, body, contentType) => setBody(self, HttpBody.uint8Array(body, contentType)));\n/**\n * Sets a text request body with an optional content type.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyText = /*#__PURE__*/dual(args => isHttpClientRequest(args[0]), (self, body, contentType) => setBody(self, HttpBody.text(body, contentType)));\n/**\n * Encodes a value as a JSON request body and sets it on the request, failing with `HttpBodyError` if encoding fails.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyJson = /*#__PURE__*/dual(2, (self, body) => Effect.map(HttpBody.json(body), body => setBody(self, body)));\n/**\n * Sets a JSON request body using unsafe JSON encoding, which may throw instead of failing in the Effect error channel.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyJsonUnsafe = /*#__PURE__*/dual(2, (self, body) => setBody(self, HttpBody.jsonUnsafe(body)));\n/**\n * Creates a schema-based JSON body encoder that sets the encoded value on a request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const schemaBodyJson = (schema, options) => {\n const encode = HttpBody.jsonSchema(schema, options);\n return dual(2, (self, body) => Effect.map(encode(body), body => setBody(self, body)));\n};\n/**\n * Sets an `application/x-www-form-urlencoded` request body from URL parameter input.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyUrlParams = /*#__PURE__*/dual(2, (self, input) => setBody(self, HttpBody.urlParams(UrlParams.fromInput(input))));\n/**\n * Sets a `FormData` request body.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyFormData = /*#__PURE__*/dual(2, (self, body) => setBody(self, HttpBody.formData(body)));\n/**\n * Creates a `FormData` request body from record-style entries and sets it on the request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyFormDataRecord = /*#__PURE__*/dual(2, (self, entries) => setBody(self, HttpBody.formDataRecord(entries)));\n/**\n * Sets a streaming `Uint8Array` request body with optional content type and content length metadata.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyStream = /*#__PURE__*/dual(args => isHttpClientRequest(args[0]), (self, body, options) => setBody(self, HttpBody.stream(body, options?.contentType, options?.contentLength)));\n/**\n * Creates a file-backed request body from a filesystem path and sets it on the request.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const bodyFile = /*#__PURE__*/dual(args => isHttpClientRequest(args[0]), (self, path, options) => Effect.map(HttpBody.file(path, options), body => setBody(self, body)));\n/**\n * Builds a `URL` from the request URL, query parameters, and hash, returning `Option.none()` if the URL is invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport function toUrl(self) {\n const r = UrlParams.makeUrl(self.url, self.urlParams, Option.getOrUndefined(self.hash));\n if (Result.isSuccess(r)) {\n return Option.some(r.success);\n }\n return Option.none();\n}\n/**\n * Converts a Web `Request` into an `HttpClientRequest`, preserving method, URL, headers, and supported request bodies.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromWeb = request => {\n const method = request.method.toUpperCase();\n return modify(empty, {\n method,\n url: new URL(request.url),\n headers: request.headers,\n body: fromWebBody(request, method)\n });\n};\nconst fromWebBody = (request, method) => {\n if (!hasBody(method) || request.body === null) {\n return HttpBody.empty;\n }\n return HttpBody.raw(request.body, {\n contentType: request.headers.get(\"content-type\") ?? undefined,\n contentLength: parseContentLength(request.headers.get(\"content-length\"))\n });\n};\nconst parseContentLength = contentLength => {\n if (contentLength === null) {\n return undefined;\n }\n const parsed = Number.parseInt(contentLength, 10);\n return Number.isNaN(parsed) ? undefined : parsed;\n};\n/**\n * Converts an `HttpClientRequest` safely to a Web `Request` as a `Result`, failing when the request URL is invalid.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebResult = (self, options) => {\n const url = UrlParams.makeUrl(self.url, self.urlParams, Option.getOrUndefined(self.hash));\n if (Result.isFailure(url)) {\n return Result.fail(url.failure);\n }\n const requestInit = {\n method: self.method,\n headers: self.headers\n };\n if (options?.signal) {\n requestInit.signal = options.signal;\n }\n if (hasBody(self.method)) {\n switch (self.body._tag) {\n case \"Empty\":\n {\n break;\n }\n case \"Raw\":\n {\n requestInit.body = self.body.body;\n if (isReadableStream(self.body.body)) {\n ;\n requestInit.duplex = \"half\";\n }\n break;\n }\n case \"Uint8Array\":\n {\n requestInit.body = self.body.body;\n break;\n }\n case \"FormData\":\n {\n requestInit.body = self.body.formData;\n break;\n }\n case \"Stream\":\n {\n requestInit.body = Stream.toReadableStreamWith(self.body.stream, options?.context ?? Context.empty());\n requestInit.duplex = \"half\";\n break;\n }\n }\n }\n return Result.try({\n try: () => new Request(url.success, requestInit),\n catch: cause => new UrlParams.UrlParamsError({\n cause\n })\n });\n};\nconst isReadableStream = u => typeof ReadableStream !== \"undefined\" && u instanceof ReadableStream;\n/**\n * Converts an `HttpClientRequest` to a Web `Request`, failing with `UrlParamsError` when the request URL is invalid.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWeb = (self, options) => Effect.contextWith(context => Effect.fromResult(toWebResult(self, {\n context: context,\n signal: options?.signal\n})));\n//# sourceMappingURL=HttpClientRequest.js.map",
13
+ "/**\n * Shared utilities for reading and decoding incoming HTTP messages.\n *\n * `HttpIncomingMessage` is the common body-and-header surface used by HTTP\n * server requests and client responses. It keeps transport-specific metadata in\n * the surrounding request and response modules while this module focuses on\n * headers, optional remote address information, byte streams, buffered body\n * views, and schema decoders for JSON bodies, URL-encoded bodies, and headers.\n *\n * Use these helpers in middleware, route handlers, client response processing,\n * and adapters when code should work with any incoming message instead of a\n * concrete request or response type. Body access is effectful because reading,\n * parsing, and decoding can fail; use `stream` when bytes should stay\n * streaming, and use `text`, `json`, `urlParamsBody`, or `arrayBuffer` when a\n * buffered view is appropriate. Some runtimes expose bodies as one-shot Web\n * streams, so prefer one body representation per message and let each\n * implementation's cached accessors handle repeated reads where available.\n *\n * Headers use the HTTP `Headers` module's lowercase, single-value map, so\n * repeated values may already have been combined or normalized by the adapter.\n * Decode headers with `schemaHeaders` when their shape matters. For form\n * bodies, `urlParamsBody` handles URL-encoded payloads; multipart support lives\n * on `HttpServerRequest`, with `MaxBodySize` providing the shared limit\n * reference used by multipart parsing.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport { redact } from \"../../Redactable.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as UrlParams from \"./UrlParams.js\";\n/**\n * Type identifier for `HttpIncomingMessage` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/http/HttpIncomingMessage\";\n/**\n * Returns `true` when a value is an `HttpIncomingMessage`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpIncomingMessage = u => hasProperty(u, TypeId);\n/**\n * Creates a decoder that reads an incoming message's JSON body and decodes it with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyJson = (schema, options) => {\n const decode = Schema.decodeEffect(Schema.toCodecJson(schema));\n return self => Effect.flatMap(self.json, u => decode(u, options));\n};\n/**\n * Creates a decoder that reads an incoming message's URL-encoded body parameters and decodes them with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyUrlParams = (schema, options) => {\n const decode = UrlParams.schemaRecord.pipe(Schema.decodeTo(schema), Schema.decodeEffect);\n return self => Effect.flatMap(self.urlParamsBody, u => decode(u, options));\n};\n/**\n * Creates a decoder that validates and decodes an incoming message's headers with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaHeaders = (schema, options) => {\n const decode = Schema.decodeUnknownEffect(schema);\n return self => decode(self.headers, options);\n};\n/**\n * Context reference for the optional maximum size allowed when reading an incoming message body.\n *\n * @category references\n * @since 4.0.0\n */\nexport const MaxBodySize = /*#__PURE__*/Context.Reference(\"effect/http/HttpIncomingMessage/MaxBodySize\", {\n defaultValue: () => undefined\n});\n/**\n * Builds an inspectable object for an incoming message, redacting headers and including a synchronously readable JSON or text body when available.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const inspect = (self, that) => {\n const contentType = self.headers[\"content-type\"] ?? \"\";\n let body;\n if (contentType.includes(\"application/json\")) {\n try {\n body = Effect.runSync(self.json);\n // oxlint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (_) {\n //\n }\n } else if (contentType.includes(\"text/\") || contentType.includes(\"urlencoded\")) {\n try {\n body = Effect.runSync(self.text);\n // oxlint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (_) {\n //\n }\n }\n const obj = {\n ...that,\n headers: redact(self.headers),\n remoteAddress: self.remoteAddress\n };\n if (body !== undefined) {\n obj.body = body;\n }\n return obj;\n};\n//# sourceMappingURL=HttpIncomingMessage.js.map",
14
+ "/**\n * HTTP client response values, status helpers, and body decoders.\n *\n * This module represents responses produced by the Effect HTTP client. An\n * {@link HttpClientResponse} keeps the original request together with the\n * response status, headers, cookies, and effectful body accessors inherited from\n * the shared incoming-message model.\n *\n * **Mental model**\n *\n * A response is a successful client result unless a status filter turns it into\n * a failure. {@link fromWeb} adapts a platform `Response`, body readers decode\n * the underlying Web response, and schema helpers combine status, headers, and\n * decoded body data when validating API-specific responses.\n *\n * **Common tasks**\n *\n * - Branch on exact or status-class handlers with {@link matchStatus}.\n * - Fail non-accepted statuses with {@link filterStatus} or\n * {@link filterStatusOk}.\n * - Decode JSON response envelopes with {@link schemaJson}.\n * - Decode status and headers without reading a body with {@link schemaNoBody}.\n * - Stream response bytes from an effect with {@link stream}.\n *\n * **Gotchas**\n *\n * HTTP status codes are data, not errors, until a filter is applied. `json`\n * parses an empty text body as `null`. Body readers fail with `HttpClientError`\n * when decoding fails, and the raw stream fails when no body is present.\n * Headers use the HTTP `Headers` module's lowercase, single-value map, while\n * response cookies are parsed separately from `Set-Cookie` headers.\n *\n * **See also**\n *\n * {@link HttpClientResponse}, {@link fromWeb}, {@link matchStatus},\n * {@link schemaJson}, {@link filterStatus}.\n *\n * @since 4.0.0\n */\nimport * as Effect from \"../../Effect.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Cookies from \"./Cookies.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as Error from \"./HttpClientError.js\";\nimport * as HttpIncomingMessage from \"./HttpIncomingMessage.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nexport {\n/**\n * Creates a decoder that reads a response JSON body and decodes it with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nschemaBodyJson,\n/**\n * Creates a decoder that reads response URL-encoded body parameters and decodes them with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nschemaBodyUrlParams,\n/**\n * Creates a decoder that validates and decodes response headers with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nschemaHeaders } from \"./HttpIncomingMessage.js\";\n/**\n * Type identifier for `HttpClientResponse` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/http/HttpClientResponse\";\n/**\n * Wraps a Web `Response` and its original `HttpClientRequest` as an `HttpClientResponse`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromWeb = (request, source) => new WebHttpClientResponse(request, source);\n/**\n * Creates a decoder for a response's status, headers, and JSON body using the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaJson = (schema, options) => {\n const decode = Schema.decodeEffect(Schema.toCodecJson(schema).annotate({\n options\n }));\n return self => Effect.flatMap(self.json, body => decode({\n status: self.status,\n headers: self.headers,\n body\n }));\n};\n/**\n * Creates a decoder for a response's status and headers without reading a response body.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaNoBody = (schema, options) => {\n const decode = Schema.decodeEffect(schema.annotate({\n options\n }));\n return self => decode({\n status: self.status,\n headers: self.headers\n });\n};\n/**\n * Converts an effect producing an `HttpClientResponse` into a stream of response body bytes.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const stream = effect => Stream.unwrap(Effect.map(effect, self => self.stream));\n/**\n * Pattern matches on a response status, checking exact status handlers before status-class handlers and `orElse`.\n *\n * @category pattern matching\n * @since 4.0.0\n */\nexport const matchStatus = /*#__PURE__*/dual(2, (self, cases) => {\n const status = self.status;\n if (cases[status]) {\n return cases[status](self);\n } else if (status >= 200 && status < 300 && cases[\"2xx\"]) {\n return cases[\"2xx\"](self);\n } else if (status >= 300 && status < 400 && cases[\"3xx\"]) {\n return cases[\"3xx\"](self);\n } else if (status >= 400 && status < 500 && cases[\"4xx\"]) {\n return cases[\"4xx\"](self);\n } else if (status >= 500 && status < 600 && cases[\"5xx\"]) {\n return cases[\"5xx\"](self);\n }\n return cases.orElse(self);\n});\n/**\n * Succeeds with the response when its status satisfies the predicate, otherwise fails with `HttpClientError`.\n *\n * @category filters\n * @since 4.0.0\n */\nexport const filterStatus = /*#__PURE__*/dual(2, (self, f) => Effect.suspend(() => f(self.status) ? Effect.succeed(self) : Effect.fail(new Error.HttpClientError({\n reason: new Error.StatusCodeError({\n response: self,\n request: self.request,\n description: \"invalid status code\"\n })\n}))));\n/**\n * Succeeds with the response only when its status is in the 2xx range, otherwise fails with `HttpClientError`.\n *\n * @category filters\n * @since 4.0.0\n */\nexport const filterStatusOk = self => self.status >= 200 && self.status < 300 ? Effect.succeed(self) : Effect.fail(new Error.HttpClientError({\n reason: new Error.StatusCodeError({\n response: self,\n request: self.request,\n description: \"non 2xx status code\"\n })\n}));\n// -----------------------------------------------------------------------------\n// internal\n// -----------------------------------------------------------------------------\nclass WebHttpClientResponse extends Inspectable.Class {\n [HttpIncomingMessage.TypeId];\n [TypeId];\n request;\n source;\n constructor(request, source) {\n super();\n this.request = request;\n this.source = source;\n this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n this[TypeId] = TypeId;\n }\n toJSON() {\n return HttpIncomingMessage.inspect(this, {\n _id: \"HttpClientResponse\",\n request: this.request.toJSON(),\n status: this.status\n });\n }\n get status() {\n return this.source.status;\n }\n get headers() {\n return Headers.fromInput(this.source.headers);\n }\n cachedCookies;\n get cookies() {\n if (this.cachedCookies) {\n return this.cachedCookies;\n }\n return this.cachedCookies = Cookies.fromSetCookie(this.source.headers.getSetCookie());\n }\n get remoteAddress() {\n return Option.none();\n }\n get stream() {\n return this.source.body ? Stream.fromReadableStream({\n evaluate: () => this.source.body,\n onError: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }) : Stream.fail(new Error.HttpClientError({\n reason: new Error.EmptyBodyError({\n request: this.request,\n response: this,\n description: \"can not create stream from empty body\"\n })\n }));\n }\n get json() {\n return Effect.flatMap(this.text, text => Effect.try({\n try: () => text === \"\" ? null : JSON.parse(text),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }));\n }\n textBody;\n get text() {\n if (this.textBody) {\n return this.textBody;\n }\n this.textBody = Effect.tryPromise({\n try: () => this.source.text(),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }).pipe(Effect.cached, Effect.runSync);\n this.arrayBufferBody = Effect.map(this.textBody, _ => new TextEncoder().encode(_).buffer);\n return this.textBody;\n }\n get urlParamsBody() {\n return Effect.flatMap(this.text, _ => Effect.try({\n try: () => UrlParams.fromInput(new URLSearchParams(_)),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }));\n }\n formDataBody;\n get formData() {\n return this.formDataBody ??= Effect.tryPromise({\n try: () => this.source.formData(),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }).pipe(Effect.cached, Effect.runSync);\n }\n arrayBufferBody;\n get arrayBuffer() {\n if (this.arrayBufferBody) {\n return this.arrayBufferBody;\n }\n this.arrayBufferBody = Effect.tryPromise({\n try: () => this.source.arrayBuffer(),\n catch: cause => new Error.HttpClientError({\n reason: new Error.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }).pipe(Effect.cached, Effect.runSync);\n this.textBody = Effect.map(this.arrayBufferBody, _ => new TextDecoder().decode(_));\n return this.arrayBufferBody;\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n}\n//# sourceMappingURL=HttpClientResponse.js.map",
15
+ "/**\n * HTTP propagation helpers for Effect tracing context.\n *\n * This module converts Effect `Tracer.Span` values into outbound trace headers\n * and decodes inbound propagation headers into `Tracer.ExternalSpan` parents.\n * HTTP clients use it to continue the current span across outgoing requests, and\n * server middleware uses it to parent request spans from upstream services.\n *\n * **Mental model**\n *\n * Propagation is metadata, not tracing storage. {@link toHeaders} serializes the\n * current span into HTTP headers for the next service. {@link fromHeaders}\n * inspects incoming headers and returns an external parent span when a supported\n * propagation format is present.\n *\n * **Common tasks**\n *\n * - Add outbound propagation headers with {@link toHeaders}\n * - Decode an inbound parent span with {@link fromHeaders}\n * - Use {@link w3c}, {@link b3}, or {@link xb3} directly when an adapter needs a\n * specific propagation format\n *\n * **Gotchas**\n *\n * - Outbound propagation writes both W3C `traceparent` and compact B3 `b3`\n * headers\n * - Inbound decoding prefers W3C `traceparent`, then compact B3, then\n * multi-header B3 (`x-b3-*`)\n * - Header names in `Headers.Headers` are expected to be lowercase\n * - Missing or unsupported trace context decodes to `Option.none`, so callers\n * should start a new trace when no parent is returned\n *\n * @since 4.0.0\n */\nimport * as Option from \"../../Option.js\";\nimport * as Tracer from \"../../Tracer.js\";\nimport * as Headers from \"./Headers.js\";\n/**\n * Encodes a span into HTTP trace propagation headers.\n *\n * **Details**\n *\n * The generated headers include both compact B3 (`b3`) and W3C `traceparent`\n * formats.\n *\n * @category encoding\n * @since 4.0.0\n */\nexport const toHeaders = span => Headers.fromRecordUnsafe({\n b3: `${span.traceId}-${span.spanId}-${span.sampled ? \"1\" : \"0\"}${Option.match(span.parent, {\n onNone: () => \"\",\n onSome: parent => `-${parent.spanId}`\n })}`,\n traceparent: `00-${span.traceId}-${span.spanId}-${span.sampled ? \"01\" : \"00\"}`\n});\n/**\n * Decodes an external span safely from HTTP trace propagation headers.\n *\n * **Details**\n *\n * W3C `traceparent` is tried first, followed by compact B3 (`b3`) and then\n * multi-header B3 (`x-b3-*`).\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const fromHeaders = headers => {\n let span = w3c(headers);\n if (Option.isSome(span)) {\n return span;\n }\n span = b3(headers);\n if (Option.isSome(span)) {\n return span;\n }\n return xb3(headers);\n};\n/**\n * Decodes an external span safely from the compact B3 `b3` header.\n *\n * **Details**\n *\n * Returns `Option.none` when the header is missing or does not contain trace and\n * span identifiers.\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const b3 = headers => {\n if (!(\"b3\" in headers)) {\n return Option.none();\n }\n const parts = headers[\"b3\"].split(\"-\");\n if (parts.length < 2) {\n return Option.none();\n }\n return Option.some(Tracer.externalSpan({\n traceId: parts[0],\n spanId: parts[1],\n sampled: parts[2] ? parts[2] === \"1\" : true\n }));\n};\n/**\n * Decodes an external span safely from multi-header B3 propagation headers.\n *\n * **Details**\n *\n * The decoder reads `x-b3-traceid`, `x-b3-spanid`, and optional `x-b3-sampled`\n * headers.\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const xb3 = headers => {\n if (!headers[\"x-b3-traceid\"] || !headers[\"x-b3-spanid\"]) {\n return Option.none();\n }\n return Option.some(Tracer.externalSpan({\n traceId: headers[\"x-b3-traceid\"],\n spanId: headers[\"x-b3-spanid\"],\n sampled: headers[\"x-b3-sampled\"] ? headers[\"x-b3-sampled\"] === \"1\" : true\n }));\n};\nconst w3cTraceId = /^[0-9a-f]{32}$/i;\nconst w3cSpanId = /^[0-9a-f]{16}$/i;\n/**\n * Decodes an external span safely from the W3C `traceparent` header.\n *\n * **Details**\n *\n * Only version `00` headers with valid trace and span identifiers are accepted.\n *\n * @category decoding\n * @since 4.0.0\n */\nexport const w3c = headers => {\n if (!headers[\"traceparent\"]) {\n return Option.none();\n }\n const parts = headers[\"traceparent\"].split(\"-\");\n if (parts.length !== 4) {\n return Option.none();\n }\n const [version, traceId, spanId, flags] = parts;\n switch (version) {\n case \"00\":\n {\n if (w3cTraceId.test(traceId) === false || w3cSpanId.test(spanId) === false) {\n return Option.none();\n }\n return Option.some(Tracer.externalSpan({\n traceId,\n spanId,\n sampled: (parseInt(flags, 16) & 1) === 1\n }));\n }\n default:\n {\n return Option.none();\n }\n }\n};\n//# sourceMappingURL=HttpTraceContext.js.map",
16
+ "import * as Cause from \"../../Cause.js\";\nimport { Clock } from \"../../Clock.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Duration from \"../../Duration.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Fiber from \"../../Fiber.js\";\nimport { constant, constFalse, constTrue, dual, flow, identity } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Ref from \"../../Ref.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schedule from \"../../Schedule.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Tracer from \"../../Tracer.js\";\nimport * as Cookies from \"./Cookies.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as Error from \"./HttpClientError.js\";\nimport * as HttpClientRequest from \"./HttpClientRequest.js\";\nimport * as HttpClientResponse from \"./HttpClientResponse.js\";\nimport * as HttpIncomingMessage from \"./HttpIncomingMessage.js\";\nimport * as HttpMethod from \"./HttpMethod.js\";\nimport * as TraceContext from \"./HttpTraceContext.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nconst TypeId = \"~effect/http/HttpClient\";\n/**\n * Returns `true` if the provided value is an `HttpClient`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpClient = u => Predicate.hasProperty(u, TypeId);\n/**\n * Service tag for the default outgoing HTTP client service.\n *\n * **When to use**\n *\n * Use to provide the HTTP client implementation consumed by the module's\n * request accessor functions.\n *\n * @category services\n * @since 4.0.0\n */\nexport const HttpClient = /*#__PURE__*/Context.Service(\"effect/HttpClient\");\nconst accessor = method => (...args) => Effect.flatMap(HttpClient, client => client[method](...args));\n/**\n * Executes a prebuilt `HttpClientRequest` using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const execute = /*#__PURE__*/accessor(\"execute\");\n/**\n * Executes a `GET` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const get = /*#__PURE__*/accessor(\"get\");\n/**\n * Executes a `HEAD` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const head = /*#__PURE__*/accessor(\"head\");\n/**\n * Executes a `POST` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const post = /*#__PURE__*/accessor(\"post\");\n/**\n * Executes a `PATCH` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const patch = /*#__PURE__*/accessor(\"patch\");\n/**\n * Executes a `PUT` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const put = /*#__PURE__*/accessor(\"put\");\n/**\n * Executes a `DELETE` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const del = /*#__PURE__*/accessor(\"del\");\n/**\n * Executes an `OPTIONS` request using the `HttpClient` service from the environment.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const options = /*#__PURE__*/accessor(\"options\");\n/**\n * Transforms a client by wrapping the response effect for each request.\n *\n * **Details**\n *\n * The transformation receives both the response effect and the original request, allowing it to change success, error, and environment behavior.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const transform = /*#__PURE__*/dual(2, (self, f) => makeWith(Effect.flatMap(request => f(self.postprocess(Effect.succeed(request)), request)), self.preprocess));\n/**\n * Transforms a client by applying an effectful transformation to each response effect.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const transformResponse = /*#__PURE__*/dual(2, (self, f) => makeWith(request => f(self.postprocess(request)), self.preprocess));\nconst catch_ = /*#__PURE__*/dual(2, (self, f) => transformResponse(self, Effect.catch(f)));\nexport {\n/**\n * Handles all client failures with an effectful recovery function and returns a transformed client.\n *\n * @category error handling\n * @since 4.0.0\n */\ncatch_ as catch };\n/**\n * Handles client failures with one or more matching `_tag` values and returns a transformed client.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const catchTag = /*#__PURE__*/dual(3, (self, tag, f) => transformResponse(self, effect => Effect.catchTag(effect, tag, f)));\n/**\n * Handles client failures by matching their `_tag` values against a case map.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const catchTags = /*#__PURE__*/dual(2, (self, cases) => transformResponse(self, Effect.catchTags(cases)));\n/**\n * Filters the result of a response, or runs an alternative effect if the predicate fails.\n *\n * @category filters\n * @since 4.0.0\n */\nexport const filterOrElse = /*#__PURE__*/dual(3, (self, f, orElse) => transformResponse(self, Effect.filterOrElse(f, orElse)));\n/**\n * Filters successful responses, or fails with the error produced by `orFailWith` when the predicate does not match.\n *\n * @category filters\n * @since 4.0.0\n */\nexport const filterOrFail = /*#__PURE__*/dual(3, (self, f, orFailWith) => transformResponse(self, Effect.filterOrFail(f, orFailWith)));\n/**\n * Filters responses by HTTP status code.\n *\n * @category filters\n * @since 4.0.0\n */\nexport const filterStatus = /*#__PURE__*/dual(2, (self, f) => transformResponse(self, Effect.flatMap(HttpClientResponse.filterStatus(f))));\n/**\n * Filters responses that return a 2xx status code.\n *\n * @category filters\n * @since 4.0.0\n */\nexport const filterStatusOk = /*#__PURE__*/transformResponse(/*#__PURE__*/Effect.flatMap(HttpClientResponse.filterStatusOk));\n/**\n * Constructs an `HttpClient.With` from a preprocessing function and a postprocessing function.\n *\n * **Details**\n *\n * `execute` applies preprocessing to the request and then passes the resulting request effect to postprocessing.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeWith = (postprocess, preprocess) => {\n const self = Object.create(Proto);\n self.preprocess = preprocess;\n self.postprocess = postprocess;\n self.execute = function (request) {\n return postprocess(preprocess(request));\n };\n return self;\n};\nconst Proto = {\n [TypeId]: TypeId,\n pipe() {\n return pipeArguments(this, arguments);\n },\n ...Inspectable.BaseProto,\n toJSON() {\n return {\n _id: \"effect/HttpClient\"\n };\n },\n ... /*#__PURE__*/Object.fromEntries(/*#__PURE__*/HttpMethod.allShort.map(([fullMethod, method]) => [method, function (url, options) {\n return this.execute(HttpClientRequest.make(fullMethod)(url, options));\n }]))\n};\n/**\n * Constructs an `HttpClient` from a low-level request runner.\n *\n * **Details**\n *\n * The runner receives the request, resolved URL, abort signal, and current fiber. The client wrapper handles URL construction failures, tracing and propagation, header redaction, and aborting non-scoped requests on interruption.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = f => makeWith(effect => Effect.flatMap(effect, request => Effect.withFiber(fiber => {\n const scopedController = scopedRequests.get(request);\n const controller = scopedController ?? new AbortController();\n const urlResult = UrlParams.makeUrl(request.url, request.urlParams, Option.getOrUndefined(request.hash));\n if (Result.isFailure(urlResult)) {\n return Effect.fail(new Error.HttpClientError({\n reason: new Error.InvalidUrlError({\n request,\n cause: urlResult.failure\n })\n }));\n }\n const url = urlResult.success;\n const tracerDisabled = fiber.getRef(Tracer.DisablePropagation) || fiber.getRef(TracerDisabledWhen)(request);\n if (tracerDisabled) {\n const effect = f(request, url, controller.signal, fiber);\n if (scopedController) return effect;\n return Effect.uninterruptibleMask(restore => Effect.matchCauseEffect(restore(effect), {\n onSuccess(response) {\n responseRegistry.register(response, controller);\n return Effect.succeed(new InterruptibleResponse(response, controller));\n },\n onFailure(cause) {\n if (Cause.hasInterrupts(cause)) {\n controller.abort();\n }\n return Effect.failCause(cause);\n }\n }));\n }\n return Effect.useSpan(fiber.getRef(SpanNameGenerator)(request), {\n kind: \"client\"\n }, span => {\n span.attribute(\"http.request.method\", request.method);\n span.attribute(\"server.address\", url.origin);\n if (url.port !== \"\") {\n span.attribute(\"server.port\", +url.port);\n }\n span.attribute(\"url.full\", url.toString());\n span.attribute(\"url.path\", url.pathname);\n span.attribute(\"url.scheme\", url.protocol.slice(0, -1));\n const query = url.search.slice(1);\n if (query !== \"\") {\n span.attribute(\"url.query\", query);\n }\n const redactedHeaderNames = fiber.getRef(Headers.CurrentRedactedNames);\n const redactedHeaders = Headers.redact(request.headers, redactedHeaderNames);\n for (const name in redactedHeaders) {\n span.attribute(`http.request.header.${name}`, String(redactedHeaders[name]));\n }\n request = fiber.getRef(TracerPropagationEnabled) ? HttpClientRequest.setHeaders(request, TraceContext.toHeaders(span)) : request;\n return Effect.uninterruptibleMask(restore => restore(f(request, url, controller.signal, fiber)).pipe(Effect.withParentSpan(span, {\n captureStackTrace: false\n }), Effect.matchCauseEffect({\n onSuccess: response => {\n span.attribute(\"http.response.status_code\", response.status);\n const redactedHeaders = Headers.redact(response.headers, redactedHeaderNames);\n for (const name in redactedHeaders) {\n span.attribute(`http.response.header.${name}`, String(redactedHeaders[name]));\n }\n if (scopedController) return Effect.succeed(response);\n responseRegistry.register(response, controller);\n return Effect.succeed(new InterruptibleResponse(response, controller));\n },\n onFailure(cause) {\n if (!scopedController && Cause.hasInterrupts(cause)) {\n controller.abort();\n }\n return Effect.failCause(cause);\n }\n })));\n });\n})), Effect.succeed);\n/**\n * Appends a transformation of the request object before sending it.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const mapRequest = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => Effect.map(self.preprocess(request), f)));\n/**\n * Appends an effectful transformation of the request object before sending it.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const mapRequestEffect = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => Effect.flatMap(self.preprocess(request), f)));\n/**\n * Prepends a transformation of the request object before sending it.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const mapRequestInput = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => self.preprocess(f(request))));\n/**\n * Prepends an effectful transformation of the request object before sending it.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const mapRequestInputEffect = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => Effect.flatMap(f(request), self.preprocess)));\n/**\n * Retries the request based on a provided schedule or policy.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const retry = /*#__PURE__*/dual(2, (self, policy) => transformResponse(self, Effect.retry(policy)));\n/**\n * Retries common transient errors, such as rate limiting, timeouts or network issues.\n *\n * **When to use**\n *\n * Use to focus on retrying errors, transient responses, or both.\n *\n * **Details**\n *\n * Specifying a `while` predicate allows you to consider other errors as\n * transient, and is ignored in \"response-only\" mode.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const retryTransient = /*#__PURE__*/dual(2, (self, options) => {\n const isOnlySchedule = Schedule.isSchedule(options);\n const retryOn = isOnlySchedule ? \"errors-and-responses\" : options.retryOn ?? \"errors-and-responses\";\n const schedule = isOnlySchedule ? options : options.schedule;\n const passthroughSchedule = schedule && Schedule.passthrough(schedule);\n const times = isOnlySchedule ? undefined : options.times;\n return transformResponse(self, flow(retryOn === \"errors-only\" ? identity : Effect.repeat({\n schedule: passthroughSchedule,\n times,\n while: isTransientResponse\n }), retryOn === \"response-only\" ? identity : Effect.retry({\n while: isOnlySchedule || options.while === undefined ? isTransientError : Predicate.or(isTransientError, options.while),\n schedule,\n times\n })));\n});\n/**\n * Applies request rate limiting using the `RateLimiter` service.\n *\n * **Details**\n *\n * It can update limits by inspecting common rate limit response headers and\n * automatically retries HTTP `429` responses (or `HttpClientError` values\n * wrapping a `429` response) by forcing the retry back through the limiter.\n *\n * @category rate limiting\n * @since 4.0.0\n */\nexport const withRateLimiter = /*#__PURE__*/dual(2, (self, options) => {\n const initialState = {\n initial: true,\n limit: options.limit,\n window: Duration.max(Duration.fromInputUnsafe(options.window), Duration.millis(1))\n };\n const states = new Map();\n const keyOption = options.key;\n const resolveKey = typeof keyOption === \"function\" ? keyOption : constant(keyOption);\n const tokensOption = options.tokens;\n const resolveTokens = typeof tokensOption === \"function\" ? tokensOption : constant(tokensOption ?? 1);\n const getState = key => {\n const current = states.get(key);\n if (current !== undefined) {\n return current;\n }\n states.set(key, initialState);\n return initialState;\n };\n const onResponse = options.disableResponseInspection ? undefined : (clock, key, headers, tokens) => {\n const current = getState(key);\n const next = parseRateLimiterState(current, clock, headers, tokens);\n if (next.limit !== current.limit || !Duration.equals(next.window, current.window)) {\n states.set(key, next);\n }\n };\n return transform(self, function loop(effect, request) {\n const fiber = Fiber.getCurrent();\n const clock = fiber.getRef(Clock);\n const key = resolveKey(request);\n const tokens = Math.max(resolveTokens(request), 1);\n const current = getState(key);\n function retry(response) {\n if (options.disableResponseInspection) return loop(effect, request);\n const retryAfter = parseRetryAfter(clock, getHeader(response.headers, \"retry-after\"));\n return retryAfter ? Effect.flatMap(Effect.sleep(retryAfter), () => loop(effect, request)) : loop(effect, request);\n }\n return Effect.flatMap(options.limiter.consume({\n algorithm: options.algorithm,\n onExceeded: \"delay\",\n key,\n limit: current.limit,\n window: current.window,\n tokens\n }), ({\n delay\n }) => {\n const run = Effect.matchEffect(effect, {\n onSuccess(response) {\n onResponse?.(clock, key, response.headers, tokens);\n if (response.status !== 429) return Effect.succeed(response);\n return retry(response);\n },\n onFailure(error) {\n if (isTooManyRequestsHttpClientError(error)) {\n onResponse?.(clock, key, error.reason.response.headers, tokens);\n return retry(error.reason.response);\n }\n return Effect.fail(error);\n }\n });\n return Duration.isZero(delay) ? run : Effect.delay(run, delay);\n });\n });\n});\nconst parseRateLimiterState = (state, clock, headers, tokens) => {\n const limit = parseRateLimitLimit(state, headers, tokens) ?? state.limit;\n const window = parseRateLimitWindow(clock, headers) ?? state.window;\n if (limit === state.limit && Duration.equals(window, state.window)) {\n return state;\n }\n return {\n limit,\n window,\n initial: false\n };\n};\nconst parseRateLimitLimit = (state, headers, tokens) => {\n const raw = getHeader(headers, \"ratelimit-limit\", \"x-ratelimit-limit\");\n const value = parseNumberHeader(raw);\n if (value !== undefined && value > 0) {\n return value;\n }\n const remaining = parseRateLimitRemaining(headers);\n if (remaining === undefined) {\n return undefined;\n }\n return state.initial ? remaining + tokens : Math.max(remaining + tokens, state.limit);\n};\nconst parseRateLimitRemaining = headers => {\n const raw = getHeader(headers, \"ratelimit-remaining\", \"x-ratelimit-remaining\");\n const value = parseNumberHeader(raw);\n return value !== undefined && value >= 0 ? value : undefined;\n};\nconst parseRateLimitWindow = (clock, headers) => {\n const retryAfter = parseRetryAfter(clock, getHeader(headers, \"retry-after\"));\n if (retryAfter !== undefined) {\n return retryAfter;\n }\n const resetAfter = parseResetAfter(getHeader(headers, \"ratelimit-reset-after\", \"x-ratelimit-reset-after\"));\n if (resetAfter !== undefined) {\n return resetAfter;\n }\n return parseResetHeader(clock, getHeader(headers, \"ratelimit-reset\", \"x-ratelimit-reset\"));\n};\nconst parseRetryAfter = (clock, value) => {\n if (value === undefined) {\n return undefined;\n }\n const numeric = parseNumberHeader(value);\n if (numeric !== undefined) {\n return Duration.max(Duration.seconds(numeric), Duration.millis(1));\n }\n const parsedDate = Date.parse(value);\n if (Number.isNaN(parsedDate)) {\n return undefined;\n }\n const millis = parsedDate - clock.currentTimeMillisUnsafe();\n if (millis <= 0) {\n return Duration.millis(1);\n }\n return Duration.millis(millis);\n};\nconst parseResetAfter = value => {\n const numeric = parseNumberHeader(value);\n if (numeric === undefined || numeric <= 0) {\n return undefined;\n }\n return Duration.max(Duration.seconds(numeric), Duration.millis(1));\n};\nconst parseResetHeader = (clock, value) => {\n const numeric = parseNumberHeader(value);\n if (numeric === undefined || numeric <= 0) {\n return undefined;\n }\n const nowMillis = clock.currentTimeMillisUnsafe();\n if (numeric > 1_000_000_000_000) {\n return Duration.millis(Math.max(numeric - nowMillis, 1));\n }\n if (numeric > 1_000_000_000) {\n return Duration.millis(Math.max(numeric * 1_000 - nowMillis, 1));\n }\n return Duration.max(Duration.seconds(numeric), Duration.millis(1));\n};\nconst parseNumberHeader = value => {\n if (value === undefined) {\n return undefined;\n }\n const match = /-?\\d+(?:\\.\\d+)?/.exec(value);\n if (match === null) {\n return undefined;\n }\n const parsed = Number(match[0]);\n return Number.isFinite(parsed) ? parsed : undefined;\n};\nconst getHeader = (headers, ...keys) => {\n for (let i = 0; i < keys.length; i++) {\n const value = headers[keys[i]];\n if (value !== undefined) {\n return value;\n }\n }\n return undefined;\n};\n/**\n * Performs an additional effect after a successful request.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const tap = /*#__PURE__*/dual(2, (self, f) => transformResponse(self, Effect.tap(f)));\n/**\n * Performs an additional effect after an unsuccessful request.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const tapError = /*#__PURE__*/dual(2, (self, f) => transformResponse(self, Effect.tapError(f)));\n/**\n * Performs an additional effect on the request before sending it.\n *\n * @category mapping & sequencing\n * @since 4.0.0\n */\nexport const tapRequest = /*#__PURE__*/dual(2, (self, f) => makeWith(self.postprocess, request => Effect.tap(self.preprocess(request), f)));\n/**\n * Adds a `Ref` of cookies to the client for handling cookies across requests.\n *\n * **When to use**\n *\n * Use to add shared cookie storage to a client so response cookies are retained\n * and sent by later requests.\n *\n * @category cookies\n * @since 4.0.0\n */\nexport const withCookiesRef = /*#__PURE__*/dual(2, (self, ref) => makeWith(request => Effect.tap(self.postprocess(request), response => Ref.update(ref, cookies => Cookies.merge(cookies, response.cookies))), request => Effect.flatMap(self.preprocess(request), request => Effect.map(Ref.get(ref), cookies => Cookies.isEmpty(cookies) ? request : HttpClientRequest.setHeader(request, \"cookie\", Cookies.toCookieHeader(cookies))))));\n/**\n * Attaches the lifetime of the `HttpClientRequest` to a `Scope`.\n *\n * @category resource management\n * @since 4.0.0\n */\nexport const withScope = self => transform(self, (effect, request) => {\n const controller = new AbortController();\n scopedRequests.set(request, controller);\n return Effect.andThen(Effect.addFinalizer(() => Effect.sync(() => controller.abort())), effect);\n});\n/**\n * Enables following HTTP redirects up to a specified number of times.\n *\n * @category redirects\n * @since 4.0.0\n */\nexport const followRedirects = /*#__PURE__*/dual(args => isHttpClient(args[0]), (self, maxRedirects) => makeWith(request => {\n const loop = (request, redirects) => Effect.flatMap(self.postprocess(Effect.succeed(request)), response => response.status >= 300 && response.status < 400 && response.headers.location && redirects < (maxRedirects ?? 10) ? loop(HttpClientRequest.setUrl(request, new URL(response.headers.location, response.request.url)), redirects + 1) : Effect.succeed(response));\n return Effect.flatMap(request, request => loop(request, 0));\n}, self.preprocess));\n/**\n * Context reference for a predicate that disables client-side tracing for matching outgoing requests.\n *\n * @category references\n * @since 4.0.0\n */\nexport const TracerDisabledWhen = /*#__PURE__*/Context.Reference(\"effect/http/HttpClient/TracerDisabledWhen\", {\n defaultValue: () => constFalse\n});\n/**\n * Context reference that controls whether outgoing client spans are propagated to request headers.\n *\n * @category references\n * @since 4.0.0\n */\nexport const TracerPropagationEnabled = /*#__PURE__*/Context.Reference(\"effect/HttpClient/TracerPropagationEnabled\", {\n defaultValue: constTrue\n});\n/**\n * Context reference for generating the span name used for outgoing client request spans.\n *\n * @category references\n * @since 4.0.0\n */\nexport const SpanNameGenerator = /*#__PURE__*/Context.Reference(\"effect/http/HttpClient/SpanNameGenerator\", {\n defaultValue: () => request => `http.client ${request.method}`\n});\n/**\n * Creates an `HttpClient` layer and merges the layer construction context into client response effects.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerMergedContext = effect => Layer.effect(HttpClient)(Effect.contextWith(context => Effect.map(effect, client => transformResponse(client, Effect.updateContext(input => Context.merge(context, input))))));\n// -----------------------------------------------------------------------------\n// internal\n// -----------------------------------------------------------------------------\nconst responseRegistry = /*#__PURE__*/(() => {\n if (\"FinalizationRegistry\" in globalThis && globalThis.FinalizationRegistry) {\n const registry = /*#__PURE__*/new FinalizationRegistry(controller => {\n controller.abort();\n });\n return {\n register(response, controller) {\n registry.register(response, controller, response);\n },\n unregister(response) {\n registry.unregister(response);\n }\n };\n }\n const timers = /*#__PURE__*/new Map();\n return {\n register(response, controller) {\n timers.set(response, setTimeout(() => controller.abort(), 5000));\n },\n unregister(response) {\n const timer = timers.get(response);\n if (timer === undefined) return;\n clearTimeout(timer);\n timers.delete(response);\n }\n };\n})();\nconst scopedRequests = /*#__PURE__*/new WeakMap();\nclass InterruptibleResponse {\n original;\n controller;\n constructor(original, controller) {\n this.original = original;\n this.controller = controller;\n }\n [HttpClientResponse.TypeId] = HttpClientResponse.TypeId;\n [HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n applyInterrupt(effect) {\n return Effect.suspend(() => {\n responseRegistry.unregister(this.original);\n return Effect.onInterrupt(effect, () => Effect.sync(() => {\n this.controller.abort();\n }));\n });\n }\n get request() {\n return this.original.request;\n }\n get status() {\n return this.original.status;\n }\n get headers() {\n return this.original.headers;\n }\n get cookies() {\n return this.original.cookies;\n }\n get remoteAddress() {\n return this.original.remoteAddress;\n }\n get formData() {\n return this.applyInterrupt(this.original.formData);\n }\n get text() {\n return this.applyInterrupt(this.original.text);\n }\n get json() {\n return this.applyInterrupt(this.original.json);\n }\n get urlParamsBody() {\n return this.applyInterrupt(this.original.urlParamsBody);\n }\n get arrayBuffer() {\n return this.applyInterrupt(this.original.arrayBuffer);\n }\n get stream() {\n return Stream.suspend(() => {\n responseRegistry.unregister(this.original);\n return Stream.ensuring(this.original.stream, Effect.sync(() => {\n this.controller.abort();\n }));\n });\n }\n toJSON() {\n return this.original.toJSON();\n }\n [Inspectable.NodeInspectSymbol]() {\n return this.original[Inspectable.NodeInspectSymbol]();\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n}\nconst isTransientError = error => Cause.isTimeoutError(error) || isTransientHttpError(error);\nconst isTransientHttpError = error => Error.isHttpClientError(error) && (error.reason._tag === \"TransportError\" || error.reason._tag === \"StatusCodeError\" && isTransientResponse(error.reason.response));\nconst isTooManyRequestsHttpClientError = error => Error.isHttpClientError(error) && error.reason._tag === \"StatusCodeError\" && error.reason.response.status === 429;\nconst isTransientResponse = response => response.status === 408 || response.status === 429 || response.status === 500 || response.status === 502 || response.status === 503 || response.status === 504;\n//# sourceMappingURL=HttpClient.js.map",
17
+ "import * as Effect from \"./Effect.js\";\nimport * as effect from \"./internal/effect.js\";\nimport * as references from \"./internal/references.js\";\nimport * as Layer from \"./Layer.js\";\nimport * as LogLevel from \"./LogLevel.js\";\n/**\n * Runtime type identifier attached to `ErrorReporter` values.\n *\n * **Details**\n *\n * This marker is part of the runtime representation of `ErrorReporter`\n * implementations. Most code should create reporters with `make` and register\n * them with `layer`.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/ErrorReporter\";\n/**\n * Creates an `ErrorReporter` from a callback.\n *\n * **When to use**\n *\n * Use to define how reported failures are forwarded to a logging, monitoring,\n * or error-tracking backend.\n *\n * **Details**\n *\n * The returned reporter automatically deduplicates causes and individual\n * errors (the same object is never reported twice), skips interruptions,\n * and resolves the `ignore`, `severity`, and `attributes` annotations on\n * each error before invoking your callback.\n *\n * **Example** (Forwarding errors to the console)\n *\n * ```ts\n * import { ErrorReporter } from \"effect\"\n *\n * // Forward every failure to the console\n * const consoleReporter = ErrorReporter.make(\n * ({ error, severity, attributes }) => {\n * console.error(`[${severity}]`, error.message, attributes)\n * }\n * )\n * ```\n *\n * @see {@link layer} for registering reporters in the environment\n * @see {@link report} for manually reporting a `Cause`\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = report => {\n const reported = new WeakSet();\n return {\n [TypeId]: TypeId,\n report(options) {\n if (reported.has(options.cause)) return;\n reported.add(options.cause);\n for (let i = 0; i < options.cause.reasons.length; i++) {\n const reason = options.cause.reasons[i];\n if (reason._tag === \"Interrupt\") continue;\n const original = reason._tag === \"Fail\" ? reason.error : reason.defect;\n const isObject = typeof original === \"object\" && original !== null;\n if (isObject) {\n if (reported.has(original)) continue;\n reported.add(original);\n }\n if (isIgnored(original)) continue;\n const pretty = effect.causePrettyError(original, reason.annotations);\n report({\n ...options,\n error: pretty,\n severity: isObject ? getSeverity(original) : \"Info\",\n attributes: isObject ? getAttributes(original) : emptyAttributes\n });\n }\n }\n };\n};\n/**\n * Context reference that holds the set of active error reporters for the\n * current fiber. Defaults to an empty set (no reporting).\n *\n * **When to use**\n *\n * Use when low-level code needs to read or replace the current set of reporters\n * directly.\n *\n * @category references\n * @since 4.0.0\n */\nexport const CurrentErrorReporters = references.CurrentErrorReporters;\n/**\n * Creates a `Layer` that registers one or more `ErrorReporter`s.\n *\n * **When to use**\n *\n * Use to provide one or more error reporters to effects that perform error\n * reporting.\n *\n * **Details**\n *\n * Reporters can be plain `ErrorReporter` values or effectful\n * `Effect<ErrorReporter>` values that are resolved when the layer is built. By\n * default the provided reporters **replace** any previously registered\n * reporters. Set `mergeWithExisting: true` to add them alongside existing ones.\n *\n * **Example** (Providing error reporters)\n *\n * ```ts\n * import { Effect, ErrorReporter } from \"effect\"\n *\n * const consoleReporter = ErrorReporter.make(({ error, severity }) => {\n * console.error(`[${severity}]`, error.message)\n * })\n *\n * const metricsReporter = ErrorReporter.make(({ severity }) => {\n * // increment an error counter by severity\n * })\n *\n * // Replace all existing reporters\n * const ReporterLive = ErrorReporter.layer([\n * consoleReporter,\n * metricsReporter\n * ])\n *\n * // Add to existing reporters instead of replacing\n * const ReporterMerged = ErrorReporter.layer(\n * [metricsReporter],\n * { mergeWithExisting: true }\n * )\n *\n * const program = Effect.fail(\"boom\").pipe(\n * Effect.withErrorReporting,\n * Effect.provide(ReporterLive)\n * )\n * ```\n *\n * @see {@link make} for creating an `ErrorReporter` from a callback\n * @see {@link CurrentErrorReporters} for low-level access to the current reporters\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = (reporters, options) => Layer.effect(CurrentErrorReporters, Effect.withFiber(Effect.fnUntraced(function* (fiber) {\n const currentReporters = new Set(options?.mergeWithExisting === true ? fiber.getRef(references.CurrentErrorReporters) : []);\n for (const reporter of reporters) {\n currentReporters.add(Effect.isEffect(reporter) ? yield* reporter : reporter);\n }\n return currentReporters;\n})));\n/**\n * Runs all registered error reporters on the current fiber for a `Cause`.\n *\n * **When to use**\n *\n * Use to report a failure for observability without failing the current fiber.\n *\n * **Example** (Reporting a cause manually)\n *\n * ```ts\n * import { Cause, Effect, ErrorReporter } from \"effect\"\n *\n * // Log the cause for monitoring, then continue with a fallback\n * const program = Effect.gen(function*() {\n * const cause = Cause.fail(\"something went wrong\")\n * yield* ErrorReporter.report(cause)\n * return \"fallback value\"\n * })\n * ```\n *\n * @category Reporting\n * @since 4.0.0\n */\nexport const report = cause => Effect.withFiber(fiber => {\n effect.reportCauseUnsafe(fiber, cause);\n return Effect.void;\n});\n/**\n * Defines the runtime property key used to mark an object error as ignored by error\n * reporting.\n *\n * **When to use**\n *\n * Use to suppress reporting for expected object errors, such as HTTP 404\n * responses.\n *\n * **Details**\n *\n * Set `error[ErrorReporter.ignore]` to `true` to prevent the error from being\n * forwarded to reporters. This is useful for expected failures such as HTTP 404\n * responses.\n *\n * **Example** (Marking errors as ignored)\n *\n * ```ts\n * import { Data, ErrorReporter } from \"effect\"\n *\n * class NotFoundError extends Data.TaggedError(\"NotFoundError\")<{}> {\n * readonly [ErrorReporter.ignore] = true\n * }\n * ```\n *\n * @see {@link isIgnored} for checking whether a value carries this annotation\n * @see {@link Reportable} for the annotation contract recognized on object\n * errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const ignore = \"~effect/ErrorReporter/ignore\";\n/**\n * Returns `true` if the given value has the `ErrorReporter.ignore` annotation\n * set to `true`.\n *\n * **When to use**\n *\n * Use to check whether an error value is annotated to be skipped before\n * forwarding it to error reporting code.\n *\n * @see {@link ignore} for the annotation key this predicate reads\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const isIgnored = u => typeof u === \"object\" && u !== null && ignore in u && u[ignore] === true;\n/**\n * Defines the runtime property key used to override the severity level of an object error.\n *\n * **When to use**\n *\n * Use to annotate object errors with the severity reporter callbacks should\n * receive.\n *\n * **Details**\n *\n * Set `error[ErrorReporter.severity]` to a valid `LogLevel.Severity` value.\n * Missing or invalid values fall back to `\"Info\"`.\n *\n * **Example** (Setting error severity annotations)\n *\n * ```ts\n * import { Data, ErrorReporter } from \"effect\"\n *\n * class DeprecationWarning extends Data.TaggedError(\"DeprecationWarning\")<{}> {\n * readonly [ErrorReporter.severity] = \"Warn\" as const\n * }\n * ```\n *\n * @see {@link getSeverity} for reading the severity stored under this key\n * @see {@link Reportable} for the annotation contract recognized on object\n * errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const severity = \"~effect/ErrorReporter/severity\";\n/**\n * Reads the `ErrorReporter.severity` annotation from an error object,\n * falling back to `\"Info\"` when the annotation is unset or invalid.\n *\n * **When to use**\n *\n * Use to inspect the severity that reporter callbacks will receive for an\n * object error.\n *\n * @see {@link severity} for the annotation key used to override severity\n * @see {@link Reportable} for the annotation properties recognized on object errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const getSeverity = error => {\n if (severity in error && LogLevel.values.includes(error[severity])) {\n return error[severity];\n }\n return \"Info\";\n};\n/**\n * Defines the runtime property key used to attach extra key/value metadata to an object\n * error report.\n *\n * **When to use**\n *\n * Use to attach domain metadata to object errors so reporter callbacks receive\n * it with the reported failure.\n *\n * **Details**\n *\n * Set `error[ErrorReporter.attributes]` to a record of metadata that should be\n * forwarded to reporters alongside the error.\n *\n * **Example** (Setting error attributes)\n *\n * ```ts\n * import { Data, ErrorReporter } from \"effect\"\n *\n * class PaymentError extends Data.TaggedError(\"PaymentError\")<{\n * readonly orderId: string\n * }> {\n * readonly [ErrorReporter.attributes] = {\n * orderId: this.orderId\n * }\n * }\n * ```\n *\n * @see {@link ignore} for suppressing reports for expected object errors\n * @see {@link severity} for overriding reporter severity\n * @see {@link getAttributes} for reading the metadata stored under this key\n * @see {@link Reportable} for the annotation contract recognized on object\n * errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const attributes = \"~effect/ErrorReporter/attributes\";\n/**\n * Reads the `ErrorReporter.attributes` annotation from an error object,\n * returning an empty record when unset.\n *\n * **When to use**\n *\n * Use to inspect the attributes that reporter callbacks will receive for an\n * object error.\n *\n * **Details**\n *\n * Returns the value stored under `ErrorReporter.attributes`, or the module's\n * shared empty record when the annotation is absent.\n *\n * **Gotchas**\n *\n * The annotation value is returned as-is; this helper does not validate or\n * clone it.\n *\n * @see {@link attributes} for the annotation key used to attach metadata\n * @see {@link Reportable} for the annotation properties recognized on object errors\n *\n * @category annotations\n * @since 4.0.0\n */\nexport const getAttributes = error => {\n return attributes in error ? error[attributes] : emptyAttributes;\n};\nconst emptyAttributes = {};\n//# sourceMappingURL=ErrorReporter.js.map",
18
+ "/**\n * Effect-aware template literal rendering for HTTP response text.\n *\n * This module backs HTTP response helpers that accept template tags, especially\n * HTML responses assembled from plain values, optional values, effects, and\n * streams. It keeps template interpolation in the Effect type system so dynamic\n * fragments can contribute errors and service requirements to the final\n * response-producing program.\n *\n * **Mental model**\n *\n * `make` evaluates effectful interpolations and returns one complete string.\n * `stream` emits static template text together with effect and stream\n * interpolations as a `Stream`. Plain primitive values are converted to text,\n * arrays are concatenated without separators, and `Option.none`, `null`, and\n * `undefined` render as empty text.\n *\n * **Common tasks**\n *\n * Use `make` when the entire rendered body should be available before creating\n * the response. Use `stream` when a response can be emitted incrementally, for\n * example when part of an HTML page is produced by an existing stream.\n *\n * **Gotchas**\n *\n * Templates do not escape HTML, encode bytes, set content types, or compute\n * content lengths. Escape or encode untrusted values before interpolation and\n * choose the response constructor that matches the rendered body.\n *\n * @since 4.0.0\n */\nimport * as Effect from \"../../Effect.js\";\nimport * as Exit from \"../../Exit.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Stream from \"../../Stream.js\";\n/**\n * Creates an effectful string from a template literal.\n *\n * **Details**\n *\n * Primitive and `Option` interpolations are rendered immediately. Effect\n * interpolations are evaluated and rendered before the final string is produced.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function make(strings, ...args) {\n const argsLength = args.length;\n const values = new Array(argsLength);\n const effects = [];\n for (let i = 0; i < argsLength; i++) {\n const arg = args[i];\n if (Option.isOption(arg)) {\n values[i] = arg._tag === \"Some\" ? primitiveToString(arg.value) : \"\";\n } else if (isSuccess(arg)) {\n values[i] = primitiveToString(arg.value);\n } else if (Effect.isEffect(arg)) {\n effects.push([i, arg]);\n } else {\n values[i] = primitiveToString(arg);\n }\n }\n if (effects.length === 0) {\n return Effect.succeed(consolidate(strings, values));\n }\n return Effect.map(Effect.forEach(effects, ([index, effect]) => Effect.tap(effect, value => Effect.sync(() => {\n values[index] = primitiveToString(value);\n })), {\n concurrency: \"inherit\",\n discard: true\n }), _ => consolidate(strings, values));\n}\n/**\n * Creates a stream of strings from a template literal.\n *\n * **Details**\n *\n * Static text is emitted with interpolated values. Effect interpolations are\n * evaluated as stream chunks, and stream interpolations are flattened into the\n * output.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport function stream(strings, ...args) {\n const chunks = [];\n let buffer = \"\";\n for (let i = 0, len = args.length; i < len; i++) {\n buffer += strings[i];\n const arg = args[i];\n if (Option.isOption(arg)) {\n buffer += arg._tag === \"Some\" ? primitiveToString(arg.value) : \"\";\n } else if (isSuccess(arg)) {\n buffer += primitiveToString(arg.value);\n } else if (Effect.isEffect(arg)) {\n if (buffer.length > 0) {\n chunks.push(buffer);\n buffer = \"\";\n }\n chunks.push(Effect.map(arg, primitiveToString));\n } else if (Stream.isStream(arg)) {\n if (buffer.length > 0) {\n chunks.push(buffer);\n buffer = \"\";\n }\n chunks.push(Stream.map(arg, primitiveToString));\n } else {\n buffer += primitiveToString(arg);\n }\n }\n buffer += strings[strings.length - 1];\n if (buffer.length > 0) {\n chunks.push(buffer);\n buffer = \"\";\n }\n return Stream.flatMap(Stream.fromIterable(chunks), chunk => typeof chunk === \"string\" ? Stream.succeed(chunk) : Effect.isEffect(chunk) ? Stream.fromEffect(chunk) : chunk, {\n concurrency: \"unbounded\"\n });\n}\nfunction primitiveToString(value) {\n if (Array.isArray(value)) {\n return value.map(primitiveToString).join(\"\");\n }\n switch (typeof value) {\n case \"string\":\n {\n return value;\n }\n case \"number\":\n case \"bigint\":\n {\n return value.toString();\n }\n case \"boolean\":\n {\n return value ? \"true\" : \"false\";\n }\n default:\n {\n return \"\";\n }\n }\n}\nfunction consolidate(strings, values) {\n let out = \"\";\n for (let i = 0, len = values.length; i < len; i++) {\n out += strings[i];\n out += values[i];\n }\n return out + strings[strings.length - 1];\n}\nfunction isSuccess(u) {\n return Exit.isExit(u) && u._tag === \"Success\";\n}\n//# sourceMappingURL=Template.js.map",
19
+ "/**\n * The `HttpServerResponse` module provides immutable response values for Effect\n * HTTP servers. Handlers return an {@link HttpServerResponse}, then the runtime\n * converts it to a platform response such as a Web `Response`.\n *\n * **Mental model**\n *\n * - A response is a status, optional status text, headers, cookies, and an HTTP\n * body.\n * - Constructors set practical defaults: {@link empty} uses `204`,\n * {@link redirect} uses `302`, and body constructors use `200`.\n * - Body metadata is reflected into headers when a response is created or when\n * the body is replaced.\n * - Cookies are stored separately from the normal header map and become\n * `Set-Cookie` headers during conversion.\n * - Constructors that encode data can return effects when encoding may fail.\n *\n * **Common tasks**\n *\n * - Create empty, redirect, text, HTML, JSON, or URL-encoded responses with\n * {@link empty}, {@link redirect}, {@link text}, {@link html}, {@link json},\n * {@link schemaJson}, or {@link urlParams}.\n * - Send binary, raw, form-data, stream, or file bodies with {@link uint8Array},\n * {@link raw}, {@link formData}, {@link stream}, {@link file}, or\n * {@link fileWeb}.\n * - Adjust status, headers, and bodies with {@link setStatus},\n * {@link setHeader}, {@link setHeaders}, and {@link setBody}.\n * - Manage cookies with {@link setCookie}, {@link expireCookie},\n * {@link removeCookie}, and their unsafe variants.\n * - Convert responses with {@link toWeb}, {@link fromWeb},\n * {@link toClientResponse}, and {@link fromClientResponse}.\n *\n * **Gotchas**\n *\n * - Body content type and content length override existing `content-type` and\n * `content-length` headers when body metadata is present.\n * - {@link json} and {@link schemaJson} capture encoding failures in the Effect\n * error channel; {@link jsonUnsafe} throws instead.\n * - {@link setCookie} and {@link expireCookie} validate cookie output in the\n * Effect error channel; unsafe cookie helpers throw on invalid cookies.\n * - `Set-Cookie` headers are produced from the response cookie collection, not\n * by manually editing the normal header map.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as ErrorReporter from \"../../ErrorReporter.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport { PipeInspectableProto } from \"../../internal/core.js\";\nimport * as Option from \"../../Option.js\";\nimport { pipeArguments } from \"../../Pipeable.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport { redact } from \"../../Redactable.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Cookies from \"./Cookies.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as Body from \"./HttpBody.js\";\nimport * as HttpClientError from \"./HttpClientError.js\";\nimport * as HttpClientRequest from \"./HttpClientRequest.js\";\nimport * as HttpClientResponse from \"./HttpClientResponse.js\";\nimport * as HttpIncomingMessage from \"./HttpIncomingMessage.js\";\nimport * as Template from \"./Template.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nconst TypeId = \"~effect/http/HttpServerResponse\";\n/**\n * Returns `true` when the supplied value is an `HttpServerResponse`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isHttpServerResponse = u => hasProperty(u, TypeId);\n/**\n * Creates an empty HTTP response.\n *\n * **Details**\n *\n * The default status is `204`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const empty = options => makeResponse({\n status: options?.status ?? 204,\n statusText: options?.statusText,\n headers: options?.headers ? Headers.fromInput(options.headers) : undefined,\n cookies: options?.cookies\n});\n/**\n * Creates a redirect response with a `Location` header.\n *\n * **Details**\n *\n * The default status is `302`; custom headers are merged with the generated\n * `Location` header.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const redirect = (location, options) => {\n const headers = Headers.fromRecordUnsafe({\n location: location.toString()\n });\n return makeResponse({\n status: options?.status ?? 302,\n statusText: options?.statusText,\n headers: options?.headers ? Headers.merge(headers, Headers.fromInput(options.headers)) : headers,\n cookies: options?.cookies ?? Cookies.empty\n });\n};\n/**\n * Creates an HTTP response whose body is a `Uint8Array`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const uint8Array = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies ?? Cookies.empty,\n body: Body.uint8Array(body, getContentType(options, headers))\n });\n};\nconst getContentType = (options, headers) => {\n if (options?.contentType) {\n return options.contentType;\n } else if (options?.headers) {\n return headers[\"content-type\"];\n }\n};\n/**\n * Creates an HTTP response whose body is a string.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const text = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies ?? Cookies.empty,\n body: Body.text(body, getContentType(options, headers))\n });\n};\n/**\n * Creates an HTML response with the `text/html` content type.\n *\n * **Details**\n *\n * Passing a string returns a response directly. Using it as a template tag returns\n * an effect so interpolated values can be rendered with their required services\n * and errors.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const html = (strings, ...args) => {\n if (typeof strings === \"string\") {\n return text(strings, {\n contentType: \"text/html\"\n });\n }\n return Effect.map(Template.make(strings, ...args), _ => text(_, {\n contentType: \"text/html\"\n }));\n};\n/**\n * Creates a streaming HTML response from a template.\n *\n * **Details**\n *\n * The template is encoded as a byte stream and can use streaming interpolated\n * values from the current context.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const htmlStream = (strings, ...args) => Effect.map(Effect.context(), context => stream(Stream.provideContext(Stream.encodeText(Template.stream(strings, ...args)), context), {\n contentType: \"text/html\"\n}));\n/**\n * Creates a JSON HTTP response.\n *\n * **Details**\n *\n * The body is serialized with `JSON.stringify`; serialization errors are captured\n * as `HttpBodyError` failures.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const json = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return Effect.map(Body.json(body, getContentType(options, headers)), body => makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body\n }));\n};\n/**\n * Creates a JSON response constructor backed by a schema encoder.\n *\n * **Details**\n *\n * The returned function encodes the value with the supplied schema before\n * serializing it as JSON, and can fail with `HttpBodyError` if schema encoding or\n * JSON serialization fails.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const schemaJson = (schema, options) => {\n const encode = Body.jsonSchema(schema, options);\n return (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return Effect.map(encode(body, getContentType(options, headers)), body => makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body\n }));\n };\n};\n/**\n * Creates a JSON HTTP response synchronously.\n *\n * **Gotchas**\n *\n * Unlike `json`, serialization errors from `JSON.stringify` are not captured in\n * `Effect`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const jsonUnsafe = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body: Body.jsonUnsafe(body, getContentType(options, headers))\n });\n};\n/**\n * Creates a response from URL parameters using the\n * `application/x-www-form-urlencoded` content type by default.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const urlParams = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body: Body.text(UrlParams.toString(UrlParams.fromInput(body)), getContentType(options, headers) ?? \"application/x-www-form-urlencoded\")\n });\n};\n/**\n * Creates a response with a raw body value.\n *\n * **When to use**\n *\n * Use when the underlying runtime already understands the body value, such\n * as a Web `Response`, `Blob`, or `ReadableStream`; the body is passed through\n * for later platform conversion.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const raw = (body, options) => makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers: options?.headers && Headers.fromInput(options.headers),\n cookies: options?.cookies,\n body: Body.raw(body, {\n contentType: options?.contentType,\n contentLength: options?.contentLength\n })\n});\n/**\n * Creates a response whose body is a Web `FormData` value.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const formData = (body, options) => makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers: options?.headers && Headers.fromInput(options.headers),\n cookies: options?.cookies,\n body: Body.formData(body)\n});\n/**\n * Creates a streaming response from a stream of byte chunks.\n *\n * **Details**\n *\n * Optional response metadata can supply the status, headers, content type, and\n * content length.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const stream = (body, options) => {\n const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty;\n return makeResponse({\n status: options?.status ?? 200,\n statusText: options?.statusText,\n headers,\n cookies: options?.cookies,\n body: Body.stream(body, getContentType(options, headers), options?.contentLength)\n });\n};\nconst HttpPlatformKey = /*#__PURE__*/Context.Service(\"effect/http/HttpPlatform\");\n/**\n * Creates a streamed file response for a file system path.\n *\n * **Details**\n *\n * The effect requires `HttpPlatform`, can fail with a platform error, and supports\n * options for status, headers, offset, and byte range.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const file = (path, options) => Effect.flatMap(HttpPlatformKey, platform => platform.fileResponse(path, options));\n/**\n * Creates a streamed file response for a Web `File`-like value.\n *\n * **Details**\n *\n * The effect requires `HttpPlatform` and supports options for status, headers,\n * offset, and byte range.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fileWeb = (file, options) => Effect.flatMap(HttpPlatformKey, platform => platform.fileWebResponse(file, options));\n/**\n * Returns a response with the specified header set to the supplied value.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHeader = /*#__PURE__*/dual(3, (self, key, value) => makeResponse({\n ...self,\n headers: Headers.set(self.headers, key, value)\n}));\n/**\n * Returns a response with all supplied headers set on the existing header map.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setHeaders = /*#__PURE__*/dual(2, (self, input) => makeResponse({\n ...self,\n headers: Headers.setAll(self.headers, input)\n}));\n/**\n * Returns a response with the cookie of the specified name removed.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const removeCookie = /*#__PURE__*/dual(2, (self, name) => makeResponse({\n ...self,\n cookies: Cookies.remove(self.cookies, name)\n}));\n/**\n * Returns a response with its cookie collection replaced by the supplied cookies.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const replaceCookies = /*#__PURE__*/dual(2, (self, cookies) => makeResponse({\n ...self,\n cookies\n}));\n/**\n * Sets a cookie on the response.\n *\n * **Details**\n *\n * The effect fails with `CookiesError` if the cookie name, value, or options are\n * invalid.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookie = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, name, value, options) => Effect.map(Effect.fromResult(Cookies.set(self.cookies, name, value, options)), cookies => makeResponse({\n ...self,\n cookies\n})));\n/**\n * Sets an expired cookie on an `HttpServerResponse`.\n *\n * **Details**\n *\n * Returns an effect because cookie encoding can fail. The original response is not\n * mutated; the effect succeeds with a response containing the updated cookie set.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookie = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, name, options) => Effect.map(Effect.fromResult(Cookies.expireCookie(self.cookies, name, options)), cookies => makeResponse({\n ...self,\n cookies\n})));\n/**\n * Sets a cookie on an `HttpServerResponse`, throwing if the cookie cannot be\n * encoded.\n *\n * **When to use**\n *\n * Use when setting one trusted cookie and encoding failures should throw\n * instead of being represented as `CookiesError` failures.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookieUnsafe = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, name, value, options) => makeResponse({\n ...self,\n cookies: Cookies.setUnsafe(self.cookies, name, value, options)\n}));\n/**\n * Sets an expired cookie on an `HttpServerResponse`, throwing if the expiration cookie\n * cannot be encoded.\n *\n * **When to use**\n *\n * Use when expiring one trusted cookie and encoding failures should throw\n * instead of being represented as `CookiesError` failures.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const expireCookieUnsafe = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, name, options) => makeResponse({\n ...self,\n cookies: Cookies.expireCookieUnsafe(self.cookies, name, options)\n}));\n/**\n * Updates the cookies attached to an `HttpServerResponse` using the supplied\n * function.\n *\n * **Details**\n *\n * The original response is not mutated; a new response is returned with the\n * callback result as its cookie collection.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const updateCookies = /*#__PURE__*/dual(2, (self, f) => makeResponse({\n ...self,\n cookies: f(self.cookies)\n}));\n/**\n * Merges additional cookies into the cookies attached to an\n * `HttpServerResponse`.\n *\n * **Details**\n *\n * The original response is not mutated; a new response is returned with the merged\n * cookie collection.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const mergeCookies = /*#__PURE__*/dual(2, (self, cookies) => makeResponse({\n ...self,\n cookies: Cookies.merge(self.cookies, cookies)\n}));\n/**\n * Sets multiple cookies on an `HttpServerResponse`.\n *\n * **Details**\n *\n * Each input entry contains a cookie name, value, and optional cookie options. The\n * returned effect fails with `CookiesError` if any cookie cannot be encoded.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookies = /*#__PURE__*/dual(2, (self, cookies) => Effect.map(Effect.fromResult(Cookies.setAll(self.cookies, cookies)), cookies => makeResponse({\n ...self,\n cookies\n})));\n/**\n * Sets multiple cookies on an `HttpServerResponse`, throwing if any cookie cannot\n * be encoded.\n *\n * **When to use**\n *\n * Use when setting multiple trusted cookies and encoding failures should throw\n * instead of being represented as `CookiesError` failures.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setCookiesUnsafe = /*#__PURE__*/dual(2, (self, cookies) => makeResponse({\n ...self,\n cookies: Cookies.setAllUnsafe(self.cookies, cookies)\n}));\n/**\n * Replaces the body of an `HttpServerResponse`.\n *\n * **Details**\n *\n * When the body carries a content type or content length, the returned response\n * includes the corresponding headers.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setBody = /*#__PURE__*/dual(2, (self, body) => makeResponse({\n ...self,\n body\n}));\n/**\n * Sets the HTTP status code of an `HttpServerResponse`.\n *\n * **Details**\n *\n * When `statusText` is omitted, the existing status text is preserved.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const setStatus = /*#__PURE__*/dual(args => isHttpServerResponse(args[0]), (self, status, statusText) => makeResponse({\n ...self,\n status,\n statusText: statusText ?? self.statusText\n}));\n/**\n * Converts an `HttpServerResponse` to a Web `Response`.\n *\n * **Details**\n *\n * Cookies are appended as `Set-Cookie` headers. Stream bodies are converted using\n * the supplied context, and `withoutBody` can be used for responses such as HEAD\n * responses.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWeb = (response, options) => {\n const headers = new globalThis.Headers(response.headers);\n if (!Cookies.isEmpty(response.cookies)) {\n const toAdd = Cookies.toSetCookieHeaders(response.cookies);\n for (const header of toAdd) {\n headers.append(\"set-cookie\", header);\n }\n }\n if (options?.withoutBody) {\n return new Response(undefined, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n const body = response.body;\n switch (body._tag) {\n case \"Empty\":\n {\n return new Response(undefined, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n case \"Uint8Array\":\n case \"Raw\":\n {\n if (body.body instanceof Response) {\n for (const [key, value] of headers) {\n body.body.headers.set(key, value);\n }\n return body.body;\n }\n return new Response(body.body, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n case \"FormData\":\n {\n return new Response(body.formData, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n case \"Stream\":\n {\n return new Response(Stream.toReadableStreamWith(body.stream, options?.context ?? Context.empty()), {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n }\n};\n/**\n * Wraps an `HttpServerResponse` as an `HttpClientResponse`.\n *\n * **Details**\n *\n * An optional request can be supplied for client-response metadata and decode\n * errors.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toClientResponse = (response, options) => new ServerHttpClientResponse(options?.request ?? HttpClientRequest.empty, response);\nclass ServerHttpClientResponse extends Inspectable.Class {\n [HttpIncomingMessage.TypeId];\n [HttpClientResponse.TypeId];\n request;\n response;\n constructor(request, response) {\n super();\n this.request = request;\n this.response = response;\n this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n this[HttpClientResponse.TypeId] = HttpClientResponse.TypeId;\n }\n toJSON() {\n return HttpIncomingMessage.inspect(this, {\n _id: \"HttpClientResponse\",\n request: this.request.toJSON(),\n status: this.status\n });\n }\n get status() {\n return this.response.status;\n }\n cachedHeaders;\n get headers() {\n return this.cachedHeaders ??= this.response.body._tag === \"FormData\" ? Headers.merge(this.response.headers, Headers.fromInput(this.getFormDataResponse().headers)) : this.response.headers;\n }\n get cookies() {\n return this.response.cookies;\n }\n get remoteAddress() {\n return Option.none();\n }\n get stream() {\n const body = this.response.body;\n switch (body._tag) {\n case \"Empty\":\n {\n return Stream.empty;\n }\n case \"Stream\":\n {\n return Stream.mapError(body.stream, cause => this.decodeError(cause));\n }\n case \"Uint8Array\":\n {\n return Stream.succeed(body.body);\n }\n case \"Raw\":\n {\n const rawBody = body.body;\n if (rawBody instanceof Response) {\n return rawBody.body ? Stream.fromReadableStream({\n evaluate: () => rawBody.body,\n onError: cause => this.decodeError(cause)\n }) : Stream.empty;\n }\n if (isReadableStream(rawBody)) {\n return Stream.fromReadableStream({\n evaluate: () => rawBody,\n onError: cause => this.decodeError(cause)\n });\n }\n if (rawBody instanceof Blob) {\n return Stream.fromReadableStream({\n evaluate: () => rawBody.stream(),\n onError: cause => this.decodeError(cause)\n });\n }\n return Stream.unwrap(Effect.map(this.bytes, Stream.succeed));\n }\n case \"FormData\":\n {\n const response = this.getFormDataResponse();\n return Stream.fromReadableStream({\n evaluate: () => response.body,\n onError: cause => this.decodeError(cause)\n });\n }\n }\n }\n get json() {\n return Effect.flatMap(this.text, text => Effect.try({\n try: () => text === \"\" ? null : JSON.parse(text),\n catch: cause => new HttpClientError.HttpClientError({\n reason: new HttpClientError.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }));\n }\n get bytes() {\n const body = this.response.body;\n switch (body._tag) {\n case \"Empty\":\n {\n return Effect.succeed(new Uint8Array(0));\n }\n case \"Uint8Array\":\n {\n return Effect.succeed(body.body);\n }\n case \"Stream\":\n {\n return Stream.mkUint8Array(this.stream);\n }\n case \"Raw\":\n {\n const rawBody = body.body;\n if (rawBody instanceof Response) {\n return Effect.tryPromise({\n try: () => rawBody.arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => this.decodeError(cause)\n });\n }\n return Effect.tryPromise({\n try: () => new Response(rawBody).arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => this.decodeError(cause)\n });\n }\n case \"FormData\":\n {\n return Effect.tryPromise({\n try: () => new Response(body.formData).arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => this.decodeError(cause)\n });\n }\n }\n }\n get text() {\n return Effect.map(this.bytes, bytes => textDecoder.decode(bytes));\n }\n get urlParamsBody() {\n return Effect.flatMap(this.text, _ => Effect.try({\n try: () => UrlParams.fromInput(new URLSearchParams(_)),\n catch: cause => new HttpClientError.HttpClientError({\n reason: new HttpClientError.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n })\n }));\n }\n get formData() {\n const body = this.response.body;\n if (body._tag === \"FormData\") {\n return Effect.succeed(body.formData);\n }\n return Effect.contextWith(context => {\n const readableStream = Stream.toReadableStreamWith(this.stream, context);\n return Effect.tryPromise({\n try: () => new Response(readableStream, {\n headers: this.headers\n }).formData(),\n catch: cause => this.decodeError(cause)\n });\n });\n }\n get arrayBuffer() {\n return Effect.map(this.bytes, bytes => bytes.slice().buffer);\n }\n decodeError(cause) {\n return new HttpClientError.HttpClientError({\n reason: new HttpClientError.DecodeError({\n request: this.request,\n response: this,\n cause\n })\n });\n }\n formDataResponse;\n getFormDataResponse() {\n return this.formDataResponse ??= new Response(this.response.body.formData);\n }\n pipe() {\n return pipeArguments(this, arguments);\n }\n}\nconst textDecoder = /*#__PURE__*/new TextDecoder();\n/**\n * Converts an `HttpClientResponse` to an `HttpServerResponse`.\n *\n * **Details**\n *\n * The response body is streamed from the client response. `Set-Cookie` headers are\n * removed from the header map and represented in the response cookie collection.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromClientResponse = response => {\n const headers = Headers.remove(response.headers, \"set-cookie\");\n return makeResponse({\n status: response.status,\n headers,\n cookies: response.cookies,\n body: Body.stream(Stream.catchIf(response.stream, isEmptyBodyError, () => Stream.empty), Option.getOrUndefined(Headers.get(headers, \"content-type\")), getContentLength(headers))\n });\n};\nconst isReadableStream = u => typeof ReadableStream !== \"undefined\" && u instanceof ReadableStream;\nconst isEmptyBodyError = error => HttpClientError.isHttpClientError(error) && error.reason._tag === \"EmptyBodyError\";\nconst getContentLength = headers => {\n const contentLength = Option.getOrUndefined(Headers.get(headers, \"content-length\"));\n if (contentLength === undefined) {\n return undefined;\n }\n const parsed = Number(contentLength);\n return Number.isFinite(parsed) && parsed >= 0 ? parsed : undefined;\n};\nconst Proto = {\n ...PipeInspectableProto,\n [TypeId]: TypeId,\n [ErrorReporter.ignore]: true,\n toJSON() {\n return {\n _id: \"HttpServerResponse\",\n status: this.status,\n statusText: this.statusText,\n headers: redact(this.headers),\n cookies: this.cookies.toJSON(),\n body: this.body.toJSON()\n };\n }\n};\nconst makeResponse = options => {\n const self = Object.create(Proto);\n self.status = options.status;\n self.statusText = options.statusText;\n self.cookies = options.cookies ?? Cookies.empty;\n self.body = options.body ?? Body.empty;\n if (self.body._tag !== \"Empty\" && (self.body.contentType || self.body.contentLength)) {\n const newHeaders = Headers.fromRecordUnsafe({\n ...options.headers\n });\n if (self.body.contentType) {\n newHeaders[\"content-type\"] = self.body.contentType;\n }\n if (self.body.contentLength) {\n newHeaders[\"content-length\"] = self.body.contentLength.toString();\n }\n self.headers = newHeaders;\n } else {\n self.headers = options.headers ?? Headers.empty;\n }\n return self;\n};\n/**\n * Converts a Web `Response` to an `HttpServerResponse`.\n *\n * **Details**\n *\n * `Set-Cookie` headers are parsed into the response cookie collection and removed\n * from the header map. A present Web body is exposed as a stream body.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromWeb = response => {\n const headers = new globalThis.Headers(response.headers);\n const setCookieHeaders = headers.getSetCookie();\n headers.delete(\"set-cookie\");\n let self = empty({\n status: response.status,\n statusText: response.statusText,\n headers: headers,\n cookies: Cookies.fromSetCookie(setCookieHeaders)\n });\n if (response.body) {\n const contentType = response.headers.get(\"content-type\");\n self = setBody(self, Body.stream(Stream.fromReadableStream({\n evaluate: () => response.body,\n onError: e => e\n }), contentType ?? undefined));\n }\n return self;\n};\n//# sourceMappingURL=HttpServerResponse.js.map",
20
+ "/**\n * Platform-specific support for serving files as HTTP server responses.\n *\n * `HttpPlatform` is the boundary between the portable HTTP response model and\n * the runtime that knows how to stream bytes from the host platform. Server\n * code uses this service when it needs to return local files, static assets,\n * downloads, byte ranges, or Web `File`-like values without constructing the\n * response body by hand.\n *\n * The helpers in this module enrich those responses with file metadata such as\n * `etag`, `last-modified`, and content length where available. Path-based\n * responses require `FileSystem` and can fail with `PlatformError` while\n * inspecting or streaming the file; `File`-like responses use the Web\n * `ReadableStream` and `lastModified` metadata exposed by the value.\n *\n * Provide `layer` when the default streaming implementation is suitable, or\n * use `make` to plug in a runtime-specific response constructor. The default\n * layer supplies weak ETag generation itself, but the surrounding runtime still\n * needs to provide the `FileSystem` service and run the resulting\n * `HttpServerResponse` on an HTTP server adapter that understands Effect\n * streams.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { identity } from \"../../Function.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Etag from \"./Etag.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as Response from \"./HttpServerResponse.js\";\n/**\n * Service for platform-specific HTTP response helpers, including file-backed server responses.\n *\n * @category services\n * @since 4.0.0\n */\nexport class HttpPlatform extends /*#__PURE__*/Context.Service()(\"effect/http/HttpPlatform\") {}\n/**\n * Creates an `HttpPlatform` service from platform-specific file response constructors, using `FileSystem` and `Etag.Generator`.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = /*#__PURE__*/Effect.fnUntraced(function* (impl) {\n const fs = yield* FileSystem.FileSystem;\n const etagGen = yield* Etag.Generator;\n return HttpPlatform.of({\n fileResponse: Effect.fnUntraced(function* (path, options) {\n const info = yield* fs.stat(path);\n const etag = yield* etagGen.fromFileInfo(info);\n const start = Number(options?.offset ?? 0);\n const end = options?.bytesToRead !== undefined ? start + Number(options.bytesToRead) : undefined;\n const headers = Headers.set(options?.headers ? Headers.fromInput(options.headers) : Headers.empty, \"etag\", Etag.toString(etag));\n if (Option.isSome(info.mtime)) {\n ;\n headers[\"last-modified\"] = info.mtime.value.toUTCString();\n }\n const contentLength = end !== undefined ? end - start : Number(info.size) - start;\n return impl.fileResponse(path, options?.status ?? 200, options?.statusText, headers, start, end, contentLength);\n }),\n fileWebResponse(file, options) {\n return Effect.map(etagGen.fromFileWeb(file), etag => {\n const headers = Headers.merge(options?.headers ? Headers.fromInput(options.headers) : Headers.empty, Headers.fromRecordUnsafe({\n etag: Etag.toString(etag),\n \"last-modified\": new Date(file.lastModified).toUTCString()\n }));\n return impl.fileWebResponse(file, options?.status ?? 200, options?.statusText, headers, options);\n });\n }\n });\n});\n/**\n * Provides the default `HttpPlatform` implementation for serving file paths and\n * `File`-like values as streamed HTTP responses.\n *\n * **Details**\n *\n * The layer uses the `FileSystem` and weak ETag services to add file metadata\n * headers such as `etag` and `last-modified`.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.effect(HttpPlatform)(Effect.flatMap(FileSystem.FileSystem, fs => make({\n fileResponse(path, status, statusText, headers, start, end, contentLength) {\n return Response.stream(fs.stream(path, {\n offset: start,\n bytesToRead: end !== undefined ? end - start : undefined\n }), {\n contentLength,\n headers,\n status,\n statusText\n });\n },\n fileWebResponse(file, status, statusText, headers, _options) {\n return Response.stream(Stream.fromReadableStream({\n evaluate: () => file.stream(),\n onError: identity\n }), {\n headers,\n status,\n statusText\n });\n }\n}))).pipe(/*#__PURE__*/Layer.provide(Etag.layerWeak));\n//# sourceMappingURL=HttpPlatform.js.map",
21
+ "/**\n * Runtime boundary for serving Effect HTTP responses on a concrete HTTP server.\n *\n * `HttpServer` is the service implemented by platform adapters and consumed by\n * routers, API layers, tests, and applications that start serving from a\n * `Layer`. It exposes the listening address and a `serve` operation that runs\n * an `HttpServerResponse` effect for each incoming request.\n *\n * **Mental model**\n *\n * The server owns the listener and supplies `HttpServerRequest` for every\n * request. The application effect only describes how to produce a response, so\n * request-scoped data comes from the server while the rest of the environment is\n * still provided by the surrounding layer graph. `serve` ties listener lifetime\n * to a layer scope, and `serveEffect` performs the same work inside an explicit\n * `Scope`.\n *\n * **Common tasks**\n *\n * - Build a server service from a platform adapter with `make`.\n * - Serve an HTTP app with `serve` or `serveEffect`.\n * - Format or log the listening address with `formatAddress`,\n * `addressFormattedWith`, `logAddress`, or `withLogAddress`.\n * - Create a test client that targets the running server with `makeTestClient`\n * or `layerTestClient`.\n *\n * **Gotchas**\n *\n * Middleware is applied at the server boundary, after the server has supplied\n * the request service. Test clients only support TCP addresses, and rewrite\n * `0.0.0.0` to `127.0.0.1` for local requests.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { dual } from \"../../Function.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Path from \"../../Path.js\";\nimport * as Etag from \"./Etag.js\";\nimport * as HttpClient from \"./HttpClient.js\";\nimport * as ClientRequest from \"./HttpClientRequest.js\";\nimport * as HttpPlatform from \"./HttpPlatform.js\";\n/**\n * Service tag for an HTTP server runtime.\n *\n * **Details**\n *\n * The service can serve an HTTP response effect and exposes the address where the\n * server is listening.\n *\n * @category models\n * @since 4.0.0\n */\nexport class HttpServer extends /*#__PURE__*/Context.Service()(\"effect/http/HttpServer\") {}\n/**\n * Constructs an `HttpServer` service from a serving implementation and listening\n * address.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = options => options;\n/**\n * Creates a layer that starts serving an HTTP response effect with the current\n * `HttpServer`.\n *\n * **Details**\n *\n * The request service is supplied by the server for each request; the returned\n * layer still requires the server, a scope, and any non-request dependencies of\n * the response effect or middleware.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const serve = /*#__PURE__*/dual(args => Effect.isEffect(args[0]), (effect, middleware) => Layer.effectDiscard(HttpServer.use(server => server.serve(effect, middleware))));\n/**\n * Effect that starts serving an HTTP response effect with the current\n * `HttpServer`.\n *\n * **Details**\n *\n * The request service is supplied by the server for each request; the effect\n * requires a scope and any non-request dependencies of the response effect or\n * middleware.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const serveEffect = /*#__PURE__*/dual(args => Effect.isEffect(args[0]), (effect, middleware) => HttpServer.use(server => server.serve(effect, middleware)));\n/**\n * Formats a server address as a display string.\n *\n * **Details**\n *\n * TCP addresses are formatted as `http://host:port`; Unix socket addresses are\n * formatted as `unix://path`.\n *\n * @category address\n * @since 4.0.0\n */\nexport const formatAddress = address => {\n switch (address._tag) {\n case \"UnixAddress\":\n return `unix://${address.path}`;\n case \"TcpAddress\":\n return `http://${address.hostname}:${address.port}`;\n }\n};\n/**\n * Reads the current server address, formats it with `formatAddress`, and passes\n * the formatted address to the supplied effectful function.\n *\n * @category address\n * @since 4.0.0\n */\nexport const addressFormattedWith = f => Effect.flatMap(HttpServer, server => f(formatAddress(server.address)));\n/**\n * Logs the formatted address of the current HTTP server.\n *\n * @category address\n * @since 4.0.0\n */\nexport const logAddress = /*#__PURE__*/addressFormattedWith(_ => Effect.log(`Listening on ${_}`));\n/**\n * Adds address logging to a layer that provides an `HttpServer`.\n *\n * @category address\n * @since 4.0.0\n */\nexport const withLogAddress = layer => Layer.effectDiscard(logAddress).pipe(Layer.provideMerge(layer));\n/**\n * Builds an `HttpClient` that sends requests to the current test HTTP server.\n *\n * **Details**\n *\n * For TCP servers, requests are prefixed with the server URL and `0.0.0.0` is\n * rewritten to `127.0.0.1`.\n *\n * **Gotchas**\n *\n * Unix socket addresses are not supported.\n *\n * @category testing\n * @since 4.0.0\n */\nexport const makeTestClient = /*#__PURE__*/Effect.gen(function* () {\n const server = yield* HttpServer;\n const client = yield* HttpClient.HttpClient;\n const address = server.address;\n if (address._tag === \"UnixAddress\") {\n return yield* Effect.die(new Error(\"HttpServer.layerTestClient: UnixAddress not supported\"));\n }\n const host = address.hostname === \"0.0.0.0\" ? \"127.0.0.1\" : address.hostname;\n const url = `http://${host}:${address.port}`;\n return HttpClient.mapRequest(client, ClientRequest.prependUrl(url));\n});\n/**\n * Layer that provides the test `HttpClient` created by `makeTestClient`.\n *\n * @category testing\n * @since 4.0.0\n */\nexport const layerTestClient = /*#__PURE__*/Layer.effect(HttpClient.HttpClient)(makeTestClient);\n/**\n * Layer that provides the platform services commonly needed by HTTP\n * server tests.\n *\n * **Details**\n *\n * It includes `HttpPlatform`, `Path`, a weak ETag generator, and a no-op\n * `FileSystem`.\n *\n * @category testing\n * @since 4.0.0\n */\nexport const layerServices = /*#__PURE__*/Layer.mergeAll(HttpPlatform.layer, Path.layer, Etag.layerWeak).pipe(/*#__PURE__*/Layer.provideMerge(/*#__PURE__*/FileSystem.layerNoop({})));\n//# sourceMappingURL=HttpServer.js.map",
22
+ "/**\n * @since 1.0.0\n */\n// Taken from https://github.com/anonrig/fast-querystring under MIT License\nconst plusRegex = /\\+/g;\nconst Empty = function () {};\nEmpty.prototype = /*#__PURE__*/Object.create(null);\n/**\n * @category parsing\n * @since 1.0.0\n */\nexport function parse(input) {\n // Optimization: Use new Empty() instead of Object.create(null) for performance\n // v8 has a better optimization for initializing functions compared to Object\n const result = new Empty();\n if (typeof input !== \"string\") {\n return result;\n }\n const inputLength = input.length;\n let key = \"\";\n let value = \"\";\n let startingIndex = -1;\n let equalityIndex = -1;\n let shouldDecodeKey = false;\n let shouldDecodeValue = false;\n let keyHasPlus = false;\n let valueHasPlus = false;\n let hasBothKeyValuePair = false;\n let c = 0;\n // Have a boundary of input.length + 1 to access last pair inside the loop.\n for (let i = 0; i < inputLength + 1; i++) {\n c = i !== inputLength ? input.charCodeAt(i) : 38;\n // Handle '&' and end of line to pass the current values to result\n if (c === 38) {\n hasBothKeyValuePair = equalityIndex > startingIndex;\n // Optimization: Reuse equality index to store the end of key\n if (!hasBothKeyValuePair) {\n equalityIndex = i;\n }\n key = input.slice(startingIndex + 1, equalityIndex);\n // Add key/value pair only if the range size is greater than 1; a.k.a. contains at least \"=\"\n if (hasBothKeyValuePair || key.length > 0) {\n // Optimization: Replace '+' with space\n if (keyHasPlus) {\n key = key.replace(plusRegex, \" \");\n }\n // Optimization: Do not decode if it's not necessary.\n if (shouldDecodeKey) {\n try {\n key = decodeURIComponent(key) || key;\n } catch {}\n }\n if (hasBothKeyValuePair) {\n value = input.slice(equalityIndex + 1, i);\n if (valueHasPlus) {\n value = value.replace(plusRegex, \" \");\n }\n if (shouldDecodeValue) {\n try {\n value = decodeURIComponent(value) || value;\n } catch {}\n }\n }\n const currentValue = result[key];\n if (currentValue === undefined) {\n result[key] = value;\n } else {\n // Optimization: value.pop is faster than Array.isArray(value)\n if (currentValue.pop) {\n currentValue.push(value);\n } else {\n result[key] = [currentValue, value];\n }\n }\n }\n // Reset reading key value pairs\n value = \"\";\n startingIndex = i;\n equalityIndex = i;\n shouldDecodeKey = false;\n shouldDecodeValue = false;\n keyHasPlus = false;\n valueHasPlus = false;\n }\n // Check '='\n else if (c === 61) {\n if (equalityIndex <= startingIndex) {\n equalityIndex = i;\n }\n // If '=' character occurs again, we should decode the input.\n else {\n shouldDecodeValue = true;\n }\n }\n // Check '+', and remember to replace it with empty space.\n else if (c === 43) {\n if (equalityIndex > startingIndex) {\n valueHasPlus = true;\n } else {\n keyHasPlus = true;\n }\n }\n // Check '%' character for encoding\n else if (c === 37) {\n if (equalityIndex > startingIndex) {\n shouldDecodeValue = true;\n } else {\n shouldDecodeKey = true;\n }\n }\n }\n return result;\n}\nfunction getAsPrimitive(value) {\n const type = typeof value;\n if (type === \"string\") {\n // Length check is handled inside encodeString function\n return encodeString(value);\n } else if (type === \"bigint\" || type === \"boolean\") {\n return \"\" + value;\n } else if (type === \"number\" && Number.isFinite(value)) {\n return value < 1e21 ? \"\" + value : encodeString(\"\" + value);\n }\n return \"\";\n}\n/**\n * @category encoding\n * @since 1.0.0\n */\nexport function stringify(input) {\n let result = \"\";\n if (input === null || typeof input !== \"object\") {\n return result;\n }\n const separator = \"&\";\n const keys = Object.keys(input);\n const keyLength = keys.length;\n let valueLength = 0;\n for (let i = 0; i < keyLength; i++) {\n const key = keys[i];\n const value = input[key];\n const encodedKey = encodeString(key) + \"=\";\n if (i) {\n result += separator;\n }\n if (Array.isArray(value)) {\n valueLength = value.length;\n for (let j = 0; j < valueLength; j++) {\n if (j) {\n result += separator;\n }\n // Optimization: Dividing into multiple lines improves the performance.\n // Since v8 does not need to care about the '+' character if it was one-liner.\n result += encodedKey;\n result += getAsPrimitive(value[j]);\n }\n } else {\n result += encodedKey;\n result += getAsPrimitive(value);\n }\n }\n return result;\n}\n// -----------------------------------------------------------------------------\n// This has been taken from Node.js project.\n// Full implementation can be found from https://github.com/nodejs/node/blob/main/lib/internal/querystring.js\nconst hexTable = /*#__PURE__*/Array.from({\n length: 256\n}, (_, i) => \"%\" + ((i < 16 ? \"0\" : \"\") + i.toString(16)).toUpperCase());\n// These characters do not need escaping when generating query strings:\n// ! - . _ ~\n// ' ( ) *\n// digits\n// alpha (uppercase)\n// alpha (lowercase)\n// biome-ignore format: the array should not be formatted\nconst noEscape = /*#__PURE__*/new Int8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n// 0 - 15\n0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n// 16 - 31\n0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0,\n// 32 - 47\n1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,\n// 48 - 63\n0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n// 64 - 79\n1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,\n// 80 - 95\n0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n// 96 - 111\n1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0 // 112 - 127\n]);\nfunction encodeString(str) {\n const len = str.length;\n if (len === 0) return \"\";\n let out = \"\";\n let lastPos = 0;\n let i = 0;\n outer: for (; i < len; i++) {\n let c = str.charCodeAt(i);\n // ASCII\n while (c < 0x80) {\n if (noEscape[c] !== 1) {\n if (lastPos < i) out += str.slice(lastPos, i);\n lastPos = i + 1;\n out += hexTable[c];\n }\n if (++i === len) break outer;\n c = str.charCodeAt(i);\n }\n if (lastPos < i) out += str.slice(lastPos, i);\n // Multi-byte characters ...\n if (c < 0x800) {\n lastPos = i + 1;\n out += hexTable[0xc0 | c >> 6] + hexTable[0x80 | c & 0x3f];\n continue;\n }\n if (c < 0xd800 || c >= 0xe000) {\n lastPos = i + 1;\n out += hexTable[0xe0 | c >> 12] + hexTable[0x80 | c >> 6 & 0x3f] + hexTable[0x80 | c & 0x3f];\n continue;\n }\n // Surrogate pair\n ++i;\n // This branch should never happen because all URLSearchParams entries\n // should already be converted to USVString. But, included for\n // completion's sake anyway.\n if (i >= len) {\n throw new Error(\"URI malformed\");\n }\n const c2 = str.charCodeAt(i) & 0x3ff;\n lastPos = i + 1;\n c = 0x10000 + ((c & 0x3ff) << 10 | c2);\n out += hexTable[0xf0 | c >> 18] + hexTable[0x80 | c >> 12 & 0x3f] + hexTable[0x80 | c >> 6 & 0x3f] + hexTable[0x80 | c & 0x3f];\n }\n if (lastPos === 0) return str;\n if (lastPos < len) return out + str.slice(lastPos);\n return out;\n}\n//# sourceMappingURL=QueryString.js.map",
23
+ "import * as QS from \"../QueryString.js\";\nconst FULL_PATH_REGEXP = /^https?:\\/\\/.*?\\//;\nconst OPTIONAL_PARAM_REGEXP = /(\\/:[^/()]*?)\\?(\\/?)/;\n/** @internal */\nexport const make = (options = {}) => new RouterImpl(options);\nclass RouterImpl {\n constructor(options = {}) {\n this.options = {\n ignoreTrailingSlash: true,\n ignoreDuplicateSlashes: true,\n caseSensitive: false,\n maxParamLength: 100,\n ...options\n };\n }\n options;\n routes = [];\n trees = {};\n on(method, path, handler) {\n const optionalParamMatch = path.match(OPTIONAL_PARAM_REGEXP);\n if (optionalParamMatch && optionalParamMatch.index !== undefined) {\n assert(path.length === optionalParamMatch.index + optionalParamMatch[0].length, \"Optional Parameter needs to be the last parameter of the path\");\n const pathFull = path.replace(OPTIONAL_PARAM_REGEXP, \"$1$2\");\n const pathOptional = path.replace(OPTIONAL_PARAM_REGEXP, \"$2\");\n this.on(method, pathFull, handler);\n this.on(method, pathOptional, handler);\n return;\n }\n if (this.options.ignoreDuplicateSlashes) {\n path = removeDuplicateSlashes(path);\n }\n if (this.options.ignoreTrailingSlash) {\n path = trimLastSlash(path);\n }\n const methods = typeof method === \"string\" ? [method] : method;\n for (const method of methods) {\n this._on(method, path, handler);\n }\n }\n all(path, handler) {\n this.on(httpMethods, path, handler);\n }\n _on(method, path, handler) {\n if (this.trees[method] === undefined) {\n this.trees[method] = new StaticNode(\"/\");\n }\n let pattern = path;\n if (pattern === \"*\" && this.trees[method].prefix.length !== 0) {\n const currentRoot = this.trees[method];\n this.trees[method] = new StaticNode(\"\");\n this.trees[method].staticChildren[\"/\"] = currentRoot;\n }\n let parentNodePathIndex = this.trees[method].prefix.length;\n let currentNode = this.trees[method];\n const params = [];\n for (let i = 0; i <= pattern.length; i++) {\n if (pattern.charCodeAt(i) === 58 && pattern.charCodeAt(i + 1) === 58) {\n // It's a double colon\n i++;\n continue;\n }\n const isParametricNode = pattern.charCodeAt(i) === 58 && pattern.charCodeAt(i + 1) !== 58;\n const isWildcardNode = pattern.charCodeAt(i) === 42;\n if (isParametricNode || isWildcardNode || i === pattern.length && i !== parentNodePathIndex) {\n let staticNodePath = pattern.slice(parentNodePathIndex, i);\n if (!this.options.caseSensitive) {\n staticNodePath = staticNodePath.toLowerCase();\n }\n staticNodePath = staticNodePath.split(\"::\").join(\":\");\n staticNodePath = staticNodePath.split(\"%\").join(\"%25\");\n // add the static part of the route to the tree\n currentNode = currentNode.createStaticChild(staticNodePath);\n }\n if (isParametricNode) {\n let isRegexNode = false;\n const regexps = [];\n let lastParamStartIndex = i + 1;\n for (let j = lastParamStartIndex;; j++) {\n const charCode = pattern.charCodeAt(j);\n const isRegexParam = charCode === 40;\n const isStaticPart = charCode === 45 || charCode === 46;\n const isEndOfNode = charCode === 47 || j === pattern.length;\n if (isRegexParam || isStaticPart || isEndOfNode) {\n const paramName = pattern.slice(lastParamStartIndex, j);\n params.push(paramName);\n isRegexNode = isRegexNode || isRegexParam || isStaticPart;\n if (isRegexParam) {\n const endOfRegexIndex = getClosingParenthensePosition(pattern, j);\n const regexString = pattern.slice(j, endOfRegexIndex + 1);\n regexps.push(trimRegExpStartAndEnd(regexString));\n j = endOfRegexIndex + 1;\n } else {\n regexps.push(\"(.*?)\");\n }\n const staticPartStartIndex = j;\n for (; j < pattern.length; j++) {\n const charCode = pattern.charCodeAt(j);\n if (charCode === 47) break;\n if (charCode === 58) {\n const nextCharCode = pattern.charCodeAt(j + 1);\n if (nextCharCode === 58) j++;else break;\n }\n }\n let staticPart = pattern.slice(staticPartStartIndex, j);\n if (staticPart) {\n staticPart = staticPart.split(\"::\").join(\":\");\n staticPart = staticPart.split(\"%\").join(\"%25\");\n regexps.push(escapeRegExp(staticPart));\n }\n lastParamStartIndex = j + 1;\n if (isEndOfNode || pattern.charCodeAt(j) === 47 || j === pattern.length) {\n const nodePattern = isRegexNode ? \"()\" + staticPart : staticPart;\n const nodePath = pattern.slice(i, j);\n pattern = pattern.slice(0, i + 1) + nodePattern + pattern.slice(j);\n i += nodePattern.length;\n const regex = isRegexNode ? new RegExp(\"^\" + regexps.join(\"\") + \"$\") : undefined;\n currentNode = currentNode.createParametricChild(regex, staticPart, nodePath);\n parentNodePathIndex = i + 1;\n break;\n }\n }\n }\n } else if (isWildcardNode) {\n // add the wildcard parameter\n params.push(\"*\");\n currentNode = currentNode.createWildcardChild();\n parentNodePathIndex = i + 1;\n if (i !== pattern.length - 1) {\n throw new Error(\"Wildcard must be the last character in the route\");\n }\n }\n }\n if (!this.options.caseSensitive) {\n pattern = pattern.toLowerCase();\n }\n if (pattern === \"*\") {\n pattern = \"/*\";\n }\n for (const existRoute of this.routes) {\n if (existRoute.method === method && existRoute.pattern === pattern) {\n throw new Error(`Method '${method}' already declared for route '${pattern}'`);\n }\n }\n const route = {\n method,\n path,\n pattern,\n params,\n handler\n };\n this.routes.push(route);\n currentNode.addRoute(route);\n }\n has(method, path) {\n const node = this.trees[method];\n if (node === undefined) {\n return false;\n }\n const staticNode = node.getStaticChild(path);\n if (staticNode === undefined) {\n return false;\n }\n return staticNode.isLeafNode;\n }\n find(method, path) {\n let currentNode = this.trees[method];\n if (currentNode === undefined) return undefined;\n if (path.charCodeAt(0) !== 47) {\n // 47 is '/'\n path = path.replace(FULL_PATH_REGEXP, \"/\");\n }\n // This must be run before sanitizeUrl as the resulting function\n // .sliceParameter must be constructed with same URL string used\n // throughout the rest of this function.\n if (this.options.ignoreDuplicateSlashes) {\n path = removeDuplicateSlashes(path);\n }\n let sanitizedUrl;\n let querystring;\n let shouldDecodeParam;\n try {\n sanitizedUrl = safeDecodeURI(path);\n path = sanitizedUrl.path;\n querystring = sanitizedUrl.querystring;\n shouldDecodeParam = sanitizedUrl.shouldDecodeParam;\n } catch (error) {\n return undefined;\n }\n if (this.options.ignoreTrailingSlash) {\n path = trimLastSlash(path);\n }\n const originPath = path;\n if (this.options.caseSensitive === false) {\n path = path.toLowerCase();\n }\n const maxParamLength = this.options.maxParamLength;\n let pathIndex = currentNode.prefix.length;\n const params = [];\n const pathLen = path.length;\n const brothersNodesStack = [];\n while (true) {\n if (pathIndex === pathLen && currentNode.isLeafNode) {\n const handle = currentNode.handlerStorage?.find();\n if (handle !== undefined) {\n return {\n handler: handle.handler,\n params: handle.createParams(params),\n searchParams: QS.parse(querystring)\n };\n }\n }\n let node = currentNode.getNextNode(path, pathIndex, brothersNodesStack, params.length);\n if (node === undefined) {\n if (brothersNodesStack.length === 0) {\n return undefined;\n }\n const brotherNodeState = brothersNodesStack.pop();\n pathIndex = brotherNodeState.brotherPathIndex;\n params.splice(brotherNodeState.paramsCount);\n node = brotherNodeState.brotherNode;\n }\n currentNode = node;\n // static route\n if (currentNode._tag === \"StaticNode\") {\n pathIndex += currentNode.prefix.length;\n continue;\n }\n if (currentNode._tag === \"WildcardNode\") {\n let param = originPath.slice(pathIndex);\n if (shouldDecodeParam) {\n param = safeDecodeURIComponent(param);\n }\n params.push(param);\n pathIndex = pathLen;\n continue;\n }\n if (currentNode._tag === \"ParametricNode\") {\n let paramEndIndex = originPath.indexOf(\"/\", pathIndex);\n if (paramEndIndex === -1) {\n paramEndIndex = pathLen;\n }\n let param = originPath.slice(pathIndex, paramEndIndex);\n if (shouldDecodeParam) {\n param = safeDecodeURIComponent(param);\n }\n if (currentNode.regex !== undefined) {\n const matchedParameters = currentNode.regex.exec(param);\n if (matchedParameters === null) continue;\n for (let i = 1; i < matchedParameters.length; i++) {\n const matchedParam = matchedParameters[i];\n if (matchedParam.length > maxParamLength) {\n return undefined;\n }\n params.push(matchedParam);\n }\n } else {\n if (param.length > maxParamLength) {\n return undefined;\n }\n params.push(param);\n }\n pathIndex = paramEndIndex;\n }\n }\n }\n}\nclass HandlerStorage {\n handlers = [];\n unconstrainedHandler;\n find() {\n return this.unconstrainedHandler;\n }\n add(route) {\n const handler = {\n params: route.params,\n handler: route.handler,\n createParams: compileCreateParams(route.params)\n };\n this.handlers.push(handler);\n this.unconstrainedHandler = this.handlers[0];\n }\n}\nclass NodeBase {\n isLeafNode = false;\n routes;\n handlerStorage;\n addRoute(route) {\n if (this.routes === undefined) {\n this.routes = [route];\n } else {\n this.routes.push(route);\n }\n if (this.handlerStorage === undefined) {\n this.handlerStorage = new HandlerStorage();\n }\n this.isLeafNode = true;\n this.handlerStorage.add(route);\n }\n}\nclass ParentNode extends NodeBase {\n staticChildren = {};\n findStaticMatchingChild(path, pathIndex) {\n const staticChild = this.staticChildren[path.charAt(pathIndex)];\n if (staticChild === undefined || !staticChild.matchPrefix(path, pathIndex)) {\n return undefined;\n }\n return staticChild;\n }\n getStaticChild(path, pathIndex = 0) {\n if (path.length === pathIndex) {\n return this;\n }\n const staticChild = this.findStaticMatchingChild(path, pathIndex);\n if (staticChild === undefined) {\n return undefined;\n }\n return staticChild.getStaticChild(path, pathIndex + staticChild.prefix.length);\n }\n createStaticChild(path) {\n if (path.length === 0) {\n return this;\n }\n let staticChild = this.staticChildren[path.charAt(0)];\n if (staticChild) {\n let i = 1;\n for (; i < staticChild.prefix.length; i++) {\n if (path.charCodeAt(i) !== staticChild.prefix.charCodeAt(i)) {\n staticChild = staticChild.split(this, i);\n break;\n }\n }\n return staticChild.createStaticChild(path.slice(i));\n }\n const label = path.charAt(0);\n this.staticChildren[label] = new StaticNode(path);\n return this.staticChildren[label];\n }\n}\nclass StaticNode extends ParentNode {\n _tag = \"StaticNode\";\n constructor(prefix) {\n super();\n this.setPrefix(prefix);\n }\n prefix;\n matchPrefix;\n parametricChildren = [];\n wildcardChild;\n setPrefix(prefix) {\n this.prefix = prefix;\n if (prefix.length === 1) {\n this.matchPrefix = (_path, _pathIndex) => true;\n } else {\n const len = prefix.length;\n this.matchPrefix = function (path, pathIndex) {\n for (let i = 1; i < len; i++) {\n if (path.charCodeAt(pathIndex + i) !== this.prefix.charCodeAt(i)) {\n return false;\n }\n }\n return true;\n };\n }\n }\n getParametricChild(regex) {\n if (regex === undefined) {\n return this.parametricChildren.find(child => child.isRegex === false);\n }\n const source = regex.source;\n return this.parametricChildren.find(child => {\n if (child.regex === undefined) {\n return false;\n }\n return child.regex.source === source;\n });\n }\n createParametricChild(regex, staticSuffix, nodePath) {\n let child = this.getParametricChild(regex);\n if (child !== undefined) {\n child.nodePaths.add(nodePath);\n return child;\n }\n child = new ParametricNode(regex, staticSuffix, nodePath);\n this.parametricChildren.push(child);\n this.parametricChildren.sort((child1, child2) => {\n if (!child1.isRegex) return 1;\n if (!child2.isRegex) return -1;\n if (child1.staticSuffix === undefined) return 1;\n if (child2.staticSuffix === undefined) return -1;\n if (child2.staticSuffix.endsWith(child1.staticSuffix)) return 1;\n if (child1.staticSuffix.endsWith(child2.staticSuffix)) return -1;\n return 0;\n });\n return child;\n }\n createWildcardChild() {\n if (this.wildcardChild === undefined) {\n this.wildcardChild = new WildcardNode();\n }\n return this.wildcardChild;\n }\n split(parentNode, length) {\n const parentPrefix = this.prefix.slice(0, length);\n const childPrefix = this.prefix.slice(length);\n this.setPrefix(childPrefix);\n const staticNode = new StaticNode(parentPrefix);\n staticNode.staticChildren[childPrefix.charAt(0)] = this;\n parentNode.staticChildren[parentPrefix.charAt(0)] = staticNode;\n return staticNode;\n }\n getNextNode(path, pathIndex, nodeStack, paramsCount) {\n let node = this.findStaticMatchingChild(path, pathIndex);\n let parametricBrotherNodeIndex = 0;\n if (node === undefined) {\n if (this.parametricChildren.length === 0) {\n return this.wildcardChild;\n }\n node = this.parametricChildren[0];\n parametricBrotherNodeIndex = 1;\n }\n if (this.wildcardChild !== undefined) {\n nodeStack.push({\n paramsCount,\n brotherPathIndex: pathIndex,\n brotherNode: this.wildcardChild\n });\n }\n for (let i = this.parametricChildren.length - 1; i >= parametricBrotherNodeIndex; i--) {\n nodeStack.push({\n paramsCount,\n brotherPathIndex: pathIndex,\n brotherNode: this.parametricChildren[i]\n });\n }\n return node;\n }\n}\nclass ParametricNode extends ParentNode {\n regex;\n staticSuffix;\n _tag = \"ParametricNode\";\n constructor(regex, staticSuffix, nodePath) {\n super();\n this.regex = regex;\n this.staticSuffix = staticSuffix;\n this.isRegex = !!regex;\n this.nodePaths = new Set([nodePath]);\n }\n isRegex;\n nodePaths;\n getNextNode(path, pathIndex) {\n return this.findStaticMatchingChild(path, pathIndex);\n }\n}\nclass WildcardNode extends NodeBase {\n _tag = \"WildcardNode\";\n getNextNode(_path, _pathIndex, _nodeStack, _paramsCount) {\n return undefined;\n }\n}\nconst assert = (condition, message) => {\n if (!condition) {\n throw new Error(message);\n }\n};\nfunction removeDuplicateSlashes(path) {\n return path.replace(/\\/\\/+/g, \"/\");\n}\nfunction trimLastSlash(path) {\n if (path.length > 1 && path.charCodeAt(path.length - 1) === 47) {\n return path.slice(0, -1);\n }\n return path;\n}\nfunction compileCreateParams(params) {\n const len = params.length;\n return function (paramsArray) {\n const paramsObject = {};\n for (let i = 0; i < len; i++) {\n paramsObject[params[i]] = paramsArray[i];\n }\n return paramsObject;\n };\n}\nfunction getClosingParenthensePosition(path, idx) {\n // `path.indexOf()` will always return the first position of the closing parenthese,\n // but it's inefficient for grouped or wrong regexp expressions.\n // see issues #62 and #63 for more info\n let parentheses = 1;\n while (idx < path.length) {\n idx++;\n // ignore skipped chars\n if (path[idx] === \"\\\\\") {\n idx++;\n continue;\n }\n if (path[idx] === \")\") {\n parentheses--;\n } else if (path[idx] === \"(\") {\n parentheses++;\n }\n if (!parentheses) return idx;\n }\n throw new TypeError('Invalid regexp expression in \"' + path + '\"');\n}\nfunction trimRegExpStartAndEnd(regexString) {\n // removes chars that marks start \"^\" and end \"$\" of regexp\n if (regexString.charCodeAt(1) === 94) {\n regexString = regexString.slice(0, 1) + regexString.slice(2);\n }\n if (regexString.charCodeAt(regexString.length - 2) === 36) {\n regexString = regexString.slice(0, regexString.length - 2) + regexString.slice(regexString.length - 1);\n }\n return regexString;\n}\nfunction escapeRegExp(string) {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n// It must spot all the chars where decodeURIComponent(x) !== decodeURI(x)\n// The chars are: # $ & + , / : ; = ? @\nfunction decodeComponentChar(highCharCode, lowCharCode) {\n if (highCharCode === 50) {\n if (lowCharCode === 53) return \"%\";\n if (lowCharCode === 51) return \"#\";\n if (lowCharCode === 52) return \"$\";\n if (lowCharCode === 54) return \"&\";\n if (lowCharCode === 66) return \"+\";\n if (lowCharCode === 98) return \"+\";\n if (lowCharCode === 67) return \",\";\n if (lowCharCode === 99) return \",\";\n if (lowCharCode === 70) return \"/\";\n if (lowCharCode === 102) return \"/\";\n return undefined;\n }\n if (highCharCode === 51) {\n if (lowCharCode === 65) return \":\";\n if (lowCharCode === 97) return \":\";\n if (lowCharCode === 66) return \";\";\n if (lowCharCode === 98) return \";\";\n if (lowCharCode === 68) return \"=\";\n if (lowCharCode === 100) return \"=\";\n if (lowCharCode === 70) return \"?\";\n if (lowCharCode === 102) return \"?\";\n return undefined;\n }\n if (highCharCode === 52 && lowCharCode === 48) {\n return \"@\";\n }\n return undefined;\n}\nfunction safeDecodeURI(path) {\n let shouldDecode = false;\n let shouldDecodeParam = false;\n let querystring = \"\";\n for (let i = 1; i < path.length; i++) {\n const charCode = path.charCodeAt(i);\n if (charCode === 37) {\n const highCharCode = path.charCodeAt(i + 1);\n const lowCharCode = path.charCodeAt(i + 2);\n if (decodeComponentChar(highCharCode, lowCharCode) === undefined) {\n shouldDecode = true;\n } else {\n shouldDecodeParam = true;\n // %25 - encoded % char. We need to encode one more time to prevent double decoding\n if (highCharCode === 50 && lowCharCode === 53) {\n shouldDecode = true;\n path = path.slice(0, i + 1) + \"25\" + path.slice(i + 1);\n i += 2;\n }\n i += 2;\n }\n // Some systems do not follow RFC and separate the path and query\n // string with a `;` character (code 59), e.g. `/foo;jsessionid=123456`.\n // Thus, we need to split on `;` as well as `?` and `#`.\n } else if (charCode === 63 || charCode === 59 || charCode === 35) {\n querystring = path.slice(i + 1);\n path = path.slice(0, i);\n break;\n }\n }\n const decodedPath = shouldDecode ? decodeURI(path) : path;\n return {\n path: decodedPath,\n querystring,\n shouldDecodeParam\n };\n}\nfunction safeDecodeURIComponent(uriComponent) {\n const startIndex = uriComponent.indexOf(\"%\");\n if (startIndex === -1) return uriComponent;\n let decoded = \"\";\n let lastIndex = startIndex;\n for (let i = startIndex; i < uriComponent.length; i++) {\n if (uriComponent.charCodeAt(i) === 37) {\n const highCharCode = uriComponent.charCodeAt(i + 1);\n const lowCharCode = uriComponent.charCodeAt(i + 2);\n const decodedChar = decodeComponentChar(highCharCode, lowCharCode);\n decoded += uriComponent.slice(lastIndex, i) + decodedChar;\n lastIndex = i + 3;\n }\n }\n return uriComponent.slice(0, startIndex) + decoded + uriComponent.slice(lastIndex);\n}\nconst httpMethods = [\"ACL\", \"BIND\", \"CHECKOUT\", \"CONNECT\", \"COPY\", \"DELETE\", \"GET\", \"HEAD\", \"LINK\", \"LOCK\", \"M-SEARCH\", \"MERGE\", \"MKACTIVITY\", \"MKCALENDAR\", \"MKCOL\", \"MOVE\", \"NOTIFY\", \"OPTIONS\", \"PATCH\", \"POST\", \"PROPFIND\", \"PROPPATCH\", \"PURGE\", \"PUT\", \"REBIND\", \"REPORT\", \"SEARCH\", \"SOURCE\", \"SUBSCRIBE\", \"TRACE\", \"UNBIND\", \"UNLINK\", \"UNLOCK\", \"UNSUBSCRIBE\"];\n//# sourceMappingURL=router.js.map",
24
+ "/**\n * @since 1.0.0\n */\nimport * as internal from \"./internal/router.js\";\n/**\n * @since 1.0.0\n * @category constructors\n */\nexport const make = internal.make;\n//# sourceMappingURL=index.js.map",
25
+ "/**\n * Protocol for values that can render themselves as HTTP server responses.\n *\n * This module lets server-side domain errors, HTTP API errors, and helper\n * values describe the response they should send to a client. Implement\n * `Respondable` when a value should choose its own status, headers, cookies, or\n * body during route error handling without forcing every call site to construct\n * an `HttpServerResponse` directly.\n *\n * **Mental model**\n *\n * A respondable value owns the last step from domain-level information to an\n * `HttpServerResponse`. Server error handling can ask the value for a response,\n * while unknown failures still go through a caller-provided fallback response.\n * Existing `HttpServerResponse` values are already respondable for conversion\n * purposes and are returned directly.\n *\n * **Common tasks**\n *\n * Use `toResponse` when the value is known to implement the protocol and\n * conversion failures should become defects. Use `toResponseOrElse` when\n * handling unknown failures from route effects and a fallback response should be\n * used when no conversion is available. Use `toResponseOrElseDefect` for defect\n * recovery, where only explicit response-like values receive special handling.\n *\n * **Gotchas**\n *\n * Fallback conversion is intentionally conservative. Schema errors become `400`\n * responses, no-such-element errors become `404` responses, and other values use\n * the supplied fallback. The fallback helpers also catch failures raised while\n * running a respondable conversion; `toResponse` does not.\n *\n * @since 4.0.0\n */\nimport * as Cause from \"../../Cause.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Response from \"./HttpServerResponse.js\";\n/**\n * Protocol key used by values that can render themselves as\n * `HttpServerResponse` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const symbol = \"~effect/http/HttpServerRespondable\";\n/**\n * Returns `true` when the supplied value implements the `Respondable` protocol.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isRespondable = u => hasProperty(u, symbol);\nconst badRequest = /*#__PURE__*/Response.empty({\n status: 400\n});\nconst notFound = /*#__PURE__*/Response.empty({\n status: 404\n});\n/**\n * Converts a `Respondable` value into an `HttpServerResponse`.\n *\n * **Details**\n *\n * If the value is already an HTTP server response it is returned directly; errors\n * from the response conversion are converted to defects.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const toResponse = self => {\n if (Response.isHttpServerResponse(self)) {\n return Effect.succeed(self);\n }\n return Effect.orDie(self[symbol]());\n};\n/**\n * Attempts to convert an unknown value into an `HttpServerResponse`, falling back\n * to the supplied response when no conversion is available.\n *\n * **Details**\n *\n * `HttpServerResponse` and `Respondable` values are used directly, schema errors\n * become `400` responses, and no-such-element errors become `404` responses.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const toResponseOrElse = (u, orElse) => {\n if (Response.isHttpServerResponse(u)) {\n return Effect.succeed(u);\n } else if (isRespondable(u)) {\n return Effect.catchCause(u[symbol](), () => Effect.succeed(orElse));\n // add support for some commmon types\n } else if (Schema.isSchemaError(u)) {\n return Effect.succeed(badRequest);\n } else if (Cause.isNoSuchElementError(u)) {\n return Effect.succeed(notFound);\n }\n return Effect.succeed(orElse);\n};\n/**\n * Attempts to convert an unknown defect into an `HttpServerResponse`, falling\n * back to the supplied response when no conversion is available.\n *\n * **Details**\n *\n * Only `HttpServerResponse` and `Respondable` values receive special handling.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const toResponseOrElseDefect = (u, orElse) => {\n if (Response.isHttpServerResponse(u)) {\n return Effect.succeed(u);\n } else if (isRespondable(u)) {\n return Effect.catchCause(u[symbol](), () => Effect.succeed(orElse));\n }\n return Effect.succeed(orElse);\n};\n//# sourceMappingURL=HttpServerRespondable.js.map",
26
+ "/**\n * Error model used by the unstable HTTP server runtime.\n *\n * This module defines the tagged failures that can occur while a server accepts\n * a request, matches a route, runs a handler, or builds and sends a response.\n * Request-scoped failures keep the request that caused them, and response\n * failures keep the response that was being produced, so applications can log,\n * report, or translate failures without reconstructing HTTP context.\n *\n * **Mental model**\n *\n * {@link HttpServerError} wraps a concrete {@link HttpServerErrorReason}.\n * {@link RequestParseError}, {@link RouteNotFound}, and {@link InternalError}\n * describe failures before or during request handling, while\n * {@link ResponseError} describes a failure tied to a response that was already\n * being built or sent. {@link ServeError} represents lower-level server\n * implementation failures outside an individual handler response.\n *\n * **Common tasks**\n *\n * Use {@link isHttpServerError} to refine unknown failures, inspect `request`\n * and `response` when reporting failures, and use {@link causeResponse} or\n * {@link exitResponse} when a handler cause or exit must be translated into the\n * HTTP response sent to the client.\n *\n * **Gotchas**\n *\n * The default response mapping is intentionally small: request parse errors\n * become `400`, route misses become ignored `404` failures, internal and\n * response errors become `500`, client aborts marked with {@link ClientAbort}\n * become `499`, and server-side interrupts become `503`. A\n * {@link ResponseError} does not reuse the failed response when converted; it\n * produces an empty `500` because that response may be invalid or partly sent.\n *\n * @since 4.0.0\n */\nimport * as Cause from \"../../Cause.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Data from \"../../Data.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as ErrorReporter from \"../../ErrorReporter.js\";\nimport { constUndefined } from \"../../Function.js\";\nimport * as Option from \"../../Option.js\";\nimport { hasProperty } from \"../../Predicate.js\";\nimport * as Respondable from \"./HttpServerRespondable.js\";\nimport * as Response from \"./HttpServerResponse.js\";\nconst TypeId = \"~effect/http/HttpServerError\";\n/**\n * Tagged error for failures that occur while handling an HTTP server request.\n *\n * **Details**\n *\n * It wraps a `HttpServerErrorReason`, exposes the associated request and optional\n * response, and can be converted to an HTTP response through the `Respondable`\n * protocol.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class HttpServerError extends /*#__PURE__*/Data.TaggedError(\"HttpServerError\") {\n constructor(props) {\n if (\"cause\" in props.reason) {\n super({\n ...props,\n cause: props.reason.cause\n });\n } else {\n super(props);\n }\n }\n [TypeId] = TypeId;\n stack = `${this.name}: ${this.message}`;\n get request() {\n return this.reason.request;\n }\n get response() {\n return \"response\" in this.reason ? this.reason.response : undefined;\n }\n [Respondable.symbol]() {\n return this.reason[Respondable.symbol]();\n }\n get [ErrorReporter.ignore]() {\n return this.reason[ErrorReporter.ignore] ?? false;\n }\n get message() {\n return this.reason.message;\n }\n}\n/**\n * Error describing a failure to parse or read an incoming request.\n *\n * **Details**\n *\n * When converted to a response it produces an empty `400` response.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class RequestParseError extends /*#__PURE__*/Data.TaggedError(\"RequestParseError\") {\n /**\n * Converts the request error into a `400 Bad Request` response.\n *\n * @since 4.0.0\n */\n [Respondable.symbol]() {\n return Effect.succeed(Response.empty({\n status: 400\n }));\n }\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n get message() {\n return formatRequestMessage(this._tag, this.description, this.methodAndUrl);\n }\n}\n/**\n * Error indicating that no route matched the incoming request.\n *\n * **Details**\n *\n * When converted to a response it produces an empty `404` response, and it is\n * ignored by the error reporter.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class RouteNotFound extends /*#__PURE__*/Data.TaggedError(\"RouteNotFound\") {\n [Respondable.symbol]() {\n return Effect.succeed(Response.empty({\n status: 404\n }));\n }\n [ErrorReporter.ignore] = true;\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n get message() {\n return formatRequestMessage(this._tag, this.description, this.methodAndUrl);\n }\n}\n/**\n * Error describing an unexpected server-side failure while handling a request.\n *\n * **Details**\n *\n * When converted to a response it produces an empty `500` response.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class InternalError extends /*#__PURE__*/Data.TaggedError(\"InternalError\") {\n /**\n * Converts the server error into a `500 Internal Server Error` response.\n *\n * @since 4.0.0\n */\n [Respondable.symbol]() {\n return Effect.succeed(Response.empty({\n status: 500\n }));\n }\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n get message() {\n return formatRequestMessage(this._tag, this.description, this.methodAndUrl);\n }\n}\n/**\n * Returns `true` when the supplied value is an `HttpServerError`.\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const isHttpServerError = u => hasProperty(u, TypeId);\n/**\n * Error describing a failure related to an HTTP response.\n *\n * **Details**\n *\n * It carries the request and response involved in the failure. When converted to\n * a response it produces an empty `500` response.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class ResponseError extends /*#__PURE__*/Data.TaggedError(\"ResponseError\") {\n [Respondable.symbol]() {\n return Effect.succeed(Response.empty({\n status: 500\n }));\n }\n get methodAndUrl() {\n return `${this.request.method} ${this.request.url}`;\n }\n get message() {\n const info = `${this._tag} (${this.response.status} ${this.methodAndUrl})`;\n return this.description ? `${info}: ${this.description}` : info;\n }\n}\n/**\n * Error wrapping a low-level failure from the HTTP server implementation.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class ServeError extends /*#__PURE__*/Data.TaggedError(\"ServeError\") {}\n/**\n * Context annotation used to mark an interrupt as caused by the client aborting\n * the request.\n *\n * **Details**\n *\n * `causeResponse` uses this annotation to map a pure client abort to a `499`\n * response instead of a server abort response.\n *\n * @category annotations\n * @since 4.0.0\n */\nexport class ClientAbort extends /*#__PURE__*/Context.Service()(\"effect/http/HttpServerError/ClientAbort\") {\n static annotation = /*#__PURE__*/this.context(true).pipe(/*#__PURE__*/Context.add(Cause.StackTrace, {\n name: \"ClientAbort\",\n stack: constUndefined,\n parent: undefined\n }));\n}\nconst formatRequestMessage = (reason, description, info) => {\n const prefix = `${reason} (${info})`;\n return description ? `${prefix}: ${description}` : prefix;\n};\n/**\n * Converts a failed handler cause into the HTTP response that should be sent and\n * the cause that should be reported.\n *\n * **Details**\n *\n * Respondable failures and defects can choose their own response, defects that\n * are already `HttpServerResponse` values are used directly, and pure interrupts\n * produce either `499` for client aborts or `503` for server aborts.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const causeResponse = cause => {\n let response;\n let effect = succeedInternalServerError;\n const failures = [];\n let interrupts = [];\n let isClientInterrupt = false;\n for (let i = 0; i < cause.reasons.length; i++) {\n const reason = cause.reasons[i];\n switch (reason._tag) {\n case \"Fail\":\n {\n effect = Respondable.toResponseOrElse(reason.error, internalServerError);\n failures.push(reason);\n break;\n }\n case \"Die\":\n {\n if (Response.isHttpServerResponse(reason.defect)) {\n response = reason.defect;\n } else {\n effect = Respondable.toResponseOrElseDefect(reason.defect, internalServerError);\n failures.push(reason);\n }\n break;\n }\n case \"Interrupt\":\n {\n isClientInterrupt = reason.annotations.has(ClientAbort.key);\n if (failures.length > 0) break;\n interrupts.push(reason);\n break;\n }\n }\n }\n if (response) {\n return Effect.succeed([response, Cause.fromReasons(failures)]);\n } else if (interrupts.length > 0 && failures.length === 0) {\n failures.push(...interrupts);\n effect = isClientInterrupt ? clientAbortError : serverAbortError;\n }\n return Effect.mapEager(effect, response => {\n failures.push(Cause.makeDieReason(response));\n return [response, Cause.fromReasons(failures)];\n });\n};\n/**\n * Derives an HTTP response from a failed handler cause synchronously.\n *\n * **Details**\n *\n * If the cause contains a defect that is already an `HttpServerResponse`, that\n * response is used and removed from the remaining cause. Otherwise the response\n * defaults to `500`.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const causeResponseStripped = cause => {\n let response;\n const failures = cause.reasons.filter(f => {\n if (f._tag === \"Die\" && Response.isHttpServerResponse(f.defect)) {\n response = f.defect;\n return false;\n }\n return true;\n });\n return [response ?? internalServerError, failures.length > 0 ? Option.some(Cause.fromReasons(failures)) : Option.none()];\n};\nconst internalServerError = /*#__PURE__*/Response.empty({\n status: 500\n});\nconst succeedInternalServerError = /*#__PURE__*/Effect.succeed(internalServerError);\nconst clientAbortError = /*#__PURE__*/Effect.succeed(/*#__PURE__*/Response.empty({\n status: 499\n}));\nconst serverAbortError = /*#__PURE__*/Effect.succeed(/*#__PURE__*/Response.empty({\n status: 503\n}));\n/**\n * Extracts the response from a successful handler exit, or derives a response\n * from the failure cause.\n *\n * @category error handling\n * @since 4.0.0\n */\nexport const exitResponse = exit => {\n if (exit._tag === \"Success\") {\n return exit.value;\n }\n return causeResponseStripped(exit.cause)[0];\n};\n//# sourceMappingURL=HttpServerError.js.map",
27
+ "import * as Channel from \"../../Channel.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Deferred from \"../../Deferred.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Exit from \"../../Exit.js\";\nimport * as FiberSet from \"../../FiberSet.js\";\nimport { constVoid, dual, flow } from \"../../Function.js\";\nimport * as Latch from \"../../Latch.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Pull from \"../../Pull.js\";\nimport * as Queue from \"../../Queue.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Scope from \"../../Scope.js\";\n/**\n * Runtime type identifier attached to `Socket` services.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/socket/Socket\";\n/**\n * Returns `true` when a value is a `Socket`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isSocket = u => Predicate.hasProperty(u, TypeId);\n/**\n * Service tag for bidirectional socket transports.\n *\n * **When to use**\n *\n * Use to access or provide the socket implementation used by programs that\n * read and write frames through the Effect environment.\n *\n * @category services\n * @since 4.0.0\n */\nexport const Socket = /*#__PURE__*/Context.Service(\"effect/socket/Socket\");\n/**\n * Constructs a `Socket` from a raw read loop and scoped writer, deriving binary\n * and string read loops when they are not provided.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = options => Socket.of({\n [TypeId]: TypeId,\n runRaw: options.runRaw,\n run: options.run ?? ((handler, opts) => options.runRaw(data => typeof data === \"string\" ? handler(encoder.encode(data)) : data instanceof Uint8Array ? handler(data) : handler(new Uint8Array(data)), opts)),\n runString: options.runString ?? (options.run ? (handler, opts) => options.run(data => handler(decoder.decode(data)), opts) : (handler, opts) => options.runRaw(data => typeof data === \"string\" ? handler(data) : data instanceof Uint8Array ? handler(decoder.decode(data)) : handler(decoder.decode(new Uint8Array(data))), opts)),\n writer: options.writer\n});\nconst encoder = /*#__PURE__*/new TextEncoder();\nconst decoder = /*#__PURE__*/new TextDecoder();\nconst CloseEventTypeId = \"~effect/socket/Socket/CloseEvent\";\n/**\n * Represents a socket close event value carrying a close code and optional\n * reason.\n *\n * @category models\n * @since 4.0.0\n */\nexport class CloseEvent {\n /**\n * Marks this value as a socket close event for runtime guards.\n *\n * @since 4.0.0\n */\n [CloseEventTypeId];\n code;\n reason;\n constructor(code = 1000, reason) {\n this[CloseEventTypeId] = CloseEventTypeId;\n this.code = code;\n this.reason = reason;\n }\n /**\n * Formats the close code and optional reason for display.\n *\n * @since 4.0.0\n */\n toString() {\n return this.reason ? `${this.code}: ${this.reason}` : `${this.code}`;\n }\n}\n/**\n * Returns `true` when a value is a `CloseEvent`.\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isCloseEvent = u => Predicate.hasProperty(u, CloseEventTypeId);\n/**\n * Runtime type identifier attached to `SocketError` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const SocketErrorTypeId = \"~effect/socket/Socket/SocketError\";\n/**\n * Returns `true` when a value is a `SocketError`.\n *\n * @category refinements\n * @since 4.0.0\n */\nexport const isSocketError = u => Predicate.hasProperty(u, SocketErrorTypeId);\n/**\n * Typed error for failures that occur while reading from a socket.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketReadError extends /*#__PURE__*/Schema.ErrorClass(\"effect/socket/Socket/SocketReadError\")({\n _tag: /*#__PURE__*/Schema.tag(\"SocketReadError\"),\n cause: Schema.Defect\n}) {\n /**\n * Default message used for socket read failures.\n *\n * @since 4.0.0\n */\n message = `An error occurred during Read`;\n}\n/**\n * Typed error for failures that occur while writing to a socket.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketWriteError extends /*#__PURE__*/Schema.ErrorClass(\"effect/socket/Socket/SocketWriteError\")({\n _tag: /*#__PURE__*/Schema.tag(\"SocketWriteError\"),\n cause: Schema.Defect\n}) {\n /**\n * Default message used for socket write failures.\n *\n * @since 4.0.0\n */\n message = `An error occurred during Write`;\n}\n/**\n * Typed error for failures that occur while opening a socket, including\n * unknown open failures and open timeouts.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketOpenError extends /*#__PURE__*/Schema.ErrorClass(\"effect/socket/Socket/SocketOpenError\")({\n _tag: /*#__PURE__*/Schema.tag(\"SocketOpenError\"),\n kind: /*#__PURE__*/Schema.Literals([\"Unknown\", \"Timeout\"]),\n cause: Schema.Defect\n}) {\n /**\n * Formats timeout and unknown open failures for display.\n *\n * @since 4.0.0\n */\n get message() {\n return this.kind === \"Timeout\" ? `timeout waiting for \"open\"` : `An error occurred during Open`;\n }\n}\n/**\n * Typed error for a socket close event, carrying the close code and optional\n * close reason.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketCloseError extends /*#__PURE__*/Schema.ErrorClass(\"effect/socket/Socket/SocketCloseError\")({\n _tag: /*#__PURE__*/Schema.tag(\"SocketCloseError\"),\n code: Schema.Number,\n closeReason: /*#__PURE__*/Schema.optional(Schema.String)\n}) {\n /**\n * Separates clean socket close errors from errors that should remain failures.\n *\n * @since 4.0.0\n */\n static filterClean(isClean) {\n return function (u) {\n return SocketError.is(u) && u.reason._tag === \"SocketCloseError\" && isClean(u.reason.code) ? Result.succeed(u.reason) : Result.fail(u);\n };\n }\n get message() {\n if (this.closeReason) {\n return `${this.code}: ${this.closeReason}`;\n }\n return `${this.code}`;\n }\n}\n/**\n * Schema for all socket-specific error reasons.\n *\n * @category errors\n * @since 4.0.0\n */\nexport const SocketErrorReason = /*#__PURE__*/Schema.Union([SocketReadError, SocketWriteError, SocketOpenError, SocketCloseError]);\n/**\n * Tagged error that wraps socket read, write, open, and close failures while\n * preserving the underlying reason.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class SocketError extends /*#__PURE__*/Schema.TaggedErrorClass(SocketErrorTypeId)(\"SocketError\", {\n _tag: /*#__PURE__*/Schema.tag(\"SocketError\"),\n reason: SocketErrorReason\n}) {\n // @effect-diagnostics-next-line overriddenSchemaConstructor:off\n constructor(props) {\n if (\"cause\" in props.reason) {\n super({\n ...props,\n cause: props.reason.cause\n });\n } else {\n super(props);\n }\n }\n /**\n * Marks this value as a socket error wrapper for runtime guards.\n *\n * @since 4.0.0\n */\n [SocketErrorTypeId] = SocketErrorTypeId;\n /**\n * Returns `true` when the value is a `SocketError`.\n *\n * @since 4.0.0\n */\n static is(u) {\n return isSocketError(u);\n }\n message = this.reason.message;\n}\n/**\n * Converts a `Socket` into a bidirectional `Channel`, mapping incoming string\n * or binary frames and writing outgoing frame batches to the socket.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toChannelMap = (self, f) => Channel.fromTransform(Effect.fnUntraced(function* (upstream, scope) {\n const queue = yield* Queue.make();\n const writeScope = yield* Scope.fork(scope);\n const write = yield* Scope.provide(self.writer, writeScope);\n let chunk;\n let index = 0;\n const writeChunk = Effect.whileLoop({\n while: () => index < chunk.length,\n body: () => write(chunk[index++]),\n step: constVoid\n });\n yield* upstream.pipe(Effect.flatMap(arr => {\n if (arr.length === 1) return write(arr[0]);\n chunk = arr;\n index = 0;\n return writeChunk;\n }), Effect.forever({\n disableYield: true\n }), Effect.catchCauseFilter(Pull.filterNoDone, cause => Queue.failCause(queue, cause)), Effect.ensuring(Scope.close(writeScope, Exit.void)), Effect.forkIn(scope));\n yield* self.runRaw(data => {\n Queue.offerUnsafe(queue, f(data));\n }).pipe(Queue.into(queue), Effect.forkIn(scope));\n // @effect-diagnostics-next-line returnEffectInGen:off\n return Queue.takeAll(queue);\n}));\n/**\n * Converts a `Socket` into a binary `Channel`, encoding incoming string frames\n * as UTF-8 bytes.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toChannel = self => {\n const encoder = new TextEncoder();\n return toChannelMap(self, data => typeof data === \"string\" ? encoder.encode(data) : data);\n};\n/**\n * Converts a `Socket` into a string `Channel`, decoding binary frames with the\n * optional text encoding.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toChannelString = /*#__PURE__*/dual(args => isSocket(args[0]), (self, encoding) => {\n const decoder = new TextDecoder(encoding);\n return toChannelMap(self, data => typeof data === \"string\" ? data : decoder.decode(data));\n});\n/**\n * Creates a `Socket` to binary `Channel` adapter with a fixed upstream error\n * type.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toChannelWith = () => self => toChannel(self);\n/**\n * Creates a binary socket `Channel` from the `Socket` service in the\n * environment.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeChannel = () => Channel.unwrap(Effect.map(Socket, toChannelWith()));\n/**\n * Default close-code classifier that treats every socket close code as an\n * error.\n *\n * @category predicates\n * @since 4.0.0\n */\nexport const defaultCloseCodeIsError = _code => true;\n/**\n * Context service for the active `WebSocket` instance available while a\n * WebSocket-backed socket run is handling events.\n *\n * @category services\n * @since 4.0.0\n */\nexport class WebSocket extends /*#__PURE__*/Context.Service()(\"~effect/socket/Socket/WebSocket\") {}\n/**\n * Context service for constructing `WebSocket` instances from a URL and\n * optional protocols.\n *\n * @category services\n * @since 4.0.0\n */\nexport class WebSocketConstructor extends /*#__PURE__*/Context.Service()(\"@effect/platform/Socket/WebSocketConstructor\") {}\n/**\n * Layer that provides `WebSocketConstructor` using `globalThis.WebSocket`.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWebSocketConstructorGlobal = /*#__PURE__*/Layer.succeed(WebSocketConstructor)((url, protocols) => new globalThis.WebSocket(url, protocols));\n/**\n * Creates a `Socket` backed by a `WebSocketConstructor`, acquiring the\n * WebSocket for each run and using the close-code classifier to decide which\n * closes fail the run.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeWebSocket = (url, options) => WebSocketConstructor.use(makeWs => fromWebSocket(Effect.acquireRelease((typeof url === \"string\" ? Effect.succeed(url) : url).pipe(Effect.map(url => makeWs(url, options?.protocols))), ws => Effect.sync(() => ws.close(1000))), options));\n/**\n * Builds a `Socket` from a scoped WebSocket acquisition effect, waiting for the\n * socket to open, dispatching message handlers in fibers, and translating\n * open, read, and close events into `SocketError` values.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromWebSocket = (acquire, options) => Effect.withFiber(fiber => {\n let currentWS;\n const latch = Latch.makeUnsafe(false);\n const acquireContext = fiber.context;\n const closeCodeIsError = options?.closeCodeIsError ?? defaultCloseCodeIsError;\n const runRaw = (handler, opts) => Effect.scopedWith(Effect.fnUntraced(function* (scope) {\n const fiberSet = yield* FiberSet.make().pipe(Scope.provide(scope));\n const ws = yield* Scope.provide(acquire, scope);\n const run = yield* Effect.provideService(FiberSet.runtime(fiberSet)(), WebSocket, ws);\n let open = false;\n function onMessage(event) {\n if (event.data instanceof Blob) {\n const effect = Effect.flatMap(Effect.promise(() => event.data.arrayBuffer()), buffer => {\n const result = handler(new Uint8Array(buffer));\n return Effect.isEffect(result) ? result : Effect.void;\n });\n return run(effect);\n }\n const result = handler(event.data);\n if (Effect.isEffect(result)) {\n run(result);\n }\n }\n function onError(cause) {\n ws.removeEventListener(\"message\", onMessage);\n ws.removeEventListener(\"close\", onClose);\n Deferred.doneUnsafe(fiberSet.deferred, Effect.fail(new SocketError({\n reason: open ? new SocketReadError({\n cause\n }) : new SocketOpenError({\n kind: \"Unknown\",\n cause\n })\n })));\n }\n function onClose(event) {\n const code = typeof event.code === \"number\" ? event.code : 1001;\n ws.removeEventListener(\"message\", onMessage);\n ws.removeEventListener(\"error\", onError);\n Deferred.doneUnsafe(fiberSet.deferred, Effect.fail(new SocketError({\n reason: new SocketCloseError({\n code,\n closeReason: event.reason\n })\n })));\n }\n ws.addEventListener(\"close\", onClose, {\n once: true\n });\n ws.addEventListener(\"error\", onError, {\n once: true\n });\n ws.addEventListener(\"message\", onMessage);\n if (ws.readyState !== 1) {\n const openDeferred = Deferred.makeUnsafe();\n ws.addEventListener(\"open\", () => {\n open = true;\n Deferred.doneUnsafe(openDeferred, Effect.void);\n }, {\n once: true\n });\n yield* Deferred.await(openDeferred).pipe(Effect.timeoutOrElse({\n duration: options?.openTimeout ?? 10000,\n orElse: () => Effect.fail(new SocketError({\n reason: new SocketOpenError({\n kind: \"Timeout\",\n cause: new Error(\"timeout waiting for \\\"open\\\"\")\n })\n }))\n }), Effect.raceFirst(FiberSet.join(fiberSet)));\n }\n open = true;\n currentWS = ws;\n latch.openUnsafe();\n if (opts?.onOpen) yield* opts.onOpen;\n return yield* Effect.catchFilter(FiberSet.join(fiberSet), SocketCloseError.filterClean(_ => !closeCodeIsError(_)), () => Effect.void);\n })).pipe(Effect.updateContext(input => Context.merge(acquireContext, input)), Effect.ensuring(Effect.sync(() => {\n latch.closeUnsafe();\n currentWS = undefined;\n })));\n const write = chunk => latch.whenOpen(Effect.sync(() => {\n const ws = currentWS;\n if (isCloseEvent(chunk)) {\n ws.close(chunk.code, chunk.reason);\n } else {\n ws.send(chunk);\n }\n }));\n const writer = Effect.succeed(write);\n return Effect.succeed(make({\n runRaw,\n writer\n }));\n});\n/**\n * Creates a binary `Channel` backed by a WebSocket URL, requiring a\n * `WebSocketConstructor` service.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeWebSocketChannel = (url, options) => Channel.unwrap(Effect.map(makeWebSocket(url, options), toChannelWith()));\n/**\n * Layer that provides a `Socket` service backed by a WebSocket URL or URL\n * effect.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWebSocket = /*#__PURE__*/flow(makeWebSocket, /*#__PURE__*/Layer.effect(Socket));\n/**\n * Context reference for socket send queue capacity, defaulting to `16`.\n *\n * @category fiber refs\n * @since 4.0.0\n */\nexport const SendQueueCapacity = /*#__PURE__*/Context.Reference(\"~effect/socket/Socket/SendQueueCapacity\", {\n defaultValue: () => 16\n});\n/**\n * Builds a `Socket` from a scoped `InputTransformStream`, reading incoming\n * chunks through socket handlers and writing outgoing chunks to the writable\n * stream, encoding strings as UTF-8 and using close-code classification for\n * `CloseEvent` values.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const fromTransformStream = (acquire, options) => Effect.withFiber(fiber => {\n const latch = Latch.makeUnsafe(false);\n let currentStream;\n const acquireServices = fiber.context;\n const closeCodeIsError = options?.closeCodeIsError ?? defaultCloseCodeIsError;\n const runRaw = (handler, opts) => Effect.scopedWith(Effect.fnUntraced(function* (scope) {\n const stream = yield* Scope.provide(acquire, scope);\n const reader = stream.readable.getReader();\n yield* Scope.addFinalizer(scope, Effect.promise(() => reader.cancel()));\n const fiberSet = yield* FiberSet.make().pipe(Scope.provide(scope));\n const runFork = yield* FiberSet.runtime(fiberSet)();\n yield* Effect.tryPromise({\n try: async () => {\n while (true) {\n const {\n done,\n value\n } = await reader.read();\n if (done) {\n throw new SocketError({\n reason: new SocketCloseError({\n code: 1000\n })\n });\n }\n const result = handler(value);\n if (Effect.isEffect(result)) {\n runFork(result);\n }\n }\n },\n catch: cause => isSocketError(cause) ? cause : new SocketError({\n reason: new SocketReadError({\n cause\n })\n })\n }).pipe(FiberSet.run(fiberSet));\n currentStream = {\n stream,\n fiberSet\n };\n yield* latch.open;\n if (opts?.onOpen) yield* opts.onOpen;\n return yield* Effect.catchFilter(FiberSet.join(fiberSet), SocketCloseError.filterClean(_ => !closeCodeIsError(_)), () => Effect.void);\n })).pipe(_ => _, Effect.updateContext(input => Context.merge(acquireServices, input)), Effect.ensuring(Effect.sync(() => {\n latch.closeUnsafe();\n currentStream = undefined;\n })));\n const writers = new WeakMap();\n const getWriter = stream => {\n let writer = writers.get(stream);\n if (!writer) {\n writer = stream.writable.getWriter();\n writers.set(stream, writer);\n }\n return writer;\n };\n const write = chunk => latch.whenOpen(Effect.suspend(() => {\n const {\n fiberSet,\n stream\n } = currentStream;\n if (isCloseEvent(chunk)) {\n return Deferred.fail(fiberSet.deferred, new SocketError({\n reason: new SocketCloseError({\n code: chunk.code,\n closeReason: chunk.reason\n })\n }));\n }\n return Effect.promise(() => getWriter(stream).write(typeof chunk === \"string\" ? encoder.encode(chunk) : chunk));\n }));\n const writer = Effect.acquireRelease(Effect.succeed(write), () => Effect.promise(async () => {\n if (!currentStream) return;\n await getWriter(currentStream.stream).close();\n }));\n return Effect.succeed(make({\n runRaw,\n writer\n }));\n});\n//# sourceMappingURL=Socket.js.map",
28
+ "// taken from https://github.com/fastify/fast-content-type-parse\n// under the MIT license\n/**\n * RegExp to match *( \";\" parameter ) in RFC 7231 sec 3.1.1.1\n *\n * parameter = token \"=\" ( token / quoted-string )\n * token = 1*tchar\n * tchar = \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" / \"*\"\n * / \"+\" / \"-\" / \".\" / \"^\" / \"_\" / \"`\" / \"|\" / \"~\"\n * / DIGIT / ALPHA\n * ; any VCHAR, except delimiters\n * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE\n * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text\n * obs-text = %x80-FF\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n */\nconst paramRE = /; *([!#$%&'*+.^\\w`|~-]+)=(\"(?:[\\v\\u0020\\u0021\\u0023-\\u005b\\u005d-\\u007e\\u0080-\\u00ff]|\\\\[\\v\\u0020-\\u00ff])*\"|[!#$%&'*+.^\\w`|~-]+) */gu;\n/**\n * RegExp to match quoted-pair in RFC 7230 sec 3.2.6\n *\n * quoted-pair = \"\\\" ( HTAB / SP / VCHAR / obs-text )\n * obs-text = %x80-FF\n */\nconst quotedPairRE = /\\\\([\\v\\u0020-\\u00ff])/gu;\n/**\n * RegExp to match type in RFC 7231 sec 3.1.1.1\n *\n * media-type = type \"/\" subtype\n * type = token\n * subtype = token\n */\nconst mediaTypeRE = /^[!#$%&'*+.^\\w|~-]+\\/[!#$%&'*+.^\\w|~-]+$/u;\nconst mediaTypeRENoSlash = /^[!#$%&'*+.^\\w|~-]+$/u;\n// default ContentType to prevent repeated object creation\nconst defaultContentType = {\n value: \"\",\n parameters: /*#__PURE__*/Object.create(null)\n};\nexport function parse(header, withoutSlash = false) {\n if (typeof header !== \"string\") {\n return defaultContentType;\n }\n let index = header.indexOf(\";\");\n const type = index !== -1 ? header.slice(0, index).trim() : header.trim();\n const mediaRE = withoutSlash ? mediaTypeRENoSlash : mediaTypeRE;\n if (mediaRE.test(type) === false) {\n return defaultContentType;\n }\n const result = {\n value: type.toLowerCase(),\n parameters: Object.create(null)\n };\n // parse parameters\n if (index === -1) {\n return result;\n }\n let key;\n let match;\n let value;\n paramRE.lastIndex = index;\n while (match = paramRE.exec(header)) {\n if (match.index !== index) {\n return defaultContentType;\n }\n index += match[0].length;\n key = match[1].toLowerCase();\n value = match[2];\n if (value[0] === '\"') {\n // remove quotes and escapes\n value = value.slice(1, value.length - 1);\n !withoutSlash && quotedPairRE.test(value) && (value = value.replace(quotedPairRE, \"$1\"));\n }\n result.parameters[key] = value;\n }\n if (index !== header.length) {\n return defaultContentType;\n }\n return result;\n}\n//# sourceMappingURL=contentType.js.map",
29
+ "const constMaxPairs = 100;\nconst constMaxSize = 16 * 1024;\nvar State;\n(function (State) {\n State[State[\"key\"] = 0] = \"key\";\n State[State[\"whitespace\"] = 1] = \"whitespace\";\n State[State[\"value\"] = 2] = \"value\";\n})(State || (State = {}));\nconst constContinue = {\n _tag: \"Continue\"\n};\nconst constNameChars = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 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const decoder = new TextDecoder();\n const state = {\n state: State.key,\n headers: Object.create(null),\n key: \"\",\n value: undefined,\n crlf: 0,\n previousChunk: undefined,\n pairs: 0,\n size: 0\n };\n function reset(value) {\n state.state = State.key;\n state.headers = Object.create(null);\n state.key = \"\";\n state.value = undefined;\n state.crlf = 0;\n state.previousChunk = undefined;\n state.pairs = 0;\n state.size = 0;\n return value;\n }\n function concatUint8Array(a, b) {\n const newUint8Array = new Uint8Array(a.length + b.length);\n newUint8Array.set(a);\n newUint8Array.set(b, a.length);\n return newUint8Array;\n }\n function error(reason) {\n return reset({\n _tag: \"Failure\",\n reason,\n headers: state.headers\n });\n }\n return function write(chunk, start) {\n let endOffset = 0;\n let previousCursor;\n if (state.previousChunk !== undefined) {\n endOffset = state.previousChunk.length;\n previousCursor = endOffset;\n const newChunk = new Uint8Array(chunk.length + endOffset);\n newChunk.set(state.previousChunk);\n newChunk.set(chunk, endOffset);\n state.previousChunk = undefined;\n chunk = newChunk;\n }\n const end = chunk.length;\n outer: while (start < end) {\n if (state.state === State.key) {\n let i = start;\n for (; i < end; i++) {\n if (state.size++ > constMaxSize) {\n return error(\"HeaderTooLarge\");\n }\n if (chunk[i] === 58) {\n state.key += decoder.decode(chunk.subarray(start, i)).toLowerCase();\n if (state.key.length === 0) {\n return error(\"InvalidHeaderName\");\n }\n if (chunk[i + 1] === 32 && chunk[i + 2] !== 32 && chunk[i + 2] !== 9) {\n start = i + 2;\n state.state = State.value;\n state.size++;\n } else if (chunk[i + 1] !== 32 && chunk[i + 1] !== 9) {\n start = i + 1;\n state.state = State.value;\n } else {\n start = i + 1;\n state.state = State.whitespace;\n }\n break;\n } else if (constNameChars[chunk[i]] !== 1) {\n return error(\"InvalidHeaderName\");\n }\n }\n if (i === end) {\n state.key += decoder.decode(chunk.subarray(start, end)).toLowerCase();\n return constContinue;\n }\n }\n if (state.state === State.whitespace) {\n for (; start < end; start++) {\n if (state.size++ > constMaxSize) {\n return error(\"HeaderTooLarge\");\n }\n if (chunk[start] !== 32 && chunk[start] !== 9) {\n state.state = State.value;\n break;\n }\n }\n if (start === end) {\n return constContinue;\n }\n }\n if (state.state === State.value) {\n let i = start;\n if (previousCursor !== undefined) {\n i = previousCursor;\n previousCursor = undefined;\n }\n for (; i < end; i++) {\n if (state.size++ > constMaxSize) {\n return error(\"HeaderTooLarge\");\n }\n if (chunk[i] === 13 || state.crlf > 0) {\n let byte = chunk[i];\n if (byte === 13 && state.crlf === 0) {\n state.crlf = 1;\n i++;\n state.size++;\n byte = chunk[i];\n }\n if (byte === 10 && state.crlf === 1) {\n state.crlf = 2;\n i++;\n state.size++;\n byte = chunk[i];\n }\n if (byte === 13 && state.crlf === 2) {\n state.crlf = 3;\n i++;\n state.size++;\n byte = chunk[i];\n }\n if (byte === 10 && state.crlf === 3) {\n state.crlf = 4;\n i++;\n state.size++;\n }\n if (state.crlf < 4 && i >= end) {\n state.previousChunk = chunk.subarray(start);\n return constContinue;\n } else if (state.crlf >= 2) {\n state.value = state.value === undefined ? chunk.subarray(start, i - state.crlf) : concatUint8Array(state.value, chunk.subarray(start, i - state.crlf));\n const value = decoder.decode(state.value);\n if (state.headers[state.key] === undefined) {\n state.headers[state.key] = value;\n } else if (typeof state.headers[state.key] === \"string\") {\n state.headers[state.key] = [state.headers[state.key], value];\n } else {\n ;\n state.headers[state.key].push(value);\n }\n start = i;\n state.size--;\n if (state.crlf !== 4 && state.pairs === constMaxPairs) {\n return error(\"TooManyHeaders\");\n } else if (state.crlf === 3) {\n return error(\"InvalidHeaderValue\");\n } else if (state.crlf === 4) {\n return reset({\n _tag: \"Headers\",\n headers: state.headers,\n endPosition: start - endOffset\n });\n }\n state.pairs++;\n state.key = \"\";\n state.value = undefined;\n state.crlf = 0;\n state.state = State.key;\n continue outer;\n }\n } else if (constValueChars[chunk[i]] !== 1) {\n return error(\"InvalidHeaderValue\");\n }\n }\n if (i === end) {\n state.value = state.value === undefined ? chunk.subarray(start, end) : concatUint8Array(state.value, chunk.subarray(start, end));\n return constContinue;\n }\n }\n }\n if (start > end) {\n state.size += end - start;\n }\n return constContinue;\n };\n}\n//# sourceMappingURL=headers.js.map",
30
+ "function makeState(needle_) {\n const needle = new TextEncoder().encode(needle_);\n const needleLength = needle.length;\n const indexes = {};\n for (let i = 0; i < needleLength; i++) {\n const b = needle[i];\n if (indexes[b] === undefined) indexes[b] = [];\n indexes[b].push(i);\n }\n return {\n needle,\n needleLength,\n indexes,\n firstByte: needle[0],\n previousChunk: undefined,\n previousChunkLength: 0,\n matchIndex: 0\n };\n}\nexport function make(needle, callback, seed) {\n const state = makeState(needle);\n if (seed !== undefined) {\n state.previousChunk = seed;\n state.previousChunkLength = seed.length;\n }\n function makeIndexOf() {\n // on node.js use the Buffer api\n if (\"Buffer\" in globalThis && !(\"Bun\" in globalThis || \"Deno\" in globalThis)) {\n return function (chunk, needle, fromIndex) {\n return Buffer.prototype.indexOf.call(chunk, needle, fromIndex);\n };\n }\n const skipTable = new Uint8Array(256).fill(state.needle.length);\n for (let i = 0, lastIndex = state.needle.length - 1; i < lastIndex; ++i) {\n skipTable[state.needle[i]] = lastIndex - i;\n }\n return function (chunk, needle, fromIndex) {\n const lengthTotal = chunk.length;\n let i = fromIndex + state.needleLength - 1;\n while (i < lengthTotal) {\n for (let j = state.needleLength - 1, k = i; j >= 0 && chunk[k] === needle[j]; j--, k--) {\n if (j === 0) return k;\n }\n i += skipTable[chunk[i]];\n }\n return -1;\n };\n }\n const indexOf = makeIndexOf();\n function write(chunk) {\n let chunkLength = chunk.length;\n if (state.previousChunk !== undefined) {\n const newChunk = new Uint8Array(state.previousChunkLength + chunkLength);\n newChunk.set(state.previousChunk);\n newChunk.set(chunk, state.previousChunkLength);\n chunk = newChunk;\n chunkLength = state.previousChunkLength + chunkLength;\n state.previousChunk = undefined;\n }\n if (chunkLength < state.needleLength) {\n state.previousChunk = chunk;\n state.previousChunkLength = chunkLength;\n return;\n }\n let pos = 0;\n while (pos < chunkLength) {\n const match = indexOf(chunk, state.needle, pos);\n if (match > -1) {\n if (match > pos) {\n callback(state.matchIndex, chunk.subarray(pos, match));\n }\n state.matchIndex += 1;\n pos = match + state.needleLength;\n continue;\n } else if (chunk[chunkLength - 1] in state.indexes) {\n const indexes = state.indexes[chunk[chunkLength - 1]];\n let earliestIndex = -1;\n for (let i = 0, len = indexes.length; i < len; i++) {\n const index = indexes[i];\n if (chunk[chunkLength - 1 - index] === state.firstByte && i > earliestIndex) {\n earliestIndex = index;\n }\n }\n if (earliestIndex === -1) {\n if (pos === 0) {\n callback(state.matchIndex, chunk);\n } else {\n callback(state.matchIndex, chunk.subarray(pos));\n }\n } else {\n if (chunkLength - 1 - earliestIndex > pos) {\n callback(state.matchIndex, chunk.subarray(pos, chunkLength - 1 - earliestIndex));\n }\n state.previousChunk = chunk.subarray(chunkLength - 1 - earliestIndex);\n state.previousChunkLength = earliestIndex + 1;\n }\n } else if (pos === 0) {\n callback(state.matchIndex, chunk);\n } else {\n callback(state.matchIndex, chunk.subarray(pos));\n }\n break;\n }\n }\n function end() {\n if (state.previousChunk !== undefined && state.previousChunk !== seed) {\n callback(state.matchIndex, state.previousChunk);\n }\n state.previousChunk = seed;\n state.previousChunkLength = seed?.length ?? 0;\n state.matchIndex = 0;\n }\n return {\n write,\n end\n };\n}\n//# sourceMappingURL=search.js.map",
31
+ "import * as CT from \"./contentType.js\";\nimport * as HP from \"./headers.js\";\nimport * as Search from \"./search.js\";\nvar State;\n(function (State) {\n State[State[\"headers\"] = 0] = \"headers\";\n State[State[\"body\"] = 1] = \"body\";\n})(State || (State = {}));\nconst errInvalidDisposition = {\n _tag: \"InvalidDisposition\"\n};\nconst errEndNotReached = {\n _tag: \"EndNotReached\"\n};\nconst errMaxParts = {\n _tag: \"ReachedLimit\",\n limit: \"MaxParts\"\n};\nconst errMaxTotalSize = {\n _tag: \"ReachedLimit\",\n limit: \"MaxTotalSize\"\n};\nconst errMaxPartSize = {\n _tag: \"ReachedLimit\",\n limit: \"MaxPartSize\"\n};\nconst errMaxFieldSize = {\n _tag: \"ReachedLimit\",\n limit: \"MaxFieldSize\"\n};\nconst constCR = /*#__PURE__*/new TextEncoder().encode(\"\\r\\n\");\nexport function defaultIsFile(info) {\n return info.filename !== undefined || info.contentType === \"application/octet-stream\";\n}\nfunction parseBoundary(headers) {\n const contentType = CT.parse(headers[\"content-type\"]);\n return contentType.parameters.boundary;\n}\nfunction noopOnChunk(_chunk) {}\nexport function make({\n headers,\n onFile: onPart,\n onField,\n onError,\n onDone,\n isFile = defaultIsFile,\n maxParts = Infinity,\n maxTotalSize = Infinity,\n maxPartSize = Infinity,\n maxFieldSize = 1024 * 1024\n}) {\n const boundary = parseBoundary(headers);\n if (boundary === undefined) {\n onError({\n _tag: \"InvalidBoundary\"\n });\n return {\n write: noopOnChunk,\n end() {}\n };\n }\n const state = {\n state: State.headers,\n index: 0,\n parts: 0,\n onChunk: noopOnChunk,\n info: undefined,\n headerSkip: 0,\n partSize: 0,\n totalSize: 0,\n isFile: false,\n fieldChunks: [],\n fieldSize: 0\n };\n function skipBody() {\n state.state = State.body;\n state.isFile = true;\n state.onChunk = noopOnChunk;\n }\n const headerParser = HP.make();\n const split = Search.make(`\\r\\n--${boundary}`, function (index, chunk) {\n if (index === 0) {\n // data before the first boundary\n skipBody();\n return;\n } else if (index !== state.index) {\n if (state.index > 0) {\n if (state.isFile) {\n state.onChunk(null);\n state.partSize = 0;\n } else {\n if (state.fieldChunks.length === 1) {\n onField(state.info, state.fieldChunks[0]);\n } else {\n const buf = new Uint8Array(state.fieldSize);\n let offset = 0;\n for (let i = 0; i < state.fieldChunks.length; i++) {\n const chunk = state.fieldChunks[i];\n buf.set(chunk, offset);\n offset += chunk.length;\n }\n onField(state.info, buf);\n }\n state.fieldSize = 0;\n state.fieldChunks = [];\n }\n }\n state.state = State.headers;\n state.index = index;\n state.headerSkip = 2; // skip the first \\r\\n\n // trailing --\n if (chunk[0] === 45 && chunk[1] === 45) {\n return onDone();\n }\n state.parts++;\n if (state.parts > maxParts) {\n onError(errMaxParts);\n }\n }\n if ((state.partSize += chunk.length) > maxPartSize) {\n onError(errMaxPartSize);\n }\n if (state.state === State.headers) {\n const result = headerParser(chunk, state.headerSkip);\n state.headerSkip = 0;\n if (result._tag === \"Continue\") {\n return;\n } else if (result._tag === \"Failure\") {\n skipBody();\n return onError({\n _tag: \"BadHeaders\",\n error: result\n });\n }\n const contentType = CT.parse(result.headers[\"content-type\"]);\n const contentDisposition = CT.parse(result.headers[\"content-disposition\"], true);\n if (\"form-data\" === contentDisposition.value && !(\"name\" in contentDisposition.parameters)) {\n skipBody();\n return onError(errInvalidDisposition);\n }\n let encodedFilename;\n if (\"filename*\" in contentDisposition.parameters) {\n const parts = contentDisposition.parameters[\"filename*\"].split(\"''\");\n if (parts.length === 2) {\n encodedFilename = decodeURIComponent(parts[1]);\n }\n }\n state.info = {\n name: contentDisposition.parameters.name ?? \"\",\n filename: encodedFilename ?? contentDisposition.parameters.filename,\n contentType: contentType.value === \"\" ? contentDisposition.parameters.filename !== undefined ? \"application/octet-stream\" : \"text/plain\" : contentType.value,\n contentTypeParameters: contentType.parameters,\n contentDisposition: contentDisposition.value,\n contentDispositionParameters: contentDisposition.parameters,\n headers: result.headers\n };\n state.state = State.body;\n state.isFile = isFile(state.info);\n if (state.isFile) {\n state.onChunk = onPart(state.info);\n }\n if (result.endPosition < chunk.length) {\n if (state.isFile) {\n state.onChunk(chunk.subarray(result.endPosition));\n } else {\n const buf = chunk.subarray(result.endPosition);\n if ((state.fieldSize += buf.length) > maxFieldSize) {\n onError(errMaxFieldSize);\n }\n state.fieldChunks.push(buf);\n }\n }\n } else if (state.isFile) {\n state.onChunk(chunk);\n } else {\n if ((state.fieldSize += chunk.length) > maxFieldSize) {\n onError(errMaxFieldSize);\n }\n state.fieldChunks.push(chunk);\n }\n }, constCR);\n return {\n write(chunk) {\n if ((state.totalSize += chunk.length) > maxTotalSize) {\n return onError(errMaxTotalSize);\n }\n return split.write(chunk);\n },\n end() {\n split.end();\n if (state.state === State.body) {\n onError(errEndNotReached);\n }\n state.state = State.headers;\n state.index = 0;\n state.parts = 0;\n state.onChunk = noopOnChunk;\n state.info = undefined;\n state.totalSize = 0;\n state.partSize = 0;\n state.fieldChunks = [];\n state.fieldSize = 0;\n }\n };\n}\nconst utf8Decoder = /*#__PURE__*/new TextDecoder(\"utf-8\");\nfunction getDecoder(charset) {\n if (charset === \"utf-8\" || charset === \"utf8\" || charset === \"\") {\n return utf8Decoder;\n }\n try {\n return new TextDecoder(charset);\n } catch (error) {\n return utf8Decoder;\n }\n}\nexport function decodeField(info, value) {\n return getDecoder(info.contentTypeParameters.charset ?? \"utf-8\").decode(value);\n}\n//# sourceMappingURL=multipart.js.map",
32
+ "import * as internal from \"./internal/multipart.js\";\nexport const make = internal.make;\nexport const defaultIsFile = internal.defaultIsFile;\nexport const decodeField = internal.decodeField;\n//# sourceMappingURL=index.js.map",
33
+ "/**\n * Parses and persists HTTP `multipart/form-data` request bodies.\n *\n * `Multipart` turns incoming byte streams into typed {@link Part} values. Text\n * parts become decoded {@link Field} values, while upload parts remain streamed\n * {@link File} values until they are collected or written to scoped temporary\n * files. The persisted representation can then be decoded with schemas for\n * request handlers that receive fields and uploaded files together.\n *\n * **Mental model**\n *\n * Multipart parsing is incremental. {@link makeChannel} consumes request body\n * chunks and emits fields or files as soon as the parser reaches each part. A\n * `File` owns a one-shot byte stream for that upload; {@link toPersisted}\n * drains those file streams into scoped paths and collects text fields into a\n * {@link Persisted} record.\n *\n * **Common tasks**\n *\n * - Parse a request body stream into {@link Part} values with {@link makeChannel}.\n * - Persist parsed parts with {@link toPersisted} before schema decoding.\n * - Decode persisted forms with {@link schemaPersisted}, {@link schemaJson},\n * {@link PersistedFileSchema}, or {@link SingleFileSchema}.\n * - Configure parser limits with {@link limitsServices} or the `Max*` context\n * references.\n *\n * **Gotchas**\n *\n * Multipart request bodies are usually one-shot streams. Read each file stream\n * once, and use `contentEffect` only when the file is small enough to hold in\n * memory. Paths produced by {@link toPersisted} are scoped resources and stop\n * being valid when the scope closes. Client-provided file names are metadata,\n * not trusted filesystem paths.\n *\n * **See also**\n *\n * {@link Part}, {@link Field}, {@link File}, {@link Persisted},\n * {@link makeChannel}, {@link toPersisted}.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"../../Array.js\";\nimport * as Cause from \"../../Cause.js\";\nimport * as Channel from \"../../Channel.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Data from \"../../Data.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Exit from \"../../Exit.js\";\nimport * as FileSystem from \"../../FileSystem.js\";\nimport { constant, dual } from \"../../Function.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Path from \"../../Path.js\";\nimport * as Predicate from \"../../Predicate.js\";\nimport * as Pull from \"../../Pull.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Transformation from \"../../SchemaTransformation.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as UndefinedOr from \"../../UndefinedOr.js\";\nimport * as IncomingMessage from \"./HttpIncomingMessage.js\";\nimport * as MP from \"./Multipasta.js\";\n/**\n * Type identifier used to brand multipart part values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/http/Multipart\";\n/**\n * Returns `true` when a value is a multipart `Part`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isPart = u => Predicate.hasProperty(u, TypeId);\n/**\n * Returns `true` when a value is a multipart text `Field`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isField = u => isPart(u) && u._tag === \"Field\";\n/**\n * Returns `true` when a value is a multipart `File`.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isFile = u => isPart(u) && u._tag === \"File\";\n/**\n * Returns `true` when a value is a persisted multipart file.\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isPersistedFile = u => Predicate.hasProperty(u, TypeId) && Predicate.isTagged(u, \"PersistedFile\");\nconst MultipartErrorTypeId = \"~effect/http/Multipart/MultipartError\";\n/**\n * Error reason carried by a `MultipartError`.\n *\n * **Details**\n *\n * It identifies parser and limit failures such as oversized files or fields, too\n * many parts, total body size limits, parse errors, and internal errors.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class MultipartErrorReason extends Data.Error {}\n/**\n * Error raised while parsing, streaming, or persisting multipart form data.\n *\n * **Details**\n *\n * The `reason` field contains the concrete `MultipartErrorReason`.\n *\n * @category errors\n * @since 4.0.0\n */\nexport class MultipartError extends /*#__PURE__*/Data.TaggedError(\"MultipartError\") {\n /**\n * Creates a multipart error from a reason tag and optional cause.\n *\n * @since 4.0.0\n */\n static fromReason(reason, cause) {\n return new MultipartError({\n reason: new MultipartErrorReason({\n _tag: reason,\n cause\n })\n });\n }\n /**\n * Marks this value as a multipart error for runtime guards.\n *\n * @since 4.0.0\n */\n [MultipartErrorTypeId] = MultipartErrorTypeId;\n /**\n * Uses the concrete multipart error reason as the public message.\n *\n * @since 4.0.0\n */\n get message() {\n return this.reason._tag;\n }\n}\n/**\n * Schema for persisted multipart files.\n *\n * **Details**\n *\n * The encoded form contains the field key, original file name, content type, and\n * filesystem path.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const PersistedFileSchema = /*#__PURE__*/Schema.declare(isPersistedFile, {\n typeConstructor: {\n _tag: \"effect/http/PersistedFile\"\n },\n generation: {\n runtime: `Multipart.PersistedFileSchema`,\n Type: `Multipart.PersistedFile`,\n importDeclaration: `import * as Multipart from \"effect/unstable/http/Multipart\"`\n },\n expected: \"PersistedFile\",\n toCodecJson: () => Schema.link()(Schema.Struct({\n key: Schema.String,\n name: Schema.String,\n contentType: Schema.String.annotate({\n contentEncoding: \"binary\"\n }),\n path: Schema.String\n }), Transformation.transform({\n decode: ({\n contentType,\n key,\n name,\n path\n }) => new PersistedFileImpl(key, name, contentType, path),\n encode: file => ({\n key: file.key,\n name: file.name,\n contentType: file.contentType,\n path: file.path\n })\n }))\n});\n/**\n * Schema for an array of persisted multipart files.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const FilesSchema = /*#__PURE__*/Schema.Array(PersistedFileSchema);\n/**\n * Schema for exactly one persisted multipart file.\n *\n * **Details**\n *\n * The encoded form is a one-element file array, while the decoded value is the\n * single `PersistedFile`.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const SingleFileSchema = /*#__PURE__*/FilesSchema.check(Schema.isLengthBetween(1, 1)).pipe(/*#__PURE__*/Schema.decodeTo(PersistedFileSchema, /*#__PURE__*/Transformation.transform({\n decode: ([file]) => file,\n encode: file => [file]\n})));\n/**\n * Creates a decoder for persisted multipart data using the supplied schema.\n *\n * **Details**\n *\n * The returned function decodes an unknown input into the schema output and fails\n * with `SchemaError` when validation fails.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaPersisted = schema => Schema.decodeUnknownEffect(schema);\n/**\n * Creates a decoder for a JSON-encoded field in persisted multipart data.\n *\n * **Details**\n *\n * The selected field is parsed from a JSON string and decoded with the supplied\n * schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaJson = (schema, options) => {\n const fromJson = Schema.fromJsonString(schema);\n return dual(2, (persisted, field) => Effect.map(Schema.decodeUnknownEffect(Schema.Struct({\n [field]: fromJson\n }))(persisted, options), _ => _[field]));\n};\n/**\n * Builds the low-level multipart parser configuration from request headers and\n * the current fiber context.\n *\n * **Details**\n *\n * Parser limits are read from the multipart references, including maximum parts,\n * field size, file size, total body size, and field MIME type overrides.\n *\n * @category configuration\n * @since 4.0.0\n */\nexport const makeConfig = headers => Effect.withFiber(fiber => {\n const mimeTypes = Context.get(fiber.context, FieldMimeTypes);\n return Effect.succeed({\n headers,\n maxParts: fiber.getRef(MaxParts),\n maxFieldSize: Number(fiber.getRef(MaxFieldSize)),\n maxPartSize: UndefinedOr.map(fiber.getRef(MaxFileSize), Number),\n maxTotalSize: UndefinedOr.map(fiber.getRef(IncomingMessage.MaxBodySize), Number),\n isFile: mimeTypes.length === 0 ? undefined : info => !mimeTypes.some(_ => info.contentType.includes(_)) && MP.defaultIsFile(info)\n });\n});\n/**\n * Creates a channel that parses multipart byte chunks into multipart parts.\n *\n * **Details**\n *\n * The channel consumes non-empty batches of `Uint8Array` chunks and emits\n * non-empty batches of parsed `Part` values, failing with `MultipartError` for\n * parser and limit failures.\n *\n * @category Parsers\n * @since 4.0.0\n */\nexport const makeChannel = headers => Channel.fromTransform(upstream => Effect.map(makeConfig(headers), config => {\n let partsBuffer = [];\n let exit = Option.none();\n const parser = MP.make({\n ...config,\n onField(info, value) {\n partsBuffer.push(new FieldImpl(info.name, info.contentType, MP.decodeField(info, value)));\n },\n onFile(info) {\n let chunks = [];\n let finished = false;\n const pullChunks = Channel.fromPull(Effect.succeed(Effect.suspend(function loop() {\n if (!Arr.isReadonlyArrayNonEmpty(chunks)) {\n return finished ? Cause.done() : Effect.flatMap(pump, loop);\n }\n const chunk = chunks;\n chunks = [];\n return Effect.succeed(chunk);\n })));\n partsBuffer.push(new FileImpl(info, pullChunks));\n return function (chunk) {\n if (chunk === null) {\n finished = true;\n } else {\n chunks.push(chunk);\n }\n };\n },\n onError(error_) {\n exit = Option.some(Exit.fail(convertError(error_)));\n },\n onDone() {\n exit = Option.some(Exit.fail(Cause.Done()));\n }\n });\n const pump = upstream.pipe(Effect.flatMap(chunk => {\n for (let i = 0; i < chunk.length; i++) {\n parser.write(chunk[i]);\n }\n return Effect.void;\n }), Effect.catchCause(cause => {\n if (Pull.isDoneCause(cause)) {\n parser.end();\n } else {\n exit = Option.some(Exit.failCause(cause));\n }\n return Effect.void;\n }));\n return pump.pipe(Effect.flatMap(function loop() {\n if (!Arr.isReadonlyArrayNonEmpty(partsBuffer)) {\n if (Option.isSome(exit)) {\n return exit.value;\n }\n return Effect.flatMap(pump, loop);\n }\n const parts = partsBuffer;\n partsBuffer = [];\n return Effect.succeed(parts);\n }));\n}));\nfunction convertError(cause) {\n switch (cause._tag) {\n case \"ReachedLimit\":\n {\n switch (cause.limit) {\n case \"MaxParts\":\n {\n return MultipartError.fromReason(\"TooManyParts\", cause);\n }\n case \"MaxFieldSize\":\n {\n return MultipartError.fromReason(\"FieldTooLarge\", cause);\n }\n case \"MaxPartSize\":\n {\n return MultipartError.fromReason(\"FileTooLarge\", cause);\n }\n case \"MaxTotalSize\":\n {\n return MultipartError.fromReason(\"BodyTooLarge\", cause);\n }\n }\n }\n default:\n {\n return MultipartError.fromReason(\"Parse\", cause);\n }\n }\n}\nclass PartBase extends Inspectable.Class {\n [TypeId];\n constructor() {\n super();\n this[TypeId] = TypeId;\n }\n}\nclass FieldImpl extends PartBase {\n _tag = \"Field\";\n key;\n contentType;\n value;\n constructor(key, contentType, value) {\n super();\n this.key = key;\n this.contentType = contentType;\n this.value = value;\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"Field\",\n key: this.key,\n contentType: this.contentType,\n value: this.value\n };\n }\n}\nclass FileImpl extends PartBase {\n _tag = \"File\";\n key;\n name;\n contentType;\n content;\n contentEffect;\n constructor(info, channel) {\n super();\n this.key = info.name;\n this.name = info.filename ?? info.name;\n this.contentType = info.contentType;\n this.content = Stream.fromChannel(channel);\n this.contentEffect = channel.pipe(collectUint8Array, Effect.mapError(cause => MultipartError.fromReason(\"InternalError\", cause)));\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"File\",\n key: this.key,\n name: this.name,\n contentType: this.contentType\n };\n }\n}\nconst defaultWriteFile = (path, file) => Effect.flatMap(FileSystem.FileSystem, fs => Effect.mapError(Stream.run(file.content, fs.sink(path)), cause => MultipartError.fromReason(\"InternalError\", cause)));\n/**\n * Runs a channel of byte chunks and collects all output into a single\n * `Uint8Array`.\n *\n * **Gotchas**\n *\n * This materializes the full content in memory.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const collectUint8Array = self => Channel.runFold(self, constant(new Uint8Array(0)), (accumulator, chunk) => {\n const totalLength = chunk.reduce((sum, element) => sum + element.length, accumulator.length);\n const newAccumulator = new Uint8Array(totalLength);\n newAccumulator.set(accumulator, 0);\n let offset = accumulator.length;\n for (const element of chunk) {\n newAccumulator.set(element, offset);\n offset += element.length;\n }\n return newAccumulator;\n});\n/**\n * Persists a stream of multipart parts into a record.\n *\n * **Details**\n *\n * Text fields are collected as strings, and file parts are written to files in a\n * scoped temporary directory.\n *\n * **Gotchas**\n *\n * Persisted file paths remain valid for the lifetime of the scope.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toPersisted = (stream, writeFile = defaultWriteFile) => Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path_ = yield* Path.Path;\n const dir = yield* fs.makeTempDirectoryScoped();\n const persisted = Object.create(null);\n yield* Stream.runForEach(stream, part => {\n if (part._tag === \"Field\") {\n if (!(part.key in persisted)) {\n persisted[part.key] = part.value;\n } else if (typeof persisted[part.key] === \"string\") {\n persisted[part.key] = [persisted[part.key], part.value];\n } else {\n ;\n persisted[part.key].push(part.value);\n }\n return Effect.void;\n } else if (part.name === \"\") {\n return Effect.void;\n }\n const file = part;\n const path = path_.join(dir, path_.basename(file.name).slice(-128));\n const filePart = new PersistedFileImpl(file.key, file.name, file.contentType, path);\n if (Array.isArray(persisted[part.key])) {\n ;\n persisted[part.key].push(filePart);\n } else {\n persisted[part.key] = [filePart];\n }\n return writeFile(path, file);\n });\n return persisted;\n}).pipe(Effect.catchTag(\"PlatformError\", cause => Effect.fail(MultipartError.fromReason(\"InternalError\", cause))));\nclass PersistedFileImpl extends PartBase {\n _tag = \"PersistedFile\";\n key;\n name;\n contentType;\n path;\n constructor(key, name, contentType, path) {\n super();\n this.key = key;\n this.name = name;\n this.contentType = contentType;\n this.path = path;\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"PersistedFile\",\n key: this.key,\n name: this.name,\n contentType: this.contentType,\n path: this.path\n };\n }\n}\n/**\n * Creates a context containing multipart parser limit settings.\n *\n * **Details**\n *\n * The context can provide maximum part count, field size, file size, total body\n * size, and MIME types that should be parsed as fields.\n *\n * @category references\n * @since 4.0.0\n */\nexport const limitsServices = options => {\n const map = new Map();\n if (options.maxParts !== undefined) {\n map.set(MaxParts.key, options.maxParts);\n }\n if (options.maxFieldSize !== undefined) {\n map.set(MaxFieldSize.key, FileSystem.Size(options.maxFieldSize));\n }\n if (options.maxFileSize !== undefined) {\n map.set(MaxFileSize.key, UndefinedOr.map(options.maxFileSize, FileSystem.Size));\n }\n if (options.maxTotalSize !== undefined) {\n map.set(IncomingMessage.MaxBodySize.key, UndefinedOr.map(options.maxTotalSize, FileSystem.Size));\n }\n if (options.fieldMimeTypes !== undefined) {\n map.set(FieldMimeTypes.key, options.fieldMimeTypes);\n }\n return Context.makeUnsafe(map);\n};\n/**\n * Context reference for the maximum number of multipart parts allowed.\n *\n * **Details**\n *\n * The default is `undefined`, meaning no explicit part-count limit.\n *\n * @category references\n * @since 4.0.0\n */\nexport const MaxParts = /*#__PURE__*/Context.Reference(\"effect/http/Multipart/MaxParts\", {\n defaultValue: () => undefined\n});\n/**\n * Context reference for the maximum size of a multipart field value.\n *\n * **Details**\n *\n * The default limit is 10 MiB.\n *\n * @category references\n * @since 4.0.0\n */\nexport const MaxFieldSize = /*#__PURE__*/Context.Reference(\"effect/http/Multipart/MaxFieldSize\", {\n defaultValue: /*#__PURE__*/constant(/*#__PURE__*/FileSystem.Size(10 * 1024 * 1024))\n});\n/**\n * Context reference for the maximum size of a multipart file part.\n *\n * **Details**\n *\n * The default is `undefined`, meaning no explicit per-file limit.\n *\n * @category references\n * @since 4.0.0\n */\nexport const MaxFileSize = /*#__PURE__*/Context.Reference(\"effect/http/Multipart/MaxFileSize\", {\n defaultValue: () => undefined\n});\n/**\n * Context reference for MIME type fragments that should be parsed as multipart\n * fields instead of files.\n *\n * **Details**\n *\n * The default treats `application/json` parts as fields.\n *\n * @category references\n * @since 4.0.0\n */\nexport const FieldMimeTypes = /*#__PURE__*/Context.Reference(\"effect/http/Multipart/FieldMimeTypes\", {\n defaultValue: /*#__PURE__*/constant([\"application/json\"])\n});\n//# sourceMappingURL=Multipart.js.map",
34
+ "import * as Channel from \"../../Channel.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Inspectable from \"../../Inspectable.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Result from \"../../Result.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Socket from \"../socket/Socket.js\";\nimport * as Cookies from \"./Cookies.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as HttpBody from \"./HttpBody.js\";\nimport * as HttpClientRequest from \"./HttpClientRequest.js\";\nimport * as HttpIncomingMessage from \"./HttpIncomingMessage.js\";\nimport { hasBody } from \"./HttpMethod.js\";\nimport { HttpServerError, RequestParseError } from \"./HttpServerError.js\";\nimport * as Multipart from \"./Multipart.js\";\nimport * as UrlParams from \"./UrlParams.js\";\nexport {\n/**\n * Provides the `MaxBodySize` fiber reference for configuring request body limits.\n *\n * **When to use**\n *\n * Use to configure the maximum body size accepted while reading server\n * request bodies.\n *\n * @category fiber refs\n * @since 4.0.0\n */\nMaxBodySize } from \"./HttpIncomingMessage.js\";\n/**\n * Runtime type identifier for `HttpServerRequest` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/http/HttpServerRequest\";\n/**\n * Service tag for the active server-side HTTP request.\n *\n * **When to use**\n *\n * Use to access the request currently being handled by HTTP server routes and\n * middleware.\n *\n * @category context\n * @since 4.0.0\n */\nexport const HttpServerRequest = /*#__PURE__*/Context.Service(\"effect/http/HttpServerRequest\");\n/**\n * Service that contains decoded URL query parameters for the current request.\n *\n * **When to use**\n *\n * Use to access query parameters that have already been parsed for the current\n * server request.\n *\n * **Details**\n *\n * Each key maps to a string value, or to an array when the parameter appears more\n * than once.\n *\n * @category search params\n * @since 4.0.0\n */\nexport class ParsedSearchParams extends /*#__PURE__*/Context.Service()(\"effect/http/ParsedSearchParams\") {}\n/**\n * Converts a `URL` object's search parameters into a record.\n *\n * **Details**\n *\n * Repeated parameters are represented as arrays in insertion order.\n *\n * @category search params\n * @since 4.0.0\n */\nexport const searchParamsFromURL = url => {\n const out = {};\n for (const [key, value] of url.searchParams.entries()) {\n const entry = out[key];\n if (entry !== undefined) {\n if (Array.isArray(entry)) {\n entry.push(value);\n } else {\n out[key] = [entry, value];\n }\n } else {\n out[key] = value;\n }\n }\n return out;\n};\n/**\n * Creates a channel backed by the current request's upgraded socket.\n *\n * **Details**\n *\n * The channel reads incoming socket messages and writes byte chunks to the\n * socket, failing if the request cannot be upgraded or the socket fails.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const upgradeChannel = () => HttpServerRequest.pipe(Effect.flatMap(_ => _.upgrade), Effect.map(Socket.toChannelWith()), Channel.unwrap);\n/**\n * Decodes a schema from the cookies of the current request.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaCookies = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.flatMap(HttpServerRequest, req => parse(req.cookies, options));\n};\n/**\n * Decodes a schema from the headers of the current request.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaHeaders = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.flatMap(HttpServerRequest, req => parse(req.headers, options));\n};\n/**\n * Decodes a schema from the parsed search parameters of the current request.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaSearchParams = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.flatMap(ParsedSearchParams, params => parse(params, options));\n};\n/**\n * Reads the current request body as JSON and decodes it with the supplied schema.\n *\n * **Details**\n *\n * The effect can fail if the body cannot be read or parsed, or if schema decoding\n * fails.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyJson = (schema, options) => {\n const parse = HttpIncomingMessage.schemaBodyJson(schema, options);\n return Effect.flatMap(HttpServerRequest, parse);\n};\nconst isMultipart = request => request.headers[\"content-type\"]?.toLowerCase().includes(\"multipart/form-data\") === true || getFormDataBody(request) !== undefined;\n/**\n * Decodes the current request body as form data.\n *\n * **Details**\n *\n * Multipart requests are persisted and decoded as multipart data; other form\n * requests are decoded from URL-encoded body parameters.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyForm = (schema, options) => {\n const parseMultipart = Multipart.schemaPersisted(schema);\n const parseUrlParams = HttpIncomingMessage.schemaBodyUrlParams(schema, options);\n return Effect.flatMap(HttpServerRequest, request => {\n if (isMultipart(request)) {\n return Effect.flatMap(request.multipart, _ => parseMultipart(_, options));\n }\n return parseUrlParams(request);\n });\n};\n/**\n * Reads the current request body as URL-encoded parameters and decodes them with\n * the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyUrlParams = (schema, options) => {\n const parse = HttpIncomingMessage.schemaBodyUrlParams(schema, options);\n return Effect.flatMap(HttpServerRequest, parse);\n};\n/**\n * Persists the current multipart request body and decodes it with the supplied\n * schema.\n *\n * **Details**\n *\n * The effect requires the services needed to persist multipart files, including a\n * scope, file system, and path service.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyMultipart = (schema, options) => {\n const parse = Multipart.schemaPersisted(schema);\n return HttpServerRequest.pipe(Effect.flatMap(_ => _.multipart), Effect.flatMap(_ => parse(_, options)));\n};\n/**\n * Creates a decoder for a JSON value stored in a form field.\n *\n * **Details**\n *\n * For multipart requests, the named multipart field is decoded as JSON. For\n * URL-encoded requests, the named parameter is decoded as JSON and then decoded\n * with the supplied schema.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaBodyFormJson = (schema, options) => {\n const parseMultipart = Multipart.schemaJson(schema, options);\n return field => {\n const parseUrlParams = UrlParams.schemaJsonField(field).pipe(Schema.decodeTo(schema), Schema.decodeEffect);\n return Effect.flatMap(HttpServerRequest, request => {\n if (isMultipart(request)) {\n return Effect.flatMap(Effect.mapError(request.multipart, cause => new HttpServerError({\n reason: new RequestParseError({\n request,\n cause\n })\n })), parseMultipart(field));\n }\n return Effect.flatMap(request.urlParamsBody, _ => parseUrlParams(_, options));\n });\n };\n};\n/**\n * Creates an `HttpServerRequest` view of an `HttpClientRequest`.\n *\n * **Details**\n *\n * If the client request can be converted to an absolute URL, that URL is used as\n * the original URL.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromClientRequest = request => {\n const url = Option.match(HttpClientRequest.toUrl(request), {\n onNone: () => request.url,\n onSome: url => url.toString()\n });\n return new ClientRequestImpl(request, url);\n};\n/**\n * Wraps a Web `Request` as an `HttpServerRequest`.\n *\n * **Details**\n *\n * The request's current URL is stored without the scheme and host, while the\n * original Web URL remains available as `originalUrl`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromWeb = request => new ServerRequestImpl(request, removeHost(request.url));\n/**\n * Converts an `HttpServerRequest` into an `HttpClientRequest`.\n *\n * **Details**\n *\n * The converted request preserves the method, headers, body stream, and a URL\n * derived from the request when possible.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toClientRequest = request => HttpClientRequest.setUrl(HttpClientRequest.makeWith(request.method, \"\", UrlParams.empty, Option.none(), request.headers, toClientBody(request)), Option.getOrElse(toURL(request), () => request.url));\nconst toClientBody = request => hasBody(request.method) ? HttpBody.stream(request.stream, request.headers[\"content-type\"], parseContentLength(request.headers[\"content-length\"])) : HttpBody.empty;\nconst parseContentLength = contentLength => {\n if (contentLength === undefined) {\n return undefined;\n }\n const parsed = Number.parseInt(contentLength, 10);\n return Number.isNaN(parsed) ? undefined : parsed;\n};\nconst removeHost = url => {\n if (url[0] === \"/\") {\n return url;\n }\n const index = url.indexOf(\"/\", url.indexOf(\"//\") + 2);\n return index === -1 ? \"/\" : url.slice(index);\n};\nclass ServerRequestImpl extends Inspectable.Class {\n [TypeId];\n [HttpIncomingMessage.TypeId];\n source;\n url;\n headersOverride;\n remoteAddressOverride;\n constructor(source, url, headersOverride, remoteAddressOverride) {\n super();\n this[TypeId] = TypeId;\n this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n this.source = source;\n this.url = url;\n this.headersOverride = headersOverride;\n this.remoteAddressOverride = remoteAddressOverride;\n }\n toJSON() {\n return HttpIncomingMessage.inspect(this, {\n _id: \"HttpServerRequest\",\n method: this.method,\n url: this.originalUrl\n });\n }\n modify(options) {\n return new ServerRequestImpl(this.source, options.url ?? this.url, options.headers ?? this.headersOverride, \"remoteAddress\" in options ? options.remoteAddress : this.remoteAddressOverride);\n }\n get method() {\n return this.source.method.toUpperCase();\n }\n get originalUrl() {\n return this.source.url;\n }\n get remoteAddress() {\n return this.remoteAddressOverride ?? Option.none();\n }\n get headers() {\n this.headersOverride ??= Headers.fromInput(this.source.headers);\n return this.headersOverride;\n }\n cachedCookies;\n get cookies() {\n if (this.cachedCookies) {\n return this.cachedCookies;\n }\n return this.cachedCookies = Cookies.parseHeader(this.headers.cookie ?? \"\");\n }\n get stream() {\n return this.source.body ? Stream.fromReadableStream({\n evaluate: () => this.source.body,\n onError: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n }) : Stream.fail(new HttpServerError({\n reason: new RequestParseError({\n request: this,\n description: \"can not create stream from empty body\"\n })\n }));\n }\n textEffect;\n get text() {\n if (this.textEffect) {\n return this.textEffect;\n }\n this.textEffect = Effect.runSync(Effect.cached(Effect.tryPromise({\n try: () => this.source.text(),\n catch: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n })));\n return this.textEffect;\n }\n get json() {\n return Effect.flatMap(this.text, text => Effect.try({\n try: () => JSON.parse(text),\n catch: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n }));\n }\n get urlParamsBody() {\n return Effect.flatMap(this.text, _ => Effect.try({\n try: () => UrlParams.fromInput(new URLSearchParams(_)),\n catch: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n }));\n }\n multipartEffect;\n get multipart() {\n if (this.multipartEffect) {\n return this.multipartEffect;\n }\n this.multipartEffect = Effect.runSync(Effect.cached(Multipart.toPersisted(this.multipartStream)));\n return this.multipartEffect;\n }\n get multipartStream() {\n return Stream.pipeThroughChannel(Stream.mapError(this.stream, cause => Multipart.MultipartError.fromReason(\"InternalError\", cause)), Multipart.makeChannel(this.headers));\n }\n arrayBufferEffect;\n get arrayBuffer() {\n if (this.arrayBufferEffect) {\n return this.arrayBufferEffect;\n }\n this.arrayBufferEffect = Effect.runSync(Effect.cached(Effect.tryPromise({\n try: () => this.source.arrayBuffer(),\n catch: cause => new HttpServerError({\n reason: new RequestParseError({\n request: this,\n cause\n })\n })\n })));\n return this.arrayBufferEffect;\n }\n get upgrade() {\n return Effect.fail(new HttpServerError({\n reason: new RequestParseError({\n request: this,\n description: \"Not an upgradeable ServerRequest\"\n })\n }));\n }\n}\nclass ClientRequestImpl extends Inspectable.Class {\n [TypeId];\n [HttpIncomingMessage.TypeId];\n source;\n originalUrl;\n headersOverride;\n remoteAddressOverride;\n urlOverride;\n constructor(source, originalUrl, urlOverride, headersOverride, remoteAddressOverride) {\n super();\n this[TypeId] = TypeId;\n this[HttpIncomingMessage.TypeId] = HttpIncomingMessage.TypeId;\n this.source = source;\n this.originalUrl = originalUrl;\n this.urlOverride = urlOverride;\n this.headersOverride = headersOverride;\n this.remoteAddressOverride = remoteAddressOverride;\n }\n toJSON() {\n return HttpIncomingMessage.inspect(this, {\n _id: \"HttpServerRequest\",\n method: this.method,\n url: this.originalUrl\n });\n }\n modify(options) {\n return new ClientRequestImpl(this.source, this.originalUrl, options.url ?? this.url, options.headers ?? this.headersOverride, \"remoteAddress\" in options ? options.remoteAddress : this.remoteAddressOverride);\n }\n get method() {\n return this.source.method;\n }\n get url() {\n return this.urlOverride ?? removeHost(this.originalUrl);\n }\n get remoteAddress() {\n return this.remoteAddressOverride ?? Option.none();\n }\n get headers() {\n return this.headersOverride ??= this.source.headers;\n }\n cachedCookies;\n get cookies() {\n if (this.cachedCookies) {\n return this.cachedCookies;\n }\n return this.cachedCookies = Cookies.parseHeader(this.headers.cookie ?? \"\");\n }\n get stream() {\n const body = this.source.body;\n switch (body._tag) {\n case \"Empty\":\n {\n return Stream.empty;\n }\n case \"Uint8Array\":\n {\n return Stream.succeed(body.body);\n }\n case \"Stream\":\n {\n return Stream.mapError(body.stream, cause => requestParseError(this, undefined, cause));\n }\n case \"FormData\":\n {\n return streamFromReadable(this, new Response(body.formData).body);\n }\n case \"Raw\":\n {\n return rawBodyStream(this, body.body);\n }\n }\n }\n bytesEffect;\n get bytes() {\n if (this.bytesEffect) {\n return this.bytesEffect;\n }\n const body = this.source.body;\n let effect;\n switch (body._tag) {\n case \"Empty\":\n {\n effect = Effect.succeed(new Uint8Array(0));\n break;\n }\n case \"Uint8Array\":\n {\n effect = Effect.succeed(body.body);\n break;\n }\n case \"FormData\":\n {\n effect = bytesFromBodyInit(this, body.formData);\n break;\n }\n case \"Stream\":\n {\n effect = Stream.mkUint8Array(this.stream);\n break;\n }\n case \"Raw\":\n {\n effect = rawBodyBytes(this, body.body);\n break;\n }\n }\n this.bytesEffect = Effect.runSync(Effect.cached(effect));\n return this.bytesEffect;\n }\n get text() {\n return Effect.map(this.bytes, bytes => textDecoder.decode(bytes));\n }\n get json() {\n return Effect.flatMap(this.text, text => Effect.try({\n try: () => text === \"\" ? null : JSON.parse(text),\n catch: cause => requestParseError(this, undefined, cause)\n }));\n }\n get urlParamsBody() {\n return Effect.flatMap(this.text, _ => Effect.try({\n try: () => UrlParams.fromInput(new URLSearchParams(_)),\n catch: cause => requestParseError(this, undefined, cause)\n }));\n }\n multipartEffect;\n get multipart() {\n if (this.multipartEffect) {\n return this.multipartEffect;\n }\n this.multipartEffect = Effect.runSync(Effect.cached(Multipart.toPersisted(this.multipartStream)));\n return this.multipartEffect;\n }\n get multipartStream() {\n const formData = this.source.body._tag === \"FormData\" && this.source.body.formData;\n if (formData) {\n return Stream.fromIterable(formDataToParts(formData));\n }\n return Stream.pipeThroughChannel(Stream.mapError(this.stream, cause => Multipart.MultipartError.fromReason(\"InternalError\", cause)), Multipart.makeChannel(this.headers));\n }\n get arrayBuffer() {\n return Effect.map(this.bytes, bytes => bytes.slice().buffer);\n }\n get upgrade() {\n return Effect.fail(requestParseError(this, \"Not an upgradeable ServerRequest\"));\n }\n}\nconst getFormDataBody = request => {\n if (!HttpClientRequest.isHttpClientRequest(request.source)) {\n return undefined;\n }\n const body = request.source.body;\n if (body._tag === \"FormData\") {\n return body.formData;\n }\n if (body._tag === \"Raw\" && isFormData(body.body)) {\n return body.body;\n }\n return undefined;\n};\nconst rawBodyStream = (request, body) => {\n if (body instanceof Request) {\n return streamFromReadable(request, body.body);\n }\n if (isFormData(body)) {\n return streamFromReadable(request, new Response(body).body);\n }\n if (isReadableStream(body)) {\n return streamFromReadable(request, body);\n }\n return Stream.fail(requestParseError(request, \"Unsupported body type\"));\n};\nconst rawBodyBytes = (request, body) => {\n if (body instanceof Blob) {\n return bytesFromBodyInit(request, body);\n }\n if (body instanceof Request) {\n return Effect.tryPromise({\n try: () => body.arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => requestParseError(request, undefined, cause)\n });\n }\n return Effect.fail(requestParseError(request, \"Unsupported body type\"));\n};\nconst bytesFromBodyInit = (request, body) => Effect.tryPromise({\n try: () => new Response(body).arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => requestParseError(request, undefined, cause)\n});\nconst streamFromReadable = (request, body) => body ? Stream.fromReadableStream({\n evaluate: () => body,\n onError: cause => requestParseError(request, undefined, cause)\n}) : Stream.empty;\nconst requestParseError = (request, description, cause) => new HttpServerError({\n reason: new RequestParseError({\n request,\n ...(description === undefined ? undefined : {\n description\n }),\n ...(cause === undefined ? undefined : {\n cause\n })\n })\n});\nconst formDataToParts = formData => {\n const parts = [];\n for (const [key, value] of formData.entries()) {\n parts.push(typeof value === \"string\" ? new MultipartFieldPart(key, value) : new MultipartFilePart(key, value));\n }\n return parts;\n};\nclass MultipartFieldPart extends Inspectable.Class {\n [Multipart.TypeId];\n _tag = \"Field\";\n contentType = \"text/plain\";\n key;\n value;\n constructor(key, value) {\n super();\n this[Multipart.TypeId] = Multipart.TypeId;\n this.key = key;\n this.value = value;\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"Field\",\n key: this.key,\n contentType: this.contentType,\n value: this.value\n };\n }\n}\nclass MultipartFilePart extends Inspectable.Class {\n [Multipart.TypeId];\n _tag = \"File\";\n key;\n name;\n contentType;\n content;\n contentEffect;\n constructor(key, file) {\n super();\n this[Multipart.TypeId] = Multipart.TypeId;\n this.key = key;\n this.name = file.name;\n this.contentType = file.type;\n this.content = Stream.fromReadableStream({\n evaluate: () => file.stream(),\n onError: cause => Multipart.MultipartError.fromReason(\"InternalError\", cause)\n });\n this.contentEffect = Effect.tryPromise({\n try: () => file.arrayBuffer().then(buffer => new Uint8Array(buffer)),\n catch: cause => Multipart.MultipartError.fromReason(\"InternalError\", cause)\n });\n }\n toJSON() {\n return {\n _id: \"@effect/platform/Multipart/Part\",\n _tag: \"File\",\n key: this.key,\n name: this.name,\n contentType: this.contentType\n };\n }\n}\nconst isReadableStream = u => typeof ReadableStream !== \"undefined\" && u instanceof ReadableStream;\nconst isFormData = u => typeof FormData !== \"undefined\" && u instanceof FormData;\nconst textDecoder = /*#__PURE__*/new TextDecoder();\n/**\n * Attempts to construct an absolute `URL` for a server request safely.\n *\n * **Details**\n *\n * The host comes from the `host` header, defaulting to `localhost`, and the\n * protocol is `https` only when `x-forwarded-proto` is `https`; invalid URLs\n * return `Option.none`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toURL = self => {\n const host = self.headers.host ?? \"localhost\";\n const protocol = self.headers[\"x-forwarded-proto\"] === \"https\" ? \"https\" : \"http\";\n try {\n return Option.some(new URL(self.url, `${protocol}://${host}`));\n } catch {\n return Option.none();\n }\n};\n/**\n * Converts an `HttpServerRequest` safely to a Web `Request` as a `Result`.\n *\n * **Details**\n *\n * If the source is already a Web `Request`, it is returned unchanged. Otherwise\n * an absolute URL is derived from the request; invalid URLs fail with a\n * `RequestParseError`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebResult = (self, options) => {\n if (self.source instanceof Request) {\n return Result.succeed(self.source);\n }\n const url = toURL(self);\n if (Option.isNone(url)) {\n return Result.fail(new RequestParseError({\n request: self,\n description: \"Invalid URL\"\n }));\n }\n const requestInit = {\n method: self.method,\n headers: self.headers\n };\n if (options?.signal) {\n requestInit.signal = options.signal;\n }\n if (hasBody(self.method)) {\n requestInit.body = Stream.toReadableStreamWith(self.stream, options?.context ?? Context.empty());\n requestInit.duplex = \"half\";\n }\n return Result.succeed(new Request(url.value, requestInit));\n};\n/**\n * Converts an `HttpServerRequest` to a Web `Request` in `Effect`.\n *\n * **Details**\n *\n * The current context is used when streaming the request body into the Web\n * request.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWeb = (self, options) => Effect.contextWith(context => Effect.fromResult(toWebResult(self, {\n context,\n signal: options?.signal\n})));\n//# sourceMappingURL=HttpServerRequest.js.map",
35
+ "import * as Effect from \"../../../Effect.js\";\n/** @internal */\nexport const requestPreResponseHandlers = /*#__PURE__*/new WeakMap();\n/** @internal */\nexport const appendPreResponseHandlerUnsafe = (request, handler) => {\n const prev = requestPreResponseHandlers.get(request.source);\n const next = prev ? (request, response) => Effect.flatMap(prev(request, response), response => handler(request, response)) : handler;\n requestPreResponseHandlers.set(request.source, next);\n};\n//# sourceMappingURL=preResponseHandler.js.map",
36
+ "/**\n * Server-side HTTP middleware for wrapping `HttpServerResponse` effects with\n * cross-cutting request and response behavior.\n *\n * A middleware is a function from one HTTP server app effect to another. The app\n * is evaluated with the current `HttpServerRequest` service in its context, so\n * middleware in this module can inspect or rewrite the request, provide\n * request-scoped services, attach pre-response hooks, or observe the app exit\n * while preserving normal Effect error and interruption semantics.\n *\n * Use this module for common server concerns such as access logging, trace span\n * creation, trusting forwarded proxy headers, parsing search parameters, and\n * adding CORS handling. Middleware can be applied directly when serving an\n * `HttpServer` / `HttpEffect` app or registered through `HttpRouter.middleware`\n * for route-scoped or global behavior.\n *\n * Middleware composition is order-sensitive, and each middleware may change the\n * wrapped effect's requirements or error channel. These functions expect a\n * per-request `HttpServerRequest` to be present; context-providing middleware\n * should wrap handlers before they access the provided service, and\n * error-handling middleware should be installed where its transformed error type\n * matches the surrounding app or router registration.\n *\n * @since 4.0.0\n */\nimport { Clock } from \"../../Clock.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { constant, constFalse } from \"../../Function.js\";\nimport * as internalEffect from \"../../internal/effect.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\nimport { TracerEnabled } from \"../../References.js\";\nimport { ParentSpan } from \"../../Tracer.js\";\nimport * as Headers from \"./Headers.js\";\nimport { causeResponseStripped, exitResponse } from \"./HttpServerError.js\";\nimport { HttpServerRequest } from \"./HttpServerRequest.js\";\nimport * as Request from \"./HttpServerRequest.js\";\nimport * as Response from \"./HttpServerResponse.js\";\nimport * as TraceContext from \"./HttpTraceContext.js\";\nimport { appendPreResponseHandlerUnsafe } from \"./internal/preResponseHandler.js\";\n/**\n * Defines an `HttpMiddleware` while preserving its precise type.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = middleware => middleware;\nconst loggerDisabledRequests = /*#__PURE__*/new WeakSet();\nconst stripSearchAndHash = url => {\n const queryIndex = url.indexOf(\"?\");\n const hashIndex = url.indexOf(\"#\");\n if (queryIndex === -1) {\n return hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n if (hashIndex === -1) {\n return url.slice(0, queryIndex);\n }\n return url.slice(0, Math.min(queryIndex, hashIndex));\n};\n/**\n * Runs an effect with HTTP response logging disabled for the current server request.\n *\n * @category Logger\n * @since 4.0.0\n */\nexport const withLoggerDisabled = self => Effect.withFiber(fiber => {\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n loggerDisabledRequests.add(request.source);\n return self;\n});\n/**\n * Context reference for a predicate that disables server-side tracing for matching requests.\n *\n * @category Tracer\n * @since 4.0.0\n */\nexport const TracerDisabledWhen = /*#__PURE__*/Context.Reference(\"effect/http/HttpMiddleware/TracerDisabledWhen\", {\n defaultValue: () => constFalse\n});\n/**\n * Creates a layer that disables server-side tracing for requests whose URL exactly matches one of the supplied URLs.\n *\n * @category Tracer\n * @since 4.0.0\n */\nexport const layerTracerDisabledForUrls = urls => Layer.succeed(TracerDisabledWhen)(req => urls.includes(req.url));\n/**\n * Context reference for generating server span names from HTTP server requests.\n *\n * @category Tracer\n * @since 4.0.0\n */\nexport const SpanNameGenerator = /*#__PURE__*/Context.Reference(\"@effect/platform/HttpMiddleware/SpanNameGenerator\", {\n defaultValue: () => request => `http.server ${request.method}`\n});\n/**\n * Middleware that logs sent HTTP responses with request method, request URL, and response status annotations.\n *\n * @category Logger\n * @since 4.0.0\n */\nexport const logger = /*#__PURE__*/make(httpApp => Effect.withFiber(fiber => {\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const path = stripSearchAndHash(request.url);\n return Effect.withLogSpan(Effect.flatMap(Effect.exit(httpApp), exit => {\n if (loggerDisabledRequests.has(request.source)) {\n return exit;\n } else if (exit._tag === \"Failure\") {\n const [response, cause] = causeResponseStripped(exit.cause);\n return Effect.andThen(Effect.annotateLogs(Effect.log(Option.getOrElse(cause, () => \"Sent HTTP Response\")), {\n \"http.method\": request.method,\n \"http.url\": path,\n \"http.status\": response.status\n }), exit);\n }\n return Effect.andThen(Effect.annotateLogs(Effect.log(\"Sent HTTP response\"), {\n \"http.method\": request.method,\n \"http.url\": path,\n \"http.status\": exit.value.status\n }), exit);\n }), \"http.span\");\n}));\n/**\n * Middleware that creates a server trace span for each request and records request and response HTTP attributes.\n *\n * @category Tracer\n * @since 4.0.0\n */\nexport const tracer = /*#__PURE__*/make(httpApp => Effect.withFiber(fiber => {\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const disabled = !fiber.getRef(TracerEnabled) || fiber.getRef(TracerDisabledWhen)(request);\n if (disabled) {\n return httpApp;\n }\n const nameGenerator = fiber.getRef(SpanNameGenerator);\n const span = internalEffect.makeSpanUnsafe(fiber, nameGenerator(request), {\n parent: Option.getOrUndefined(TraceContext.fromHeaders(request.headers)),\n kind: \"server\"\n });\n const prevServices = fiber.context;\n fiber.setContext(Context.add(fiber.context, ParentSpan, span));\n return Effect.onExitPrimitive(httpApp, exit => {\n fiber.setContext(prevServices);\n const endTime = fiber.getRef(Clock).currentTimeNanosUnsafe();\n fiber.currentDispatcher.scheduleTask(() => {\n const url = Request.toURL(request);\n if (Option.isSome(url) && (url.value.username !== \"\" || url.value.password !== \"\")) {\n url.value.username = \"REDACTED\";\n url.value.password = \"REDACTED\";\n }\n const redactedHeaderNames = fiber.getRef(Headers.CurrentRedactedNames);\n const requestHeaders = Headers.redact(request.headers, redactedHeaderNames);\n span.attribute(\"http.request.method\", request.method);\n if (Option.isSome(url)) {\n span.attribute(\"url.full\", url.value.toString());\n span.attribute(\"url.path\", url.value.pathname);\n const query = url.value.search.slice(1);\n if (query !== \"\") {\n span.attribute(\"url.query\", url.value.search.slice(1));\n }\n span.attribute(\"url.scheme\", url.value.protocol.slice(0, -1));\n }\n if (request.headers[\"user-agent\"] !== undefined) {\n span.attribute(\"user_agent.original\", request.headers[\"user-agent\"]);\n }\n for (const name in requestHeaders) {\n span.attribute(`http.request.header.${name}`, String(requestHeaders[name]));\n }\n if (Option.isSome(request.remoteAddress)) {\n span.attribute(\"client.address\", request.remoteAddress.value);\n }\n const response = exitResponse(exit);\n span.attribute(\"http.response.status_code\", response.status);\n const responseHeaders = Headers.redact(response.headers, redactedHeaderNames);\n for (const name in responseHeaders) {\n span.attribute(`http.response.header.${name}`, String(responseHeaders[name]));\n }\n span.end(endTime, exit);\n }, 0);\n return undefined;\n }, true);\n}));\n/**\n * Middleware that trusts `X-Forwarded-Host` and `X-Forwarded-For`, updating the request host header and remote address.\n *\n * @category Proxying\n * @since 4.0.0\n */\nexport const xForwardedHeaders = /*#__PURE__*/make(httpApp => Effect.updateService(httpApp, HttpServerRequest, request => request.headers[\"x-forwarded-host\"] ? request.modify({\n headers: Headers.set(request.headers, \"host\", request.headers[\"x-forwarded-host\"]),\n remoteAddress: Option.fromNullishOr(request.headers[\"x-forwarded-for\"]?.split(\",\")[0].trim())\n}) : request));\n/**\n * Middleware that parses the current request URL's search parameters and provides them as `ParsedSearchParams`.\n *\n * @category search params\n * @since 4.0.0\n */\nexport const searchParamsParser = httpApp => Effect.withFiber(fiber => {\n const services = fiber.context;\n const request = Context.getUnsafe(services, HttpServerRequest);\n const params = Request.searchParamsFromURL(new URL(request.originalUrl));\n return Effect.provideService(httpApp, Request.ParsedSearchParams, params);\n});\n/**\n * Middleware that handles CORS preflight requests and adds configured CORS headers to HTTP responses.\n *\n * @category CORS\n * @since 4.0.0\n */\nexport const cors = options => {\n const opts = {\n allowedOrigins: options?.allowedOrigins ?? [],\n allowedMethods: options?.allowedMethods ?? [\"GET\", \"HEAD\", \"PUT\", \"PATCH\", \"POST\", \"DELETE\"],\n allowedHeaders: options?.allowedHeaders ?? [],\n exposedHeaders: options?.exposedHeaders ?? [],\n credentials: options?.credentials ?? false,\n maxAge: options?.maxAge\n };\n const isAllowedOrigin = typeof opts.allowedOrigins === \"function\" ? opts.allowedOrigins : origin => opts.allowedOrigins.includes(origin);\n const allowOrigin = typeof opts.allowedOrigins === \"function\" || opts.allowedOrigins.length > 1 ? originHeader => {\n if (!isAllowedOrigin(originHeader)) return undefined;\n return {\n \"access-control-allow-origin\": originHeader,\n vary: \"Origin\"\n };\n } : opts.allowedOrigins.length === 0 ? constant({\n \"access-control-allow-origin\": \"*\"\n }) : constant({\n \"access-control-allow-origin\": opts.allowedOrigins[0],\n vary: \"Origin\"\n });\n const allowMethods = opts.allowedMethods.length > 0 ? {\n \"access-control-allow-methods\": opts.allowedMethods.join(\", \")\n } : undefined;\n const allowCredentials = opts.credentials ? {\n \"access-control-allow-credentials\": \"true\"\n } : undefined;\n const allowHeaders = accessControlRequestHeaders => {\n if (opts.allowedHeaders.length === 0 && accessControlRequestHeaders) {\n return {\n vary: \"Access-Control-Request-Headers\",\n \"access-control-allow-headers\": accessControlRequestHeaders\n };\n }\n if (opts.allowedHeaders) {\n return {\n \"access-control-allow-headers\": opts.allowedHeaders.join(\",\")\n };\n }\n return undefined;\n };\n const exposeHeaders = opts.exposedHeaders.length > 0 ? {\n \"access-control-expose-headers\": opts.exposedHeaders.join(\",\")\n } : undefined;\n const maxAge = opts.maxAge ? {\n \"access-control-max-age\": opts.maxAge.toString()\n } : undefined;\n const headersFromRequest = request => {\n const origin = request.headers[\"origin\"];\n return Headers.fromRecordUnsafe({\n ...allowOrigin(origin),\n ...allowCredentials,\n ...exposeHeaders\n });\n };\n const headersFromRequestOptions = request => {\n const origin = request.headers[\"origin\"];\n const accessControlRequestHeaders = request.headers[\"access-control-request-headers\"];\n return Headers.fromRecordUnsafe({\n ...allowOrigin(origin),\n ...allowCredentials,\n ...exposeHeaders,\n ...allowMethods,\n ...allowHeaders(accessControlRequestHeaders),\n ...maxAge\n });\n };\n const preResponseHandler = (request, response) => Effect.succeed(Response.setHeaders(response, headersFromRequest(request)));\n return httpApp => Effect.withFiber(fiber => {\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n if (request.method === \"OPTIONS\") {\n return Effect.succeed(Response.empty({\n status: 204,\n headers: headersFromRequestOptions(request)\n }));\n }\n appendPreResponseHandlerUnsafe(request, preResponseHandler);\n return httpApp;\n });\n};\n//# sourceMappingURL=HttpMiddleware.js.map",
37
+ "import * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Exit from \"../../Exit.js\";\nimport * as Fiber from \"../../Fiber.js\";\nimport { dual } from \"../../Function.js\";\nimport { reportCauseUnsafe } from \"../../internal/effect.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Scope from \"../../Scope.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as HttpBody from \"./HttpBody.js\";\nimport { tracer } from \"./HttpMiddleware.js\";\nimport { causeResponse, ClientAbort, HttpServerError, InternalError } from \"./HttpServerError.js\";\nimport { HttpServerRequest } from \"./HttpServerRequest.js\";\nimport * as Request from \"./HttpServerRequest.js\";\nimport * as Response from \"./HttpServerResponse.js\";\nimport { appendPreResponseHandlerUnsafe, requestPreResponseHandlers } from \"./internal/preResponseHandler.js\";\n/**\n * Runs an HTTP server effect, sends the produced response with the supplied handler, and converts failures into HTTP responses.\n *\n * @category combinators\n * @since 4.0.0\n */\nexport const toHandled = (self, handleResponse, middleware) => {\n const handleCause = cause => Effect.flatMapEager(causeResponse(cause), ([response, cause]) => {\n const fiber = Fiber.getCurrent();\n reportCauseUnsafe(fiber, cause);\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const handler = requestPreResponseHandlers.get(request.source);\n const cont = cause.reasons.length === 0 ? Effect.succeed(response) : Effect.failCause(cause);\n if (handler === undefined) {\n ;\n request[handledSymbol] = true;\n return Effect.flatMapEager(handleResponse(request, response), () => cont);\n }\n return Effect.flatMapEager(Effect.flatMapEager(handler(request, response), response => {\n ;\n request[handledSymbol] = true;\n return handleResponse(request, response);\n }), () => cont);\n });\n const responded = Effect.matchCauseEffect(self, {\n onSuccess: response => {\n const fiber = Fiber.getCurrent();\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const handler = requestPreResponseHandlers.get(request.source);\n if (handler === undefined) {\n ;\n request[handledSymbol] = true;\n return Effect.mapEager(handleResponse(request, response), () => response);\n }\n return Effect.flatMapEager(handler(request, response), sentResponse => {\n ;\n request[handledSymbol] = true;\n return Effect.mapEager(handleResponse(request, sentResponse), () => response);\n });\n },\n onFailure: handleCause\n });\n const withMiddleware = middleware === undefined ? tracer(responded) : Effect.matchCauseEffect(tracer(middleware(responded)), {\n onFailure(cause) {\n const fiber = Fiber.getCurrent();\n reportCauseUnsafe(fiber, cause);\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n if (handledSymbol in request) return Effect.void;\n return Effect.matchCauseEffectEager(causeResponse(cause), {\n onFailure(_) {\n return handleResponse(request, Response.empty({\n status: 500\n }));\n },\n onSuccess([response]) {\n return handleResponse(request, response);\n }\n });\n },\n onSuccess(response) {\n const fiber = Fiber.getCurrent();\n const request = Context.getUnsafe(fiber.context, Request.HttpServerRequest);\n return handledSymbol in request ? Effect.void : handleResponse(request, response);\n }\n });\n return Effect.uninterruptible(scoped(withMiddleware));\n};\nconst handledSymbol = /*#__PURE__*/Symbol.for(\"effect/http/HttpEffect/handled\");\n/**\n * Disables automatic closing for an HTTP request scope.\n *\n * **Gotchas**\n *\n * Use only when another owner will close the scope; otherwise resources attached\n * to the request scope can leak.\n *\n * @category resource management\n * @since 4.0.0\n */\nexport const scopeDisableClose = scope => {\n ;\n scope[scopeEjected] = true;\n};\n/**\n * Returns a streaming server response that closes the request scope when the body stream exits.\n *\n * @category resource management\n * @since 4.0.0\n */\nexport const scopeTransferToStream = response => {\n if (response.body._tag !== \"Stream\") {\n return response;\n }\n const fiber = Fiber.getCurrent();\n const scope = Context.getUnsafe(fiber.context, Scope.Scope);\n scopeDisableClose(scope);\n return Response.setBody(response, HttpBody.stream(Stream.onExit(response.body.stream, exit => Scope.close(scope, exit)), response.body.contentType, response.body.contentLength));\n};\nconst scopeEjected = /*#__PURE__*/Symbol.for(\"effect/http/HttpEffect/scopeEjected\");\nconst scoped = effect => Effect.withFiber(fiber => {\n const scope = Scope.makeUnsafe();\n const prevServices = fiber.context;\n fiber.setContext(Context.add(fiber.context, Scope.Scope, scope));\n return Effect.onExitPrimitive(effect, exit => {\n fiber.setContext(prevServices);\n if (scopeEjected in scope) return undefined;\n return Scope.closeUnsafe(scope, exit);\n }, true);\n});\n/**\n * Registers an additional pre-response handler for the current HTTP server request.\n *\n * @category fiber refs\n * @since 4.0.0\n */\nexport const appendPreResponseHandler = handler => HttpServerRequest.use(request => {\n appendPreResponseHandlerUnsafe(request, handler);\n return Effect.void;\n});\nexport {\n/**\n * Registers a pre-response handler for the supplied HTTP server request.\n *\n * @category fiber refs\n * @since 4.0.0\n */\nappendPreResponseHandlerUnsafe };\n/**\n * Runs an effect after registering a pre-response handler for the current HTTP server request.\n *\n * @category fiber refs\n * @since 4.0.0\n */\nexport const withPreResponseHandler = /*#__PURE__*/dual(2, (self, handler) => HttpServerRequest.use(request => {\n appendPreResponseHandlerUnsafe(request, handler);\n return self;\n}));\n/**\n * Converts an HTTP server effect into a Web `Request` handler using the supplied base context and optional middleware.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebHandlerWith = context => (self, middleware) => {\n const resolveSymbol = Symbol.for(\"@effect/platform/HttpApp/resolve\");\n const httpApp = toHandled(self, (request, response) => {\n response = scopeTransferToStream(response);\n request[resolveSymbol](Response.toWeb(response, {\n withoutBody: request.method === \"HEAD\",\n context\n }));\n return Effect.void;\n }, middleware);\n return (request, reqContext) => new Promise(resolve => {\n const contextMap = new Map(context.mapUnsafe);\n if (Context.isContext(reqContext)) {\n for (const [key, value] of reqContext.mapUnsafe) {\n contextMap.set(key, value);\n }\n }\n const httpServerRequest = Request.fromWeb(request);\n contextMap.set(HttpServerRequest.key, httpServerRequest);\n httpServerRequest[resolveSymbol] = resolve;\n const fiber = Effect.runForkWith(Context.makeUnsafe(contextMap))(httpApp);\n request.signal?.addEventListener(\"abort\", () => {\n fiber.interruptUnsafe(undefined, ClientAbort.annotation);\n }, {\n once: true\n });\n });\n};\n/**\n * Converts an HTTP server effect into a Web `Request` handler using an empty base context.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebHandler = /*#__PURE__*/toWebHandlerWith(/*#__PURE__*/Context.empty());\n/**\n * Builds a Web `Request` handler from a layer and handler factory, returning the handler with a `dispose` function for the layer scope.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebHandlerLayerWith = (layer, options) => {\n const scope = Scope.makeUnsafe();\n const dispose = () => Effect.runPromise(Scope.close(scope, Exit.void));\n let handlerCache;\n let handlerPromise;\n function handler(request, context) {\n if (handlerCache) {\n return handlerCache(request, context);\n }\n handlerPromise ??= Effect.runPromise(Effect.gen(function* () {\n const context = yield* options.memoMap ? Layer.buildWithMemoMap(layer, options.memoMap, scope) : Layer.buildWithScope(layer, scope);\n return handlerCache = toWebHandlerWith(context)(yield* options.toHandler(context), options.middleware);\n }));\n return handlerPromise.then(f => f(request, context));\n }\n return {\n dispose,\n handler: handler\n };\n};\n/**\n * Builds a Web `Request` handler for an HTTP server effect using a layer to provide its services, returning the handler with a `dispose` function.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const toWebHandlerLayer = (self, layer, options) => toWebHandlerLayerWith(layer, {\n ...options,\n toHandler: () => Effect.succeed(self)\n});\n/**\n * Adapts a Web `Request` handler into an HTTP server effect for the current `HttpServerRequest`.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const fromWebHandler = handler => Effect.callback((resume, signal) => {\n const fiber = Fiber.getCurrent();\n const request = Context.getUnsafe(fiber.context, HttpServerRequest);\n const requestResult = Request.toWebResult(request, {\n signal,\n context: fiber.context\n });\n if (requestResult._tag === \"Failure\") {\n return resume(Effect.fail(new HttpServerError({\n reason: requestResult.failure\n })));\n }\n handler(requestResult.success).then(response => resume(Effect.succeed(Response.fromWeb(response))), cause => resume(Effect.fail(new HttpServerError({\n reason: new InternalError({\n cause,\n request,\n description: \"HttpApp.fromWebHandler: Error in handler\"\n })\n }))));\n});\n//# sourceMappingURL=HttpEffect.js.map",
38
+ "/**\n * Layer-based server-side routing for Effect HTTP applications.\n *\n * `HttpRouter` collects routes and router middleware while an application layer\n * is being built, then exposes the registered route table as an\n * `HttpServerResponse` effect for each incoming `HttpServerRequest`. Use it for\n * APIs, webhooks, and Fetch handlers that want request-scoped services, schema\n * decoding, and typed middleware to participate in the same `Layer` graph as\n * the rest of the application.\n *\n * **Mental model**\n *\n * Route layers do not handle requests immediately. They register `Route` values\n * into the current `HttpRouter`; `serve`, `toHttpEffect`, and `toWebHandler`\n * build the layer, read the completed router, and run the matching handler for\n * each request. During a request, the router provides `HttpServerRequest`,\n * `Scope`, parsed search parameters, and `RouteContext`, so handlers can decode\n * path, search, and body data or access services supplied by router middleware.\n *\n * **Common tasks**\n *\n * - Register individual routes with `add` or batches with `addAll`.\n * - Group routes under a prefix with `addAll(..., { prefix })` or\n * `router.prefixed`.\n * - Decode route, search, and JSON body data with `schemaPathParams`,\n * `schemaParams`, `schemaNoBody`, and `schemaJson`.\n * - Apply route-scoped middleware with `middleware(...).layer`, or install\n * global router middleware for all routes.\n * - Serve the layer with `serve` or create a Fetch-compatible handler with\n * `toWebHandler`.\n *\n * **Gotchas**\n *\n * Paths must be absolute `/` paths or the wildcard `*`. `HEAD` falls back to\n * `GET`, and wildcard paths ending in `/*` also match the prefix path itself.\n * For prefixed routes the matched prefix is removed from\n * `HttpServerRequest.url` before the handler sees it. Middleware passed to\n * `serve` wraps the wider server chain; use router middleware when you need to\n * provide request dependencies, handle configured route errors, or change the\n * response that will be sent.\n *\n * @since 4.0.0\n */\nimport * as Arr from \"../../Array.js\";\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport { compose, dual, identity } from \"../../Function.js\";\nimport * as Layer from \"../../Layer.js\";\nimport * as Option from \"../../Option.js\";\nimport * as Schema from \"../../Schema.js\";\nimport * as Scope from \"../../Scope.js\";\nimport * as Tracer from \"../../Tracer.js\";\nimport * as FindMyWay from \"./FindMyWay.js\";\nimport * as HttpEffect from \"./HttpEffect.js\";\nimport * as HttpMiddleware from \"./HttpMiddleware.js\";\nimport * as HttpServer from \"./HttpServer.js\";\nimport * as HttpServerError from \"./HttpServerError.js\";\nimport * as HttpServerRequest from \"./HttpServerRequest.js\";\nimport * as HttpServerResponse from \"./HttpServerResponse.js\";\nconst TypeId = \"~effect/http/HttpRouter\";\n/**\n * Service tag for the HTTP router used while constructing an HTTP application.\n * Route and middleware layers require this service to register themselves with\n * the router.\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const HttpRouter = /*#__PURE__*/Context.Service(\"effect/http/HttpRouter\");\n/**\n * Constructs an empty `HttpRouter` service.\n *\n * **Details**\n *\n * The returned router accepts route and middleware registrations and later routes\n * the current `HttpServerRequest` to the matching `HttpServerResponse`.\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const make = /*#__PURE__*/Effect.gen(function* () {\n const router = FindMyWay.make(yield* RouterConfig);\n const middleware = new Set();\n const addAll = routes => Effect.contextWith(context => {\n const middleware = getMiddleware(context);\n const applyMiddleware = effect => {\n for (let i = 0; i < middleware.length; i++) {\n effect = middleware[i](effect);\n }\n return effect;\n };\n for (let i = 0; i < routes.length; i++) {\n const route = middleware.length === 0 ? routes[i] : makeRoute({\n ...routes[i],\n handler: applyMiddleware(routes[i].handler)\n });\n if (route.method === \"*\") {\n if (route.path.endsWith(\"/*\")) {\n router.all(route.path, route);\n router.all(route.path.slice(0, -2), route);\n } else {\n router.all(route.path, route);\n }\n } else {\n if (route.path.endsWith(\"/*\")) {\n router.on(route.method, route.path, route);\n router.on(route.method, route.path.slice(0, -2), route);\n } else {\n router.on(route.method, route.path, route);\n }\n }\n }\n return Effect.void;\n });\n return HttpRouter.of({\n [TypeId]: TypeId,\n prefixed(prefix) {\n return HttpRouter.of({\n ...this,\n prefixed: newPrefix => this.prefixed(prefixPath(prefix, newPrefix)),\n addAll: routes => addAll(routes.map(prefixRoute(prefix))),\n add: (method, path, handler, options) => addAll([makeRoute({\n method,\n path: prefixPath(path, prefix),\n handler: HttpServerResponse.isHttpServerResponse(handler) ? Effect.succeed(handler) : Effect.isEffect(handler) ? handler : Effect.flatMap(HttpServerRequest.HttpServerRequest, handler),\n uninterruptible: options?.uninterruptible ?? false,\n prefix\n })])\n });\n },\n addAll,\n add: (method, path, handler, options) => addAll([route(method, path, handler, options)]),\n addGlobalMiddleware: middleware_ => Effect.sync(() => {\n middleware.add(middleware_);\n }),\n asHttpEffect() {\n let handler = Effect.withFiber(fiber => {\n const contextMap = new Map(fiber.context.mapUnsafe);\n const request = contextMap.get(HttpServerRequest.HttpServerRequest.key);\n let result = router.find(request.method, request.url);\n if (result === undefined && request.method === \"HEAD\") {\n result = router.find(\"GET\", request.url);\n }\n if (result === undefined) {\n return Effect.fail(new HttpServerError.HttpServerError({\n reason: new HttpServerError.RouteNotFound({\n request\n })\n }));\n }\n const route = result.handler;\n if (Option.isSome(route.prefix)) {\n contextMap.set(HttpServerRequest.HttpServerRequest.key, sliceRequestUrl(request, route.prefix.value));\n }\n contextMap.set(HttpServerRequest.ParsedSearchParams.key, result.searchParams);\n contextMap.set(RouteContext.key, {\n route,\n params: result.params\n });\n const span = contextMap.get(Tracer.ParentSpan.key);\n if (span && span._tag === \"Span\") {\n span.attribute(\"http.route\", route.path);\n }\n return Effect.provideContext(route.uninterruptible ? route.handler : Effect.interruptible(route.handler), Context.makeUnsafe(contextMap));\n });\n if (middleware.size === 0) return handler;\n for (const fn of Arr.reverse(middleware)) {\n handler = fn(handler);\n }\n return handler;\n }\n });\n});\nfunction sliceRequestUrl(request, prefix) {\n const prefexLen = prefix.length;\n return request.modify({\n url: request.url.length <= prefexLen ? \"/\" : request.url.slice(prefexLen)\n });\n}\n/**\n * Context reference for low-level router configuration.\n *\n * **Details**\n *\n * The value is passed to the route matcher when an `HttpRouter` is created and\n * defaults to an empty configuration.\n *\n * @category configuration\n * @since 4.0.0\n */\nexport const RouterConfig = /*#__PURE__*/Context.Reference(\"effect/http/HttpRouter/RouterConfig\", {\n defaultValue: () => ({})\n});\n/**\n * Service for the matched HTTP route in the current request.\n *\n * **When to use**\n *\n * Use to read captured path parameters and route metadata while handling a\n * request matched by the router.\n *\n * **Details**\n *\n * It provides the route definition and the path parameters captured by the route\n * matcher.\n *\n * @category services\n * @since 4.0.0\n */\nexport class RouteContext extends /*#__PURE__*/Context.Service()(\"effect/http/HttpRouter/RouteContext\") {}\n/**\n * Effect that returns the path parameters captured for the current matched route.\n *\n * @category getters\n * @since 4.0.0\n */\nexport const params = /*#__PURE__*/Effect.map(RouteContext, _ => _.params);\n/**\n * Decodes a schema from the current request and its JSON body.\n *\n * **Details**\n *\n * The input passed to the schema includes the request method, URL, headers,\n * cookies, path parameters, search parameters, and parsed JSON body. The effect\n * fails if the body cannot be parsed or the schema decode fails.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaJson = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.contextWith(context => {\n const request = Context.get(context, HttpServerRequest.HttpServerRequest);\n const searchParams = Context.get(context, HttpServerRequest.ParsedSearchParams);\n const routeContext = Context.get(context, RouteContext);\n return Effect.flatMap(request.json, body => parse({\n method: request.method,\n url: request.url,\n headers: request.headers,\n cookies: request.cookies,\n pathParams: routeContext.params,\n searchParams,\n body\n }, options));\n });\n};\n/**\n * Decodes a schema from the current request without reading the request body.\n *\n * **Details**\n *\n * The input passed to the schema includes the request method, URL, headers,\n * cookies, path parameters, and search parameters.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaNoBody = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.contextWith(context => {\n const request = Context.get(context, HttpServerRequest.HttpServerRequest);\n const searchParams = Context.get(context, HttpServerRequest.ParsedSearchParams);\n const routeContext = Context.get(context, RouteContext);\n return parse({\n method: request.method,\n url: request.url,\n headers: request.headers,\n cookies: request.cookies,\n pathParams: routeContext.params,\n searchParams\n }, options);\n });\n};\n/**\n * Decodes a schema from the current route path parameters and search parameters.\n *\n * **Details**\n *\n * When the same key appears in both sources, the path parameter value is used.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaParams = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.contextWith(context => {\n const searchParams = Context.get(context, HttpServerRequest.ParsedSearchParams);\n const routeContext = Context.get(context, RouteContext);\n return parse({\n ...searchParams,\n ...routeContext.params\n }, options);\n });\n};\n/**\n * Decodes a schema from the path parameters captured for the current matched\n * route.\n *\n * @category schemas\n * @since 4.0.0\n */\nexport const schemaPathParams = (schema, options) => {\n const parse = Schema.decodeUnknownEffect(schema);\n return Effect.flatMap(params, _ => parse(_, options));\n};\n/**\n * Creates a layer that accesses the current `HttpRouter` service and runs the\n * supplied effect.\n *\n * **When to use**\n *\n * Use when you use it to register routes or middleware with the router during layer\n * construction.\n *\n * **Example** (Registering routes during layer construction)\n *\n * ```ts\n * import { Effect, Layer } from \"effect\"\n * import { HttpRouter } from \"effect/unstable/http\"\n *\n * const MyRoute = Layer.effectDiscard(Effect.gen(function*() {\n * const router = yield* HttpRouter.HttpRouter\n *\n * // then use `yield* router.add(...)` to add a route\n * }))\n * ```\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const use = f => Layer.effectDiscard(Effect.flatMap(HttpRouter, f));\n/**\n * Create a layer that adds a single route to the HTTP router.\n *\n * **Example** (Adding a GET route)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { HttpRouter, HttpServerResponse } from \"effect/unstable/http\"\n *\n * const Route = HttpRouter.add(\n * \"GET\",\n * \"/hello\",\n * Effect.succeed(HttpServerResponse.text(\"Hello, World!\"))\n * )\n * ```\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const add = (method, path, handler, options) => use(router => router.add(method, path, handler, options));\n/**\n * Create a layer that adds multiple routes to the HTTP router.\n *\n * **Example** (Adding multiple routes)\n *\n * ```ts\n * import { Effect } from \"effect\"\n * import { HttpRouter, HttpServerResponse } from \"effect/unstable/http\"\n *\n * const Routes = HttpRouter.addAll([\n * HttpRouter.route(\n * \"GET\",\n * \"/hello\",\n * Effect.succeed(HttpServerResponse.text(\"Hello, World!\"))\n * )\n * ])\n * ```\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const addAll = (routes, options) => Layer.effectDiscard(Effect.gen(function* () {\n const toAdd = Effect.isEffect(routes) ? yield* routes : routes;\n let router = yield* HttpRouter;\n if (options?.prefix) {\n router = router.prefixed(options.prefix);\n }\n yield* router.addAll(toAdd);\n}));\n/**\n * Layer that provides a newly constructed `HttpRouter`.\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/Layer.effect(HttpRouter)(make);\n/**\n * Builds an application layer with a router and returns the router as an HTTP\n * handler effect.\n *\n * **Details**\n *\n * The returned effect handles the current `HttpServerRequest` in the current\n * `Scope`; route request markers are converted into the ordinary requirements of\n * the returned handler.\n *\n * @category HttpRouter\n * @since 4.0.0\n */\nexport const toHttpEffect = appLayer => Effect.gen(function* () {\n const context = yield* Layer.build(Layer.provideMerge(appLayer, layer));\n const router = Context.get(context, HttpRouter);\n // @effect-diagnostics effect/returnEffectInGen:off\n return router.asHttpEffect();\n});\nconst RouteTypeId = \"~effect/http/HttpRouter/Route\";\nconst makeRoute = options => ({\n ...options,\n uninterruptible: options.uninterruptible ?? false,\n prefix: typeof options.prefix === \"string\" ? Option.some(options.prefix) : options.prefix ?? Option.none(),\n [RouteTypeId]: RouteTypeId\n});\n/**\n * Constructs a `Route` from an HTTP method, path, and handler.\n *\n * **Details**\n *\n * The handler may be a static response, an effect that produces a response, or a\n * function from the current request to a response effect. Set `uninterruptible` to\n * prevent the route handler from being made interruptible while it runs.\n *\n * @category Route\n * @since 4.0.0\n */\nexport const route = (method, path, handler, options) => makeRoute({\n ...options,\n method,\n path,\n handler: HttpServerResponse.isHttpServerResponse(handler) ? Effect.succeed(handler) : Effect.isEffect(handler) ? handler : Effect.flatMap(HttpServerRequest.HttpServerRequest, handler),\n uninterruptible: options?.uninterruptible ?? false\n});\nconst removeTrailingSlash = path => path.endsWith(\"/\") ? path.slice(0, -1) : path;\n/**\n * Adds a path prefix to a route path.\n *\n * **Details**\n *\n * Trailing slashes are removed from the prefix; `/` becomes the prefix itself and\n * `*` becomes a wildcard route under the prefix.\n *\n * @category PathInput\n * @since 4.0.0\n */\nexport const prefixPath = /*#__PURE__*/dual(2, (self, prefix) => {\n prefix = removeTrailingSlash(prefix);\n if (self === \"*\") return `${prefix}/*`;else if (self === \"/\") return prefix;\n return prefix + self;\n});\n/**\n * Returns a copy of a route with its path prefixed.\n *\n * **Details**\n *\n * The prefix is also tracked on the route so that, when the route handles a\n * request, the matched prefix can be removed from the request URL seen by the\n * handler.\n *\n * @category Route\n * @since 4.0.0\n */\nexport const prefixRoute = /*#__PURE__*/dual(2, (self, prefix) => makeRoute({\n ...self,\n path: prefixPath(self.path, prefix),\n prefix: Option.match(self.prefix, {\n onNone: () => prefix,\n onSome: existingPrefix => prefixPath(existingPrefix, prefix)\n })\n}));\nconst MiddlewareTypeId = \"~effect/http/HttpRouter/Middleware\";\n/**\n * Create a middleware layer that can be used to modify requests and responses.\n *\n * **Details**\n *\n * By default, the middleware only affects the routes that it is provided to.\n *\n * If you want to create a middleware that applies globally to all routes, pass\n * the `global` option as `true`.\n *\n * **Example** (Applying route and global middleware)\n *\n * ```ts\n * import { Context, Effect, Layer } from \"effect\"\n * import { HttpMiddleware, HttpRouter, HttpServerResponse } from \"effect/unstable/http\"\n *\n * // Here we are defining a CORS middleware\n * const CorsMiddleware = HttpRouter.middleware(HttpMiddleware.cors()).layer\n * // You can also use HttpRouter.cors() to create a CORS middleware\n *\n * class CurrentSession extends Context.Service<CurrentSession, {\n * readonly token: string\n * }>()(\"CurrentSession\") {}\n *\n * // You can create middleware that provides a service to the HTTP requests.\n * const SessionMiddleware = HttpRouter.middleware<{\n * provides: CurrentSession\n * }>()(\n * Effect.gen(function*() {\n * yield* Effect.log(\"SessionMiddleware initialized\")\n *\n * return (httpEffect) =>\n * Effect.provideService(httpEffect, CurrentSession, {\n * token: \"dummy-token\"\n * })\n * })\n * ).layer\n *\n * Effect.gen(function*() {\n * const router = yield* HttpRouter.HttpRouter\n * yield* router.add(\n * \"GET\",\n * \"/hello\",\n * Effect.gen(function*() {\n * // Requests can now access the current session\n * const session = yield* CurrentSession\n * return HttpServerResponse.text(\n * `Hello, World! Your token is ${session.token}`\n * )\n * })\n * )\n * }).pipe(\n * Layer.effectDiscard,\n * // Provide the SessionMiddleware & CorsMiddleware to some routes\n * Layer.provide([SessionMiddleware, CorsMiddleware])\n * )\n * ```\n *\n * @category middleware\n * @since 4.0.0\n */\nexport const middleware = function () {\n if (arguments.length === 0) {\n return makeMiddleware;\n }\n return makeMiddleware(arguments[0], arguments[1]);\n};\nconst makeMiddleware = (middleware, options) => options?.global ? Layer.effectDiscard(Effect.gen(function* () {\n const router = yield* HttpRouter;\n const fn = Effect.isEffect(middleware) ? yield* middleware : middleware;\n yield* router.addGlobalMiddleware(fn);\n})) : new MiddlewareImpl(Effect.isEffect(middleware) ? Layer.effectContext(Effect.map(middleware, fn => Context.makeUnsafe(new Map([[fnContextKey, fn]])))) : Layer.succeedContext(Context.makeUnsafe(new Map([[fnContextKey, middleware]]))));\nlet middlewareId = 0;\nconst fnContextKey = \"effect/http/HttpRouter/MiddlewareFn\";\nclass MiddlewareImpl {\n [MiddlewareTypeId] = {};\n layerFn;\n dependencies;\n constructor(layerFn, dependencies) {\n this.layerFn = layerFn;\n this.dependencies = dependencies;\n const contextKey = `effect/http/HttpRouter/Middleware-${++middlewareId}`;\n this.layer = Layer.effectContext(Effect.gen({\n self: this\n }, function* () {\n const context = yield* Effect.context();\n const stack = [context.mapUnsafe.get(fnContextKey)];\n if (this.dependencies) {\n const memoMap = yield* Layer.CurrentMemoMap;\n const scope = Context.get(context, Scope.Scope);\n const depsContext = yield* Layer.buildWithMemoMap(this.dependencies, memoMap, scope);\n stack.push(...getMiddleware(depsContext));\n }\n return Context.makeUnsafe(new Map([[contextKey, stack]]));\n })).pipe(Layer.provide(this.layerFn));\n }\n layer;\n combine(other) {\n return new MiddlewareImpl(this.layerFn, this.dependencies ? Layer.provideMerge(this.dependencies, other.layer) : other.layer);\n }\n}\nconst middlewareCache = /*#__PURE__*/new WeakMap();\nconst getMiddleware = context => {\n let arr = middlewareCache.get(context);\n if (arr) return arr;\n const topLevel = Arr.empty();\n let maxLength = 0;\n for (const [key, value] of context.mapUnsafe) {\n if (key.startsWith(\"effect/http/HttpRouter/Middleware-\")) {\n topLevel.push(value);\n if (value.length > maxLength) {\n maxLength = value.length;\n }\n }\n }\n if (topLevel.length === 0) {\n arr = [];\n } else {\n const middleware = new Set();\n for (let i = maxLength - 1; i >= 0; i--) {\n for (const arr of topLevel) {\n if (i < arr.length) {\n middleware.add(arr[i]);\n }\n }\n }\n arr = Arr.fromIterable(middleware).reverse();\n }\n middlewareCache.set(context, arr);\n return arr;\n};\n/**\n * Middleware that applies CORS headers to the HTTP response.\n *\n * @category middleware\n * @since 4.0.0\n */\nexport const cors = options => middleware(HttpMiddleware.cors(options), {\n global: true\n});\n/**\n * Middleware that disables the logger for some routes.\n *\n * **Example** (Disabling route logging)\n *\n * ```ts\n * import { Effect, Layer } from \"effect\"\n * import { HttpRouter, HttpServerResponse } from \"effect/unstable/http\"\n *\n * const Route = HttpRouter.add(\n * \"GET\",\n * \"/hello\",\n * Effect.succeed(HttpServerResponse.text(\"Hello, World!\"))\n * ).pipe(\n * // disable the logger for this route\n * Layer.provide(HttpRouter.disableLogger)\n * )\n * ```\n *\n * @category middleware\n * @since 4.0.0\n */\nexport const disableLogger = /*#__PURE__*/middleware(HttpMiddleware.withLoggerDisabled).layer;\n/**\n * Provides request-level dependencies to some routes.\n *\n * @category middleware\n * @since 4.0.0\n */\nexport const provideRequest = layer => self => Layer.provide(self, middleware()(Effect.gen(function* () {\n const services = yield* Layer.build(layer);\n return effect => Effect.provideContext(effect, services);\n})).layer);\n/**\n * Runs the provided application layer as an HTTP server.\n *\n * @category server\n * @since 4.0.0\n */\nexport const serve = (appLayer, options) => {\n let middleware = options?.middleware;\n if (options?.disableLogger !== true) {\n middleware = middleware ? compose(middleware, HttpMiddleware.logger) : HttpMiddleware.logger;\n }\n const RouterLayer = options?.routerConfig ? Layer.provide(layer, Layer.succeed(RouterConfig)(options.routerConfig)) : layer;\n return Effect.gen(function* () {\n const router = yield* HttpRouter;\n const handler = router.asHttpEffect();\n return middleware ? HttpServer.serve(handler, middleware) : HttpServer.serve(handler);\n }).pipe(Layer.unwrap, Layer.provideMerge(appLayer), Layer.provide(RouterLayer), options?.disableListenLog ? identity : HttpServer.withLogAddress);\n};\n/**\n * Builds a Fetch-compatible request handler from an HTTP router application\n * layer.\n *\n * **Details**\n *\n * The result contains a `handler` function that converts Web `Request` values to\n * Web `Response` values and a `dispose` function for releasing the layer\n * resources.\n *\n * @category server\n * @since 4.0.0\n */\nexport const toWebHandler = (appLayer, options) => {\n let middleware = options?.middleware;\n if (options?.disableLogger !== true) {\n middleware = middleware ? compose(middleware, HttpMiddleware.logger) : HttpMiddleware.logger;\n }\n const RouterLayer = options?.routerConfig ? Layer.provide(layer, Layer.succeed(RouterConfig)(options.routerConfig)) : layer;\n return HttpEffect.toWebHandlerLayerWith(Layer.provideMerge(appLayer, RouterLayer), {\n toHandler: s => Effect.succeed(Context.get(s, HttpRouter).asHttpEffect()),\n middleware,\n memoMap: options?.memoMap\n });\n};\n//# sourceMappingURL=HttpRouter.js.map",
39
+ "/**\n * Fetch-based implementation of the Effect HTTP client service.\n *\n * This module provides an `HttpClient` layer that executes requests through a\n * Web Fetch API implementation. It is the transport to use in browsers, edge\n * runtimes, and Node.js environments where `globalThis.fetch` is available, or\n * anywhere a compatible fetch function can be supplied.\n *\n * **Mental model**\n *\n * `layer` installs an `HttpClient` whose runtime boundary is a call to `fetch`.\n * The `Fetch` reference chooses the fetch function and defaults to\n * `globalThis.fetch`. The `RequestInit` service supplies default fetch options\n * such as credentials, redirects, cache behavior, or other platform-specific\n * settings. Request-specific method, headers, body, and abort signal are written\n * by the client for each call.\n *\n * **Common tasks**\n *\n * Provide `layer` when an Effect program should run outbound HTTP through the\n * current platform. Override `Fetch` in tests or custom runtimes to capture\n * requests or route them to a different implementation. Provide `RequestInit`\n * when all requests made by this client should share fetch defaults.\n *\n * **Gotchas**\n *\n * Fetch behavior is platform behavior: CORS, cookies, redirect handling, aborts,\n * and streaming support can differ across runtimes. Stream request bodies are\n * sent as Web streams with `duplex: \"half\"` for runtimes that require it, and\n * `content-length` is removed so fetch can manage body framing.\n *\n * @since 4.0.0\n */\nimport * as Context from \"../../Context.js\";\nimport * as Effect from \"../../Effect.js\";\nimport * as Stream from \"../../Stream.js\";\nimport * as Headers from \"./Headers.js\";\nimport * as HttpClient from \"./HttpClient.js\";\nimport * as HttpClientError from \"./HttpClientError.js\";\nimport * as HttpClientResponse from \"./HttpClientResponse.js\";\n/**\n * Context reference for the `fetch` implementation used by the fetch-based HTTP client.\n *\n * **Details**\n *\n * Defaults to `globalThis.fetch`.\n *\n * @category services\n * @since 4.0.0\n */\nexport const Fetch = /*#__PURE__*/Context.Reference(\"effect/http/FetchHttpClient/Fetch\", {\n defaultValue: () => globalThis.fetch\n});\n/**\n * Service that contains default fetch options for the fetch-based HTTP client.\n *\n * **When to use**\n *\n * Use to provide default credentials, cache, redirect, integrity, or other\n * fetch options for outgoing HTTP requests.\n *\n * **Details**\n *\n * Request-specific method, headers, body, and abort signal are supplied by the client when a request is executed.\n *\n * @category services\n * @since 4.0.0\n */\nexport class RequestInit extends /*#__PURE__*/Context.Service()(\"effect/http/FetchHttpClient/RequestInit\") {}\nconst fetch = /*#__PURE__*/HttpClient.make((request, url, signal, fiber) => {\n const fetch = fiber.getRef(Fetch);\n const options = fiber.context.mapUnsafe.get(RequestInit.key) ?? {};\n let headers = options.headers ? Headers.merge(Headers.fromInput(options.headers), request.headers) : request.headers;\n if (headers[\"content-length\"]) {\n headers = Headers.remove(headers, \"content-length\");\n }\n const send = body => Effect.map(Effect.tryPromise({\n try: () => fetch(url, {\n ...options,\n method: request.method,\n headers,\n body,\n duplex: request.body._tag === \"Stream\" ? \"half\" : undefined,\n signal\n }),\n catch: cause => new HttpClientError.HttpClientError({\n reason: new HttpClientError.TransportError({\n request,\n cause\n })\n })\n }), response => HttpClientResponse.fromWeb(request, response));\n switch (request.body._tag) {\n case \"Raw\":\n case \"Uint8Array\":\n return send(request.body.body);\n case \"FormData\":\n return send(request.body.formData);\n case \"Stream\":\n return Effect.flatMap(Stream.toReadableStreamEffect(request.body.stream), send);\n }\n return send(undefined);\n});\n/**\n * Layer that provides an `HttpClient` implementation backed by the configured\n * `Fetch` function.\n *\n * **When to use**\n *\n * Use when an Effect program should execute `HttpClient` requests through the\n * platform `fetch` implementation, especially in browser, edge, or Node.js\n * runtimes with `globalThis.fetch`.\n *\n * **Details**\n *\n * The layer uses the current `Fetch` reference and optional `RequestInit`\n * service for each request. Request-specific method, headers, body, and abort\n * signal are supplied by the client and override matching `RequestInit` fields.\n *\n * **Gotchas**\n *\n * Fetch behavior comes from the runtime's implementation, so CORS, cookies,\n * redirects, abort handling, and streaming support can vary by platform. Stream\n * request bodies are sent as Web streams with `duplex: \"half\"`, and any\n * `content-length` header is removed before calling `fetch`.\n *\n * @see {@link Fetch} for supplying the fetch implementation used by this layer\n * @see {@link RequestInit} for default `RequestInit` options applied before request-specific fields\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/HttpClient.layerMergedContext(/*#__PURE__*/Effect.succeed(fetch));\n//# sourceMappingURL=FetchHttpClient.js.map",
40
+ "import path from \"path\"\nimport fs from \"fs/promises\"\nimport { xdgData, xdgCache, xdgConfig, xdgState } from \"xdg-basedir\"\nimport os from \"os\"\nimport { Context, Effect, Layer } from \"effect\"\nimport { Flock } from \"./util/flock\"\nimport { Flag } from \"./flag/flag\"\n\nconst app = \"opencode\"\nconst data = path.join(xdgData!, app)\nconst cache = path.join(xdgCache!, app)\nconst config = path.join(xdgConfig!, app)\nconst state = path.join(xdgState!, app)\nconst tmp = path.join(os.tmpdir(), app)\n\nconst paths = {\n get home() {\n return process.env.OPENCODE_TEST_HOME ?? os.homedir()\n },\n data,\n bin: path.join(cache, \"bin\"),\n log: path.join(data, \"log\"),\n repos: path.join(data, \"repos\"),\n cache,\n config,\n state,\n tmp,\n}\n\nexport const Path = paths\n\nFlock.setGlobal({ state })\n\nawait Promise.all([\n fs.mkdir(Path.data, { recursive: true }),\n fs.mkdir(Path.config, { recursive: true }),\n fs.mkdir(Path.state, { recursive: true }),\n fs.mkdir(Path.tmp, { recursive: true }),\n fs.mkdir(Path.log, { recursive: true }),\n fs.mkdir(Path.bin, { recursive: true }),\n fs.mkdir(Path.repos, { recursive: true }),\n])\n\nexport class Service extends Context.Service<Service, Interface>()(\"@opencode/Global\") {}\n\nexport interface Interface {\n readonly home: string\n readonly data: string\n readonly cache: string\n readonly config: string\n readonly state: string\n readonly tmp: string\n readonly bin: string\n readonly log: string\n readonly repos: string\n}\n\nexport function make(input: Partial<Interface> = {}): Interface {\n return {\n home: Path.home,\n data: Path.data,\n cache: Path.cache,\n config: Flag.OPENCODE_CONFIG_DIR ?? Path.config,\n state: Path.state,\n tmp: Path.tmp,\n bin: Path.bin,\n log: Path.log,\n repos: Path.repos,\n ...input,\n }\n}\n\nexport const layer = Layer.effect(\n Service,\n Effect.sync(() => Service.of(make())),\n)\n\nexport const defaultLayer = layer\n\nexport const layerWith = (input: Partial<Interface>) =>\n Layer.effect(\n Service,\n Effect.sync(() => Service.of(make(input))),\n )\n\nexport * as Global from \"./global\"\n",
41
+ "import os from 'os';\nimport path from 'path';\n\nconst homeDirectory = os.homedir();\nconst {env} = process;\n\nexport const xdgData = env.XDG_DATA_HOME ||\n\t(homeDirectory ? path.join(homeDirectory, '.local', 'share') : undefined);\n\nexport const xdgConfig = env.XDG_CONFIG_HOME ||\n\t(homeDirectory ? path.join(homeDirectory, '.config') : undefined);\n\nexport const xdgState = env.XDG_STATE_HOME ||\n\t(homeDirectory ? path.join(homeDirectory, '.local', 'state') : undefined);\n\nexport const xdgCache = env.XDG_CACHE_HOME || (homeDirectory ? path.join(homeDirectory, '.cache') : undefined);\n\nexport const xdgRuntime = env.XDG_RUNTIME_DIR || undefined;\n\nexport const xdgDataDirectories = (env.XDG_DATA_DIRS || '/usr/local/share/:/usr/share/').split(':');\n\nif (xdgData) {\n\txdgDataDirectories.unshift(xdgData);\n}\n\nexport const xdgConfigDirectories = (env.XDG_CONFIG_DIRS || '/etc/xdg').split(':');\n\nif (xdgConfig) {\n\txdgConfigDirectories.unshift(xdgConfig);\n}\n",
42
+ "import path from \"path\"\nimport os from \"os\"\nimport { randomBytes, randomUUID } from \"crypto\"\nimport { mkdir, readFile, rm, stat, utimes, writeFile } from \"fs/promises\"\nimport { Hash } from \"./hash\"\nimport { Effect } from \"effect\"\n\nexport type FlockGlobal = {\n state: string\n}\n\nexport namespace Flock {\n let global: FlockGlobal | undefined\n\n export function setGlobal(g: FlockGlobal) {\n global = g\n }\n\n const root = () => {\n if (!global) throw new Error(\"Flock global not set\")\n return path.join(global.state, \"locks\")\n }\n\n // Defaults for callers that do not provide timing options.\n const defaultOpts = {\n staleMs: 60_000,\n timeoutMs: 5 * 60_000,\n baseDelayMs: 100,\n maxDelayMs: 2_000,\n }\n\n export interface WaitEvent {\n key: string\n attempt: number\n delay: number\n waited: number\n }\n\n export type Wait = (input: WaitEvent) => void | Promise<void>\n\n export interface Options {\n dir?: string\n signal?: AbortSignal\n staleMs?: number\n timeoutMs?: number\n baseDelayMs?: number\n maxDelayMs?: number\n onWait?: Wait\n }\n\n type Opts = {\n staleMs: number\n timeoutMs: number\n baseDelayMs: number\n maxDelayMs: number\n }\n\n type Owned = {\n acquired: true\n startHeartbeat: (intervalMs?: number) => void\n release: () => Promise<void>\n }\n\n export interface Lease {\n release: () => Promise<void>\n [Symbol.asyncDispose]: () => Promise<void>\n }\n\n function code(err: unknown) {\n if (typeof err !== \"object\" || err === null || !(\"code\" in err)) return\n const value = err.code\n if (typeof value !== \"string\") return\n return value\n }\n\n function sleep(ms: number, signal?: AbortSignal) {\n return new Promise<void>((resolve, reject) => {\n if (signal?.aborted) {\n reject(signal.reason ?? new Error(\"Aborted\"))\n return\n }\n\n let timer: NodeJS.Timeout | undefined\n\n const done = () => {\n signal?.removeEventListener(\"abort\", abort)\n resolve()\n }\n\n const abort = () => {\n if (timer) {\n clearTimeout(timer)\n }\n signal?.removeEventListener(\"abort\", abort)\n reject(signal?.reason ?? new Error(\"Aborted\"))\n }\n\n signal?.addEventListener(\"abort\", abort, { once: true })\n timer = setTimeout(done, ms)\n })\n }\n\n function jitter(ms: number) {\n const j = Math.floor(ms * 0.3)\n const d = Math.floor(Math.random() * (2 * j + 1)) - j\n return Math.max(0, ms + d)\n }\n\n function mono() {\n return performance.now()\n }\n\n function wall() {\n return performance.timeOrigin + mono()\n }\n\n async function stats(file: string) {\n try {\n return await stat(file)\n } catch (err) {\n const errCode = code(err)\n if (errCode === \"ENOENT\" || errCode === \"ENOTDIR\") return\n throw err\n }\n }\n\n async function stale(lockDir: string, heartbeatPath: string, metaPath: string, staleMs: number) {\n // Stale detection allows automatic recovery after crashed owners.\n const now = wall()\n const heartbeat = await stats(heartbeatPath)\n if (heartbeat) {\n return now - heartbeat.mtimeMs > staleMs\n }\n\n const meta = await stats(metaPath)\n if (meta) {\n return now - meta.mtimeMs > staleMs\n }\n\n const dir = await stats(lockDir)\n if (!dir) {\n return false\n }\n\n return now - dir.mtimeMs > staleMs\n }\n\n async function tryAcquireLockDir(lockDir: string, opts: Opts): Promise<Owned | { acquired: false }> {\n const token = randomUUID?.() ?? randomBytes(16).toString(\"hex\")\n const metaPath = path.join(lockDir, \"meta.json\")\n const heartbeatPath = path.join(lockDir, \"heartbeat\")\n\n try {\n await mkdir(lockDir, { mode: 0o700 })\n } catch (err) {\n if (code(err) !== \"EEXIST\") {\n throw err\n }\n\n if (!(await stale(lockDir, heartbeatPath, metaPath, opts.staleMs))) {\n return { acquired: false }\n }\n\n const breakerPath = lockDir + \".breaker\"\n try {\n await mkdir(breakerPath, { mode: 0o700 })\n } catch (claimErr) {\n const errCode = code(claimErr)\n if (errCode === \"EEXIST\") {\n const breaker = await stats(breakerPath)\n if (breaker && wall() - breaker.mtimeMs > opts.staleMs) {\n await rm(breakerPath, { recursive: true, force: true }).catch(() => undefined)\n }\n return { acquired: false }\n }\n\n if (errCode === \"ENOENT\" || errCode === \"ENOTDIR\") {\n return { acquired: false }\n }\n\n throw claimErr\n }\n\n try {\n // Breaker ownership ensures only one contender performs stale cleanup.\n if (!(await stale(lockDir, heartbeatPath, metaPath, opts.staleMs))) {\n return { acquired: false }\n }\n\n await rm(lockDir, { recursive: true, force: true })\n\n try {\n await mkdir(lockDir, { mode: 0o700 })\n } catch (retryErr) {\n const errCode = code(retryErr)\n if (errCode === \"EEXIST\" || errCode === \"ENOTEMPTY\") {\n return { acquired: false }\n }\n throw retryErr\n }\n } finally {\n await rm(breakerPath, { recursive: true, force: true }).catch(() => undefined)\n }\n }\n\n const meta = {\n token,\n pid: process.pid,\n hostname: os.hostname(),\n createdAt: new Date().toISOString(),\n }\n\n await writeFile(heartbeatPath, \"\", { flag: \"wx\" }).catch(async () => {\n await rm(lockDir, { recursive: true, force: true })\n throw new Error(\"Lock acquired but heartbeat already existed (possible compromise).\")\n })\n\n await writeFile(metaPath, JSON.stringify(meta, null, 2), { flag: \"wx\" }).catch(async () => {\n await rm(lockDir, { recursive: true, force: true })\n throw new Error(\"Lock acquired but meta.json already existed (possible compromise).\")\n })\n\n let timer: NodeJS.Timeout | undefined\n\n const startHeartbeat = (intervalMs = Math.max(100, Math.floor(opts.staleMs / 3))) => {\n if (timer) return\n // Heartbeat prevents long critical sections from being evicted as stale.\n timer = setInterval(() => {\n const t = new Date()\n void utimes(heartbeatPath, t, t).catch(() => undefined)\n }, intervalMs)\n timer.unref?.()\n }\n\n const release = async () => {\n if (timer) {\n clearInterval(timer)\n timer = undefined\n }\n\n const current = await readFile(metaPath, \"utf8\")\n .then((raw) => {\n const parsed = JSON.parse(raw)\n if (!parsed || typeof parsed !== \"object\") return {}\n return {\n token: \"token\" in parsed && typeof parsed.token === \"string\" ? parsed.token : undefined,\n }\n })\n .catch((err) => {\n const errCode = code(err)\n if (errCode === \"ENOENT\" || errCode === \"ENOTDIR\") {\n throw new Error(\"Refusing to release: lock is compromised (metadata missing).\")\n }\n if (err instanceof SyntaxError) {\n throw new Error(\"Refusing to release: lock is compromised (metadata invalid).\")\n }\n throw err\n })\n // Token check prevents deleting a lock that was re-acquired by another process.\n if (current.token !== token) {\n throw new Error(\"Refusing to release: lock token mismatch (not the owner).\")\n }\n\n await rm(lockDir, { recursive: true, force: true })\n }\n\n return {\n acquired: true,\n startHeartbeat,\n release,\n }\n }\n\n async function acquireLockDir(\n lockDir: string,\n input: { key: string; onWait?: Wait; signal?: AbortSignal },\n opts: Opts,\n ) {\n const stop = mono() + opts.timeoutMs\n let attempt = 0\n let waited = 0\n let delay = opts.baseDelayMs\n\n while (true) {\n input.signal?.throwIfAborted()\n\n const res = await tryAcquireLockDir(lockDir, opts)\n if (res.acquired) {\n return res\n }\n\n if (mono() > stop) {\n throw new Error(`Timed out waiting for lock: ${input.key}`)\n }\n\n attempt += 1\n const ms = jitter(delay)\n await input.onWait?.({\n key: input.key,\n attempt,\n delay: ms,\n waited,\n })\n await sleep(ms, input.signal)\n waited += ms\n delay = Math.min(opts.maxDelayMs, Math.floor(delay * 1.7))\n }\n }\n\n export async function acquire(key: string, input: Options = {}): Promise<Lease> {\n input.signal?.throwIfAborted()\n const cfg: Opts = {\n staleMs: input.staleMs ?? defaultOpts.staleMs,\n timeoutMs: input.timeoutMs ?? defaultOpts.timeoutMs,\n baseDelayMs: input.baseDelayMs ?? defaultOpts.baseDelayMs,\n maxDelayMs: input.maxDelayMs ?? defaultOpts.maxDelayMs,\n }\n const dir = input.dir ?? root()\n\n await mkdir(dir, { recursive: true })\n const lockfile = path.join(dir, Hash.fast(key) + \".lock\")\n const lock = await acquireLockDir(\n lockfile,\n {\n key,\n onWait: input.onWait,\n signal: input.signal,\n },\n cfg,\n )\n lock.startHeartbeat()\n\n const release = () => lock.release()\n return {\n release,\n [Symbol.asyncDispose]() {\n return release()\n },\n }\n }\n\n export async function withLock<T>(key: string, fn: () => Promise<T>, input: Options = {}) {\n await using _ = await acquire(key, input)\n input.signal?.throwIfAborted()\n return await fn()\n }\n\n export const effect = Effect.fn(\"Flock.effect\")(function* (key: string, input: Options = {}) {\n return yield* Effect.acquireRelease(\n Effect.promise((signal) => Flock.acquire(key, { ...input, signal })).pipe(\n Effect.withSpan(\"Flock.acquire\", {\n attributes: { key },\n }),\n ),\n (lock) => Effect.promise(() => lock.release()).pipe(Effect.withSpan(\"Flock.release\")),\n ).pipe(Effect.asVoid)\n })\n}\n",
43
+ "import { createHash } from \"crypto\"\n\nexport namespace Hash {\n export function fast(input: string | Buffer): string {\n return createHash(\"sha1\").update(input).digest(\"hex\")\n }\n\n export function sha256(input: string | Buffer): string {\n return createHash(\"sha256\").update(input).digest(\"hex\")\n }\n}\n",
44
+ "import { Config } from \"effect\"\n\nexport function truthy(key: string) {\n const value = process.env[key]?.toLowerCase()\n return value === \"true\" || value === \"1\"\n}\n\nconst copy = process.env[\"OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT\"]\n\nfunction enabledByExperimental(key: string) {\n return process.env[key] === undefined ? truthy(\"OPENCODE_EXPERIMENTAL\") : truthy(key)\n}\n\nexport const Flag = {\n OTEL_EXPORTER_OTLP_ENDPOINT: process.env[\"OTEL_EXPORTER_OTLP_ENDPOINT\"],\n OTEL_EXPORTER_OTLP_HEADERS: process.env[\"OTEL_EXPORTER_OTLP_HEADERS\"],\n\n OPENCODE_AUTO_HEAP_SNAPSHOT: truthy(\"OPENCODE_AUTO_HEAP_SNAPSHOT\"),\n OPENCODE_GIT_BASH_PATH: process.env[\"OPENCODE_GIT_BASH_PATH\"],\n OPENCODE_CONFIG: process.env[\"OPENCODE_CONFIG\"],\n OPENCODE_CONFIG_CONTENT: process.env[\"OPENCODE_CONFIG_CONTENT\"],\n OPENCODE_DISABLE_AUTOUPDATE: truthy(\"OPENCODE_DISABLE_AUTOUPDATE\"),\n OPENCODE_ALWAYS_NOTIFY_UPDATE: truthy(\"OPENCODE_ALWAYS_NOTIFY_UPDATE\"),\n OPENCODE_DISABLE_PRUNE: truthy(\"OPENCODE_DISABLE_PRUNE\"),\n OPENCODE_DISABLE_TERMINAL_TITLE: truthy(\"OPENCODE_DISABLE_TERMINAL_TITLE\"),\n OPENCODE_SHOW_TTFD: truthy(\"OPENCODE_SHOW_TTFD\"),\n OPENCODE_DISABLE_AUTOCOMPACT: truthy(\"OPENCODE_DISABLE_AUTOCOMPACT\"),\n OPENCODE_DISABLE_MODELS_FETCH: truthy(\"OPENCODE_DISABLE_MODELS_FETCH\"),\n OPENCODE_DISABLE_MOUSE: truthy(\"OPENCODE_DISABLE_MOUSE\"),\n OPENCODE_FAKE_VCS: process.env[\"OPENCODE_FAKE_VCS\"],\n OPENCODE_SERVER_PASSWORD: process.env[\"OPENCODE_SERVER_PASSWORD\"],\n OPENCODE_SERVER_USERNAME: process.env[\"OPENCODE_SERVER_USERNAME\"],\n\n // Experimental\n OPENCODE_EXPERIMENTAL_FILEWATCHER: Config.boolean(\"OPENCODE_EXPERIMENTAL_FILEWATCHER\").pipe(\n Config.withDefault(false),\n ),\n OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: Config.boolean(\"OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER\").pipe(\n Config.withDefault(false),\n ),\n OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT:\n copy === undefined ? process.platform === \"win32\" : truthy(\"OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT\"),\n OPENCODE_MODELS_URL: process.env[\"OPENCODE_MODELS_URL\"],\n OPENCODE_MODELS_PATH: process.env[\"OPENCODE_MODELS_PATH\"],\n OPENCODE_DB: process.env[\"OPENCODE_DB\"],\n\n OPENCODE_WORKSPACE_ID: process.env[\"OPENCODE_WORKSPACE_ID\"],\n OPENCODE_EXPERIMENTAL_WORKSPACES: enabledByExperimental(\"OPENCODE_EXPERIMENTAL_WORKSPACES\"),\n OPENCODE_EXPERIMENTAL_SESSION_SWITCHER: enabledByExperimental(\"OPENCODE_EXPERIMENTAL_SESSION_SWITCHER\"),\n\n // Evaluated at access time (not module load) because tests, the CLI, and\n // external tooling set these env vars at runtime.\n get OPENCODE_DISABLE_PROJECT_CONFIG() {\n return truthy(\"OPENCODE_DISABLE_PROJECT_CONFIG\")\n },\n get OPENCODE_EXPERIMENTAL_REFERENCES() {\n return enabledByExperimental(\"OPENCODE_EXPERIMENTAL_REFERENCES\")\n },\n get OPENCODE_TUI_CONFIG() {\n return process.env[\"OPENCODE_TUI_CONFIG\"]\n },\n get OPENCODE_CONFIG_DIR() {\n return process.env[\"OPENCODE_CONFIG_DIR\"]\n },\n get OPENCODE_PURE() {\n return truthy(\"OPENCODE_PURE\")\n },\n get OPENCODE_PERMISSION() {\n return process.env[\"OPENCODE_PERMISSION\"]\n },\n get OPENCODE_PLUGIN_META_FILE() {\n return process.env[\"OPENCODE_PLUGIN_META_FILE\"]\n },\n get OPENCODE_CLIENT() {\n return process.env[\"OPENCODE_CLIENT\"] ?? \"cli\"\n },\n}\n",
45
+ "declare global {\n const OPENCODE_VERSION: string\n const OPENCODE_CHANNEL: string\n}\n\nexport const InstallationVersion = typeof OPENCODE_VERSION === \"string\" ? OPENCODE_VERSION : \"local\"\nexport const InstallationChannel = typeof OPENCODE_CHANNEL === \"string\" ? OPENCODE_CHANNEL : \"local\"\nexport const InstallationLocal = InstallationChannel === \"local\"\n",
46
+ "/**\n * Service contract for process standard input, output, error output, and\n * command-line arguments.\n *\n * `Stdio` lets command-line programs depend on standard I/O through the Effect\n * environment instead of reading from or writing to global process handles\n * directly. The service exposes arguments as an `Effect`, stdout and stderr as\n * `Sink`s that accept strings or bytes, and stdin as a byte `Stream`.\n *\n * **Mental model**\n *\n * Application code describes what it needs from standard I/O, and a runtime\n * layer supplies the concrete streams. Platform packages provide real process\n * implementations, while tests can use `Stdio.layerTest` to replace only the\n * fields that matter for a scenario and keep the rest inert.\n *\n * **Common tasks**\n *\n * - Read command-line arguments from the service's `args` effect.\n * - Write text or bytes by running values into the service's `stdout()` or\n * `stderr()` sinks.\n * - Consume `stdin` as a stream of `Uint8Array` chunks.\n * - Build deterministic tests with `Stdio.layerTest`.\n *\n * **Gotchas**\n *\n * Standard I/O is a platform capability. Reads and writes can fail with\n * `PlatformError`, so handle failures in the Effect error channel instead of\n * assuming the process streams are always available.\n *\n * @since 4.0.0\n */\nimport * as Context from \"./Context.js\";\nimport * as Effect from \"./Effect.js\";\nimport * as Layer from \"./Layer.js\";\nimport * as Sink from \"./Sink.js\";\nimport * as Stream from \"./Stream.js\";\n/**\n * Runtime identifier stored on `Stdio` service implementations.\n *\n * **Details**\n *\n * This marker is part of the runtime representation of `Stdio` service\n * implementations.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~effect/Stdio\";\n/**\n * Service tag for process standard I/O.\n *\n * **When to use**\n *\n * Use when an effect needs command-line arguments or standard I/O streams\n * supplied by its environment.\n *\n * @see {@link make} for constructing a `Stdio` service directly\n * @see {@link layerTest} for a test layer with defaults and overrides\n *\n * @category services\n * @since 4.0.0\n */\nexport const Stdio = /*#__PURE__*/Context.Service(TypeId);\n/**\n * Creates a `Stdio` service implementation from the provided fields and\n * attaches the `Stdio` type identifier.\n *\n * **When to use**\n *\n * Use to assemble a concrete `Stdio` service when you already have\n * implementations for command-line arguments, standard output, standard error,\n * and standard input.\n *\n * **Details**\n *\n * The returned service reuses the supplied fields unchanged and only adds the\n * `Stdio` type identifier; it does not create a `Layer` or provide defaults.\n *\n * @see {@link layerTest} for a test layer with default fields that can be overridden\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = options => ({\n [TypeId]: TypeId,\n ...options\n});\n/**\n * Creates a test layer for `Stdio`.\n *\n * **When to use**\n *\n * Use to provide deterministic standard I/O in tests while overriding only the\n * command-line arguments, input stream, or output sinks relevant to the case.\n *\n * **Details**\n *\n * Any provided fields override defaults. By default, arguments are empty,\n * standard output and error are draining sinks, and standard input is an empty\n * stream.\n *\n * @see {@link make} for constructing a `Stdio` service directly without a `Layer` or defaults\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerTest = impl => Layer.succeed(Stdio, make({\n args: Effect.succeed([]),\n stdout: () => Sink.drain,\n stderr: () => Sink.drain,\n stdin: Stream.empty,\n ...impl\n}));\n//# sourceMappingURL=Stdio.js.map",
47
+ "import * as Context from \"./Context.js\";\nimport * as Predicate from \"./Predicate.js\";\nimport * as Schema from \"./Schema.js\";\nconst TypeId = \"~effect/platform/Terminal\";\nconst QuitErrorTypeId = \"effect/platform/Terminal/QuitError\";\n/**\n * Represents an error that occurs when a user attempts to\n * quit out of a `Terminal` prompt for input (usually by entering `ctrl`+`c`).\n *\n * **When to use**\n *\n * Use when implementing terminal input or prompts that need to signal\n * user-requested cancellation through the typed error channel.\n *\n * @see {@link isQuitError} for checking unknown errors when handling terminal cancellation\n *\n * @category QuitError\n * @since 4.0.0\n */\nexport class QuitError extends /*#__PURE__*/Schema.ErrorClass(\"QuitError\")({\n _tag: /*#__PURE__*/Schema.tag(\"QuitError\")\n}) {\n /**\n * Marks this value as a terminal quit error for runtime guards.\n *\n * @since 4.0.0\n */\n [QuitErrorTypeId] = QuitErrorTypeId;\n}\n/**\n * Returns `true` if the provided value is a `Terminal.QuitError`.\n *\n * **When to use**\n *\n * Use to narrow unknown failures to `QuitError` when handling terminal input\n * cancellation.\n *\n * **Details**\n *\n * Returns `true` when the value carries the `QuitError` runtime marker and\n * narrows it to `QuitError`.\n *\n * @see {@link QuitError} for the error value produced when terminal input is quit\n *\n * @category guards\n * @since 4.0.0\n */\nexport const isQuitError = u => Predicate.hasProperty(u, QuitErrorTypeId);\n/**\n * Service tag for command-line input and output services.\n *\n * **When to use**\n *\n * Use to access or provide platform terminal capabilities such as reading\n * input, writing output, and inspecting terminal dimensions.\n *\n * @category services\n * @since 4.0.0\n */\nexport const Terminal = /*#__PURE__*/Context.Service(\"effect/platform/Terminal\");\n/**\n * Creates a `Terminal` service implementation.\n *\n * **When to use**\n *\n * Use to construct a custom `Terminal` service implementation from concrete\n * terminal capabilities when writing a platform adapter, test implementation,\n * or custom runtime service.\n *\n * **Details**\n *\n * The implementation object supplies `columns`, `rows`, `readInput`,\n * `readLine`, and `display`; `make` attaches the `Terminal` service marker so\n * the result can be provided through the `Terminal` context service.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = impl => Terminal.of({\n ...impl,\n [TypeId]: TypeId\n});\n//# sourceMappingURL=Terminal.js.map"
48
+ ],
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