claude-code-best 1.4.4 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (423) hide show
  1. package/README.md +1 -0
  2. package/dist/{chunk-n18n51gd.js → chunk-07hgsrrj.js} +61 -65
  3. package/dist/{chunk-10cw48wr.js → chunk-08s2vf8j.js} +51 -52
  4. package/dist/{chunk-8zx2v88n.js → chunk-099vkedx.js} +2 -2
  5. package/dist/{chunk-bvzn7axc.js → chunk-0bbrkswa.js} +1 -1
  6. package/dist/{chunk-9k46vkdf.js → chunk-0bqtrr6h.js} +55 -56
  7. package/dist/{chunk-kbzh54rh.js → chunk-0g5qnby7.js} +6 -6
  8. package/dist/{chunk-g558vggk.js → chunk-0h1mmmrb.js} +15 -15
  9. package/dist/{chunk-z2e401ww.js → chunk-0j7426hg.js} +2 -2
  10. package/dist/{chunk-0z0m6mm5.js → chunk-0k1jmtw9.js} +2 -2
  11. package/dist/{chunk-478xh8c9.js → chunk-0k5v3m41.js} +49 -50
  12. package/dist/chunk-0kd8mq8j.js +36 -0
  13. package/dist/{chunk-3fp4s54c.js → chunk-0n0ca69d.js} +8 -8
  14. package/dist/{chunk-zn7egynp.js → chunk-0qakcnby.js} +47 -48
  15. package/dist/chunk-0s7za42b.js +14 -0
  16. package/dist/{chunk-xf0t82rg.js → chunk-0tmg91b1.js} +47 -48
  17. package/dist/{chunk-hrg9vq6p.js → chunk-0v20v2af.js} +3 -3
  18. package/dist/{chunk-d9280rcs.js → chunk-0v2awzd5.js} +1 -1
  19. package/dist/{chunk-8cx4mvde.js → chunk-0v590295.js} +148 -148
  20. package/dist/{chunk-g540y6p8.js → chunk-0va3y97h.js} +50 -51
  21. package/dist/{chunk-r26enj81.js → chunk-0vcpjqz5.js} +18 -18
  22. package/dist/{chunk-ay9nh032.js → chunk-0vvk6tv4.js} +15 -15
  23. package/dist/{chunk-76qapcaf.js → chunk-0w957a33.js} +50 -51
  24. package/dist/{chunk-rygn25nx.js → chunk-0wtwnyvg.js} +1 -1
  25. package/dist/chunk-0xereag4.js +173 -0
  26. package/dist/{chunk-00xx1rmz.js → chunk-0z5j99bj.js} +16 -16
  27. package/dist/{chunk-6bd8brc4.js → chunk-0zkw14gq.js} +3 -3
  28. package/dist/{chunk-jfhmk1c6.js → chunk-13zdd5e6.js} +38 -32
  29. package/dist/{chunk-xm9ccpyh.js → chunk-16gq8x0y.js} +49 -50
  30. package/dist/{chunk-cxqaz5vr.js → chunk-19gdjrk6.js} +3 -3
  31. package/dist/{chunk-strvbymz.js → chunk-1dym9vfh.js} +37 -31
  32. package/dist/chunk-1g68v32a.js +17 -0
  33. package/dist/{chunk-w0tvdc6h.js → chunk-1k83dgjb.js} +49 -50
  34. package/dist/{chunk-k9cthr5h.js → chunk-1kr4x0ec.js} +16 -16
  35. package/dist/chunk-1v0q0tce.js +104 -0
  36. package/dist/{chunk-f84rfz6r.js → chunk-1y0w6mjw.js} +48 -49
  37. package/dist/{chunk-gjfa8v40.js → chunk-1ymrygy1.js} +3 -3
  38. package/dist/{chunk-3ckfamg7.js → chunk-1zzfvmmk.js} +47 -48
  39. package/dist/{chunk-305t7jww.js → chunk-23j983cf.js} +48 -49
  40. package/dist/{chunk-2885j676.js → chunk-25xrykpm.js} +47 -48
  41. package/dist/{chunk-cjbw6hsq.js → chunk-26yzm962.js} +47 -48
  42. package/dist/{chunk-p6zhv3fj.js → chunk-279m39zm.js} +2 -2
  43. package/dist/chunk-27an25fd.js +118 -0
  44. package/dist/{chunk-c9js3490.js → chunk-2br81xts.js} +13 -13
  45. package/dist/chunk-2eftymgs.js +70 -0
  46. package/dist/{chunk-4th8hz38.js → chunk-2n53zm0g.js} +1 -1
  47. package/dist/{chunk-xt73r8zj.js → chunk-2ppy5p0x.js} +1 -1
  48. package/dist/chunk-2rhny2td.js +542 -0
  49. package/dist/{chunk-f3gcmncr.js → chunk-2s2z24wm.js} +47 -48
  50. package/dist/{chunk-mkq4vynt.js → chunk-2tt7xc2t.js} +2 -2
  51. package/dist/{chunk-ar1mw8p5.js → chunk-2wy13rhe.js} +14 -14
  52. package/dist/{chunk-1y0e25vy.js → chunk-2xx8f4qv.js} +4 -4
  53. package/dist/{chunk-sqmb5zqp.js → chunk-32mtrtm4.js} +48 -49
  54. package/dist/{chunk-wjhhetv4.js → chunk-32vdb088.js} +208 -202
  55. package/dist/{chunk-03qpgz7e.js → chunk-36yypykx.js} +2151 -2124
  56. package/dist/{chunk-8vs3nfx4.js → chunk-381w6mma.js} +1 -1
  57. package/dist/{chunk-5hd0n4kc.js → chunk-3cghr0yw.js} +47 -48
  58. package/dist/chunk-3dpdscmt.js +5332 -0
  59. package/dist/{chunk-x8s52epd.js → chunk-3dv5ctj4.js} +48 -49
  60. package/dist/{chunk-wcjz1zkw.js → chunk-3es5r0dx.js} +48 -49
  61. package/dist/chunk-3fapt8z5.js +3686 -0
  62. package/dist/{chunk-9eq853s5.js → chunk-3gpxmzz8.js} +3 -3
  63. package/dist/{chunk-jg2ngavx.js → chunk-3xh6v618.js} +47 -48
  64. package/dist/{chunk-9n28jzta.js → chunk-3xw21x85.js} +2 -2
  65. package/dist/{chunk-0wj5655r.js → chunk-3zyt28ea.js} +14 -14
  66. package/dist/{chunk-6k55dfby.js → chunk-40d286da.js} +5 -5
  67. package/dist/{chunk-d0ss5j5q.js → chunk-42k22r18.js} +1 -1
  68. package/dist/{chunk-5dvmrn7n.js → chunk-456m81he.js} +47 -48
  69. package/dist/{chunk-cm7cxa22.js → chunk-46bqcdpf.js} +5 -5
  70. package/dist/{chunk-w61znt0r.js → chunk-4b5peb6p.js} +7 -7
  71. package/dist/chunk-4cfcpzb1.js +25 -0
  72. package/dist/chunk-4ch5vxv6.js +55 -0
  73. package/dist/chunk-4drj3c7m.js +9 -0
  74. package/dist/{chunk-6ara055f.js → chunk-4h5zefyh.js} +48 -49
  75. package/dist/{chunk-65149q8s.js → chunk-4n6tnssg.js} +75 -50
  76. package/dist/{chunk-tj662ss5.js → chunk-4pr3ph3g.js} +14 -14
  77. package/dist/{chunk-kxht28q6.js → chunk-4sahp0qz.js} +93 -101
  78. package/dist/{chunk-sxceea76.js → chunk-4ymyjjq9.js} +6 -6
  79. package/dist/{chunk-9q2y2zh1.js → chunk-50ykc5qt.js} +2 -2
  80. package/dist/{chunk-m751vrjc.js → chunk-53dr4k73.js} +3 -3
  81. package/dist/chunk-58fwsj1y.js +718 -0
  82. package/dist/chunk-59dp4z1p.js +157 -0
  83. package/dist/chunk-5b4v2zkf.js +1095 -0
  84. package/dist/{chunk-d16pe6q0.js → chunk-5c62s229.js} +14 -14
  85. package/dist/{chunk-pvvn6rs5.js → chunk-5f4n0ywb.js} +48 -49
  86. package/dist/{chunk-dx7e3yvb.js → chunk-5gv4sshz.js} +47 -48
  87. package/dist/{chunk-xerkzn28.js → chunk-5m6942nd.js} +5 -5
  88. package/dist/{chunk-ykr5qx9v.js → chunk-5nccnh01.js} +123 -103
  89. package/dist/{chunk-5n479b51.js → chunk-5q5xcm1a.js} +47 -48
  90. package/dist/{chunk-9x6kxrmf.js → chunk-5wq9nsdc.js} +3 -3
  91. package/dist/{chunk-tfsfw21c.js → chunk-5x2nq6b9.js} +55 -58
  92. package/dist/{chunk-br2fc21h.js → chunk-5y6k4xrs.js} +2 -2
  93. package/dist/{chunk-yvt4w0wr.js → chunk-63q03fkn.js} +47 -48
  94. package/dist/{chunk-6ybnndcm.js → chunk-65w3ek1a.js} +17 -17
  95. package/dist/{chunk-c81b5e4c.js → chunk-67w1zken.js} +16 -16
  96. package/dist/{chunk-xq9xqjsc.js → chunk-6ccsyy1d.js} +1 -1
  97. package/dist/{chunk-fhfp2q8c.js → chunk-6ct7fh1v.js} +3 -3
  98. package/dist/{chunk-4nv4wh05.js → chunk-6d1y8a8t.js} +2 -2
  99. package/dist/{chunk-4t6p7q4x.js → chunk-6dcmw81a.js} +22 -22
  100. package/dist/{chunk-25x89wym.js → chunk-6eb1nz6v.js} +3 -3
  101. package/dist/{chunk-z2zk7g57.js → chunk-6frqd366.js} +50 -51
  102. package/dist/chunk-6m81e182.js +81 -0
  103. package/dist/{chunk-j6k3zjb5.js → chunk-6ns89pft.js} +25 -17
  104. package/dist/chunk-6vqkv5g7.js +256 -0
  105. package/dist/{chunk-qk1txvrw.js → chunk-6weddn5h.js} +49 -50
  106. package/dist/{chunk-3n6xcqc2.js → chunk-7a6r0k3m.js} +47 -48
  107. package/dist/{chunk-e4an0rhr.js → chunk-7b2e9e81.js} +15 -17
  108. package/dist/{chunk-d5qv71vm.js → chunk-7bc12031.js} +14 -12
  109. package/dist/{chunk-cjjq2j2b.js → chunk-7brvkna2.js} +53 -54
  110. package/dist/{chunk-yqy9m4km.js → chunk-7bs8swa2.js} +7 -7
  111. package/dist/{chunk-t53aq97s.js → chunk-7dgqzj7h.js} +50 -51
  112. package/dist/{chunk-maf8nerb.js → chunk-7dk4m49a.js} +48 -49
  113. package/dist/{chunk-y7py934d.js → chunk-7e9hc8ce.js} +52 -53
  114. package/dist/{chunk-90wp6wez.js → chunk-7ebcff63.js} +2 -2
  115. package/dist/{chunk-t5dxb7t7.js → chunk-7ecg65mr.js} +1 -1
  116. package/dist/{chunk-zttmdag3.js → chunk-7fht54sw.js} +1 -1
  117. package/dist/{chunk-j5kvrt9y.js → chunk-7j845cqe.js} +47 -48
  118. package/dist/chunk-7jk88vww.js +782 -0
  119. package/dist/{chunk-rwzm45v5.js → chunk-7kfb7tqj.js} +2 -2
  120. package/dist/{chunk-rbkhemh9.js → chunk-7p437ydk.js} +37 -31
  121. package/dist/{chunk-a9zh40sj.js → chunk-7q7h7msb.js} +3 -3
  122. package/dist/{chunk-rpp3r30z.js → chunk-7ye0arvq.js} +1 -1
  123. package/dist/{chunk-db7qenhh.js → chunk-7z17cw4h.js} +47 -48
  124. package/dist/{chunk-hxc8e6wd.js → chunk-7zrkp054.js} +2 -2
  125. package/dist/chunk-82jkr65n.js +16 -0
  126. package/dist/{chunk-xh0gfn3x.js → chunk-838naekw.js} +2 -2
  127. package/dist/{chunk-5wsvwc5e.js → chunk-879maaae.js} +47 -48
  128. package/dist/chunk-87zgmycv.js +65 -0
  129. package/dist/{chunk-qfbttb4x.js → chunk-8shx4hgv.js} +48 -49
  130. package/dist/{chunk-eh2p7txn.js → chunk-8vt2rmzz.js} +52 -53
  131. package/dist/{chunk-ndq2y6sc.js → chunk-8wmyjwn2.js} +2 -2
  132. package/dist/{chunk-27ezf4tc.js → chunk-8wq0z465.js} +1 -1
  133. package/dist/{chunk-p74998st.js → chunk-8ym1t31g.js} +53 -54
  134. package/dist/{chunk-vazn9zr8.js → chunk-8z33fy5n.js} +49 -50
  135. package/dist/chunk-91abjr1g.js +29 -0
  136. package/dist/{chunk-g649rtg8.js → chunk-9230kmx2.js} +7 -6
  137. package/dist/{chunk-s39ksgef.js → chunk-93qhgq6p.js} +1 -1
  138. package/dist/{chunk-m0pkp5ga.js → chunk-9629mtdz.js} +1 -1
  139. package/dist/{chunk-kttp77s8.js → chunk-9b04n6d1.js} +1 -1
  140. package/dist/{chunk-pw8kw48d.js → chunk-9fpha2xv.js} +6 -6
  141. package/dist/{chunk-469hyn07.js → chunk-9stsxjba.js} +4 -4
  142. package/dist/{chunk-0mvnb624.js → chunk-9t7nxd80.js} +1 -1
  143. package/dist/{chunk-b9xq4536.js → chunk-9vebtp7v.js} +52 -53
  144. package/dist/{chunk-3ktg0bfz.js → chunk-a7kdj8mj.js} +54 -55
  145. package/dist/{chunk-6jpdf1q6.js → chunk-acts7vdr.js} +10 -10
  146. package/dist/{chunk-2p4y0dj6.js → chunk-adgamch7.js} +57 -60
  147. package/dist/{chunk-hnq3w6tx.js → chunk-ahebrd5y.js} +5 -5
  148. package/dist/{chunk-fngdgt2f.js → chunk-am5cn48y.js} +4 -4
  149. package/dist/{chunk-5q056cze.js → chunk-apwjfffr.js} +1 -1
  150. package/dist/{chunk-wv700xtn.js → chunk-ayn250r2.js} +16 -16
  151. package/dist/chunk-b0bk6bxs.js +742 -0
  152. package/dist/{chunk-c358prbg.js → chunk-b0yyp8et.js} +4210 -253
  153. package/dist/{chunk-ce0sqtyk.js → chunk-bg3zs6s3.js} +1 -1
  154. package/dist/chunk-btnvjcc5.js +15 -0
  155. package/dist/{chunk-32gxxymn.js → chunk-by7nh2js.js} +18 -18
  156. package/dist/{chunk-3g4s34f4.js → chunk-c0yhh86m.js} +3 -3
  157. package/dist/{chunk-d7zw0dtv.js → chunk-c68754tz.js} +5 -5
  158. package/dist/chunk-cga5sq7g.js +41 -0
  159. package/dist/{chunk-jstky2ff.js → chunk-cjzk6t5c.js} +1 -1
  160. package/dist/chunk-ck06sqpy.js +220 -0
  161. package/dist/{chunk-mffjgywd.js → chunk-ck3q71vq.js} +2 -2
  162. package/dist/{chunk-gtzjdd18.js → chunk-cqbkd5ec.js} +3 -3
  163. package/dist/{chunk-3sbbxqm9.js → chunk-cqym51bf.js} +6 -6
  164. package/dist/{chunk-8rd1b3jk.js → chunk-cvqjhmqj.js} +56 -57
  165. package/dist/{chunk-5re3kwbc.js → chunk-cxy1ed0h.js} +3 -3
  166. package/dist/{chunk-a4c4m0nx.js → chunk-czjvd1xh.js} +91 -1806
  167. package/dist/{chunk-91fs1ha7.js → chunk-d0hj14fq.js} +65 -66
  168. package/dist/{chunk-66a2h4gk.js → chunk-d2kj6nek.js} +2 -2
  169. package/dist/{chunk-dtxakwbd.js → chunk-d37y1qja.js} +53 -54
  170. package/dist/{chunk-j6e8g1ms.js → chunk-d4x13kaa.js} +53 -54
  171. package/dist/{chunk-1npsp555.js → chunk-d6kw0esk.js} +1200 -161
  172. package/dist/{chunk-f7qkp4ha.js → chunk-d7jqw171.js} +47 -48
  173. package/dist/{chunk-f4htq4m4.js → chunk-d7xarb4w.js} +50 -51
  174. package/dist/{chunk-mq1c3epq.js → chunk-db3pr49y.js} +1 -1
  175. package/dist/{chunk-f3absj1f.js → chunk-dbfg6qhf.js} +2 -2
  176. package/dist/{chunk-evv7sxhw.js → chunk-dcs7myc3.js} +7 -7
  177. package/dist/{chunk-796a9b0z.js → chunk-ddyjgjpq.js} +47 -48
  178. package/dist/chunk-dgv19cce.js +183 -0
  179. package/dist/{chunk-t7v7can7.js → chunk-djrgjmyj.js} +1 -1
  180. package/dist/{chunk-sj43vmjm.js → chunk-djye5k50.js} +56 -59
  181. package/dist/{chunk-zkskmsjq.js → chunk-dknvhgkn.js} +3 -3
  182. package/dist/{chunk-s2t3qrte.js → chunk-drth8ce0.js} +1 -1
  183. package/dist/{chunk-p20wvv03.js → chunk-dt26hy6y.js} +1 -1
  184. package/dist/{chunk-xxr3cssg.js → chunk-dw5n6pr6.js} +47 -48
  185. package/dist/{chunk-ze6zvkg6.js → chunk-dxcr07z5.js} +4 -4
  186. package/dist/{chunk-szxy7bkh.js → chunk-dz32qcdd.js} +1 -1
  187. package/dist/chunk-e2cwk4hm.js +1185 -0
  188. package/dist/{chunk-52008rca.js → chunk-e50jgy7e.js} +14 -14
  189. package/dist/{chunk-xcmxx87m.js → chunk-e6trsfsm.js} +47 -48
  190. package/dist/{chunk-kfxyghyf.js → chunk-e6x5rpgx.js} +2 -2
  191. package/dist/{chunk-gkjcnxfe.js → chunk-e84ydbsq.js} +49 -50
  192. package/dist/{chunk-s9wgk88b.js → chunk-e96pr3z1.js} +48 -49
  193. package/dist/{chunk-7b9jrkee.js → chunk-eaawf61a.js} +47 -48
  194. package/dist/{chunk-hfntc659.js → chunk-eck5mjcw.js} +47 -48
  195. package/dist/{chunk-vtnfq4vf.js → chunk-egtb28zm.js} +233 -256
  196. package/dist/chunk-enhtm7h3.js +1731 -0
  197. package/dist/{chunk-47agtw2e.js → chunk-ep3h3f40.js} +47 -48
  198. package/dist/{chunk-8x8n4xxy.js → chunk-eqrxxgwx.js} +47 -48
  199. package/dist/chunk-es6y15pn.js +42 -0
  200. package/dist/{chunk-g9rvvqdy.js → chunk-etjwrq2s.js} +27 -27
  201. package/dist/{chunk-5der176s.js → chunk-ezbeckn3.js} +74 -51
  202. package/dist/{chunk-3fqxcp51.js → chunk-f109n77b.js} +14 -12
  203. package/dist/{chunk-kw1hpgh9.js → chunk-f29erv6g.js} +1 -1
  204. package/dist/{chunk-wvpvhk63.js → chunk-f3hyhcgd.js} +48 -49
  205. package/dist/{chunk-tcwv6fd9.js → chunk-fc9we717.js} +57 -60
  206. package/dist/{chunk-djydtvkr.js → chunk-fekynwj1.js} +505 -211
  207. package/dist/{chunk-tjr7qjpt.js → chunk-fks8ej56.js} +49 -50
  208. package/dist/{chunk-q56tkhgr.js → chunk-frwxzq55.js} +47 -48
  209. package/dist/{chunk-tkvg1xnr.js → chunk-ftdfvq1w.js} +4 -4
  210. package/dist/{chunk-w4pyvjtz.js → chunk-fx0xd0ex.js} +4 -4
  211. package/dist/{chunk-xpsb3jm8.js → chunk-fx52a9s2.js} +1 -1
  212. package/dist/{chunk-94xzz1fg.js → chunk-fxgt3m0a.js} +47 -48
  213. package/dist/{chunk-rh6936pj.js → chunk-fxm5s7sf.js} +15 -15
  214. package/dist/{chunk-j08qxq0d.js → chunk-fy2qr4hw.js} +48 -49
  215. package/dist/{chunk-5aw4k8fc.js → chunk-fz395yre.js} +1 -1
  216. package/dist/{chunk-hxy8h592.js → chunk-g0pmcggh.js} +2 -2
  217. package/dist/{chunk-20dbexrf.js → chunk-g45rr3sj.js} +1 -1
  218. package/dist/{chunk-q27bsq0y.js → chunk-g5kf8gsq.js} +4 -4
  219. package/dist/{chunk-7578r1rd.js → chunk-g9p7fypd.js} +47 -48
  220. package/dist/{chunk-ep17krqe.js → chunk-gbjhmjds.js} +9 -35
  221. package/dist/chunk-gd1ye7ef.js +168 -0
  222. package/dist/{chunk-y9pjq9h1.js → chunk-gfmss0fm.js} +15 -15
  223. package/dist/{chunk-ez10rk09.js → chunk-gg7ay6js.js} +47 -48
  224. package/dist/{chunk-777vk9pb.js → chunk-gk6v4y3r.js} +36 -32
  225. package/dist/{chunk-6hb097d3.js → chunk-gpgcar7e.js} +49 -50
  226. package/dist/{chunk-vtvxtdmq.js → chunk-gps4nmr6.js} +47 -48
  227. package/dist/{chunk-20n52jxv.js → chunk-gsa7bq8w.js} +6 -8
  228. package/dist/{chunk-7e7cb0t6.js → chunk-gsh55gb1.js} +2 -2
  229. package/dist/{chunk-094n6jd6.js → chunk-gv7bchnx.js} +47 -48
  230. package/dist/{chunk-fmadtbcm.js → chunk-gvg7arvr.js} +47 -48
  231. package/dist/chunk-gxnyeps9.js +3 -3
  232. package/dist/{chunk-xw38vjj4.js → chunk-gy5rfgd4.js} +6 -6
  233. package/dist/{chunk-ma9s7ycf.js → chunk-gzsnwa2e.js} +2 -2
  234. package/dist/{chunk-4qqswajh.js → chunk-h2vxyvpa.js} +12 -14
  235. package/dist/{chunk-f8ad6drq.js → chunk-h9dtsc52.js} +51 -53
  236. package/dist/{chunk-xha58rh2.js → chunk-hjr7tc1g.js} +1 -1
  237. package/dist/{chunk-9dhy1ekj.js → chunk-hkfat5cj.js} +50 -51
  238. package/dist/{chunk-dgrwcrwx.js → chunk-hkk80362.js} +1 -1
  239. package/dist/{chunk-p523ftrq.js → chunk-hkqvtcn2.js} +1 -1
  240. package/dist/{chunk-tszkvvnq.js → chunk-hs7sxtea.js} +2 -2
  241. package/dist/{chunk-8ymf4e6z.js → chunk-hxc5rbra.js} +3 -3
  242. package/dist/{chunk-h7xct2p1.js → chunk-hz9ty6jz.js} +50 -51
  243. package/dist/{chunk-x9rddxdt.js → chunk-hzk6nn1a.js} +47 -48
  244. package/dist/{chunk-ptdf4e9y.js → chunk-hzq56eee.js} +15 -15
  245. package/dist/{chunk-bt64sq5y.js → chunk-j04z48rw.js} +2 -2
  246. package/dist/chunk-j99epwtm.js +703 -0
  247. package/dist/{chunk-zs5b1dgr.js → chunk-jdq8jgyg.js} +1 -1
  248. package/dist/chunk-jdx93dh4.js +412 -0
  249. package/dist/chunk-jfqdw43z.js +14 -0
  250. package/dist/{chunk-ej1wwrcw.js → chunk-jvwa5w8w.js} +440 -654
  251. package/dist/{chunk-krgdryc0.js → chunk-jxzrapdr.js} +47 -48
  252. package/dist/{chunk-q76tj8p6.js → chunk-k7qqw0mj.js} +4 -4
  253. package/dist/{chunk-a8ejc632.js → chunk-k97s93n9.js} +1 -1
  254. package/dist/{chunk-dc0zwsyd.js → chunk-kcewk85p.js} +2 -2
  255. package/dist/{chunk-5xbvemsj.js → chunk-kdbbs50z.js} +3 -3
  256. package/dist/{chunk-2qsaxjnq.js → chunk-ke0bvd5n.js} +48 -49
  257. package/dist/{chunk-qc94x3p3.js → chunk-kggr6n4m.js} +60 -63
  258. package/dist/{chunk-8yxajf0d.js → chunk-km3ssf62.js} +19 -19
  259. package/dist/{chunk-kbeyhztj.js → chunk-kmh848ar.js} +19 -19
  260. package/dist/{chunk-ptn9f3na.js → chunk-kmy230xj.js} +50 -51
  261. package/dist/{chunk-acn3w259.js → chunk-kpyj9z78.js} +1 -1
  262. package/dist/{chunk-ywc2acy0.js → chunk-kwrep6kh.js} +2 -2
  263. package/dist/chunk-kxqjncxw.js +35 -0
  264. package/dist/{chunk-gfex5hb6.js → chunk-kyddexms.js} +13 -19
  265. package/dist/{chunk-04tphv07.js → chunk-kyefv6ng.js} +16 -16
  266. package/dist/{chunk-4faf9wd3.js → chunk-kz44a3qf.js} +3 -3
  267. package/dist/{chunk-dy8tttdp.js → chunk-m0vj33nj.js} +3 -3
  268. package/dist/chunk-m2rg2m7x.js +910 -0
  269. package/dist/{chunk-pps04vej.js → chunk-mbg1aw69.js} +10 -10
  270. package/dist/{chunk-5v45gvyx.js → chunk-mbkp0n55.js} +25 -25
  271. package/dist/{chunk-cajvbw85.js → chunk-mc41nrsy.js} +15 -15
  272. package/dist/{chunk-x94fchq0.js → chunk-me5gz5wa.js} +14 -14
  273. package/dist/{chunk-yz8h8hk3.js → chunk-mg8jtbwg.js} +50 -51
  274. package/dist/{chunk-ve9cwe9g.js → chunk-mgkaqb94.js} +47 -48
  275. package/dist/{chunk-ajzahsxn.js → chunk-mhygj95j.js} +48 -49
  276. package/dist/{chunk-0vkx14y7.js → chunk-mjqazs3m.js} +2 -2
  277. package/dist/{chunk-wgxsm74y.js → chunk-mnfb10tx.js} +3 -3
  278. package/dist/{chunk-t138q38h.js → chunk-mp72s5hc.js} +1 -1
  279. package/dist/{chunk-v2jb74tk.js → chunk-mp7bn9nx.js} +47 -48
  280. package/dist/{chunk-2afqgmq4.js → chunk-ms5agen7.js} +47 -48
  281. package/dist/{chunk-1xw41svw.js → chunk-msehbnjp.js} +59 -60
  282. package/dist/{chunk-yy13r4f1.js → chunk-my9dkgm8.js} +118 -4
  283. package/dist/{chunk-n6gs8dkk.js → chunk-n7pwac8p.js} +15 -15
  284. package/dist/{chunk-5d2nad7e.js → chunk-n8fxmey8.js} +1 -1
  285. package/dist/{chunk-w51ffctd.js → chunk-nd8hhtqz.js} +1 -1
  286. package/dist/{chunk-s0kbrpnn.js → chunk-nehajf9x.js} +3 -5
  287. package/dist/{chunk-fz0ch109.js → chunk-ng6s8w0e.js} +2 -2
  288. package/dist/{chunk-1n3pvcxm.js → chunk-ngryd7gy.js} +1 -1
  289. package/dist/{chunk-0sge3cez.js → chunk-nhxygcn1.js} +49 -50
  290. package/dist/chunk-nv7eb4pc.js +22 -0
  291. package/dist/{chunk-f8mc5g94.js → chunk-p6bws1a4.js} +16 -16
  292. package/dist/{chunk-y5x8wqe5.js → chunk-p8c4512d.js} +1 -1
  293. package/dist/{chunk-2xyp6pwt.js → chunk-pa4m8fka.js} +14 -14
  294. package/dist/{chunk-kzfj5mnk.js → chunk-pd9q9fd7.js} +47 -48
  295. package/dist/chunk-pf1dekdv.js +26 -0
  296. package/dist/{chunk-r2wcdqy9.js → chunk-pj5wk9qe.js} +47 -48
  297. package/dist/{chunk-zwv360y2.js → chunk-pkaehdm6.js} +859 -942
  298. package/dist/{chunk-ta1191a6.js → chunk-pp4kq0fa.js} +47 -48
  299. package/dist/{chunk-1je9wp7r.js → chunk-ptnf75rg.js} +47 -48
  300. package/dist/{chunk-27mj2w02.js → chunk-q09zbxk4.js} +15 -15
  301. package/dist/{chunk-5htp89xt.js → chunk-q1e46gk8.js} +55 -56
  302. package/dist/{chunk-rxep4zes.js → chunk-q1e7t6tz.js} +15 -128
  303. package/dist/{chunk-exv8n1za.js → chunk-q2jeezb4.js} +3 -3
  304. package/dist/{chunk-v69kxnen.js → chunk-q6vk37f0.js} +47 -48
  305. package/dist/chunk-q95b9wrd.js +40 -0
  306. package/dist/{chunk-ktmr2qew.js → chunk-qcvyd3y4.js} +3 -3
  307. package/dist/{chunk-08ap04th.js → chunk-qd97hcgd.js} +5 -5
  308. package/dist/{chunk-dpfjphps.js → chunk-qgx9mc6p.js} +5 -5
  309. package/dist/{chunk-15yxvxxm.js → chunk-qkp3ytva.js} +108 -111
  310. package/dist/{chunk-gfe3e4ce.js → chunk-qkymv6n8.js} +6 -6
  311. package/dist/{chunk-rc5r5t8e.js → chunk-qrz3b0e1.js} +4 -4
  312. package/dist/{chunk-3e1p9kv7.js → chunk-qzjk4vpq.js} +4 -4
  313. package/dist/{chunk-dnkd9ckw.js → chunk-r35b43p4.js} +17 -17
  314. package/dist/{chunk-6gg2cvm2.js → chunk-r4j2h4yp.js} +1 -1
  315. package/dist/{chunk-0s5m8nkk.js → chunk-r651whr2.js} +15 -15
  316. package/dist/{chunk-fhwpgyvw.js → chunk-r70h7x48.js} +50 -51
  317. package/dist/{chunk-xs7e9ynx.js → chunk-r8yzzrsp.js} +55 -56
  318. package/dist/{chunk-wkqf9whj.js → chunk-rdgrfsjm.js} +47 -48
  319. package/dist/{chunk-dps4gfm1.js → chunk-rfmf8jw2.js} +1 -1
  320. package/dist/{chunk-b623tcjz.js → chunk-rhdgt3c8.js} +4 -4
  321. package/dist/{chunk-dq4ckzab.js → chunk-rqwcz7mf.js} +16 -16
  322. package/dist/{chunk-73pxnrgv.js → chunk-rvb54w68.js} +2 -2
  323. package/dist/{chunk-jy1nhwr3.js → chunk-rwa1xxqk.js} +4 -4
  324. package/dist/{chunk-fgcxrx4c.js → chunk-s3k2jajp.js} +47 -48
  325. package/dist/{chunk-p1z86trg.js → chunk-s5cvaf0y.js} +3 -3
  326. package/dist/{chunk-wve68bf5.js → chunk-s8tq4y70.js} +2 -2
  327. package/dist/{chunk-2t5ncw9x.js → chunk-sa2gzt2m.js} +2 -2
  328. package/dist/chunk-scyjb4rw.js +42 -0
  329. package/dist/{chunk-nsndts3z.js → chunk-sfem4v24.js} +14 -14
  330. package/dist/{chunk-2z01s54n.js → chunk-sjc21xag.js} +4 -4
  331. package/dist/{chunk-400zp41r.js → chunk-snkt46ca.js} +1 -1
  332. package/dist/{chunk-xfnekqkc.js → chunk-sqk9ayam.js} +5 -7
  333. package/dist/chunk-swjfjpja.js +3213 -0
  334. package/dist/{chunk-c7qxrffg.js → chunk-swyr0ze5.js} +5 -5
  335. package/dist/{chunk-y6n3fdt2.js → chunk-t0rxmbvz.js} +17 -17
  336. package/dist/{chunk-eskw6xkv.js → chunk-t260g32y.js} +4 -4
  337. package/dist/{chunk-fg46hc6d.js → chunk-t6kym3nr.js} +38 -32
  338. package/dist/{chunk-bwv73k9n.js → chunk-t79jmj3c.js} +5 -5
  339. package/dist/chunk-t7vqt78m.js +32 -0
  340. package/dist/chunk-t8sg0wf3.js +23 -0
  341. package/dist/{chunk-kqe7861c.js → chunk-tc92qnj1.js} +77 -50
  342. package/dist/{chunk-dd60e5wj.js → chunk-temv6q01.js} +4 -4
  343. package/dist/chunk-th1cykx3.js +494 -0
  344. package/dist/chunk-tp6bgx9r.js +90 -0
  345. package/dist/{chunk-d1dkt8pf.js → chunk-tq61s8re.js} +48 -49
  346. package/dist/chunk-tsycknnm.js +887 -0
  347. package/dist/{chunk-45kw3kmb.js → chunk-tv3n7nyr.js} +47 -48
  348. package/dist/{chunk-swd4vhn1.js → chunk-v3a3d8qr.js} +48 -49
  349. package/dist/{chunk-4z3yrp6y.js → chunk-v6q8mas6.js} +48 -49
  350. package/dist/{chunk-1zvd49vg.js → chunk-v9xtwnkn.js} +4 -4
  351. package/dist/{chunk-emgk6xvg.js → chunk-vecm4b7g.js} +1 -1
  352. package/dist/{chunk-h6gm2k0d.js → chunk-vhjrpmd7.js} +48 -49
  353. package/dist/{chunk-rbwfpwps.js → chunk-vmp1tr7b.js} +2 -2
  354. package/dist/{chunk-amdb0grz.js → chunk-vn9dpw7e.js} +50 -51
  355. package/dist/{chunk-vxstb12h.js → chunk-vnhhnca0.js} +1 -1
  356. package/dist/{chunk-rj8p3f8w.js → chunk-vqf0cwfx.js} +48 -49
  357. package/dist/chunk-vqm2wda9.js +46 -0
  358. package/dist/{chunk-3h1nhq6f.js → chunk-vrbtdakb.js} +1 -1
  359. package/dist/{chunk-422fx6t4.js → chunk-vrdp6hk3.js} +50 -51
  360. package/dist/{chunk-ght1jhcp.js → chunk-vzn6172q.js} +56 -58
  361. package/dist/chunk-w0b04y7r.js +609 -0
  362. package/dist/{chunk-w49cma0z.js → chunk-w20437bg.js} +47 -48
  363. package/dist/{chunk-139bbdnz.js → chunk-w54rzd0a.js} +50 -51
  364. package/dist/{chunk-dq6gsxma.js → chunk-w7eccwbe.js} +15 -15
  365. package/dist/{chunk-mas3fz1d.js → chunk-wa3arctj.js} +12 -12
  366. package/dist/{chunk-w8am6ta4.js → chunk-wa7rnp49.js} +1 -1
  367. package/dist/{chunk-vagfnqc6.js → chunk-waazrpce.js} +2 -2
  368. package/dist/{chunk-0h3t3pg2.js → chunk-wbh9ydpk.js} +19 -19
  369. package/dist/{chunk-vdtdq74g.js → chunk-wc7s61fq.js} +15 -15
  370. package/dist/{chunk-2e6t5g22.js → chunk-wgmkhbe4.js} +2 -2
  371. package/dist/{chunk-j5xh6s8y.js → chunk-wh23fnfe.js} +11 -11
  372. package/dist/{chunk-wys7e7qz.js → chunk-whvpa72n.js} +4 -4
  373. package/dist/chunk-wkyyghn6.js +184 -0
  374. package/dist/{chunk-ebnp9s5b.js → chunk-wngtt6cw.js} +2 -2
  375. package/dist/chunk-wp35dfwp.js +15 -0
  376. package/dist/{chunk-6gr3c3w9.js → chunk-wpqynh28.js} +2 -2
  377. package/dist/{chunk-fykf8xpq.js → chunk-wtje1bzc.js} +48 -49
  378. package/dist/{chunk-fpgevc9q.js → chunk-wwjb9kpr.js} +48 -49
  379. package/dist/{chunk-78bk581m.js → chunk-wzarjbqs.js} +47 -48
  380. package/dist/{chunk-0r9ed6vz.js → chunk-wzyspdkz.js} +54 -55
  381. package/dist/chunk-x3atm9a1.js +864 -0
  382. package/dist/{chunk-rkmwx1yz.js → chunk-x52qkhng.js} +1 -1
  383. package/dist/{chunk-xcg8gj4z.js → chunk-xpecr6a1.js} +5 -7
  384. package/dist/{chunk-re56c4sb.js → chunk-xt3x0wrj.js} +1 -1
  385. package/dist/{chunk-8avpe537.js → chunk-xvwv91w4.js} +47 -48
  386. package/dist/{chunk-8c32awe2.js → chunk-xwh3q911.js} +2 -2
  387. package/dist/{chunk-26p2hgat.js → chunk-xydbqr0b.js} +47 -48
  388. package/dist/{chunk-npmd1tms.js → chunk-xzmas4y8.js} +47 -48
  389. package/dist/{chunk-vr9rckk8.js → chunk-y4dgbkb3.js} +290 -261
  390. package/dist/{chunk-2f1f034j.js → chunk-y5phkfvf.js} +3 -3
  391. package/dist/{chunk-gqvdqmgm.js → chunk-y689dg14.js} +14 -14
  392. package/dist/{chunk-0t1bd4sb.js → chunk-yevw8ttf.js} +15 -15
  393. package/dist/{chunk-9wev49x3.js → chunk-yhqcnq80.js} +50 -51
  394. package/dist/{chunk-9mh13mnf.js → chunk-yk4t7kxm.js} +1 -1
  395. package/dist/{chunk-7r2k7qes.js → chunk-ykbz8f85.js} +3 -3
  396. package/dist/{chunk-h3p151fx.js → chunk-ykcqa4mj.js} +1 -1
  397. package/dist/{chunk-d90bhmt1.js → chunk-ysj2gfxe.js} +48 -47
  398. package/dist/{chunk-0t80kx3c.js → chunk-z51fyxdw.js} +55 -56
  399. package/dist/{chunk-vmc31gbm.js → chunk-z86pzxdm.js} +48 -49
  400. package/dist/chunk-z88f5181.js +258 -0
  401. package/dist/{chunk-8epxe23k.js → chunk-zd6w7gc2.js} +5 -5
  402. package/dist/{chunk-ebrc3yf3.js → chunk-zv0txvbs.js} +4 -4
  403. package/dist/{chunk-196500e9.js → chunk-zvkkjep6.js} +12 -12
  404. package/dist/{chunk-phf40t3n.js → chunk-zx2xx5ek.js} +20 -20
  405. package/dist/{chunk-trt2sfjg.js → chunk-zzz4ny7p.js} +1 -1
  406. package/dist/cli.js +24 -24
  407. package/package.json +28 -28
  408. package/dist/chunk-0mf8c3kx.js +0 -8
  409. package/dist/chunk-5vvqe088.js +0 -946
  410. package/dist/chunk-6c5zyga7.js +0 -12
  411. package/dist/chunk-f9tjvhq5.js +0 -186
  412. package/dist/chunk-k97ze3a8.js +0 -524
  413. package/dist/chunk-pps45448.js +0 -159
  414. package/dist/chunk-qqvaem6g.js +0 -68
  415. package/dist/chunk-shvjqnv4.js +0 -53
  416. package/dist/chunk-z0b7xfwn.js +0 -47
  417. package/dist/download-ripgrep.js +0 -24837
  418. package/dist/{chunk-y3jmpqat.js → chunk-5vdpbk46.js} +3 -3
  419. package/dist/{chunk-vest0y6x.js → chunk-6h6kzvyd.js} +3 -3
  420. package/dist/{chunk-f5ma3nh5.js → chunk-7a31vc3r.js} +0 -0
  421. package/dist/{chunk-tbas522c.js → chunk-ftbf37y7.js} +1 -1
  422. package/dist/{chunk-pfgwfg55.js → chunk-xexnht94.js} +3 -3
  423. package/dist/{chunk-0fnpkgd6.js → chunk-ybebarb1.js} +10 -10
@@ -0,0 +1,3686 @@
1
+ // @bun
2
+ import {
3
+ endInteractionSpan,
4
+ init_betaSessionTracing,
5
+ init_perfettoTracing,
6
+ init_sessionTracing,
7
+ initializePerfettoTracing,
8
+ isBetaTracingEnabled,
9
+ isEnhancedTelemetryEnabled
10
+ } from "./chunk-7ye0arvq.js";
11
+ import {
12
+ BasicTracerProvider,
13
+ BatchSpanProcessor,
14
+ ConsoleSpanExporter,
15
+ init_esm as init_esm4
16
+ } from "./chunk-5nccnh01.js";
17
+ import {
18
+ BatchLogRecordProcessor,
19
+ ConsoleLogRecordExporter,
20
+ ExportResultCode,
21
+ LoggerProvider,
22
+ checkHasTrustDialogAccepted,
23
+ defaultResource,
24
+ envDetector,
25
+ getAuthHeaders,
26
+ getClaudeCodeUserAgent,
27
+ getGlobalConfig,
28
+ getOtelHeadersFromHelper,
29
+ getSettings_DEPRECATED,
30
+ getSubscriptionType,
31
+ globalErrorHandler,
32
+ hasProfileScope,
33
+ hostDetector,
34
+ hrTimeToMicroseconds,
35
+ init_auth,
36
+ init_config1 as init_config,
37
+ init_esm,
38
+ init_esm1 as init_esm2,
39
+ init_esm2 as init_esm3,
40
+ init_http,
41
+ init_settings1 as init_settings,
42
+ init_userAgent,
43
+ internal,
44
+ is1PApiCustomer,
45
+ isClaudeAISubscriber,
46
+ millisToHrTime,
47
+ osDetector,
48
+ require_src as require_src3,
49
+ resourceFromAttributes,
50
+ saveGlobalConfig,
51
+ withOAuth401Retry
52
+ } from "./chunk-d6kw0esk.js";
53
+ import"./chunk-ykcqa4mj.js";
54
+ import"./chunk-r4j2h4yp.js";
55
+ import {
56
+ HttpsProxyAgent,
57
+ getCACertificates,
58
+ getMTLSConfig,
59
+ getProxyUrl,
60
+ init_caCerts,
61
+ init_dist,
62
+ init_mtls,
63
+ init_proxy,
64
+ shouldBypassProxy
65
+ } from "./chunk-7zrkp054.js";
66
+ import"./chunk-zwarn9h7.js";
67
+ import"./chunk-fx52a9s2.js";
68
+ import"./chunk-7hmy36fh.js";
69
+ import"./chunk-64c1avct.js";
70
+ import"./chunk-qbrsmra3.js";
71
+ import"./chunk-8g5pe1gr.js";
72
+ import {
73
+ getPlatform,
74
+ getWslVersion,
75
+ init_platform
76
+ } from "./chunk-pjz4m7pd.js";
77
+ import"./chunk-zvdc0eh1.js";
78
+ import {
79
+ require_src as require_src2
80
+ } from "./chunk-7a31vc3r.js";
81
+ import"./chunk-6y2wszkc.js";
82
+ import"./chunk-3c25bcsw.js";
83
+ import"./chunk-9qh5f9r3.js";
84
+ import"./chunk-xhesahm0.js";
85
+ import"./chunk-rh5a2rg9.js";
86
+ import"./chunk-8g747a8x.js";
87
+ import"./chunk-d7886r6a.js";
88
+ import"./chunk-v1kzp02e.js";
89
+ import {
90
+ require_src
91
+ } from "./chunk-p2816w9z.js";
92
+ import {
93
+ init_startupProfiler,
94
+ profileCheckpoint
95
+ } from "./chunk-ea7t0b92.js";
96
+ import"./chunk-crmjpsqe.js";
97
+ import"./chunk-m9w972ny.js";
98
+ import"./chunk-b5wxetbv.js";
99
+ import"./chunk-f2mhrmww.js";
100
+ import"./chunk-0vkfrmqm.js";
101
+ import"./chunk-0xjaqda8.js";
102
+ import"./chunk-rvb54w68.js";
103
+ import {
104
+ init_memoize,
105
+ memoizeWithTTLAsync
106
+ } from "./chunk-fz395yre.js";
107
+ import"./chunk-jdq8jgyg.js";
108
+ import"./chunk-99zt59gg.js";
109
+ import"./chunk-tv74hgw9.js";
110
+ import {
111
+ init_log,
112
+ init_privacyLevel,
113
+ isEssentialTrafficOnly,
114
+ logError
115
+ } from "./chunk-vp2p7azg.js";
116
+ import"./chunk-8tnsngw2.js";
117
+ import"./chunk-vsbyhpfy.js";
118
+ import"./chunk-p7pj6wf8.js";
119
+ import"./chunk-5z28bqne.js";
120
+ import"./chunk-qajrkk97.js";
121
+ import {
122
+ errorMessage,
123
+ getHasFormattedOutput,
124
+ init_cleanupRegistry,
125
+ init_debug,
126
+ init_errors,
127
+ init_slowOperations,
128
+ jsonStringify,
129
+ logForDebugging,
130
+ registerCleanup,
131
+ toError
132
+ } from "./chunk-5khwvj1z.js";
133
+ import"./chunk-fbv4apne.js";
134
+ import {
135
+ getIsNonInteractiveSession,
136
+ getLoggerProvider,
137
+ getMeterProvider,
138
+ getTracerProvider,
139
+ init_state,
140
+ setEventLogger,
141
+ setLoggerProvider,
142
+ setMeterProvider,
143
+ setTracerProvider
144
+ } from "./chunk-gzp6rza1.js";
145
+ import"./chunk-50dgek10.js";
146
+ import"./chunk-7wm5s02e.js";
147
+ import"./chunk-z0csm2zq.js";
148
+ import {
149
+ init_envUtils,
150
+ isEnvTruthy
151
+ } from "./chunk-hxhwzgnn.js";
152
+ import"./chunk-qx8z601m.js";
153
+ import"./chunk-cgm6758j.js";
154
+ import {
155
+ axios_default,
156
+ init_axios
157
+ } from "./chunk-9m27g5s1.js";
158
+ import"./chunk-8pn8tvgg.js";
159
+ import"./chunk-netzwgv1.js";
160
+ import {
161
+ __esm,
162
+ __require,
163
+ __toESM
164
+ } from "./chunk-qp2qdcda.js";
165
+
166
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/export/AggregationTemporality.js
167
+ var AggregationTemporality;
168
+ var init_AggregationTemporality = __esm(() => {
169
+ (function(AggregationTemporality2) {
170
+ AggregationTemporality2[AggregationTemporality2["DELTA"] = 0] = "DELTA";
171
+ AggregationTemporality2[AggregationTemporality2["CUMULATIVE"] = 1] = "CUMULATIVE";
172
+ })(AggregationTemporality || (AggregationTemporality = {}));
173
+ });
174
+
175
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/utils.js
176
+ function hashAttributes(attributes) {
177
+ let keys = Object.keys(attributes);
178
+ if (keys.length === 0)
179
+ return "";
180
+ keys = keys.sort();
181
+ return JSON.stringify(keys.map((key) => [key, attributes[key]]));
182
+ }
183
+ function instrumentationScopeId(instrumentationScope) {
184
+ return `${instrumentationScope.name}:${instrumentationScope.version ?? ""}:${instrumentationScope.schemaUrl ?? ""}`;
185
+ }
186
+ function callWithTimeout(promise, timeout) {
187
+ let timeoutHandle;
188
+ const timeoutPromise = new Promise(function timeoutFunction(_resolve, reject) {
189
+ timeoutHandle = setTimeout(function timeoutHandler() {
190
+ reject(new TimeoutError("Operation timed out."));
191
+ }, timeout);
192
+ });
193
+ return Promise.race([promise, timeoutPromise]).then((result) => {
194
+ clearTimeout(timeoutHandle);
195
+ return result;
196
+ }, (reason) => {
197
+ clearTimeout(timeoutHandle);
198
+ throw reason;
199
+ });
200
+ }
201
+ function setEquals(lhs, rhs) {
202
+ if (lhs.size !== rhs.size) {
203
+ return false;
204
+ }
205
+ for (const item of lhs) {
206
+ if (!rhs.has(item)) {
207
+ return false;
208
+ }
209
+ }
210
+ return true;
211
+ }
212
+ function binarySearchUB(arr, value) {
213
+ let lo = 0;
214
+ let hi = arr.length - 1;
215
+ let ret = arr.length;
216
+ while (hi >= lo) {
217
+ const mid = lo + Math.trunc((hi - lo) / 2);
218
+ if (arr[mid] < value) {
219
+ lo = mid + 1;
220
+ } else {
221
+ ret = mid;
222
+ hi = mid - 1;
223
+ }
224
+ }
225
+ return ret;
226
+ }
227
+ function equalsCaseInsensitive(lhs, rhs) {
228
+ return lhs.toLowerCase() === rhs.toLowerCase();
229
+ }
230
+ var TimeoutError;
231
+ var init_utils = __esm(() => {
232
+ TimeoutError = class TimeoutError extends Error {
233
+ constructor(message) {
234
+ super(message);
235
+ Object.setPrototypeOf(this, TimeoutError.prototype);
236
+ }
237
+ };
238
+ });
239
+
240
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/types.js
241
+ var AggregatorKind;
242
+ var init_types = __esm(() => {
243
+ (function(AggregatorKind2) {
244
+ AggregatorKind2[AggregatorKind2["DROP"] = 0] = "DROP";
245
+ AggregatorKind2[AggregatorKind2["SUM"] = 1] = "SUM";
246
+ AggregatorKind2[AggregatorKind2["LAST_VALUE"] = 2] = "LAST_VALUE";
247
+ AggregatorKind2[AggregatorKind2["HISTOGRAM"] = 3] = "HISTOGRAM";
248
+ AggregatorKind2[AggregatorKind2["EXPONENTIAL_HISTOGRAM"] = 4] = "EXPONENTIAL_HISTOGRAM";
249
+ })(AggregatorKind || (AggregatorKind = {}));
250
+ });
251
+
252
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Drop.js
253
+ class DropAggregator {
254
+ kind = AggregatorKind.DROP;
255
+ createAccumulation() {
256
+ return;
257
+ }
258
+ merge(_previous, _delta) {
259
+ return;
260
+ }
261
+ diff(_previous, _current) {
262
+ return;
263
+ }
264
+ toMetricData(_descriptor, _aggregationTemporality, _accumulationByAttributes, _endTime) {
265
+ return;
266
+ }
267
+ }
268
+ var init_Drop = __esm(() => {
269
+ init_types();
270
+ });
271
+
272
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricData.js
273
+ var InstrumentType, DataPointType;
274
+ var init_MetricData = __esm(() => {
275
+ (function(InstrumentType2) {
276
+ InstrumentType2["COUNTER"] = "COUNTER";
277
+ InstrumentType2["GAUGE"] = "GAUGE";
278
+ InstrumentType2["HISTOGRAM"] = "HISTOGRAM";
279
+ InstrumentType2["UP_DOWN_COUNTER"] = "UP_DOWN_COUNTER";
280
+ InstrumentType2["OBSERVABLE_COUNTER"] = "OBSERVABLE_COUNTER";
281
+ InstrumentType2["OBSERVABLE_GAUGE"] = "OBSERVABLE_GAUGE";
282
+ InstrumentType2["OBSERVABLE_UP_DOWN_COUNTER"] = "OBSERVABLE_UP_DOWN_COUNTER";
283
+ })(InstrumentType || (InstrumentType = {}));
284
+ (function(DataPointType2) {
285
+ DataPointType2[DataPointType2["HISTOGRAM"] = 0] = "HISTOGRAM";
286
+ DataPointType2[DataPointType2["EXPONENTIAL_HISTOGRAM"] = 1] = "EXPONENTIAL_HISTOGRAM";
287
+ DataPointType2[DataPointType2["GAUGE"] = 2] = "GAUGE";
288
+ DataPointType2[DataPointType2["SUM"] = 3] = "SUM";
289
+ })(DataPointType || (DataPointType = {}));
290
+ });
291
+
292
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Histogram.js
293
+ function createNewEmptyCheckpoint(boundaries) {
294
+ const counts = boundaries.map(() => 0);
295
+ counts.push(0);
296
+ return {
297
+ buckets: {
298
+ boundaries,
299
+ counts
300
+ },
301
+ sum: 0,
302
+ count: 0,
303
+ hasMinMax: false,
304
+ min: Infinity,
305
+ max: -Infinity
306
+ };
307
+ }
308
+
309
+ class HistogramAccumulation {
310
+ startTime;
311
+ _boundaries;
312
+ _recordMinMax;
313
+ _current;
314
+ constructor(startTime, boundaries, recordMinMax = true, current = createNewEmptyCheckpoint(boundaries)) {
315
+ this.startTime = startTime;
316
+ this._boundaries = boundaries;
317
+ this._recordMinMax = recordMinMax;
318
+ this._current = current;
319
+ }
320
+ record(value) {
321
+ if (Number.isNaN(value)) {
322
+ return;
323
+ }
324
+ this._current.count += 1;
325
+ this._current.sum += value;
326
+ if (this._recordMinMax) {
327
+ this._current.min = Math.min(value, this._current.min);
328
+ this._current.max = Math.max(value, this._current.max);
329
+ this._current.hasMinMax = true;
330
+ }
331
+ const idx = binarySearchUB(this._boundaries, value);
332
+ this._current.buckets.counts[idx] += 1;
333
+ }
334
+ setStartTime(startTime) {
335
+ this.startTime = startTime;
336
+ }
337
+ toPointValue() {
338
+ return this._current;
339
+ }
340
+ }
341
+
342
+ class HistogramAggregator {
343
+ kind = AggregatorKind.HISTOGRAM;
344
+ _boundaries;
345
+ _recordMinMax;
346
+ constructor(boundaries, recordMinMax) {
347
+ this._boundaries = boundaries;
348
+ this._recordMinMax = recordMinMax;
349
+ }
350
+ createAccumulation(startTime) {
351
+ return new HistogramAccumulation(startTime, this._boundaries, this._recordMinMax);
352
+ }
353
+ merge(previous, delta) {
354
+ const previousValue = previous.toPointValue();
355
+ const deltaValue = delta.toPointValue();
356
+ const previousCounts = previousValue.buckets.counts;
357
+ const deltaCounts = deltaValue.buckets.counts;
358
+ const mergedCounts = new Array(previousCounts.length);
359
+ for (let idx = 0;idx < previousCounts.length; idx++) {
360
+ mergedCounts[idx] = previousCounts[idx] + deltaCounts[idx];
361
+ }
362
+ let min = Infinity;
363
+ let max = -Infinity;
364
+ if (this._recordMinMax) {
365
+ if (previousValue.hasMinMax && deltaValue.hasMinMax) {
366
+ min = Math.min(previousValue.min, deltaValue.min);
367
+ max = Math.max(previousValue.max, deltaValue.max);
368
+ } else if (previousValue.hasMinMax) {
369
+ min = previousValue.min;
370
+ max = previousValue.max;
371
+ } else if (deltaValue.hasMinMax) {
372
+ min = deltaValue.min;
373
+ max = deltaValue.max;
374
+ }
375
+ }
376
+ return new HistogramAccumulation(previous.startTime, previousValue.buckets.boundaries, this._recordMinMax, {
377
+ buckets: {
378
+ boundaries: previousValue.buckets.boundaries,
379
+ counts: mergedCounts
380
+ },
381
+ count: previousValue.count + deltaValue.count,
382
+ sum: previousValue.sum + deltaValue.sum,
383
+ hasMinMax: this._recordMinMax && (previousValue.hasMinMax || deltaValue.hasMinMax),
384
+ min,
385
+ max
386
+ });
387
+ }
388
+ diff(previous, current) {
389
+ const previousValue = previous.toPointValue();
390
+ const currentValue = current.toPointValue();
391
+ const previousCounts = previousValue.buckets.counts;
392
+ const currentCounts = currentValue.buckets.counts;
393
+ const diffedCounts = new Array(previousCounts.length);
394
+ for (let idx = 0;idx < previousCounts.length; idx++) {
395
+ diffedCounts[idx] = currentCounts[idx] - previousCounts[idx];
396
+ }
397
+ return new HistogramAccumulation(current.startTime, previousValue.buckets.boundaries, this._recordMinMax, {
398
+ buckets: {
399
+ boundaries: previousValue.buckets.boundaries,
400
+ counts: diffedCounts
401
+ },
402
+ count: currentValue.count - previousValue.count,
403
+ sum: currentValue.sum - previousValue.sum,
404
+ hasMinMax: false,
405
+ min: Infinity,
406
+ max: -Infinity
407
+ });
408
+ }
409
+ toMetricData(descriptor, aggregationTemporality, accumulationByAttributes, endTime) {
410
+ return {
411
+ descriptor,
412
+ aggregationTemporality,
413
+ dataPointType: DataPointType.HISTOGRAM,
414
+ dataPoints: accumulationByAttributes.map(([attributes, accumulation]) => {
415
+ const pointValue = accumulation.toPointValue();
416
+ const allowsNegativeValues = descriptor.type === InstrumentType.GAUGE || descriptor.type === InstrumentType.UP_DOWN_COUNTER || descriptor.type === InstrumentType.OBSERVABLE_GAUGE || descriptor.type === InstrumentType.OBSERVABLE_UP_DOWN_COUNTER;
417
+ return {
418
+ attributes,
419
+ startTime: accumulation.startTime,
420
+ endTime,
421
+ value: {
422
+ min: pointValue.hasMinMax ? pointValue.min : undefined,
423
+ max: pointValue.hasMinMax ? pointValue.max : undefined,
424
+ sum: !allowsNegativeValues ? pointValue.sum : undefined,
425
+ buckets: pointValue.buckets,
426
+ count: pointValue.count
427
+ }
428
+ };
429
+ })
430
+ };
431
+ }
432
+ }
433
+ var init_Histogram = __esm(() => {
434
+ init_types();
435
+ init_MetricData();
436
+ init_utils();
437
+ });
438
+
439
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/exponential-histogram/Buckets.js
440
+ class Buckets {
441
+ backing;
442
+ indexBase;
443
+ indexStart;
444
+ indexEnd;
445
+ constructor(backing = new BucketsBacking, indexBase = 0, indexStart = 0, indexEnd = 0) {
446
+ this.backing = backing;
447
+ this.indexBase = indexBase;
448
+ this.indexStart = indexStart;
449
+ this.indexEnd = indexEnd;
450
+ }
451
+ get offset() {
452
+ return this.indexStart;
453
+ }
454
+ get length() {
455
+ if (this.backing.length === 0) {
456
+ return 0;
457
+ }
458
+ if (this.indexEnd === this.indexStart && this.at(0) === 0) {
459
+ return 0;
460
+ }
461
+ return this.indexEnd - this.indexStart + 1;
462
+ }
463
+ counts() {
464
+ return Array.from({ length: this.length }, (_, i) => this.at(i));
465
+ }
466
+ at(position) {
467
+ const bias = this.indexBase - this.indexStart;
468
+ if (position < bias) {
469
+ position += this.backing.length;
470
+ }
471
+ position -= bias;
472
+ return this.backing.countAt(position);
473
+ }
474
+ incrementBucket(bucketIndex, increment) {
475
+ this.backing.increment(bucketIndex, increment);
476
+ }
477
+ decrementBucket(bucketIndex, decrement) {
478
+ this.backing.decrement(bucketIndex, decrement);
479
+ }
480
+ trim() {
481
+ for (let i = 0;i < this.length; i++) {
482
+ if (this.at(i) !== 0) {
483
+ this.indexStart += i;
484
+ break;
485
+ } else if (i === this.length - 1) {
486
+ this.indexStart = this.indexEnd = this.indexBase = 0;
487
+ return;
488
+ }
489
+ }
490
+ for (let i = this.length - 1;i >= 0; i--) {
491
+ if (this.at(i) !== 0) {
492
+ this.indexEnd -= this.length - i - 1;
493
+ break;
494
+ }
495
+ }
496
+ this._rotate();
497
+ }
498
+ downscale(by) {
499
+ this._rotate();
500
+ const size = 1 + this.indexEnd - this.indexStart;
501
+ const each = 1 << by;
502
+ let inpos = 0;
503
+ let outpos = 0;
504
+ for (let pos = this.indexStart;pos <= this.indexEnd; ) {
505
+ let mod = pos % each;
506
+ if (mod < 0) {
507
+ mod += each;
508
+ }
509
+ for (let i = mod;i < each && inpos < size; i++) {
510
+ this._relocateBucket(outpos, inpos);
511
+ inpos++;
512
+ pos++;
513
+ }
514
+ outpos++;
515
+ }
516
+ this.indexStart >>= by;
517
+ this.indexEnd >>= by;
518
+ this.indexBase = this.indexStart;
519
+ }
520
+ clone() {
521
+ return new Buckets(this.backing.clone(), this.indexBase, this.indexStart, this.indexEnd);
522
+ }
523
+ _rotate() {
524
+ const bias = this.indexBase - this.indexStart;
525
+ if (bias === 0) {
526
+ return;
527
+ } else if (bias > 0) {
528
+ this.backing.reverse(0, this.backing.length);
529
+ this.backing.reverse(0, bias);
530
+ this.backing.reverse(bias, this.backing.length);
531
+ } else {
532
+ this.backing.reverse(0, this.backing.length);
533
+ this.backing.reverse(0, this.backing.length + bias);
534
+ }
535
+ this.indexBase = this.indexStart;
536
+ }
537
+ _relocateBucket(dest, src) {
538
+ if (dest === src) {
539
+ return;
540
+ }
541
+ this.incrementBucket(dest, this.backing.emptyBucket(src));
542
+ }
543
+ }
544
+
545
+ class BucketsBacking {
546
+ _counts;
547
+ constructor(counts = [0]) {
548
+ this._counts = counts;
549
+ }
550
+ get length() {
551
+ return this._counts.length;
552
+ }
553
+ countAt(pos) {
554
+ return this._counts[pos];
555
+ }
556
+ growTo(newSize, oldPositiveLimit, newPositiveLimit) {
557
+ const tmp = new Array(newSize).fill(0);
558
+ tmp.splice(newPositiveLimit, this._counts.length - oldPositiveLimit, ...this._counts.slice(oldPositiveLimit));
559
+ tmp.splice(0, oldPositiveLimit, ...this._counts.slice(0, oldPositiveLimit));
560
+ this._counts = tmp;
561
+ }
562
+ reverse(from, limit) {
563
+ const num = Math.floor((from + limit) / 2) - from;
564
+ for (let i = 0;i < num; i++) {
565
+ const tmp = this._counts[from + i];
566
+ this._counts[from + i] = this._counts[limit - i - 1];
567
+ this._counts[limit - i - 1] = tmp;
568
+ }
569
+ }
570
+ emptyBucket(src) {
571
+ const tmp = this._counts[src];
572
+ this._counts[src] = 0;
573
+ return tmp;
574
+ }
575
+ increment(bucketIndex, increment) {
576
+ this._counts[bucketIndex] += increment;
577
+ }
578
+ decrement(bucketIndex, decrement) {
579
+ if (this._counts[bucketIndex] >= decrement) {
580
+ this._counts[bucketIndex] -= decrement;
581
+ } else {
582
+ this._counts[bucketIndex] = 0;
583
+ }
584
+ }
585
+ clone() {
586
+ return new BucketsBacking([...this._counts]);
587
+ }
588
+ }
589
+ var init_Buckets = () => {};
590
+
591
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/exponential-histogram/mapping/ieee754.js
592
+ function getNormalBase2(value) {
593
+ const dv = new DataView(new ArrayBuffer(8));
594
+ dv.setFloat64(0, value);
595
+ const hiBits = dv.getUint32(0);
596
+ const expBits = (hiBits & EXPONENT_MASK) >> 20;
597
+ return expBits - EXPONENT_BIAS;
598
+ }
599
+ function getSignificand(value) {
600
+ const dv = new DataView(new ArrayBuffer(8));
601
+ dv.setFloat64(0, value);
602
+ const hiBits = dv.getUint32(0);
603
+ const loBits = dv.getUint32(4);
604
+ const significandHiBits = (hiBits & SIGNIFICAND_MASK) * Math.pow(2, 32);
605
+ return significandHiBits + loBits;
606
+ }
607
+ var SIGNIFICAND_WIDTH = 52, EXPONENT_MASK = 2146435072, SIGNIFICAND_MASK = 1048575, EXPONENT_BIAS = 1023, MIN_NORMAL_EXPONENT, MAX_NORMAL_EXPONENT, MIN_VALUE;
608
+ var init_ieee754 = __esm(() => {
609
+ MIN_NORMAL_EXPONENT = -EXPONENT_BIAS + 1;
610
+ MAX_NORMAL_EXPONENT = EXPONENT_BIAS;
611
+ MIN_VALUE = Math.pow(2, -1022);
612
+ });
613
+
614
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/exponential-histogram/util.js
615
+ function ldexp(frac, exp) {
616
+ if (frac === 0 || frac === Number.POSITIVE_INFINITY || frac === Number.NEGATIVE_INFINITY || Number.isNaN(frac)) {
617
+ return frac;
618
+ }
619
+ return frac * Math.pow(2, exp);
620
+ }
621
+ function nextGreaterSquare(v) {
622
+ v--;
623
+ v |= v >> 1;
624
+ v |= v >> 2;
625
+ v |= v >> 4;
626
+ v |= v >> 8;
627
+ v |= v >> 16;
628
+ v++;
629
+ return v;
630
+ }
631
+ var init_util = () => {};
632
+
633
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/exponential-histogram/mapping/types.js
634
+ var MappingError;
635
+ var init_types2 = __esm(() => {
636
+ MappingError = class MappingError extends Error {
637
+ };
638
+ });
639
+
640
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/exponential-histogram/mapping/ExponentMapping.js
641
+ class ExponentMapping {
642
+ _shift;
643
+ constructor(scale) {
644
+ this._shift = -scale;
645
+ }
646
+ mapToIndex(value) {
647
+ if (value < MIN_VALUE) {
648
+ return this._minNormalLowerBoundaryIndex();
649
+ }
650
+ const exp = getNormalBase2(value);
651
+ const correction = this._rightShift(getSignificand(value) - 1, SIGNIFICAND_WIDTH);
652
+ return exp + correction >> this._shift;
653
+ }
654
+ lowerBoundary(index) {
655
+ const minIndex = this._minNormalLowerBoundaryIndex();
656
+ if (index < minIndex) {
657
+ throw new MappingError(`underflow: ${index} is < minimum lower boundary: ${minIndex}`);
658
+ }
659
+ const maxIndex = this._maxNormalLowerBoundaryIndex();
660
+ if (index > maxIndex) {
661
+ throw new MappingError(`overflow: ${index} is > maximum lower boundary: ${maxIndex}`);
662
+ }
663
+ return ldexp(1, index << this._shift);
664
+ }
665
+ get scale() {
666
+ if (this._shift === 0) {
667
+ return 0;
668
+ }
669
+ return -this._shift;
670
+ }
671
+ _minNormalLowerBoundaryIndex() {
672
+ let index = MIN_NORMAL_EXPONENT >> this._shift;
673
+ if (this._shift < 2) {
674
+ index--;
675
+ }
676
+ return index;
677
+ }
678
+ _maxNormalLowerBoundaryIndex() {
679
+ return MAX_NORMAL_EXPONENT >> this._shift;
680
+ }
681
+ _rightShift(value, shift) {
682
+ return Math.floor(value * Math.pow(2, -shift));
683
+ }
684
+ }
685
+ var init_ExponentMapping = __esm(() => {
686
+ init_ieee754();
687
+ init_util();
688
+ init_types2();
689
+ });
690
+
691
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/exponential-histogram/mapping/LogarithmMapping.js
692
+ class LogarithmMapping {
693
+ _scale;
694
+ _scaleFactor;
695
+ _inverseFactor;
696
+ constructor(scale) {
697
+ this._scale = scale;
698
+ this._scaleFactor = ldexp(Math.LOG2E, scale);
699
+ this._inverseFactor = ldexp(Math.LN2, -scale);
700
+ }
701
+ mapToIndex(value) {
702
+ if (value <= MIN_VALUE) {
703
+ return this._minNormalLowerBoundaryIndex() - 1;
704
+ }
705
+ if (getSignificand(value) === 0) {
706
+ const exp = getNormalBase2(value);
707
+ return (exp << this._scale) - 1;
708
+ }
709
+ const index = Math.floor(Math.log(value) * this._scaleFactor);
710
+ const maxIndex = this._maxNormalLowerBoundaryIndex();
711
+ if (index >= maxIndex) {
712
+ return maxIndex;
713
+ }
714
+ return index;
715
+ }
716
+ lowerBoundary(index) {
717
+ const maxIndex = this._maxNormalLowerBoundaryIndex();
718
+ if (index >= maxIndex) {
719
+ if (index === maxIndex) {
720
+ return 2 * Math.exp((index - (1 << this._scale)) / this._scaleFactor);
721
+ }
722
+ throw new MappingError(`overflow: ${index} is > maximum lower boundary: ${maxIndex}`);
723
+ }
724
+ const minIndex = this._minNormalLowerBoundaryIndex();
725
+ if (index <= minIndex) {
726
+ if (index === minIndex) {
727
+ return MIN_VALUE;
728
+ } else if (index === minIndex - 1) {
729
+ return Math.exp((index + (1 << this._scale)) / this._scaleFactor) / 2;
730
+ }
731
+ throw new MappingError(`overflow: ${index} is < minimum lower boundary: ${minIndex}`);
732
+ }
733
+ return Math.exp(index * this._inverseFactor);
734
+ }
735
+ get scale() {
736
+ return this._scale;
737
+ }
738
+ _minNormalLowerBoundaryIndex() {
739
+ return MIN_NORMAL_EXPONENT << this._scale;
740
+ }
741
+ _maxNormalLowerBoundaryIndex() {
742
+ return (MAX_NORMAL_EXPONENT + 1 << this._scale) - 1;
743
+ }
744
+ }
745
+ var init_LogarithmMapping = __esm(() => {
746
+ init_ieee754();
747
+ init_util();
748
+ init_types2();
749
+ });
750
+
751
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/exponential-histogram/mapping/getMapping.js
752
+ function getMapping(scale) {
753
+ if (scale > MAX_SCALE || scale < MIN_SCALE) {
754
+ throw new MappingError(`expected scale >= ${MIN_SCALE} && <= ${MAX_SCALE}, got: ${scale}`);
755
+ }
756
+ return PREBUILT_MAPPINGS[scale + 10];
757
+ }
758
+ var MIN_SCALE = -10, MAX_SCALE = 20, PREBUILT_MAPPINGS;
759
+ var init_getMapping = __esm(() => {
760
+ init_ExponentMapping();
761
+ init_LogarithmMapping();
762
+ init_types2();
763
+ PREBUILT_MAPPINGS = Array.from({ length: 31 }, (_, i) => {
764
+ if (i > 10) {
765
+ return new LogarithmMapping(i - 10);
766
+ }
767
+ return new ExponentMapping(i - 10);
768
+ });
769
+ });
770
+
771
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/ExponentialHistogram.js
772
+ class HighLow {
773
+ static combine(h1, h2) {
774
+ return new HighLow(Math.min(h1.low, h2.low), Math.max(h1.high, h2.high));
775
+ }
776
+ low;
777
+ high;
778
+ constructor(low, high) {
779
+ this.low = low;
780
+ this.high = high;
781
+ }
782
+ }
783
+
784
+ class ExponentialHistogramAccumulation {
785
+ startTime;
786
+ _maxSize;
787
+ _recordMinMax;
788
+ _sum;
789
+ _count;
790
+ _zeroCount;
791
+ _min;
792
+ _max;
793
+ _positive;
794
+ _negative;
795
+ _mapping;
796
+ constructor(startTime, maxSize = DEFAULT_MAX_SIZE, recordMinMax = true, sum = 0, count = 0, zeroCount = 0, min = Number.POSITIVE_INFINITY, max = Number.NEGATIVE_INFINITY, positive = new Buckets, negative = new Buckets, mapping = getMapping(MAX_SCALE2)) {
797
+ this.startTime = startTime;
798
+ this._maxSize = maxSize;
799
+ this._recordMinMax = recordMinMax;
800
+ this._sum = sum;
801
+ this._count = count;
802
+ this._zeroCount = zeroCount;
803
+ this._min = min;
804
+ this._max = max;
805
+ this._positive = positive;
806
+ this._negative = negative;
807
+ this._mapping = mapping;
808
+ if (this._maxSize < MIN_MAX_SIZE) {
809
+ import_api.diag.warn(`Exponential Histogram Max Size set to ${this._maxSize}, changing to the minimum size of: ${MIN_MAX_SIZE}`);
810
+ this._maxSize = MIN_MAX_SIZE;
811
+ }
812
+ }
813
+ record(value) {
814
+ this.updateByIncrement(value, 1);
815
+ }
816
+ setStartTime(startTime) {
817
+ this.startTime = startTime;
818
+ }
819
+ toPointValue() {
820
+ return {
821
+ hasMinMax: this._recordMinMax,
822
+ min: this.min,
823
+ max: this.max,
824
+ sum: this.sum,
825
+ positive: {
826
+ offset: this.positive.offset,
827
+ bucketCounts: this.positive.counts()
828
+ },
829
+ negative: {
830
+ offset: this.negative.offset,
831
+ bucketCounts: this.negative.counts()
832
+ },
833
+ count: this.count,
834
+ scale: this.scale,
835
+ zeroCount: this.zeroCount
836
+ };
837
+ }
838
+ get sum() {
839
+ return this._sum;
840
+ }
841
+ get min() {
842
+ return this._min;
843
+ }
844
+ get max() {
845
+ return this._max;
846
+ }
847
+ get count() {
848
+ return this._count;
849
+ }
850
+ get zeroCount() {
851
+ return this._zeroCount;
852
+ }
853
+ get scale() {
854
+ if (this._count === this._zeroCount) {
855
+ return 0;
856
+ }
857
+ return this._mapping.scale;
858
+ }
859
+ get positive() {
860
+ return this._positive;
861
+ }
862
+ get negative() {
863
+ return this._negative;
864
+ }
865
+ updateByIncrement(value, increment) {
866
+ if (Number.isNaN(value)) {
867
+ return;
868
+ }
869
+ if (value > this._max) {
870
+ this._max = value;
871
+ }
872
+ if (value < this._min) {
873
+ this._min = value;
874
+ }
875
+ this._count += increment;
876
+ if (value === 0) {
877
+ this._zeroCount += increment;
878
+ return;
879
+ }
880
+ this._sum += value * increment;
881
+ if (value > 0) {
882
+ this._updateBuckets(this._positive, value, increment);
883
+ } else {
884
+ this._updateBuckets(this._negative, -value, increment);
885
+ }
886
+ }
887
+ merge(previous) {
888
+ if (this._count === 0) {
889
+ this._min = previous.min;
890
+ this._max = previous.max;
891
+ } else if (previous.count !== 0) {
892
+ if (previous.min < this.min) {
893
+ this._min = previous.min;
894
+ }
895
+ if (previous.max > this.max) {
896
+ this._max = previous.max;
897
+ }
898
+ }
899
+ this.startTime = previous.startTime;
900
+ this._sum += previous.sum;
901
+ this._count += previous.count;
902
+ this._zeroCount += previous.zeroCount;
903
+ const minScale = this._minScale(previous);
904
+ this._downscale(this.scale - minScale);
905
+ this._mergeBuckets(this.positive, previous, previous.positive, minScale);
906
+ this._mergeBuckets(this.negative, previous, previous.negative, minScale);
907
+ }
908
+ diff(other) {
909
+ this._min = Infinity;
910
+ this._max = -Infinity;
911
+ this._sum -= other.sum;
912
+ this._count -= other.count;
913
+ this._zeroCount -= other.zeroCount;
914
+ const minScale = this._minScale(other);
915
+ this._downscale(this.scale - minScale);
916
+ this._diffBuckets(this.positive, other, other.positive, minScale);
917
+ this._diffBuckets(this.negative, other, other.negative, minScale);
918
+ }
919
+ clone() {
920
+ return new ExponentialHistogramAccumulation(this.startTime, this._maxSize, this._recordMinMax, this._sum, this._count, this._zeroCount, this._min, this._max, this.positive.clone(), this.negative.clone(), this._mapping);
921
+ }
922
+ _updateBuckets(buckets, value, increment) {
923
+ let index = this._mapping.mapToIndex(value);
924
+ let rescalingNeeded = false;
925
+ let high = 0;
926
+ let low = 0;
927
+ if (buckets.length === 0) {
928
+ buckets.indexStart = index;
929
+ buckets.indexEnd = buckets.indexStart;
930
+ buckets.indexBase = buckets.indexStart;
931
+ } else if (index < buckets.indexStart && buckets.indexEnd - index >= this._maxSize) {
932
+ rescalingNeeded = true;
933
+ low = index;
934
+ high = buckets.indexEnd;
935
+ } else if (index > buckets.indexEnd && index - buckets.indexStart >= this._maxSize) {
936
+ rescalingNeeded = true;
937
+ low = buckets.indexStart;
938
+ high = index;
939
+ }
940
+ if (rescalingNeeded) {
941
+ const change = this._changeScale(high, low);
942
+ this._downscale(change);
943
+ index = this._mapping.mapToIndex(value);
944
+ }
945
+ this._incrementIndexBy(buckets, index, increment);
946
+ }
947
+ _incrementIndexBy(buckets, index, increment) {
948
+ if (increment === 0) {
949
+ return;
950
+ }
951
+ if (buckets.length === 0) {
952
+ buckets.indexStart = buckets.indexEnd = buckets.indexBase = index;
953
+ }
954
+ if (index < buckets.indexStart) {
955
+ const span = buckets.indexEnd - index;
956
+ if (span >= buckets.backing.length) {
957
+ this._grow(buckets, span + 1);
958
+ }
959
+ buckets.indexStart = index;
960
+ } else if (index > buckets.indexEnd) {
961
+ const span = index - buckets.indexStart;
962
+ if (span >= buckets.backing.length) {
963
+ this._grow(buckets, span + 1);
964
+ }
965
+ buckets.indexEnd = index;
966
+ }
967
+ let bucketIndex = index - buckets.indexBase;
968
+ if (bucketIndex < 0) {
969
+ bucketIndex += buckets.backing.length;
970
+ }
971
+ buckets.incrementBucket(bucketIndex, increment);
972
+ }
973
+ _grow(buckets, needed) {
974
+ const size = buckets.backing.length;
975
+ const bias = buckets.indexBase - buckets.indexStart;
976
+ const oldPositiveLimit = size - bias;
977
+ let newSize = nextGreaterSquare(needed);
978
+ if (newSize > this._maxSize) {
979
+ newSize = this._maxSize;
980
+ }
981
+ const newPositiveLimit = newSize - bias;
982
+ buckets.backing.growTo(newSize, oldPositiveLimit, newPositiveLimit);
983
+ }
984
+ _changeScale(high, low) {
985
+ let change = 0;
986
+ while (high - low >= this._maxSize) {
987
+ high >>= 1;
988
+ low >>= 1;
989
+ change++;
990
+ }
991
+ return change;
992
+ }
993
+ _downscale(change) {
994
+ if (change === 0) {
995
+ return;
996
+ }
997
+ if (change < 0) {
998
+ throw new Error(`impossible change of scale: ${this.scale}`);
999
+ }
1000
+ const newScale = this._mapping.scale - change;
1001
+ this._positive.downscale(change);
1002
+ this._negative.downscale(change);
1003
+ this._mapping = getMapping(newScale);
1004
+ }
1005
+ _minScale(other) {
1006
+ const minScale = Math.min(this.scale, other.scale);
1007
+ const highLowPos = HighLow.combine(this._highLowAtScale(this.positive, this.scale, minScale), this._highLowAtScale(other.positive, other.scale, minScale));
1008
+ const highLowNeg = HighLow.combine(this._highLowAtScale(this.negative, this.scale, minScale), this._highLowAtScale(other.negative, other.scale, minScale));
1009
+ return Math.min(minScale - this._changeScale(highLowPos.high, highLowPos.low), minScale - this._changeScale(highLowNeg.high, highLowNeg.low));
1010
+ }
1011
+ _highLowAtScale(buckets, currentScale, newScale) {
1012
+ if (buckets.length === 0) {
1013
+ return new HighLow(0, -1);
1014
+ }
1015
+ const shift = currentScale - newScale;
1016
+ return new HighLow(buckets.indexStart >> shift, buckets.indexEnd >> shift);
1017
+ }
1018
+ _mergeBuckets(ours, other, theirs, scale) {
1019
+ const theirOffset = theirs.offset;
1020
+ const theirChange = other.scale - scale;
1021
+ for (let i = 0;i < theirs.length; i++) {
1022
+ this._incrementIndexBy(ours, theirOffset + i >> theirChange, theirs.at(i));
1023
+ }
1024
+ }
1025
+ _diffBuckets(ours, other, theirs, scale) {
1026
+ const theirOffset = theirs.offset;
1027
+ const theirChange = other.scale - scale;
1028
+ for (let i = 0;i < theirs.length; i++) {
1029
+ const ourIndex = theirOffset + i >> theirChange;
1030
+ let bucketIndex = ourIndex - ours.indexBase;
1031
+ if (bucketIndex < 0) {
1032
+ bucketIndex += ours.backing.length;
1033
+ }
1034
+ ours.decrementBucket(bucketIndex, theirs.at(i));
1035
+ }
1036
+ ours.trim();
1037
+ }
1038
+ }
1039
+
1040
+ class ExponentialHistogramAggregator {
1041
+ kind = AggregatorKind.EXPONENTIAL_HISTOGRAM;
1042
+ _maxSize;
1043
+ _recordMinMax;
1044
+ constructor(maxSize, recordMinMax) {
1045
+ this._maxSize = maxSize;
1046
+ this._recordMinMax = recordMinMax;
1047
+ }
1048
+ createAccumulation(startTime) {
1049
+ return new ExponentialHistogramAccumulation(startTime, this._maxSize, this._recordMinMax);
1050
+ }
1051
+ merge(previous, delta) {
1052
+ const result = delta.clone();
1053
+ result.merge(previous);
1054
+ return result;
1055
+ }
1056
+ diff(previous, current) {
1057
+ const result = current.clone();
1058
+ result.diff(previous);
1059
+ return result;
1060
+ }
1061
+ toMetricData(descriptor, aggregationTemporality, accumulationByAttributes, endTime) {
1062
+ return {
1063
+ descriptor,
1064
+ aggregationTemporality,
1065
+ dataPointType: DataPointType.EXPONENTIAL_HISTOGRAM,
1066
+ dataPoints: accumulationByAttributes.map(([attributes, accumulation]) => {
1067
+ const pointValue = accumulation.toPointValue();
1068
+ const allowsNegativeValues = descriptor.type === InstrumentType.GAUGE || descriptor.type === InstrumentType.UP_DOWN_COUNTER || descriptor.type === InstrumentType.OBSERVABLE_GAUGE || descriptor.type === InstrumentType.OBSERVABLE_UP_DOWN_COUNTER;
1069
+ return {
1070
+ attributes,
1071
+ startTime: accumulation.startTime,
1072
+ endTime,
1073
+ value: {
1074
+ min: pointValue.hasMinMax ? pointValue.min : undefined,
1075
+ max: pointValue.hasMinMax ? pointValue.max : undefined,
1076
+ sum: !allowsNegativeValues ? pointValue.sum : undefined,
1077
+ positive: {
1078
+ offset: pointValue.positive.offset,
1079
+ bucketCounts: pointValue.positive.bucketCounts
1080
+ },
1081
+ negative: {
1082
+ offset: pointValue.negative.offset,
1083
+ bucketCounts: pointValue.negative.bucketCounts
1084
+ },
1085
+ count: pointValue.count,
1086
+ scale: pointValue.scale,
1087
+ zeroCount: pointValue.zeroCount
1088
+ }
1089
+ };
1090
+ })
1091
+ };
1092
+ }
1093
+ }
1094
+ var import_api, MAX_SCALE2 = 20, DEFAULT_MAX_SIZE = 160, MIN_MAX_SIZE = 2;
1095
+ var init_ExponentialHistogram = __esm(() => {
1096
+ init_types();
1097
+ init_MetricData();
1098
+ init_Buckets();
1099
+ init_getMapping();
1100
+ init_util();
1101
+ import_api = __toESM(require_src(), 1);
1102
+ });
1103
+
1104
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/LastValue.js
1105
+ class LastValueAccumulation {
1106
+ startTime;
1107
+ _current;
1108
+ sampleTime;
1109
+ constructor(startTime, current = 0, sampleTime = [0, 0]) {
1110
+ this.startTime = startTime;
1111
+ this._current = current;
1112
+ this.sampleTime = sampleTime;
1113
+ }
1114
+ record(value) {
1115
+ this._current = value;
1116
+ this.sampleTime = millisToHrTime(Date.now());
1117
+ }
1118
+ setStartTime(startTime) {
1119
+ this.startTime = startTime;
1120
+ }
1121
+ toPointValue() {
1122
+ return this._current;
1123
+ }
1124
+ }
1125
+
1126
+ class LastValueAggregator {
1127
+ kind = AggregatorKind.LAST_VALUE;
1128
+ createAccumulation(startTime) {
1129
+ return new LastValueAccumulation(startTime);
1130
+ }
1131
+ merge(previous, delta) {
1132
+ const latestAccumulation = hrTimeToMicroseconds(delta.sampleTime) >= hrTimeToMicroseconds(previous.sampleTime) ? delta : previous;
1133
+ return new LastValueAccumulation(previous.startTime, latestAccumulation.toPointValue(), latestAccumulation.sampleTime);
1134
+ }
1135
+ diff(previous, current) {
1136
+ const latestAccumulation = hrTimeToMicroseconds(current.sampleTime) >= hrTimeToMicroseconds(previous.sampleTime) ? current : previous;
1137
+ return new LastValueAccumulation(current.startTime, latestAccumulation.toPointValue(), latestAccumulation.sampleTime);
1138
+ }
1139
+ toMetricData(descriptor, aggregationTemporality, accumulationByAttributes, endTime) {
1140
+ return {
1141
+ descriptor,
1142
+ aggregationTemporality,
1143
+ dataPointType: DataPointType.GAUGE,
1144
+ dataPoints: accumulationByAttributes.map(([attributes, accumulation]) => {
1145
+ return {
1146
+ attributes,
1147
+ startTime: accumulation.startTime,
1148
+ endTime,
1149
+ value: accumulation.toPointValue()
1150
+ };
1151
+ })
1152
+ };
1153
+ }
1154
+ }
1155
+ var init_LastValue = __esm(() => {
1156
+ init_types();
1157
+ init_esm();
1158
+ init_MetricData();
1159
+ });
1160
+
1161
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/Sum.js
1162
+ class SumAccumulation {
1163
+ startTime;
1164
+ monotonic;
1165
+ _current;
1166
+ reset;
1167
+ constructor(startTime, monotonic, current = 0, reset = false) {
1168
+ this.startTime = startTime;
1169
+ this.monotonic = monotonic;
1170
+ this._current = current;
1171
+ this.reset = reset;
1172
+ }
1173
+ record(value) {
1174
+ if (this.monotonic && value < 0) {
1175
+ return;
1176
+ }
1177
+ this._current += value;
1178
+ }
1179
+ setStartTime(startTime) {
1180
+ this.startTime = startTime;
1181
+ }
1182
+ toPointValue() {
1183
+ return this._current;
1184
+ }
1185
+ }
1186
+
1187
+ class SumAggregator {
1188
+ kind = AggregatorKind.SUM;
1189
+ monotonic;
1190
+ constructor(monotonic) {
1191
+ this.monotonic = monotonic;
1192
+ }
1193
+ createAccumulation(startTime) {
1194
+ return new SumAccumulation(startTime, this.monotonic);
1195
+ }
1196
+ merge(previous, delta) {
1197
+ const prevPv = previous.toPointValue();
1198
+ const deltaPv = delta.toPointValue();
1199
+ if (delta.reset) {
1200
+ return new SumAccumulation(delta.startTime, this.monotonic, deltaPv, delta.reset);
1201
+ }
1202
+ return new SumAccumulation(previous.startTime, this.monotonic, prevPv + deltaPv);
1203
+ }
1204
+ diff(previous, current) {
1205
+ const prevPv = previous.toPointValue();
1206
+ const currPv = current.toPointValue();
1207
+ if (this.monotonic && prevPv > currPv) {
1208
+ return new SumAccumulation(current.startTime, this.monotonic, currPv, true);
1209
+ }
1210
+ return new SumAccumulation(current.startTime, this.monotonic, currPv - prevPv);
1211
+ }
1212
+ toMetricData(descriptor, aggregationTemporality, accumulationByAttributes, endTime) {
1213
+ return {
1214
+ descriptor,
1215
+ aggregationTemporality,
1216
+ dataPointType: DataPointType.SUM,
1217
+ dataPoints: accumulationByAttributes.map(([attributes, accumulation]) => {
1218
+ return {
1219
+ attributes,
1220
+ startTime: accumulation.startTime,
1221
+ endTime,
1222
+ value: accumulation.toPointValue()
1223
+ };
1224
+ }),
1225
+ isMonotonic: this.monotonic
1226
+ };
1227
+ }
1228
+ }
1229
+ var init_Sum = __esm(() => {
1230
+ init_types();
1231
+ init_MetricData();
1232
+ });
1233
+
1234
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/aggregator/index.js
1235
+ var init_aggregator = __esm(() => {
1236
+ init_Drop();
1237
+ init_Histogram();
1238
+ init_ExponentialHistogram();
1239
+ init_LastValue();
1240
+ init_Sum();
1241
+ });
1242
+
1243
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/view/Aggregation.js
1244
+ class ExplicitBucketHistogramAggregation {
1245
+ _boundaries;
1246
+ _recordMinMax;
1247
+ constructor(boundaries, recordMinMax = true) {
1248
+ if (boundaries == null) {
1249
+ throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");
1250
+ }
1251
+ boundaries = boundaries.concat();
1252
+ boundaries = boundaries.sort((a, b) => a - b);
1253
+ const minusInfinityIndex = boundaries.lastIndexOf(-Infinity);
1254
+ let infinityIndex = boundaries.indexOf(Infinity);
1255
+ if (infinityIndex === -1) {
1256
+ infinityIndex = undefined;
1257
+ }
1258
+ this._boundaries = boundaries.slice(minusInfinityIndex + 1, infinityIndex);
1259
+ this._recordMinMax = recordMinMax;
1260
+ }
1261
+ createAggregator(_instrument) {
1262
+ return new HistogramAggregator(this._boundaries, this._recordMinMax);
1263
+ }
1264
+ }
1265
+
1266
+ class ExponentialHistogramAggregation {
1267
+ _maxSize;
1268
+ _recordMinMax;
1269
+ constructor(maxSize = 160, recordMinMax = true) {
1270
+ this._maxSize = maxSize;
1271
+ this._recordMinMax = recordMinMax;
1272
+ }
1273
+ createAggregator(_instrument) {
1274
+ return new ExponentialHistogramAggregator(this._maxSize, this._recordMinMax);
1275
+ }
1276
+ }
1277
+
1278
+ class DefaultAggregation {
1279
+ _resolve(instrument) {
1280
+ switch (instrument.type) {
1281
+ case InstrumentType.COUNTER:
1282
+ case InstrumentType.UP_DOWN_COUNTER:
1283
+ case InstrumentType.OBSERVABLE_COUNTER:
1284
+ case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER: {
1285
+ return SUM_AGGREGATION;
1286
+ }
1287
+ case InstrumentType.GAUGE:
1288
+ case InstrumentType.OBSERVABLE_GAUGE: {
1289
+ return LAST_VALUE_AGGREGATION;
1290
+ }
1291
+ case InstrumentType.HISTOGRAM: {
1292
+ if (instrument.advice.explicitBucketBoundaries) {
1293
+ return new ExplicitBucketHistogramAggregation(instrument.advice.explicitBucketBoundaries);
1294
+ }
1295
+ return HISTOGRAM_AGGREGATION;
1296
+ }
1297
+ }
1298
+ api.diag.warn(`Unable to recognize instrument type: ${instrument.type}`);
1299
+ return DROP_AGGREGATION;
1300
+ }
1301
+ createAggregator(instrument) {
1302
+ return this._resolve(instrument).createAggregator(instrument);
1303
+ }
1304
+ }
1305
+ var api, DropAggregation, SumAggregation, LastValueAggregation, HistogramAggregation, DROP_AGGREGATION, SUM_AGGREGATION, LAST_VALUE_AGGREGATION, HISTOGRAM_AGGREGATION, EXPONENTIAL_HISTOGRAM_AGGREGATION, DEFAULT_AGGREGATION;
1306
+ var init_Aggregation = __esm(() => {
1307
+ init_aggregator();
1308
+ init_MetricData();
1309
+ api = __toESM(require_src(), 1);
1310
+ DropAggregation = class DropAggregation {
1311
+ static DEFAULT_INSTANCE = new DropAggregator;
1312
+ createAggregator(_instrument) {
1313
+ return DropAggregation.DEFAULT_INSTANCE;
1314
+ }
1315
+ };
1316
+ SumAggregation = class SumAggregation {
1317
+ static MONOTONIC_INSTANCE = new SumAggregator(true);
1318
+ static NON_MONOTONIC_INSTANCE = new SumAggregator(false);
1319
+ createAggregator(instrument) {
1320
+ switch (instrument.type) {
1321
+ case InstrumentType.COUNTER:
1322
+ case InstrumentType.OBSERVABLE_COUNTER:
1323
+ case InstrumentType.HISTOGRAM: {
1324
+ return SumAggregation.MONOTONIC_INSTANCE;
1325
+ }
1326
+ default: {
1327
+ return SumAggregation.NON_MONOTONIC_INSTANCE;
1328
+ }
1329
+ }
1330
+ }
1331
+ };
1332
+ LastValueAggregation = class LastValueAggregation {
1333
+ static DEFAULT_INSTANCE = new LastValueAggregator;
1334
+ createAggregator(_instrument) {
1335
+ return LastValueAggregation.DEFAULT_INSTANCE;
1336
+ }
1337
+ };
1338
+ HistogramAggregation = class HistogramAggregation {
1339
+ static DEFAULT_INSTANCE = new HistogramAggregator([0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 1e4], true);
1340
+ createAggregator(_instrument) {
1341
+ return HistogramAggregation.DEFAULT_INSTANCE;
1342
+ }
1343
+ };
1344
+ DROP_AGGREGATION = new DropAggregation;
1345
+ SUM_AGGREGATION = new SumAggregation;
1346
+ LAST_VALUE_AGGREGATION = new LastValueAggregation;
1347
+ HISTOGRAM_AGGREGATION = new HistogramAggregation;
1348
+ EXPONENTIAL_HISTOGRAM_AGGREGATION = new ExponentialHistogramAggregation;
1349
+ DEFAULT_AGGREGATION = new DefaultAggregation;
1350
+ });
1351
+
1352
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/view/AggregationOption.js
1353
+ function toAggregation(option) {
1354
+ switch (option.type) {
1355
+ case AggregationType.DEFAULT:
1356
+ return DEFAULT_AGGREGATION;
1357
+ case AggregationType.DROP:
1358
+ return DROP_AGGREGATION;
1359
+ case AggregationType.SUM:
1360
+ return SUM_AGGREGATION;
1361
+ case AggregationType.LAST_VALUE:
1362
+ return LAST_VALUE_AGGREGATION;
1363
+ case AggregationType.EXPONENTIAL_HISTOGRAM: {
1364
+ const expOption = option;
1365
+ return new ExponentialHistogramAggregation(expOption.options?.maxSize, expOption.options?.recordMinMax);
1366
+ }
1367
+ case AggregationType.EXPLICIT_BUCKET_HISTOGRAM: {
1368
+ const expOption = option;
1369
+ if (expOption.options == null) {
1370
+ return HISTOGRAM_AGGREGATION;
1371
+ } else {
1372
+ return new ExplicitBucketHistogramAggregation(expOption.options?.boundaries, expOption.options?.recordMinMax);
1373
+ }
1374
+ }
1375
+ default:
1376
+ throw new Error("Unsupported Aggregation");
1377
+ }
1378
+ }
1379
+ var AggregationType;
1380
+ var init_AggregationOption = __esm(() => {
1381
+ init_Aggregation();
1382
+ (function(AggregationType2) {
1383
+ AggregationType2[AggregationType2["DEFAULT"] = 0] = "DEFAULT";
1384
+ AggregationType2[AggregationType2["DROP"] = 1] = "DROP";
1385
+ AggregationType2[AggregationType2["SUM"] = 2] = "SUM";
1386
+ AggregationType2[AggregationType2["LAST_VALUE"] = 3] = "LAST_VALUE";
1387
+ AggregationType2[AggregationType2["EXPLICIT_BUCKET_HISTOGRAM"] = 4] = "EXPLICIT_BUCKET_HISTOGRAM";
1388
+ AggregationType2[AggregationType2["EXPONENTIAL_HISTOGRAM"] = 5] = "EXPONENTIAL_HISTOGRAM";
1389
+ })(AggregationType || (AggregationType = {}));
1390
+ });
1391
+
1392
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/export/AggregationSelector.js
1393
+ var DEFAULT_AGGREGATION_SELECTOR = (_instrumentType) => {
1394
+ return {
1395
+ type: AggregationType.DEFAULT
1396
+ };
1397
+ }, DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR = (_instrumentType) => AggregationTemporality.CUMULATIVE;
1398
+ var init_AggregationSelector = __esm(() => {
1399
+ init_AggregationTemporality();
1400
+ init_AggregationOption();
1401
+ });
1402
+
1403
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricReader.js
1404
+ class MetricReader {
1405
+ _shutdown = false;
1406
+ _metricProducers;
1407
+ _sdkMetricProducer;
1408
+ _aggregationTemporalitySelector;
1409
+ _aggregationSelector;
1410
+ _cardinalitySelector;
1411
+ constructor(options) {
1412
+ this._aggregationSelector = options?.aggregationSelector ?? DEFAULT_AGGREGATION_SELECTOR;
1413
+ this._aggregationTemporalitySelector = options?.aggregationTemporalitySelector ?? DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR;
1414
+ this._metricProducers = options?.metricProducers ?? [];
1415
+ this._cardinalitySelector = options?.cardinalitySelector;
1416
+ }
1417
+ setMetricProducer(metricProducer) {
1418
+ if (this._sdkMetricProducer) {
1419
+ throw new Error("MetricReader can not be bound to a MeterProvider again.");
1420
+ }
1421
+ this._sdkMetricProducer = metricProducer;
1422
+ this.onInitialized();
1423
+ }
1424
+ selectAggregation(instrumentType) {
1425
+ return this._aggregationSelector(instrumentType);
1426
+ }
1427
+ selectAggregationTemporality(instrumentType) {
1428
+ return this._aggregationTemporalitySelector(instrumentType);
1429
+ }
1430
+ selectCardinalityLimit(instrumentType) {
1431
+ return this._cardinalitySelector ? this._cardinalitySelector(instrumentType) : 2000;
1432
+ }
1433
+ onInitialized() {}
1434
+ async collect(options) {
1435
+ if (this._sdkMetricProducer === undefined) {
1436
+ throw new Error("MetricReader is not bound to a MetricProducer");
1437
+ }
1438
+ if (this._shutdown) {
1439
+ throw new Error("MetricReader is shutdown");
1440
+ }
1441
+ const [sdkCollectionResults, ...additionalCollectionResults] = await Promise.all([
1442
+ this._sdkMetricProducer.collect({
1443
+ timeoutMillis: options?.timeoutMillis
1444
+ }),
1445
+ ...this._metricProducers.map((producer) => producer.collect({
1446
+ timeoutMillis: options?.timeoutMillis
1447
+ }))
1448
+ ]);
1449
+ const errors = sdkCollectionResults.errors.concat(additionalCollectionResults.flatMap((result) => result.errors));
1450
+ const resource = sdkCollectionResults.resourceMetrics.resource;
1451
+ const scopeMetrics = sdkCollectionResults.resourceMetrics.scopeMetrics.concat(additionalCollectionResults.flatMap((result) => result.resourceMetrics.scopeMetrics));
1452
+ return {
1453
+ resourceMetrics: {
1454
+ resource,
1455
+ scopeMetrics
1456
+ },
1457
+ errors
1458
+ };
1459
+ }
1460
+ async shutdown(options) {
1461
+ if (this._shutdown) {
1462
+ api2.diag.error("Cannot call shutdown twice.");
1463
+ return;
1464
+ }
1465
+ if (options?.timeoutMillis == null) {
1466
+ await this.onShutdown();
1467
+ } else {
1468
+ await callWithTimeout(this.onShutdown(), options.timeoutMillis);
1469
+ }
1470
+ this._shutdown = true;
1471
+ }
1472
+ async forceFlush(options) {
1473
+ if (this._shutdown) {
1474
+ api2.diag.warn("Cannot forceFlush on already shutdown MetricReader.");
1475
+ return;
1476
+ }
1477
+ if (options?.timeoutMillis == null) {
1478
+ await this.onForceFlush();
1479
+ return;
1480
+ }
1481
+ await callWithTimeout(this.onForceFlush(), options.timeoutMillis);
1482
+ }
1483
+ }
1484
+ var api2;
1485
+ var init_MetricReader = __esm(() => {
1486
+ init_utils();
1487
+ init_AggregationSelector();
1488
+ api2 = __toESM(require_src(), 1);
1489
+ });
1490
+
1491
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/export/PeriodicExportingMetricReader.js
1492
+ var api3, PeriodicExportingMetricReader;
1493
+ var init_PeriodicExportingMetricReader = __esm(() => {
1494
+ init_esm();
1495
+ init_MetricReader();
1496
+ init_utils();
1497
+ init_MetricData();
1498
+ api3 = __toESM(require_src(), 1);
1499
+ PeriodicExportingMetricReader = class PeriodicExportingMetricReader extends MetricReader {
1500
+ _interval;
1501
+ _exporter;
1502
+ _exportInterval;
1503
+ _exportTimeout;
1504
+ constructor(options) {
1505
+ const { exporter, exportIntervalMillis = 60000, metricProducers, cardinalityLimits } = options;
1506
+ let { exportTimeoutMillis = 30000 } = options;
1507
+ super({
1508
+ aggregationSelector: exporter.selectAggregation?.bind(exporter),
1509
+ aggregationTemporalitySelector: exporter.selectAggregationTemporality?.bind(exporter),
1510
+ metricProducers,
1511
+ cardinalitySelector: (instrumentType) => {
1512
+ const limits = {
1513
+ default: 2000,
1514
+ ...cardinalityLimits
1515
+ };
1516
+ switch (instrumentType) {
1517
+ case InstrumentType.COUNTER:
1518
+ return limits.counter ?? limits.default;
1519
+ case InstrumentType.GAUGE:
1520
+ return limits.gauge ?? limits.default;
1521
+ case InstrumentType.HISTOGRAM:
1522
+ return limits.histogram ?? limits.default;
1523
+ case InstrumentType.OBSERVABLE_COUNTER:
1524
+ return limits.observableCounter ?? limits.default;
1525
+ case InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:
1526
+ return limits.observableUpDownCounter ?? limits.default;
1527
+ case InstrumentType.OBSERVABLE_GAUGE:
1528
+ return limits.observableGauge ?? limits.default;
1529
+ case InstrumentType.UP_DOWN_COUNTER:
1530
+ return limits.upDownCounter ?? limits.default;
1531
+ default:
1532
+ return limits.default;
1533
+ }
1534
+ }
1535
+ });
1536
+ if (exportIntervalMillis <= 0) {
1537
+ throw Error("exportIntervalMillis must be greater than 0");
1538
+ }
1539
+ if (exportTimeoutMillis <= 0) {
1540
+ throw Error("exportTimeoutMillis must be greater than 0");
1541
+ }
1542
+ if (exportIntervalMillis < exportTimeoutMillis) {
1543
+ if ("exportIntervalMillis" in options && "exportTimeoutMillis" in options) {
1544
+ throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");
1545
+ } else {
1546
+ api3.diag.info(`Timeout of ${exportTimeoutMillis} exceeds the interval of ${exportIntervalMillis}. Clamping timeout to interval duration.`);
1547
+ exportTimeoutMillis = exportIntervalMillis;
1548
+ }
1549
+ }
1550
+ this._exportInterval = exportIntervalMillis;
1551
+ this._exportTimeout = exportTimeoutMillis;
1552
+ this._exporter = exporter;
1553
+ }
1554
+ async _runOnce() {
1555
+ try {
1556
+ await callWithTimeout(this._doRun(), this._exportTimeout);
1557
+ } catch (err) {
1558
+ if (err instanceof TimeoutError) {
1559
+ api3.diag.error("Export took longer than %s milliseconds and timed out.", this._exportTimeout);
1560
+ return;
1561
+ }
1562
+ globalErrorHandler(err);
1563
+ }
1564
+ }
1565
+ async _doRun() {
1566
+ const { resourceMetrics, errors } = await this.collect({
1567
+ timeoutMillis: this._exportTimeout
1568
+ });
1569
+ if (errors.length > 0) {
1570
+ api3.diag.error("PeriodicExportingMetricReader: metrics collection errors", ...errors);
1571
+ }
1572
+ if (resourceMetrics.resource.asyncAttributesPending) {
1573
+ try {
1574
+ await resourceMetrics.resource.waitForAsyncAttributes?.();
1575
+ } catch (e) {
1576
+ api3.diag.debug("Error while resolving async portion of resource: ", e);
1577
+ globalErrorHandler(e);
1578
+ }
1579
+ }
1580
+ if (resourceMetrics.scopeMetrics.length === 0) {
1581
+ return;
1582
+ }
1583
+ const result = await internal._export(this._exporter, resourceMetrics);
1584
+ if (result.code !== ExportResultCode.SUCCESS) {
1585
+ throw new Error(`PeriodicExportingMetricReader: metrics export failed (error ${result.error})`);
1586
+ }
1587
+ }
1588
+ onInitialized() {
1589
+ this._interval = setInterval(() => {
1590
+ this._runOnce();
1591
+ }, this._exportInterval);
1592
+ if (typeof this._interval !== "number") {
1593
+ this._interval.unref();
1594
+ }
1595
+ }
1596
+ async onForceFlush() {
1597
+ await this._runOnce();
1598
+ await this._exporter.forceFlush();
1599
+ }
1600
+ async onShutdown() {
1601
+ if (this._interval) {
1602
+ clearInterval(this._interval);
1603
+ }
1604
+ await this.onForceFlush();
1605
+ await this._exporter.shutdown();
1606
+ }
1607
+ };
1608
+ });
1609
+
1610
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/export/ConsoleMetricExporter.js
1611
+ class ConsoleMetricExporter {
1612
+ _shutdown = false;
1613
+ _temporalitySelector;
1614
+ constructor(options) {
1615
+ this._temporalitySelector = options?.temporalitySelector ?? DEFAULT_AGGREGATION_TEMPORALITY_SELECTOR;
1616
+ }
1617
+ export(metrics, resultCallback) {
1618
+ if (this._shutdown) {
1619
+ resultCallback({ code: ExportResultCode.FAILED });
1620
+ return;
1621
+ }
1622
+ return ConsoleMetricExporter._sendMetrics(metrics, resultCallback);
1623
+ }
1624
+ forceFlush() {
1625
+ return Promise.resolve();
1626
+ }
1627
+ selectAggregationTemporality(_instrumentType) {
1628
+ return this._temporalitySelector(_instrumentType);
1629
+ }
1630
+ shutdown() {
1631
+ this._shutdown = true;
1632
+ return Promise.resolve();
1633
+ }
1634
+ static _sendMetrics(metrics, done) {
1635
+ for (const scopeMetrics of metrics.scopeMetrics) {
1636
+ for (const metric of scopeMetrics.metrics) {
1637
+ console.dir({
1638
+ descriptor: metric.descriptor,
1639
+ dataPointType: metric.dataPointType,
1640
+ dataPoints: metric.dataPoints
1641
+ }, { depth: null });
1642
+ }
1643
+ }
1644
+ done({ code: ExportResultCode.SUCCESS });
1645
+ }
1646
+ }
1647
+ var init_ConsoleMetricExporter = __esm(() => {
1648
+ init_esm();
1649
+ init_AggregationSelector();
1650
+ });
1651
+
1652
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/view/ViewRegistry.js
1653
+ class ViewRegistry {
1654
+ _registeredViews = [];
1655
+ addView(view) {
1656
+ this._registeredViews.push(view);
1657
+ }
1658
+ findViews(instrument, meter) {
1659
+ const views = this._registeredViews.filter((registeredView) => {
1660
+ return this._matchInstrument(registeredView.instrumentSelector, instrument) && this._matchMeter(registeredView.meterSelector, meter);
1661
+ });
1662
+ return views;
1663
+ }
1664
+ _matchInstrument(selector, instrument) {
1665
+ return (selector.getType() === undefined || instrument.type === selector.getType()) && selector.getNameFilter().match(instrument.name) && selector.getUnitFilter().match(instrument.unit);
1666
+ }
1667
+ _matchMeter(selector, meter) {
1668
+ return selector.getNameFilter().match(meter.name) && (meter.version === undefined || selector.getVersionFilter().match(meter.version)) && (meter.schemaUrl === undefined || selector.getSchemaUrlFilter().match(meter.schemaUrl));
1669
+ }
1670
+ }
1671
+ var init_ViewRegistry = () => {};
1672
+
1673
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/InstrumentDescriptor.js
1674
+ function createInstrumentDescriptor(name, type, options) {
1675
+ if (!isValidName(name)) {
1676
+ import_api2.diag.warn(`Invalid metric name: "${name}". The metric name should be a ASCII string with a length no greater than 255 characters.`);
1677
+ }
1678
+ return {
1679
+ name,
1680
+ type,
1681
+ description: options?.description ?? "",
1682
+ unit: options?.unit ?? "",
1683
+ valueType: options?.valueType ?? import_api2.ValueType.DOUBLE,
1684
+ advice: options?.advice ?? {}
1685
+ };
1686
+ }
1687
+ function createInstrumentDescriptorWithView(view, instrument) {
1688
+ return {
1689
+ name: view.name ?? instrument.name,
1690
+ description: view.description ?? instrument.description,
1691
+ type: instrument.type,
1692
+ unit: instrument.unit,
1693
+ valueType: instrument.valueType,
1694
+ advice: instrument.advice
1695
+ };
1696
+ }
1697
+ function isDescriptorCompatibleWith(descriptor, otherDescriptor) {
1698
+ return equalsCaseInsensitive(descriptor.name, otherDescriptor.name) && descriptor.unit === otherDescriptor.unit && descriptor.type === otherDescriptor.type && descriptor.valueType === otherDescriptor.valueType;
1699
+ }
1700
+ function isValidName(name) {
1701
+ return NAME_REGEXP.test(name);
1702
+ }
1703
+ var import_api2, NAME_REGEXP;
1704
+ var init_InstrumentDescriptor = __esm(() => {
1705
+ init_utils();
1706
+ import_api2 = __toESM(require_src(), 1);
1707
+ NAME_REGEXP = /^[a-z][a-z0-9_.\-/]{0,254}$/i;
1708
+ });
1709
+
1710
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/Instruments.js
1711
+ class SyncInstrument {
1712
+ _writableMetricStorage;
1713
+ _descriptor;
1714
+ constructor(writableMetricStorage, descriptor) {
1715
+ this._writableMetricStorage = writableMetricStorage;
1716
+ this._descriptor = descriptor;
1717
+ }
1718
+ _record(value, attributes = {}, context = import_api3.context.active()) {
1719
+ if (typeof value !== "number") {
1720
+ import_api3.diag.warn(`non-number value provided to metric ${this._descriptor.name}: ${value}`);
1721
+ return;
1722
+ }
1723
+ if (this._descriptor.valueType === import_api3.ValueType.INT && !Number.isInteger(value)) {
1724
+ import_api3.diag.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`);
1725
+ value = Math.trunc(value);
1726
+ if (!Number.isInteger(value)) {
1727
+ return;
1728
+ }
1729
+ }
1730
+ this._writableMetricStorage.record(value, attributes, context, millisToHrTime(Date.now()));
1731
+ }
1732
+ }
1733
+
1734
+ class ObservableInstrument {
1735
+ _metricStorages;
1736
+ _descriptor;
1737
+ _observableRegistry;
1738
+ constructor(descriptor, metricStorages, observableRegistry) {
1739
+ this._descriptor = descriptor;
1740
+ this._metricStorages = metricStorages;
1741
+ this._observableRegistry = observableRegistry;
1742
+ }
1743
+ addCallback(callback) {
1744
+ this._observableRegistry.addCallback(callback, this);
1745
+ }
1746
+ removeCallback(callback) {
1747
+ this._observableRegistry.removeCallback(callback, this);
1748
+ }
1749
+ }
1750
+ function isObservableInstrument(it) {
1751
+ return it instanceof ObservableInstrument;
1752
+ }
1753
+ var import_api3, UpDownCounterInstrument, CounterInstrument, GaugeInstrument, HistogramInstrument, ObservableCounterInstrument, ObservableGaugeInstrument, ObservableUpDownCounterInstrument;
1754
+ var init_Instruments = __esm(() => {
1755
+ init_esm();
1756
+ import_api3 = __toESM(require_src(), 1);
1757
+ UpDownCounterInstrument = class UpDownCounterInstrument extends SyncInstrument {
1758
+ add(value, attributes, ctx) {
1759
+ this._record(value, attributes, ctx);
1760
+ }
1761
+ };
1762
+ CounterInstrument = class CounterInstrument extends SyncInstrument {
1763
+ add(value, attributes, ctx) {
1764
+ if (value < 0) {
1765
+ import_api3.diag.warn(`negative value provided to counter ${this._descriptor.name}: ${value}`);
1766
+ return;
1767
+ }
1768
+ this._record(value, attributes, ctx);
1769
+ }
1770
+ };
1771
+ GaugeInstrument = class GaugeInstrument extends SyncInstrument {
1772
+ record(value, attributes, ctx) {
1773
+ this._record(value, attributes, ctx);
1774
+ }
1775
+ };
1776
+ HistogramInstrument = class HistogramInstrument extends SyncInstrument {
1777
+ record(value, attributes, ctx) {
1778
+ if (value < 0) {
1779
+ import_api3.diag.warn(`negative value provided to histogram ${this._descriptor.name}: ${value}`);
1780
+ return;
1781
+ }
1782
+ this._record(value, attributes, ctx);
1783
+ }
1784
+ };
1785
+ ObservableCounterInstrument = class ObservableCounterInstrument extends ObservableInstrument {
1786
+ };
1787
+ ObservableGaugeInstrument = class ObservableGaugeInstrument extends ObservableInstrument {
1788
+ };
1789
+ ObservableUpDownCounterInstrument = class ObservableUpDownCounterInstrument extends ObservableInstrument {
1790
+ };
1791
+ });
1792
+
1793
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/Meter.js
1794
+ class Meter {
1795
+ _meterSharedState;
1796
+ constructor(meterSharedState) {
1797
+ this._meterSharedState = meterSharedState;
1798
+ }
1799
+ createGauge(name, options) {
1800
+ const descriptor = createInstrumentDescriptor(name, InstrumentType.GAUGE, options);
1801
+ const storage = this._meterSharedState.registerMetricStorage(descriptor);
1802
+ return new GaugeInstrument(storage, descriptor);
1803
+ }
1804
+ createHistogram(name, options) {
1805
+ const descriptor = createInstrumentDescriptor(name, InstrumentType.HISTOGRAM, options);
1806
+ const storage = this._meterSharedState.registerMetricStorage(descriptor);
1807
+ return new HistogramInstrument(storage, descriptor);
1808
+ }
1809
+ createCounter(name, options) {
1810
+ const descriptor = createInstrumentDescriptor(name, InstrumentType.COUNTER, options);
1811
+ const storage = this._meterSharedState.registerMetricStorage(descriptor);
1812
+ return new CounterInstrument(storage, descriptor);
1813
+ }
1814
+ createUpDownCounter(name, options) {
1815
+ const descriptor = createInstrumentDescriptor(name, InstrumentType.UP_DOWN_COUNTER, options);
1816
+ const storage = this._meterSharedState.registerMetricStorage(descriptor);
1817
+ return new UpDownCounterInstrument(storage, descriptor);
1818
+ }
1819
+ createObservableGauge(name, options) {
1820
+ const descriptor = createInstrumentDescriptor(name, InstrumentType.OBSERVABLE_GAUGE, options);
1821
+ const storages = this._meterSharedState.registerAsyncMetricStorage(descriptor);
1822
+ return new ObservableGaugeInstrument(descriptor, storages, this._meterSharedState.observableRegistry);
1823
+ }
1824
+ createObservableCounter(name, options) {
1825
+ const descriptor = createInstrumentDescriptor(name, InstrumentType.OBSERVABLE_COUNTER, options);
1826
+ const storages = this._meterSharedState.registerAsyncMetricStorage(descriptor);
1827
+ return new ObservableCounterInstrument(descriptor, storages, this._meterSharedState.observableRegistry);
1828
+ }
1829
+ createObservableUpDownCounter(name, options) {
1830
+ const descriptor = createInstrumentDescriptor(name, InstrumentType.OBSERVABLE_UP_DOWN_COUNTER, options);
1831
+ const storages = this._meterSharedState.registerAsyncMetricStorage(descriptor);
1832
+ return new ObservableUpDownCounterInstrument(descriptor, storages, this._meterSharedState.observableRegistry);
1833
+ }
1834
+ addBatchObservableCallback(callback, observables) {
1835
+ this._meterSharedState.observableRegistry.addBatchCallback(callback, observables);
1836
+ }
1837
+ removeBatchObservableCallback(callback, observables) {
1838
+ this._meterSharedState.observableRegistry.removeBatchCallback(callback, observables);
1839
+ }
1840
+ }
1841
+ var init_Meter = __esm(() => {
1842
+ init_InstrumentDescriptor();
1843
+ init_Instruments();
1844
+ init_MetricData();
1845
+ });
1846
+
1847
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricStorage.js
1848
+ class MetricStorage {
1849
+ _instrumentDescriptor;
1850
+ constructor(instrumentDescriptor) {
1851
+ this._instrumentDescriptor = instrumentDescriptor;
1852
+ }
1853
+ getInstrumentDescriptor() {
1854
+ return this._instrumentDescriptor;
1855
+ }
1856
+ updateDescription(description) {
1857
+ this._instrumentDescriptor = createInstrumentDescriptor(this._instrumentDescriptor.name, this._instrumentDescriptor.type, {
1858
+ description,
1859
+ valueType: this._instrumentDescriptor.valueType,
1860
+ unit: this._instrumentDescriptor.unit,
1861
+ advice: this._instrumentDescriptor.advice
1862
+ });
1863
+ }
1864
+ }
1865
+ var init_MetricStorage = __esm(() => {
1866
+ init_InstrumentDescriptor();
1867
+ });
1868
+
1869
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/state/HashMap.js
1870
+ class HashMap {
1871
+ _valueMap = new Map;
1872
+ _keyMap = new Map;
1873
+ _hash;
1874
+ constructor(hash) {
1875
+ this._hash = hash;
1876
+ }
1877
+ get(key, hashCode) {
1878
+ hashCode ??= this._hash(key);
1879
+ return this._valueMap.get(hashCode);
1880
+ }
1881
+ getOrDefault(key, defaultFactory) {
1882
+ const hash = this._hash(key);
1883
+ if (this._valueMap.has(hash)) {
1884
+ return this._valueMap.get(hash);
1885
+ }
1886
+ const val = defaultFactory();
1887
+ if (!this._keyMap.has(hash)) {
1888
+ this._keyMap.set(hash, key);
1889
+ }
1890
+ this._valueMap.set(hash, val);
1891
+ return val;
1892
+ }
1893
+ set(key, value, hashCode) {
1894
+ hashCode ??= this._hash(key);
1895
+ if (!this._keyMap.has(hashCode)) {
1896
+ this._keyMap.set(hashCode, key);
1897
+ }
1898
+ this._valueMap.set(hashCode, value);
1899
+ }
1900
+ has(key, hashCode) {
1901
+ hashCode ??= this._hash(key);
1902
+ return this._valueMap.has(hashCode);
1903
+ }
1904
+ *keys() {
1905
+ const keyIterator = this._keyMap.entries();
1906
+ let next = keyIterator.next();
1907
+ while (next.done !== true) {
1908
+ yield [next.value[1], next.value[0]];
1909
+ next = keyIterator.next();
1910
+ }
1911
+ }
1912
+ *entries() {
1913
+ const valueIterator = this._valueMap.entries();
1914
+ let next = valueIterator.next();
1915
+ while (next.done !== true) {
1916
+ yield [this._keyMap.get(next.value[0]), next.value[1], next.value[0]];
1917
+ next = valueIterator.next();
1918
+ }
1919
+ }
1920
+ get size() {
1921
+ return this._valueMap.size;
1922
+ }
1923
+ }
1924
+ var AttributeHashMap;
1925
+ var init_HashMap = __esm(() => {
1926
+ init_utils();
1927
+ AttributeHashMap = class AttributeHashMap extends HashMap {
1928
+ constructor() {
1929
+ super(hashAttributes);
1930
+ }
1931
+ };
1932
+ });
1933
+
1934
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/state/DeltaMetricProcessor.js
1935
+ class DeltaMetricProcessor {
1936
+ _activeCollectionStorage = new AttributeHashMap;
1937
+ _cumulativeMemoStorage = new AttributeHashMap;
1938
+ _cardinalityLimit;
1939
+ _overflowAttributes = { "otel.metric.overflow": true };
1940
+ _overflowHashCode;
1941
+ _aggregator;
1942
+ constructor(aggregator, aggregationCardinalityLimit) {
1943
+ this._aggregator = aggregator;
1944
+ this._cardinalityLimit = (aggregationCardinalityLimit ?? 2000) - 1;
1945
+ this._overflowHashCode = hashAttributes(this._overflowAttributes);
1946
+ }
1947
+ record(value, attributes, _context, collectionTime) {
1948
+ let accumulation = this._activeCollectionStorage.get(attributes);
1949
+ if (!accumulation) {
1950
+ if (this._activeCollectionStorage.size >= this._cardinalityLimit) {
1951
+ const overflowAccumulation = this._activeCollectionStorage.getOrDefault(this._overflowAttributes, () => this._aggregator.createAccumulation(collectionTime));
1952
+ overflowAccumulation?.record(value);
1953
+ return;
1954
+ }
1955
+ accumulation = this._aggregator.createAccumulation(collectionTime);
1956
+ this._activeCollectionStorage.set(attributes, accumulation);
1957
+ }
1958
+ accumulation?.record(value);
1959
+ }
1960
+ batchCumulate(measurements, collectionTime) {
1961
+ Array.from(measurements.entries()).forEach(([attributes, value, hashCode]) => {
1962
+ const accumulation = this._aggregator.createAccumulation(collectionTime);
1963
+ accumulation?.record(value);
1964
+ let delta = accumulation;
1965
+ if (this._cumulativeMemoStorage.has(attributes, hashCode)) {
1966
+ const previous = this._cumulativeMemoStorage.get(attributes, hashCode);
1967
+ delta = this._aggregator.diff(previous, accumulation);
1968
+ } else {
1969
+ if (this._cumulativeMemoStorage.size >= this._cardinalityLimit) {
1970
+ attributes = this._overflowAttributes;
1971
+ hashCode = this._overflowHashCode;
1972
+ if (this._cumulativeMemoStorage.has(attributes, hashCode)) {
1973
+ const previous = this._cumulativeMemoStorage.get(attributes, hashCode);
1974
+ delta = this._aggregator.diff(previous, accumulation);
1975
+ }
1976
+ }
1977
+ }
1978
+ if (this._activeCollectionStorage.has(attributes, hashCode)) {
1979
+ const active = this._activeCollectionStorage.get(attributes, hashCode);
1980
+ delta = this._aggregator.merge(active, delta);
1981
+ }
1982
+ this._cumulativeMemoStorage.set(attributes, accumulation, hashCode);
1983
+ this._activeCollectionStorage.set(attributes, delta, hashCode);
1984
+ });
1985
+ }
1986
+ collect() {
1987
+ const unreportedDelta = this._activeCollectionStorage;
1988
+ this._activeCollectionStorage = new AttributeHashMap;
1989
+ return unreportedDelta;
1990
+ }
1991
+ }
1992
+ var init_DeltaMetricProcessor = __esm(() => {
1993
+ init_utils();
1994
+ init_HashMap();
1995
+ });
1996
+
1997
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/state/TemporalMetricProcessor.js
1998
+ class TemporalMetricProcessor {
1999
+ _aggregator;
2000
+ _unreportedAccumulations = new Map;
2001
+ _reportHistory = new Map;
2002
+ constructor(aggregator, collectorHandles) {
2003
+ this._aggregator = aggregator;
2004
+ collectorHandles.forEach((handle) => {
2005
+ this._unreportedAccumulations.set(handle, []);
2006
+ });
2007
+ }
2008
+ buildMetrics(collector, instrumentDescriptor, currentAccumulations, collectionTime) {
2009
+ this._stashAccumulations(currentAccumulations);
2010
+ const unreportedAccumulations = this._getMergedUnreportedAccumulations(collector);
2011
+ let result = unreportedAccumulations;
2012
+ let aggregationTemporality;
2013
+ if (this._reportHistory.has(collector)) {
2014
+ const last = this._reportHistory.get(collector);
2015
+ const lastCollectionTime = last.collectionTime;
2016
+ aggregationTemporality = last.aggregationTemporality;
2017
+ if (aggregationTemporality === AggregationTemporality.CUMULATIVE) {
2018
+ result = TemporalMetricProcessor.merge(last.accumulations, unreportedAccumulations, this._aggregator);
2019
+ } else {
2020
+ result = TemporalMetricProcessor.calibrateStartTime(last.accumulations, unreportedAccumulations, lastCollectionTime);
2021
+ }
2022
+ } else {
2023
+ aggregationTemporality = collector.selectAggregationTemporality(instrumentDescriptor.type);
2024
+ }
2025
+ this._reportHistory.set(collector, {
2026
+ accumulations: result,
2027
+ collectionTime,
2028
+ aggregationTemporality
2029
+ });
2030
+ const accumulationRecords = AttributesMapToAccumulationRecords(result);
2031
+ if (accumulationRecords.length === 0) {
2032
+ return;
2033
+ }
2034
+ return this._aggregator.toMetricData(instrumentDescriptor, aggregationTemporality, accumulationRecords, collectionTime);
2035
+ }
2036
+ _stashAccumulations(currentAccumulation) {
2037
+ const registeredCollectors = this._unreportedAccumulations.keys();
2038
+ for (const collector of registeredCollectors) {
2039
+ let stash = this._unreportedAccumulations.get(collector);
2040
+ if (stash === undefined) {
2041
+ stash = [];
2042
+ this._unreportedAccumulations.set(collector, stash);
2043
+ }
2044
+ stash.push(currentAccumulation);
2045
+ }
2046
+ }
2047
+ _getMergedUnreportedAccumulations(collector) {
2048
+ let result = new AttributeHashMap;
2049
+ const unreportedList = this._unreportedAccumulations.get(collector);
2050
+ this._unreportedAccumulations.set(collector, []);
2051
+ if (unreportedList === undefined) {
2052
+ return result;
2053
+ }
2054
+ for (const it of unreportedList) {
2055
+ result = TemporalMetricProcessor.merge(result, it, this._aggregator);
2056
+ }
2057
+ return result;
2058
+ }
2059
+ static merge(last, current, aggregator) {
2060
+ const result = last;
2061
+ const iterator = current.entries();
2062
+ let next = iterator.next();
2063
+ while (next.done !== true) {
2064
+ const [key, record, hash] = next.value;
2065
+ if (last.has(key, hash)) {
2066
+ const lastAccumulation = last.get(key, hash);
2067
+ const accumulation = aggregator.merge(lastAccumulation, record);
2068
+ result.set(key, accumulation, hash);
2069
+ } else {
2070
+ result.set(key, record, hash);
2071
+ }
2072
+ next = iterator.next();
2073
+ }
2074
+ return result;
2075
+ }
2076
+ static calibrateStartTime(last, current, lastCollectionTime) {
2077
+ for (const [key, hash] of last.keys()) {
2078
+ const currentAccumulation = current.get(key, hash);
2079
+ currentAccumulation?.setStartTime(lastCollectionTime);
2080
+ }
2081
+ return current;
2082
+ }
2083
+ }
2084
+ function AttributesMapToAccumulationRecords(map) {
2085
+ return Array.from(map.entries());
2086
+ }
2087
+ var init_TemporalMetricProcessor = __esm(() => {
2088
+ init_AggregationTemporality();
2089
+ init_HashMap();
2090
+ });
2091
+
2092
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/state/AsyncMetricStorage.js
2093
+ var AsyncMetricStorage;
2094
+ var init_AsyncMetricStorage = __esm(() => {
2095
+ init_MetricStorage();
2096
+ init_DeltaMetricProcessor();
2097
+ init_TemporalMetricProcessor();
2098
+ init_HashMap();
2099
+ AsyncMetricStorage = class AsyncMetricStorage extends MetricStorage {
2100
+ _aggregationCardinalityLimit;
2101
+ _deltaMetricStorage;
2102
+ _temporalMetricStorage;
2103
+ _attributesProcessor;
2104
+ constructor(_instrumentDescriptor, aggregator, attributesProcessor, collectorHandles, aggregationCardinalityLimit) {
2105
+ super(_instrumentDescriptor);
2106
+ this._aggregationCardinalityLimit = aggregationCardinalityLimit;
2107
+ this._deltaMetricStorage = new DeltaMetricProcessor(aggregator, this._aggregationCardinalityLimit);
2108
+ this._temporalMetricStorage = new TemporalMetricProcessor(aggregator, collectorHandles);
2109
+ this._attributesProcessor = attributesProcessor;
2110
+ }
2111
+ record(measurements, observationTime) {
2112
+ const processed = new AttributeHashMap;
2113
+ Array.from(measurements.entries()).forEach(([attributes, value]) => {
2114
+ processed.set(this._attributesProcessor.process(attributes), value);
2115
+ });
2116
+ this._deltaMetricStorage.batchCumulate(processed, observationTime);
2117
+ }
2118
+ collect(collector, collectionTime) {
2119
+ const accumulations = this._deltaMetricStorage.collect();
2120
+ return this._temporalMetricStorage.buildMetrics(collector, this._instrumentDescriptor, accumulations, collectionTime);
2121
+ }
2122
+ };
2123
+ });
2124
+
2125
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/view/RegistrationConflicts.js
2126
+ function getIncompatibilityDetails(existing, otherDescriptor) {
2127
+ let incompatibility = "";
2128
+ if (existing.unit !== otherDescriptor.unit) {
2129
+ incompatibility += ` - Unit '${existing.unit}' does not match '${otherDescriptor.unit}'
2130
+ `;
2131
+ }
2132
+ if (existing.type !== otherDescriptor.type) {
2133
+ incompatibility += ` - Type '${existing.type}' does not match '${otherDescriptor.type}'
2134
+ `;
2135
+ }
2136
+ if (existing.valueType !== otherDescriptor.valueType) {
2137
+ incompatibility += ` - Value Type '${existing.valueType}' does not match '${otherDescriptor.valueType}'
2138
+ `;
2139
+ }
2140
+ if (existing.description !== otherDescriptor.description) {
2141
+ incompatibility += ` - Description '${existing.description}' does not match '${otherDescriptor.description}'
2142
+ `;
2143
+ }
2144
+ return incompatibility;
2145
+ }
2146
+ function getValueTypeConflictResolutionRecipe(existing, otherDescriptor) {
2147
+ return ` - use valueType '${existing.valueType}' on instrument creation or use an instrument name other than '${otherDescriptor.name}'`;
2148
+ }
2149
+ function getUnitConflictResolutionRecipe(existing, otherDescriptor) {
2150
+ return ` - use unit '${existing.unit}' on instrument creation or use an instrument name other than '${otherDescriptor.name}'`;
2151
+ }
2152
+ function getTypeConflictResolutionRecipe(existing, otherDescriptor) {
2153
+ const selector = {
2154
+ name: otherDescriptor.name,
2155
+ type: otherDescriptor.type,
2156
+ unit: otherDescriptor.unit
2157
+ };
2158
+ const selectorString = JSON.stringify(selector);
2159
+ return ` - create a new view with a name other than '${existing.name}' and InstrumentSelector '${selectorString}'`;
2160
+ }
2161
+ function getDescriptionResolutionRecipe(existing, otherDescriptor) {
2162
+ const selector = {
2163
+ name: otherDescriptor.name,
2164
+ type: otherDescriptor.type,
2165
+ unit: otherDescriptor.unit
2166
+ };
2167
+ const selectorString = JSON.stringify(selector);
2168
+ return ` - create a new view with a name other than '${existing.name}' and InstrumentSelector '${selectorString}'
2169
+ - OR - create a new view with the name ${existing.name} and description '${existing.description}' and InstrumentSelector ${selectorString}
2170
+ - OR - create a new view with the name ${otherDescriptor.name} and description '${existing.description}' and InstrumentSelector ${selectorString}`;
2171
+ }
2172
+ function getConflictResolutionRecipe(existing, otherDescriptor) {
2173
+ if (existing.valueType !== otherDescriptor.valueType) {
2174
+ return getValueTypeConflictResolutionRecipe(existing, otherDescriptor);
2175
+ }
2176
+ if (existing.unit !== otherDescriptor.unit) {
2177
+ return getUnitConflictResolutionRecipe(existing, otherDescriptor);
2178
+ }
2179
+ if (existing.type !== otherDescriptor.type) {
2180
+ return getTypeConflictResolutionRecipe(existing, otherDescriptor);
2181
+ }
2182
+ if (existing.description !== otherDescriptor.description) {
2183
+ return getDescriptionResolutionRecipe(existing, otherDescriptor);
2184
+ }
2185
+ return "";
2186
+ }
2187
+ var init_RegistrationConflicts = () => {};
2188
+
2189
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricStorageRegistry.js
2190
+ class MetricStorageRegistry {
2191
+ _sharedRegistry = new Map;
2192
+ _perCollectorRegistry = new Map;
2193
+ static create() {
2194
+ return new MetricStorageRegistry;
2195
+ }
2196
+ getStorages(collector) {
2197
+ let storages = [];
2198
+ for (const metricStorages of this._sharedRegistry.values()) {
2199
+ storages = storages.concat(metricStorages);
2200
+ }
2201
+ const perCollectorStorages = this._perCollectorRegistry.get(collector);
2202
+ if (perCollectorStorages != null) {
2203
+ for (const metricStorages of perCollectorStorages.values()) {
2204
+ storages = storages.concat(metricStorages);
2205
+ }
2206
+ }
2207
+ return storages;
2208
+ }
2209
+ register(storage) {
2210
+ this._registerStorage(storage, this._sharedRegistry);
2211
+ }
2212
+ registerForCollector(collector, storage) {
2213
+ let storageMap = this._perCollectorRegistry.get(collector);
2214
+ if (storageMap == null) {
2215
+ storageMap = new Map;
2216
+ this._perCollectorRegistry.set(collector, storageMap);
2217
+ }
2218
+ this._registerStorage(storage, storageMap);
2219
+ }
2220
+ findOrUpdateCompatibleStorage(expectedDescriptor) {
2221
+ const storages = this._sharedRegistry.get(expectedDescriptor.name);
2222
+ if (storages === undefined) {
2223
+ return null;
2224
+ }
2225
+ return this._findOrUpdateCompatibleStorage(expectedDescriptor, storages);
2226
+ }
2227
+ findOrUpdateCompatibleCollectorStorage(collector, expectedDescriptor) {
2228
+ const storageMap = this._perCollectorRegistry.get(collector);
2229
+ if (storageMap === undefined) {
2230
+ return null;
2231
+ }
2232
+ const storages = storageMap.get(expectedDescriptor.name);
2233
+ if (storages === undefined) {
2234
+ return null;
2235
+ }
2236
+ return this._findOrUpdateCompatibleStorage(expectedDescriptor, storages);
2237
+ }
2238
+ _registerStorage(storage, storageMap) {
2239
+ const descriptor = storage.getInstrumentDescriptor();
2240
+ const storages = storageMap.get(descriptor.name);
2241
+ if (storages === undefined) {
2242
+ storageMap.set(descriptor.name, [storage]);
2243
+ return;
2244
+ }
2245
+ storages.push(storage);
2246
+ }
2247
+ _findOrUpdateCompatibleStorage(expectedDescriptor, existingStorages) {
2248
+ let compatibleStorage = null;
2249
+ for (const existingStorage of existingStorages) {
2250
+ const existingDescriptor = existingStorage.getInstrumentDescriptor();
2251
+ if (isDescriptorCompatibleWith(existingDescriptor, expectedDescriptor)) {
2252
+ if (existingDescriptor.description !== expectedDescriptor.description) {
2253
+ if (expectedDescriptor.description.length > existingDescriptor.description.length) {
2254
+ existingStorage.updateDescription(expectedDescriptor.description);
2255
+ }
2256
+ api4.diag.warn("A view or instrument with the name ", expectedDescriptor.name, ` has already been registered, but has a different description and is incompatible with another registered view.
2257
+ `, `Details:
2258
+ `, getIncompatibilityDetails(existingDescriptor, expectedDescriptor), `The longer description will be used.
2259
+ To resolve the conflict:`, getConflictResolutionRecipe(existingDescriptor, expectedDescriptor));
2260
+ }
2261
+ compatibleStorage = existingStorage;
2262
+ } else {
2263
+ api4.diag.warn("A view or instrument with the name ", expectedDescriptor.name, ` has already been registered and is incompatible with another registered view.
2264
+ `, `Details:
2265
+ `, getIncompatibilityDetails(existingDescriptor, expectedDescriptor), `To resolve the conflict:
2266
+ `, getConflictResolutionRecipe(existingDescriptor, expectedDescriptor));
2267
+ }
2268
+ }
2269
+ return compatibleStorage;
2270
+ }
2271
+ }
2272
+ var api4;
2273
+ var init_MetricStorageRegistry = __esm(() => {
2274
+ init_InstrumentDescriptor();
2275
+ init_RegistrationConflicts();
2276
+ api4 = __toESM(require_src(), 1);
2277
+ });
2278
+
2279
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MultiWritableMetricStorage.js
2280
+ class MultiMetricStorage {
2281
+ _backingStorages;
2282
+ constructor(backingStorages) {
2283
+ this._backingStorages = backingStorages;
2284
+ }
2285
+ record(value, attributes, context, recordTime) {
2286
+ this._backingStorages.forEach((it) => {
2287
+ it.record(value, attributes, context, recordTime);
2288
+ });
2289
+ }
2290
+ }
2291
+ var init_MultiWritableMetricStorage = () => {};
2292
+
2293
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/ObservableResult.js
2294
+ class ObservableResultImpl {
2295
+ _buffer = new AttributeHashMap;
2296
+ _instrumentName;
2297
+ _valueType;
2298
+ constructor(instrumentName, valueType) {
2299
+ this._instrumentName = instrumentName;
2300
+ this._valueType = valueType;
2301
+ }
2302
+ observe(value, attributes = {}) {
2303
+ if (typeof value !== "number") {
2304
+ import_api4.diag.warn(`non-number value provided to metric ${this._instrumentName}: ${value}`);
2305
+ return;
2306
+ }
2307
+ if (this._valueType === import_api4.ValueType.INT && !Number.isInteger(value)) {
2308
+ import_api4.diag.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`);
2309
+ value = Math.trunc(value);
2310
+ if (!Number.isInteger(value)) {
2311
+ return;
2312
+ }
2313
+ }
2314
+ this._buffer.set(attributes, value);
2315
+ }
2316
+ }
2317
+
2318
+ class BatchObservableResultImpl {
2319
+ _buffer = new Map;
2320
+ observe(metric, value, attributes = {}) {
2321
+ if (!isObservableInstrument(metric)) {
2322
+ return;
2323
+ }
2324
+ let map = this._buffer.get(metric);
2325
+ if (map == null) {
2326
+ map = new AttributeHashMap;
2327
+ this._buffer.set(metric, map);
2328
+ }
2329
+ if (typeof value !== "number") {
2330
+ import_api4.diag.warn(`non-number value provided to metric ${metric._descriptor.name}: ${value}`);
2331
+ return;
2332
+ }
2333
+ if (metric._descriptor.valueType === import_api4.ValueType.INT && !Number.isInteger(value)) {
2334
+ import_api4.diag.warn(`INT value type cannot accept a floating-point value for ${metric._descriptor.name}, ignoring the fractional digits.`);
2335
+ value = Math.trunc(value);
2336
+ if (!Number.isInteger(value)) {
2337
+ return;
2338
+ }
2339
+ }
2340
+ map.set(attributes, value);
2341
+ }
2342
+ }
2343
+ var import_api4;
2344
+ var init_ObservableResult = __esm(() => {
2345
+ init_HashMap();
2346
+ init_Instruments();
2347
+ import_api4 = __toESM(require_src(), 1);
2348
+ });
2349
+
2350
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/state/ObservableRegistry.js
2351
+ class ObservableRegistry {
2352
+ _callbacks = [];
2353
+ _batchCallbacks = [];
2354
+ addCallback(callback, instrument) {
2355
+ const idx = this._findCallback(callback, instrument);
2356
+ if (idx >= 0) {
2357
+ return;
2358
+ }
2359
+ this._callbacks.push({ callback, instrument });
2360
+ }
2361
+ removeCallback(callback, instrument) {
2362
+ const idx = this._findCallback(callback, instrument);
2363
+ if (idx < 0) {
2364
+ return;
2365
+ }
2366
+ this._callbacks.splice(idx, 1);
2367
+ }
2368
+ addBatchCallback(callback, instruments) {
2369
+ const observableInstruments = new Set(instruments.filter(isObservableInstrument));
2370
+ if (observableInstruments.size === 0) {
2371
+ import_api5.diag.error("BatchObservableCallback is not associated with valid instruments", instruments);
2372
+ return;
2373
+ }
2374
+ const idx = this._findBatchCallback(callback, observableInstruments);
2375
+ if (idx >= 0) {
2376
+ return;
2377
+ }
2378
+ this._batchCallbacks.push({ callback, instruments: observableInstruments });
2379
+ }
2380
+ removeBatchCallback(callback, instruments) {
2381
+ const observableInstruments = new Set(instruments.filter(isObservableInstrument));
2382
+ const idx = this._findBatchCallback(callback, observableInstruments);
2383
+ if (idx < 0) {
2384
+ return;
2385
+ }
2386
+ this._batchCallbacks.splice(idx, 1);
2387
+ }
2388
+ async observe(collectionTime, timeoutMillis) {
2389
+ const callbackFutures = this._observeCallbacks(collectionTime, timeoutMillis);
2390
+ const batchCallbackFutures = this._observeBatchCallbacks(collectionTime, timeoutMillis);
2391
+ const results = await Promise.allSettled([
2392
+ ...callbackFutures,
2393
+ ...batchCallbackFutures
2394
+ ]);
2395
+ const rejections = results.filter((result) => result.status === "rejected").map((result) => result.reason);
2396
+ return rejections;
2397
+ }
2398
+ _observeCallbacks(observationTime, timeoutMillis) {
2399
+ return this._callbacks.map(async ({ callback, instrument }) => {
2400
+ const observableResult = new ObservableResultImpl(instrument._descriptor.name, instrument._descriptor.valueType);
2401
+ let callPromise = Promise.resolve(callback(observableResult));
2402
+ if (timeoutMillis != null) {
2403
+ callPromise = callWithTimeout(callPromise, timeoutMillis);
2404
+ }
2405
+ await callPromise;
2406
+ instrument._metricStorages.forEach((metricStorage) => {
2407
+ metricStorage.record(observableResult._buffer, observationTime);
2408
+ });
2409
+ });
2410
+ }
2411
+ _observeBatchCallbacks(observationTime, timeoutMillis) {
2412
+ return this._batchCallbacks.map(async ({ callback, instruments }) => {
2413
+ const observableResult = new BatchObservableResultImpl;
2414
+ let callPromise = Promise.resolve(callback(observableResult));
2415
+ if (timeoutMillis != null) {
2416
+ callPromise = callWithTimeout(callPromise, timeoutMillis);
2417
+ }
2418
+ await callPromise;
2419
+ instruments.forEach((instrument) => {
2420
+ const buffer = observableResult._buffer.get(instrument);
2421
+ if (buffer == null) {
2422
+ return;
2423
+ }
2424
+ instrument._metricStorages.forEach((metricStorage) => {
2425
+ metricStorage.record(buffer, observationTime);
2426
+ });
2427
+ });
2428
+ });
2429
+ }
2430
+ _findCallback(callback, instrument) {
2431
+ return this._callbacks.findIndex((record) => {
2432
+ return record.callback === callback && record.instrument === instrument;
2433
+ });
2434
+ }
2435
+ _findBatchCallback(callback, instruments) {
2436
+ return this._batchCallbacks.findIndex((record) => {
2437
+ return record.callback === callback && setEquals(record.instruments, instruments);
2438
+ });
2439
+ }
2440
+ }
2441
+ var import_api5;
2442
+ var init_ObservableRegistry = __esm(() => {
2443
+ init_Instruments();
2444
+ init_ObservableResult();
2445
+ init_utils();
2446
+ import_api5 = __toESM(require_src(), 1);
2447
+ });
2448
+
2449
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/state/SyncMetricStorage.js
2450
+ var SyncMetricStorage;
2451
+ var init_SyncMetricStorage = __esm(() => {
2452
+ init_MetricStorage();
2453
+ init_DeltaMetricProcessor();
2454
+ init_TemporalMetricProcessor();
2455
+ SyncMetricStorage = class SyncMetricStorage extends MetricStorage {
2456
+ _aggregationCardinalityLimit;
2457
+ _deltaMetricStorage;
2458
+ _temporalMetricStorage;
2459
+ _attributesProcessor;
2460
+ constructor(instrumentDescriptor, aggregator, attributesProcessor, collectorHandles, aggregationCardinalityLimit) {
2461
+ super(instrumentDescriptor);
2462
+ this._aggregationCardinalityLimit = aggregationCardinalityLimit;
2463
+ this._deltaMetricStorage = new DeltaMetricProcessor(aggregator, this._aggregationCardinalityLimit);
2464
+ this._temporalMetricStorage = new TemporalMetricProcessor(aggregator, collectorHandles);
2465
+ this._attributesProcessor = attributesProcessor;
2466
+ }
2467
+ record(value, attributes, context, recordTime) {
2468
+ attributes = this._attributesProcessor.process(attributes, context);
2469
+ this._deltaMetricStorage.record(value, attributes, context, recordTime);
2470
+ }
2471
+ collect(collector, collectionTime) {
2472
+ const accumulations = this._deltaMetricStorage.collect();
2473
+ return this._temporalMetricStorage.buildMetrics(collector, this._instrumentDescriptor, accumulations, collectionTime);
2474
+ }
2475
+ };
2476
+ });
2477
+
2478
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/view/AttributesProcessor.js
2479
+ class NoopAttributesProcessor {
2480
+ process(incoming, _context) {
2481
+ return incoming;
2482
+ }
2483
+ }
2484
+
2485
+ class MultiAttributesProcessor {
2486
+ _processors;
2487
+ constructor(processors) {
2488
+ this._processors = processors;
2489
+ }
2490
+ process(incoming, context) {
2491
+ let filteredAttributes = incoming;
2492
+ for (const processor of this._processors) {
2493
+ filteredAttributes = processor.process(filteredAttributes, context);
2494
+ }
2495
+ return filteredAttributes;
2496
+ }
2497
+ }
2498
+ function createNoopAttributesProcessor() {
2499
+ return NOOP;
2500
+ }
2501
+ function createMultiAttributesProcessor(processors) {
2502
+ return new MultiAttributesProcessor(processors);
2503
+ }
2504
+ var NOOP;
2505
+ var init_AttributesProcessor = __esm(() => {
2506
+ NOOP = new NoopAttributesProcessor;
2507
+ });
2508
+
2509
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterSharedState.js
2510
+ class MeterSharedState {
2511
+ metricStorageRegistry = new MetricStorageRegistry;
2512
+ observableRegistry = new ObservableRegistry;
2513
+ meter;
2514
+ _meterProviderSharedState;
2515
+ _instrumentationScope;
2516
+ constructor(meterProviderSharedState, instrumentationScope) {
2517
+ this.meter = new Meter(this);
2518
+ this._meterProviderSharedState = meterProviderSharedState;
2519
+ this._instrumentationScope = instrumentationScope;
2520
+ }
2521
+ registerMetricStorage(descriptor) {
2522
+ const storages = this._registerMetricStorage(descriptor, SyncMetricStorage);
2523
+ if (storages.length === 1) {
2524
+ return storages[0];
2525
+ }
2526
+ return new MultiMetricStorage(storages);
2527
+ }
2528
+ registerAsyncMetricStorage(descriptor) {
2529
+ const storages = this._registerMetricStorage(descriptor, AsyncMetricStorage);
2530
+ return storages;
2531
+ }
2532
+ async collect(collector, collectionTime, options) {
2533
+ const errors = await this.observableRegistry.observe(collectionTime, options?.timeoutMillis);
2534
+ const storages = this.metricStorageRegistry.getStorages(collector);
2535
+ if (storages.length === 0) {
2536
+ return null;
2537
+ }
2538
+ const metricDataList = [];
2539
+ storages.forEach((metricStorage) => {
2540
+ const metricData = metricStorage.collect(collector, collectionTime);
2541
+ if (metricData != null) {
2542
+ metricDataList.push(metricData);
2543
+ }
2544
+ });
2545
+ if (metricDataList.length === 0) {
2546
+ return { errors };
2547
+ }
2548
+ return {
2549
+ scopeMetrics: {
2550
+ scope: this._instrumentationScope,
2551
+ metrics: metricDataList
2552
+ },
2553
+ errors
2554
+ };
2555
+ }
2556
+ _registerMetricStorage(descriptor, MetricStorageType) {
2557
+ const views = this._meterProviderSharedState.viewRegistry.findViews(descriptor, this._instrumentationScope);
2558
+ let storages = views.map((view) => {
2559
+ const viewDescriptor = createInstrumentDescriptorWithView(view, descriptor);
2560
+ const compatibleStorage = this.metricStorageRegistry.findOrUpdateCompatibleStorage(viewDescriptor);
2561
+ if (compatibleStorage != null) {
2562
+ return compatibleStorage;
2563
+ }
2564
+ const aggregator = view.aggregation.createAggregator(viewDescriptor);
2565
+ const viewStorage = new MetricStorageType(viewDescriptor, aggregator, view.attributesProcessor, this._meterProviderSharedState.metricCollectors, view.aggregationCardinalityLimit);
2566
+ this.metricStorageRegistry.register(viewStorage);
2567
+ return viewStorage;
2568
+ });
2569
+ if (storages.length === 0) {
2570
+ const perCollectorAggregations = this._meterProviderSharedState.selectAggregations(descriptor.type);
2571
+ const collectorStorages = perCollectorAggregations.map(([collector, aggregation]) => {
2572
+ const compatibleStorage = this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(collector, descriptor);
2573
+ if (compatibleStorage != null) {
2574
+ return compatibleStorage;
2575
+ }
2576
+ const aggregator = aggregation.createAggregator(descriptor);
2577
+ const cardinalityLimit = collector.selectCardinalityLimit(descriptor.type);
2578
+ const storage = new MetricStorageType(descriptor, aggregator, createNoopAttributesProcessor(), [collector], cardinalityLimit);
2579
+ this.metricStorageRegistry.registerForCollector(collector, storage);
2580
+ return storage;
2581
+ });
2582
+ storages = storages.concat(collectorStorages);
2583
+ }
2584
+ return storages;
2585
+ }
2586
+ }
2587
+ var init_MeterSharedState = __esm(() => {
2588
+ init_InstrumentDescriptor();
2589
+ init_Meter();
2590
+ init_AsyncMetricStorage();
2591
+ init_MetricStorageRegistry();
2592
+ init_MultiWritableMetricStorage();
2593
+ init_ObservableRegistry();
2594
+ init_SyncMetricStorage();
2595
+ init_AttributesProcessor();
2596
+ });
2597
+
2598
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MeterProviderSharedState.js
2599
+ class MeterProviderSharedState {
2600
+ viewRegistry = new ViewRegistry;
2601
+ metricCollectors = [];
2602
+ meterSharedStates = new Map;
2603
+ resource;
2604
+ constructor(resource) {
2605
+ this.resource = resource;
2606
+ }
2607
+ getMeterSharedState(instrumentationScope) {
2608
+ const id = instrumentationScopeId(instrumentationScope);
2609
+ let meterSharedState = this.meterSharedStates.get(id);
2610
+ if (meterSharedState == null) {
2611
+ meterSharedState = new MeterSharedState(this, instrumentationScope);
2612
+ this.meterSharedStates.set(id, meterSharedState);
2613
+ }
2614
+ return meterSharedState;
2615
+ }
2616
+ selectAggregations(instrumentType) {
2617
+ const result = [];
2618
+ for (const collector of this.metricCollectors) {
2619
+ result.push([
2620
+ collector,
2621
+ toAggregation(collector.selectAggregation(instrumentType))
2622
+ ]);
2623
+ }
2624
+ return result;
2625
+ }
2626
+ }
2627
+ var init_MeterProviderSharedState = __esm(() => {
2628
+ init_utils();
2629
+ init_ViewRegistry();
2630
+ init_MeterSharedState();
2631
+ init_AggregationOption();
2632
+ });
2633
+
2634
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/state/MetricCollector.js
2635
+ class MetricCollector {
2636
+ _sharedState;
2637
+ _metricReader;
2638
+ constructor(sharedState, metricReader) {
2639
+ this._sharedState = sharedState;
2640
+ this._metricReader = metricReader;
2641
+ }
2642
+ async collect(options) {
2643
+ const collectionTime = millisToHrTime(Date.now());
2644
+ const scopeMetrics = [];
2645
+ const errors = [];
2646
+ const meterCollectionPromises = Array.from(this._sharedState.meterSharedStates.values()).map(async (meterSharedState) => {
2647
+ const current = await meterSharedState.collect(this, collectionTime, options);
2648
+ if (current?.scopeMetrics != null) {
2649
+ scopeMetrics.push(current.scopeMetrics);
2650
+ }
2651
+ if (current?.errors != null) {
2652
+ errors.push(...current.errors);
2653
+ }
2654
+ });
2655
+ await Promise.all(meterCollectionPromises);
2656
+ return {
2657
+ resourceMetrics: {
2658
+ resource: this._sharedState.resource,
2659
+ scopeMetrics
2660
+ },
2661
+ errors
2662
+ };
2663
+ }
2664
+ async forceFlush(options) {
2665
+ await this._metricReader.forceFlush(options);
2666
+ }
2667
+ async shutdown(options) {
2668
+ await this._metricReader.shutdown(options);
2669
+ }
2670
+ selectAggregationTemporality(instrumentType) {
2671
+ return this._metricReader.selectAggregationTemporality(instrumentType);
2672
+ }
2673
+ selectAggregation(instrumentType) {
2674
+ return this._metricReader.selectAggregation(instrumentType);
2675
+ }
2676
+ selectCardinalityLimit(instrumentType) {
2677
+ return this._metricReader.selectCardinalityLimit?.(instrumentType) ?? 2000;
2678
+ }
2679
+ }
2680
+ var init_MetricCollector = __esm(() => {
2681
+ init_esm();
2682
+ });
2683
+
2684
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/view/Predicate.js
2685
+ class PatternPredicate {
2686
+ _matchAll;
2687
+ _regexp;
2688
+ constructor(pattern) {
2689
+ if (pattern === "*") {
2690
+ this._matchAll = true;
2691
+ this._regexp = /.*/;
2692
+ } else {
2693
+ this._matchAll = false;
2694
+ this._regexp = new RegExp(PatternPredicate.escapePattern(pattern));
2695
+ }
2696
+ }
2697
+ match(str) {
2698
+ if (this._matchAll) {
2699
+ return true;
2700
+ }
2701
+ return this._regexp.test(str);
2702
+ }
2703
+ static escapePattern(pattern) {
2704
+ return `^${pattern.replace(ESCAPE, "\\$&").replace("*", ".*")}$`;
2705
+ }
2706
+ static hasWildcard(pattern) {
2707
+ return pattern.includes("*");
2708
+ }
2709
+ }
2710
+
2711
+ class ExactPredicate {
2712
+ _matchAll;
2713
+ _pattern;
2714
+ constructor(pattern) {
2715
+ this._matchAll = pattern === undefined;
2716
+ this._pattern = pattern;
2717
+ }
2718
+ match(str) {
2719
+ if (this._matchAll) {
2720
+ return true;
2721
+ }
2722
+ if (str === this._pattern) {
2723
+ return true;
2724
+ }
2725
+ return false;
2726
+ }
2727
+ }
2728
+ var ESCAPE;
2729
+ var init_Predicate = __esm(() => {
2730
+ ESCAPE = /[\^$\\.+?()[\]{}|]/g;
2731
+ });
2732
+
2733
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/view/InstrumentSelector.js
2734
+ class InstrumentSelector {
2735
+ _nameFilter;
2736
+ _type;
2737
+ _unitFilter;
2738
+ constructor(criteria) {
2739
+ this._nameFilter = new PatternPredicate(criteria?.name ?? "*");
2740
+ this._type = criteria?.type;
2741
+ this._unitFilter = new ExactPredicate(criteria?.unit);
2742
+ }
2743
+ getType() {
2744
+ return this._type;
2745
+ }
2746
+ getNameFilter() {
2747
+ return this._nameFilter;
2748
+ }
2749
+ getUnitFilter() {
2750
+ return this._unitFilter;
2751
+ }
2752
+ }
2753
+ var init_InstrumentSelector = __esm(() => {
2754
+ init_Predicate();
2755
+ });
2756
+
2757
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/view/MeterSelector.js
2758
+ class MeterSelector {
2759
+ _nameFilter;
2760
+ _versionFilter;
2761
+ _schemaUrlFilter;
2762
+ constructor(criteria) {
2763
+ this._nameFilter = new ExactPredicate(criteria?.name);
2764
+ this._versionFilter = new ExactPredicate(criteria?.version);
2765
+ this._schemaUrlFilter = new ExactPredicate(criteria?.schemaUrl);
2766
+ }
2767
+ getNameFilter() {
2768
+ return this._nameFilter;
2769
+ }
2770
+ getVersionFilter() {
2771
+ return this._versionFilter;
2772
+ }
2773
+ getSchemaUrlFilter() {
2774
+ return this._schemaUrlFilter;
2775
+ }
2776
+ }
2777
+ var init_MeterSelector = __esm(() => {
2778
+ init_Predicate();
2779
+ });
2780
+
2781
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/view/View.js
2782
+ function isSelectorNotProvided(options) {
2783
+ return options.instrumentName == null && options.instrumentType == null && options.instrumentUnit == null && options.meterName == null && options.meterVersion == null && options.meterSchemaUrl == null;
2784
+ }
2785
+ function validateViewOptions(viewOptions) {
2786
+ if (isSelectorNotProvided(viewOptions)) {
2787
+ throw new Error("Cannot create view with no selector arguments supplied");
2788
+ }
2789
+ if (viewOptions.name != null && (viewOptions?.instrumentName == null || PatternPredicate.hasWildcard(viewOptions.instrumentName))) {
2790
+ throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.");
2791
+ }
2792
+ }
2793
+
2794
+ class View {
2795
+ name;
2796
+ description;
2797
+ aggregation;
2798
+ attributesProcessor;
2799
+ instrumentSelector;
2800
+ meterSelector;
2801
+ aggregationCardinalityLimit;
2802
+ constructor(viewOptions) {
2803
+ validateViewOptions(viewOptions);
2804
+ if (viewOptions.attributesProcessors != null) {
2805
+ this.attributesProcessor = createMultiAttributesProcessor(viewOptions.attributesProcessors);
2806
+ } else {
2807
+ this.attributesProcessor = createNoopAttributesProcessor();
2808
+ }
2809
+ this.name = viewOptions.name;
2810
+ this.description = viewOptions.description;
2811
+ this.aggregation = toAggregation(viewOptions.aggregation ?? { type: AggregationType.DEFAULT });
2812
+ this.instrumentSelector = new InstrumentSelector({
2813
+ name: viewOptions.instrumentName,
2814
+ type: viewOptions.instrumentType,
2815
+ unit: viewOptions.instrumentUnit
2816
+ });
2817
+ this.meterSelector = new MeterSelector({
2818
+ name: viewOptions.meterName,
2819
+ version: viewOptions.meterVersion,
2820
+ schemaUrl: viewOptions.meterSchemaUrl
2821
+ });
2822
+ this.aggregationCardinalityLimit = viewOptions.aggregationCardinalityLimit;
2823
+ }
2824
+ }
2825
+ var init_View = __esm(() => {
2826
+ init_Predicate();
2827
+ init_AttributesProcessor();
2828
+ init_InstrumentSelector();
2829
+ init_MeterSelector();
2830
+ init_AggregationOption();
2831
+ });
2832
+
2833
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/MeterProvider.js
2834
+ class MeterProvider {
2835
+ _sharedState;
2836
+ _shutdown = false;
2837
+ constructor(options) {
2838
+ this._sharedState = new MeterProviderSharedState(options?.resource ?? defaultResource());
2839
+ if (options?.views != null && options.views.length > 0) {
2840
+ for (const viewOption of options.views) {
2841
+ this._sharedState.viewRegistry.addView(new View(viewOption));
2842
+ }
2843
+ }
2844
+ if (options?.readers != null && options.readers.length > 0) {
2845
+ for (const metricReader of options.readers) {
2846
+ const collector = new MetricCollector(this._sharedState, metricReader);
2847
+ metricReader.setMetricProducer(collector);
2848
+ this._sharedState.metricCollectors.push(collector);
2849
+ }
2850
+ }
2851
+ }
2852
+ getMeter(name, version = "", options = {}) {
2853
+ if (this._shutdown) {
2854
+ import_api6.diag.warn("A shutdown MeterProvider cannot provide a Meter");
2855
+ return import_api6.createNoopMeter();
2856
+ }
2857
+ return this._sharedState.getMeterSharedState({
2858
+ name,
2859
+ version,
2860
+ schemaUrl: options.schemaUrl
2861
+ }).meter;
2862
+ }
2863
+ async shutdown(options) {
2864
+ if (this._shutdown) {
2865
+ import_api6.diag.warn("shutdown may only be called once per MeterProvider");
2866
+ return;
2867
+ }
2868
+ this._shutdown = true;
2869
+ await Promise.all(this._sharedState.metricCollectors.map((collector) => {
2870
+ return collector.shutdown(options);
2871
+ }));
2872
+ }
2873
+ async forceFlush(options) {
2874
+ if (this._shutdown) {
2875
+ import_api6.diag.warn("invalid attempt to force flush after MeterProvider shutdown");
2876
+ return;
2877
+ }
2878
+ await Promise.all(this._sharedState.metricCollectors.map((collector) => {
2879
+ return collector.forceFlush(options);
2880
+ }));
2881
+ }
2882
+ }
2883
+ var import_api6;
2884
+ var init_MeterProvider = __esm(() => {
2885
+ init_esm2();
2886
+ init_MeterProviderSharedState();
2887
+ init_MetricCollector();
2888
+ init_View();
2889
+ import_api6 = __toESM(require_src(), 1);
2890
+ });
2891
+
2892
+ // node_modules/.bun/@opentelemetry+sdk-metrics@2.7.0+e40b0dfdd726a224/node_modules/@opentelemetry/sdk-metrics/build/esm/index.js
2893
+ var init_esm5 = __esm(() => {
2894
+ init_AggregationTemporality();
2895
+ init_PeriodicExportingMetricReader();
2896
+ init_ConsoleMetricExporter();
2897
+ init_MeterProvider();
2898
+ });
2899
+
2900
+ // src/services/api/metricsOptOut.ts
2901
+ async function _fetchMetricsEnabled() {
2902
+ const authResult = getAuthHeaders();
2903
+ if (authResult.error) {
2904
+ throw new Error(`Auth error: ${authResult.error}`);
2905
+ }
2906
+ const headers = {
2907
+ "Content-Type": "application/json",
2908
+ "User-Agent": getClaudeCodeUserAgent(),
2909
+ ...authResult.headers
2910
+ };
2911
+ const endpoint = `https://api.anthropic.com/api/claude_code/organizations/metrics_enabled`;
2912
+ const response = await axios_default.get(endpoint, {
2913
+ headers,
2914
+ timeout: 5000
2915
+ });
2916
+ return response.data;
2917
+ }
2918
+ async function _checkMetricsEnabledAPI() {
2919
+ if (isEssentialTrafficOnly()) {
2920
+ return { enabled: false, hasError: false };
2921
+ }
2922
+ try {
2923
+ const data = await withOAuth401Retry(_fetchMetricsEnabled, {
2924
+ also403Revoked: true
2925
+ });
2926
+ logForDebugging(`Metrics opt-out API response: enabled=${data.metrics_logging_enabled}`);
2927
+ return {
2928
+ enabled: data.metrics_logging_enabled,
2929
+ hasError: false
2930
+ };
2931
+ } catch (error) {
2932
+ logForDebugging(`Failed to check metrics opt-out status: ${errorMessage(error)}`);
2933
+ logError(error);
2934
+ return { enabled: false, hasError: true };
2935
+ }
2936
+ }
2937
+ async function refreshMetricsStatus() {
2938
+ const result = await memoizedCheckMetrics();
2939
+ if (result.hasError) {
2940
+ return result;
2941
+ }
2942
+ const cached = getGlobalConfig().metricsStatusCache;
2943
+ const unchanged = cached !== undefined && cached.enabled === result.enabled;
2944
+ if (unchanged && Date.now() - cached.timestamp < DISK_CACHE_TTL_MS) {
2945
+ return result;
2946
+ }
2947
+ saveGlobalConfig((current) => ({
2948
+ ...current,
2949
+ metricsStatusCache: {
2950
+ enabled: result.enabled,
2951
+ timestamp: Date.now()
2952
+ }
2953
+ }));
2954
+ return result;
2955
+ }
2956
+ async function checkMetricsEnabled() {
2957
+ if (isClaudeAISubscriber() && !hasProfileScope()) {
2958
+ return { enabled: false, hasError: false };
2959
+ }
2960
+ const cached = getGlobalConfig().metricsStatusCache;
2961
+ if (cached) {
2962
+ if (Date.now() - cached.timestamp > DISK_CACHE_TTL_MS) {
2963
+ refreshMetricsStatus().catch(logError);
2964
+ }
2965
+ return {
2966
+ enabled: cached.enabled,
2967
+ hasError: false
2968
+ };
2969
+ }
2970
+ return refreshMetricsStatus();
2971
+ }
2972
+ var CACHE_TTL_MS, DISK_CACHE_TTL_MS, memoizedCheckMetrics;
2973
+ var init_metricsOptOut = __esm(() => {
2974
+ init_axios();
2975
+ init_auth();
2976
+ init_config();
2977
+ init_debug();
2978
+ init_errors();
2979
+ init_http();
2980
+ init_log();
2981
+ init_memoize();
2982
+ init_privacyLevel();
2983
+ init_userAgent();
2984
+ CACHE_TTL_MS = 60 * 60 * 1000;
2985
+ DISK_CACHE_TTL_MS = 24 * 60 * 60 * 1000;
2986
+ memoizedCheckMetrics = memoizeWithTTLAsync(_checkMetricsEnabledAPI, CACHE_TTL_MS);
2987
+ });
2988
+
2989
+ // src/utils/telemetry/bigqueryExporter.ts
2990
+ class BigQueryMetricsExporter {
2991
+ endpoint;
2992
+ timeout;
2993
+ pendingExports = [];
2994
+ isShutdown = false;
2995
+ constructor(options = {}) {
2996
+ const defaultEndpoint = "https://api.anthropic.com/api/claude_code/metrics";
2997
+ if (process.env.USER_TYPE === "ant" && process.env.ANT_CLAUDE_CODE_METRICS_ENDPOINT) {
2998
+ this.endpoint = process.env.ANT_CLAUDE_CODE_METRICS_ENDPOINT + "/api/claude_code/metrics";
2999
+ } else {
3000
+ this.endpoint = defaultEndpoint;
3001
+ }
3002
+ this.timeout = options.timeout || 5000;
3003
+ }
3004
+ async export(metrics, resultCallback) {
3005
+ if (this.isShutdown) {
3006
+ resultCallback({
3007
+ code: ExportResultCode.FAILED,
3008
+ error: new Error("Exporter has been shutdown")
3009
+ });
3010
+ return;
3011
+ }
3012
+ const exportPromise = this.doExport(metrics, resultCallback);
3013
+ this.pendingExports.push(exportPromise);
3014
+ exportPromise.finally(() => {
3015
+ const index = this.pendingExports.indexOf(exportPromise);
3016
+ if (index > -1) {
3017
+ this.pendingExports.splice(index, 1);
3018
+ }
3019
+ });
3020
+ }
3021
+ async doExport(metrics, resultCallback) {
3022
+ try {
3023
+ const hasTrust = checkHasTrustDialogAccepted() || getIsNonInteractiveSession();
3024
+ if (!hasTrust) {
3025
+ logForDebugging("BigQuery metrics export: trust not established, skipping");
3026
+ resultCallback({ code: ExportResultCode.SUCCESS });
3027
+ return;
3028
+ }
3029
+ const metricsStatus = await checkMetricsEnabled();
3030
+ if (!metricsStatus.enabled) {
3031
+ logForDebugging("Metrics export disabled by organization setting");
3032
+ resultCallback({ code: ExportResultCode.SUCCESS });
3033
+ return;
3034
+ }
3035
+ const payload = this.transformMetricsForInternal(metrics);
3036
+ const authResult = getAuthHeaders();
3037
+ if (authResult.error) {
3038
+ logForDebugging(`Metrics export failed: ${authResult.error}`);
3039
+ resultCallback({
3040
+ code: ExportResultCode.FAILED,
3041
+ error: new Error(authResult.error)
3042
+ });
3043
+ return;
3044
+ }
3045
+ const headers = {
3046
+ "Content-Type": "application/json",
3047
+ "User-Agent": getClaudeCodeUserAgent(),
3048
+ ...authResult.headers
3049
+ };
3050
+ const response = await axios_default.post(this.endpoint, payload, {
3051
+ timeout: this.timeout,
3052
+ headers
3053
+ });
3054
+ logForDebugging("BigQuery metrics exported successfully");
3055
+ logForDebugging(`BigQuery API Response: ${jsonStringify(response.data, null, 2)}`);
3056
+ resultCallback({ code: ExportResultCode.SUCCESS });
3057
+ } catch (error) {
3058
+ logForDebugging(`BigQuery metrics export failed: ${errorMessage(error)}`);
3059
+ logError(error);
3060
+ resultCallback({
3061
+ code: ExportResultCode.FAILED,
3062
+ error: toError(error)
3063
+ });
3064
+ }
3065
+ }
3066
+ transformMetricsForInternal(metrics) {
3067
+ const attrs = metrics.resource.attributes;
3068
+ const resourceAttributes = {
3069
+ "service.name": attrs["service.name"] || "claude-code",
3070
+ "service.version": attrs["service.version"] || "unknown",
3071
+ "os.type": attrs["os.type"] || "unknown",
3072
+ "os.version": attrs["os.version"] || "unknown",
3073
+ "host.arch": attrs["host.arch"] || "unknown",
3074
+ "aggregation.temporality": this.selectAggregationTemporality() === AggregationTemporality.DELTA ? "delta" : "cumulative"
3075
+ };
3076
+ if (attrs["wsl.version"]) {
3077
+ resourceAttributes["wsl.version"] = attrs["wsl.version"];
3078
+ }
3079
+ if (isClaudeAISubscriber()) {
3080
+ resourceAttributes["user.customer_type"] = "claude_ai";
3081
+ const subscriptionType = getSubscriptionType();
3082
+ if (subscriptionType) {
3083
+ resourceAttributes["user.subscription_type"] = subscriptionType;
3084
+ }
3085
+ } else {
3086
+ resourceAttributes["user.customer_type"] = "api";
3087
+ }
3088
+ const transformed = {
3089
+ resource_attributes: resourceAttributes,
3090
+ metrics: metrics.scopeMetrics.flatMap((scopeMetric) => scopeMetric.metrics.map((metric) => ({
3091
+ name: metric.descriptor.name,
3092
+ description: metric.descriptor.description,
3093
+ unit: metric.descriptor.unit,
3094
+ data_points: this.extractDataPoints(metric)
3095
+ })))
3096
+ };
3097
+ return transformed;
3098
+ }
3099
+ extractDataPoints(metric) {
3100
+ const dataPoints = metric.dataPoints || [];
3101
+ return dataPoints.filter((point) => typeof point.value === "number").map((point) => ({
3102
+ attributes: this.convertAttributes(point.attributes),
3103
+ value: point.value,
3104
+ timestamp: this.hrTimeToISOString(point.endTime || point.startTime || [Date.now() / 1000, 0])
3105
+ }));
3106
+ }
3107
+ async shutdown() {
3108
+ this.isShutdown = true;
3109
+ await this.forceFlush();
3110
+ logForDebugging("BigQuery metrics exporter shutdown complete");
3111
+ }
3112
+ async forceFlush() {
3113
+ await Promise.all(this.pendingExports);
3114
+ logForDebugging("BigQuery metrics exporter flush complete");
3115
+ }
3116
+ convertAttributes(attributes) {
3117
+ const result = {};
3118
+ if (attributes) {
3119
+ for (const [key, value] of Object.entries(attributes)) {
3120
+ if (value !== undefined && value !== null) {
3121
+ result[key] = String(value);
3122
+ }
3123
+ }
3124
+ }
3125
+ return result;
3126
+ }
3127
+ hrTimeToISOString(hrTime) {
3128
+ const [seconds, nanoseconds] = hrTime;
3129
+ const date = new Date(seconds * 1000 + nanoseconds / 1e6);
3130
+ return date.toISOString();
3131
+ }
3132
+ selectAggregationTemporality() {
3133
+ return AggregationTemporality.DELTA;
3134
+ }
3135
+ }
3136
+ var init_bigqueryExporter = __esm(() => {
3137
+ init_esm();
3138
+ init_esm5();
3139
+ init_axios();
3140
+ init_metricsOptOut();
3141
+ init_state();
3142
+ init_auth();
3143
+ init_config();
3144
+ init_debug();
3145
+ init_errors();
3146
+ init_http();
3147
+ init_log();
3148
+ init_slowOperations();
3149
+ init_userAgent();
3150
+ });
3151
+
3152
+ // src/utils/telemetry/logger.ts
3153
+ class ClaudeCodeDiagLogger {
3154
+ error(message, ..._) {
3155
+ logError(new Error(message));
3156
+ logForDebugging(`[3P telemetry] OTEL diag error: ${message}`, {
3157
+ level: "error"
3158
+ });
3159
+ }
3160
+ warn(message, ..._) {
3161
+ logError(new Error(message));
3162
+ logForDebugging(`[3P telemetry] OTEL diag warn: ${message}`, {
3163
+ level: "warn"
3164
+ });
3165
+ }
3166
+ info(_message, ..._args) {
3167
+ return;
3168
+ }
3169
+ debug(_message, ..._args) {
3170
+ return;
3171
+ }
3172
+ verbose(_message, ..._args) {
3173
+ return;
3174
+ }
3175
+ }
3176
+ var init_logger = __esm(() => {
3177
+ init_debug();
3178
+ init_log();
3179
+ });
3180
+
3181
+ // src/utils/telemetry/instrumentation.ts
3182
+ function telemetryTimeout(ms, message) {
3183
+ return new Promise((_, reject) => {
3184
+ setTimeout((rej, msg) => rej(new TelemetryTimeoutError(msg)), ms, reject, message).unref();
3185
+ });
3186
+ }
3187
+ function bootstrapTelemetry() {
3188
+ if (process.env.USER_TYPE === "ant") {
3189
+ if (process.env.ANT_OTEL_METRICS_EXPORTER) {
3190
+ process.env.OTEL_METRICS_EXPORTER = process.env.ANT_OTEL_METRICS_EXPORTER;
3191
+ }
3192
+ if (process.env.ANT_OTEL_LOGS_EXPORTER) {
3193
+ process.env.OTEL_LOGS_EXPORTER = process.env.ANT_OTEL_LOGS_EXPORTER;
3194
+ }
3195
+ if (process.env.ANT_OTEL_TRACES_EXPORTER) {
3196
+ process.env.OTEL_TRACES_EXPORTER = process.env.ANT_OTEL_TRACES_EXPORTER;
3197
+ }
3198
+ if (process.env.ANT_OTEL_EXPORTER_OTLP_PROTOCOL) {
3199
+ process.env.OTEL_EXPORTER_OTLP_PROTOCOL = process.env.ANT_OTEL_EXPORTER_OTLP_PROTOCOL;
3200
+ }
3201
+ if (process.env.ANT_OTEL_EXPORTER_OTLP_ENDPOINT) {
3202
+ process.env.OTEL_EXPORTER_OTLP_ENDPOINT = process.env.ANT_OTEL_EXPORTER_OTLP_ENDPOINT;
3203
+ }
3204
+ if (process.env.ANT_OTEL_EXPORTER_OTLP_HEADERS) {
3205
+ process.env.OTEL_EXPORTER_OTLP_HEADERS = process.env.ANT_OTEL_EXPORTER_OTLP_HEADERS;
3206
+ }
3207
+ }
3208
+ if (!process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE) {
3209
+ process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE = "delta";
3210
+ }
3211
+ }
3212
+ function parseExporterTypes(value) {
3213
+ return (value || "").trim().split(",").filter(Boolean).map((t) => t.trim()).filter((t) => t !== "none");
3214
+ }
3215
+ async function getOtlpReaders() {
3216
+ const exporterTypes = parseExporterTypes(process.env.OTEL_METRICS_EXPORTER);
3217
+ const exportInterval = parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL || DEFAULT_METRICS_EXPORT_INTERVAL_MS.toString());
3218
+ const exporters = [];
3219
+ for (const exporterType of exporterTypes) {
3220
+ if (exporterType === "console") {
3221
+ const consoleExporter = new ConsoleMetricExporter;
3222
+ const originalExport = consoleExporter.export.bind(consoleExporter);
3223
+ consoleExporter.export = (metrics, callback) => {
3224
+ if (metrics.resource && metrics.resource.attributes) {
3225
+ logForDebugging(`
3226
+ === Resource Attributes ===`);
3227
+ logForDebugging(jsonStringify(metrics.resource.attributes));
3228
+ logForDebugging(`===========================
3229
+ `);
3230
+ }
3231
+ return originalExport(metrics, callback);
3232
+ };
3233
+ exporters.push(consoleExporter);
3234
+ } else if (exporterType === "otlp") {
3235
+ const protocol = process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim() || process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim();
3236
+ const httpConfig = getOTLPExporterConfig();
3237
+ switch (protocol) {
3238
+ case "grpc": {
3239
+ const { OTLPMetricExporter } = await import("./chunk-4b5peb6p.js").then((m)=>__toESM(m.default,1));
3240
+ exporters.push(new OTLPMetricExporter);
3241
+ break;
3242
+ }
3243
+ case "http/json": {
3244
+ const { OTLPMetricExporter } = await import("./chunk-zv0txvbs.js").then((m)=>__toESM(m.default,1));
3245
+ exporters.push(new OTLPMetricExporter(httpConfig));
3246
+ break;
3247
+ }
3248
+ case "http/protobuf": {
3249
+ const { OTLPMetricExporter } = await import("./chunk-qrz3b0e1.js");
3250
+ exporters.push(new OTLPMetricExporter(httpConfig));
3251
+ break;
3252
+ }
3253
+ default:
3254
+ throw new Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${protocol}`);
3255
+ }
3256
+ } else if (exporterType === "prometheus") {
3257
+ const { PrometheusExporter } = await import("./chunk-wpqynh28.js").then((m)=>__toESM(m.default,1));
3258
+ exporters.push(new PrometheusExporter);
3259
+ } else {
3260
+ throw new Error(`Unknown exporter type set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${exporterType}`);
3261
+ }
3262
+ }
3263
+ return exporters.map((exporter) => {
3264
+ if ("export" in exporter) {
3265
+ return new PeriodicExportingMetricReader({
3266
+ exporter,
3267
+ exportIntervalMillis: exportInterval
3268
+ });
3269
+ }
3270
+ return exporter;
3271
+ });
3272
+ }
3273
+ async function getOtlpLogExporters() {
3274
+ const exporterTypes = parseExporterTypes(process.env.OTEL_LOGS_EXPORTER);
3275
+ const protocol = process.env.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL?.trim() || process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim();
3276
+ const endpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
3277
+ logForDebugging(`[3P telemetry] getOtlpLogExporters: types=${jsonStringify(exporterTypes)}, protocol=${protocol}, endpoint=${endpoint}`);
3278
+ const exporters = [];
3279
+ for (const exporterType of exporterTypes) {
3280
+ if (exporterType === "console") {
3281
+ exporters.push(new ConsoleLogRecordExporter);
3282
+ } else if (exporterType === "otlp") {
3283
+ const httpConfig = getOTLPExporterConfig();
3284
+ switch (protocol) {
3285
+ case "grpc": {
3286
+ const { OTLPLogExporter } = await import("./chunk-temv6q01.js").then((m)=>__toESM(m.default,1));
3287
+ exporters.push(new OTLPLogExporter);
3288
+ break;
3289
+ }
3290
+ case "http/json": {
3291
+ const { OTLPLogExporter } = await import("./chunk-0zkw14gq.js");
3292
+ exporters.push(new OTLPLogExporter(httpConfig));
3293
+ break;
3294
+ }
3295
+ case "http/protobuf": {
3296
+ const { OTLPLogExporter } = await import("./chunk-7q7h7msb.js");
3297
+ exporters.push(new OTLPLogExporter(httpConfig));
3298
+ break;
3299
+ }
3300
+ default:
3301
+ throw new Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_LOGS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${protocol}`);
3302
+ }
3303
+ } else {
3304
+ throw new Error(`Unknown exporter type set in OTEL_LOGS_EXPORTER env var: ${exporterType}`);
3305
+ }
3306
+ }
3307
+ return exporters;
3308
+ }
3309
+ async function getOtlpTraceExporters() {
3310
+ const exporterTypes = parseExporterTypes(process.env.OTEL_TRACES_EXPORTER);
3311
+ const exporters = [];
3312
+ for (const exporterType of exporterTypes) {
3313
+ if (exporterType === "console") {
3314
+ exporters.push(new ConsoleSpanExporter);
3315
+ } else if (exporterType === "otlp") {
3316
+ const protocol = process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL?.trim() || process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim();
3317
+ const httpConfig = getOTLPExporterConfig();
3318
+ switch (protocol) {
3319
+ case "grpc": {
3320
+ const { OTLPTraceExporter } = await import("./chunk-t260g32y.js").then((m)=>__toESM(m.default,1));
3321
+ exporters.push(new OTLPTraceExporter);
3322
+ break;
3323
+ }
3324
+ case "http/json": {
3325
+ const { OTLPTraceExporter } = await import("./chunk-fx0xd0ex.js");
3326
+ exporters.push(new OTLPTraceExporter(httpConfig));
3327
+ break;
3328
+ }
3329
+ case "http/protobuf": {
3330
+ const { OTLPTraceExporter } = await import("./chunk-hxc5rbra.js");
3331
+ exporters.push(new OTLPTraceExporter(httpConfig));
3332
+ break;
3333
+ }
3334
+ default:
3335
+ throw new Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_TRACES_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${protocol}`);
3336
+ }
3337
+ } else {
3338
+ throw new Error(`Unknown exporter type set in OTEL_TRACES_EXPORTER env var: ${exporterType}`);
3339
+ }
3340
+ }
3341
+ return exporters;
3342
+ }
3343
+ function isTelemetryEnabled() {
3344
+ return isEnvTruthy(process.env.CLAUDE_CODE_ENABLE_TELEMETRY);
3345
+ }
3346
+ function getBigQueryExportingReader() {
3347
+ const bigqueryExporter = new BigQueryMetricsExporter;
3348
+ return new PeriodicExportingMetricReader({
3349
+ exporter: bigqueryExporter,
3350
+ exportIntervalMillis: 300000
3351
+ });
3352
+ }
3353
+ function isBigQueryMetricsEnabled() {
3354
+ const subscriptionType = getSubscriptionType();
3355
+ const isC4EOrTeamUser = isClaudeAISubscriber() && (subscriptionType === "enterprise" || subscriptionType === "team");
3356
+ return is1PApiCustomer() || isC4EOrTeamUser;
3357
+ }
3358
+ async function initializeBetaTracing(resource) {
3359
+ const endpoint = process.env.BETA_TRACING_ENDPOINT;
3360
+ if (!endpoint) {
3361
+ return;
3362
+ }
3363
+ const [{ OTLPTraceExporter }, { OTLPLogExporter }] = await Promise.all([
3364
+ import("./chunk-fx0xd0ex.js"),
3365
+ import("./chunk-0zkw14gq.js")
3366
+ ]);
3367
+ const httpConfig = {
3368
+ url: `${endpoint}/v1/traces`
3369
+ };
3370
+ const logHttpConfig = {
3371
+ url: `${endpoint}/v1/logs`
3372
+ };
3373
+ const traceExporter = new OTLPTraceExporter(httpConfig);
3374
+ const spanProcessor = new BatchSpanProcessor(traceExporter, {
3375
+ scheduledDelayMillis: DEFAULT_TRACES_EXPORT_INTERVAL_MS
3376
+ });
3377
+ const tracerProvider = new BasicTracerProvider({
3378
+ resource,
3379
+ spanProcessors: [spanProcessor]
3380
+ });
3381
+ import_api7.trace.setGlobalTracerProvider(tracerProvider);
3382
+ setTracerProvider(tracerProvider);
3383
+ const logExporter = new OTLPLogExporter(logHttpConfig);
3384
+ const loggerProvider = new LoggerProvider({
3385
+ resource,
3386
+ processors: [
3387
+ new BatchLogRecordProcessor(logExporter, {
3388
+ scheduledDelayMillis: DEFAULT_LOGS_EXPORT_INTERVAL_MS
3389
+ })
3390
+ ]
3391
+ });
3392
+ import_api_logs.logs.setGlobalLoggerProvider(loggerProvider);
3393
+ setLoggerProvider(loggerProvider);
3394
+ const eventLogger = import_api_logs.logs.getLogger("com.anthropic.claude_code.events", "2.1.888");
3395
+ setEventLogger(eventLogger);
3396
+ process.on("beforeExit", async () => {
3397
+ await loggerProvider?.forceFlush();
3398
+ await tracerProvider?.forceFlush();
3399
+ });
3400
+ process.on("exit", () => {
3401
+ loggerProvider?.forceFlush();
3402
+ tracerProvider?.forceFlush();
3403
+ });
3404
+ }
3405
+ async function initializeTelemetry() {
3406
+ profileCheckpoint("telemetry_init_start");
3407
+ bootstrapTelemetry();
3408
+ if (getHasFormattedOutput()) {
3409
+ for (const key of [
3410
+ "OTEL_METRICS_EXPORTER",
3411
+ "OTEL_LOGS_EXPORTER",
3412
+ "OTEL_TRACES_EXPORTER"
3413
+ ]) {
3414
+ const v = process.env[key];
3415
+ if (v?.includes("console")) {
3416
+ process.env[key] = v.split(",").map((s) => s.trim()).filter((s) => s !== "console").join(",");
3417
+ }
3418
+ }
3419
+ }
3420
+ import_api7.diag.setLogger(new ClaudeCodeDiagLogger, import_api7.DiagLogLevel.ERROR);
3421
+ initializePerfettoTracing();
3422
+ const readers = [];
3423
+ const telemetryEnabled = isTelemetryEnabled();
3424
+ logForDebugging(`[3P telemetry] isTelemetryEnabled=${telemetryEnabled} (CLAUDE_CODE_ENABLE_TELEMETRY=${process.env.CLAUDE_CODE_ENABLE_TELEMETRY})`);
3425
+ if (telemetryEnabled) {
3426
+ readers.push(...await getOtlpReaders());
3427
+ }
3428
+ if (isBigQueryMetricsEnabled()) {
3429
+ readers.push(getBigQueryExportingReader());
3430
+ }
3431
+ const platform = getPlatform();
3432
+ const baseAttributes = {
3433
+ [import_semantic_conventions.ATTR_SERVICE_NAME]: "claude-code",
3434
+ [import_semantic_conventions.ATTR_SERVICE_VERSION]: "2.1.888"
3435
+ };
3436
+ if (platform === "wsl") {
3437
+ const wslVersion = getWslVersion();
3438
+ if (wslVersion) {
3439
+ baseAttributes["wsl.version"] = wslVersion;
3440
+ }
3441
+ }
3442
+ const baseResource = resourceFromAttributes(baseAttributes);
3443
+ const osResource = resourceFromAttributes(osDetector.detect().attributes || {});
3444
+ const hostDetected = hostDetector.detect();
3445
+ const hostArchAttributes = hostDetected.attributes?.[import_semantic_conventions.SEMRESATTRS_HOST_ARCH] ? {
3446
+ [import_semantic_conventions.SEMRESATTRS_HOST_ARCH]: hostDetected.attributes[import_semantic_conventions.SEMRESATTRS_HOST_ARCH]
3447
+ } : {};
3448
+ const hostArchResource = resourceFromAttributes(hostArchAttributes);
3449
+ const envResource = resourceFromAttributes(envDetector.detect().attributes || {});
3450
+ const resource = baseResource.merge(osResource).merge(hostArchResource).merge(envResource);
3451
+ if (isBetaTracingEnabled()) {
3452
+ initializeBetaTracing(resource).catch((e) => logForDebugging(`Beta tracing init failed: ${e}`, { level: "error" }));
3453
+ const meterProvider2 = new MeterProvider({
3454
+ resource,
3455
+ views: [],
3456
+ readers
3457
+ });
3458
+ setMeterProvider(meterProvider2);
3459
+ const shutdownTelemetry2 = async () => {
3460
+ const timeoutMs = parseInt(process.env.CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS || "2000");
3461
+ try {
3462
+ endInteractionSpan();
3463
+ const loggerProvider = getLoggerProvider();
3464
+ const tracerProvider = getTracerProvider();
3465
+ const chains = [meterProvider2.shutdown()];
3466
+ if (loggerProvider) {
3467
+ chains.push(loggerProvider.forceFlush().then(() => loggerProvider.shutdown()));
3468
+ }
3469
+ if (tracerProvider) {
3470
+ chains.push(tracerProvider.forceFlush().then(() => tracerProvider.shutdown()));
3471
+ }
3472
+ await Promise.race([
3473
+ Promise.all(chains),
3474
+ telemetryTimeout(timeoutMs, "OpenTelemetry shutdown timeout")
3475
+ ]);
3476
+ } catch {}
3477
+ };
3478
+ registerCleanup(shutdownTelemetry2);
3479
+ return meterProvider2.getMeter("com.anthropic.claude_code", "2.1.888");
3480
+ }
3481
+ const meterProvider = new MeterProvider({
3482
+ resource,
3483
+ views: [],
3484
+ readers
3485
+ });
3486
+ setMeterProvider(meterProvider);
3487
+ if (telemetryEnabled) {
3488
+ const logExporters = await getOtlpLogExporters();
3489
+ logForDebugging(`[3P telemetry] Created ${logExporters.length} log exporter(s)`);
3490
+ if (logExporters.length > 0) {
3491
+ const loggerProvider = new LoggerProvider({
3492
+ resource,
3493
+ processors: logExporters.map((exporter) => new BatchLogRecordProcessor(exporter, {
3494
+ scheduledDelayMillis: parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL || DEFAULT_LOGS_EXPORT_INTERVAL_MS.toString())
3495
+ }))
3496
+ });
3497
+ import_api_logs.logs.setGlobalLoggerProvider(loggerProvider);
3498
+ setLoggerProvider(loggerProvider);
3499
+ const eventLogger = import_api_logs.logs.getLogger("com.anthropic.claude_code.events", "2.1.888");
3500
+ setEventLogger(eventLogger);
3501
+ logForDebugging("[3P telemetry] Event logger set successfully");
3502
+ process.on("beforeExit", async () => {
3503
+ await loggerProvider?.forceFlush();
3504
+ const tracerProvider = getTracerProvider();
3505
+ await tracerProvider?.forceFlush();
3506
+ });
3507
+ process.on("exit", () => {
3508
+ loggerProvider?.forceFlush();
3509
+ getTracerProvider()?.forceFlush();
3510
+ });
3511
+ }
3512
+ }
3513
+ if (telemetryEnabled && isEnhancedTelemetryEnabled()) {
3514
+ const traceExporters = await getOtlpTraceExporters();
3515
+ if (traceExporters.length > 0) {
3516
+ const spanProcessors = traceExporters.map((exporter) => new BatchSpanProcessor(exporter, {
3517
+ scheduledDelayMillis: parseInt(process.env.OTEL_TRACES_EXPORT_INTERVAL || DEFAULT_TRACES_EXPORT_INTERVAL_MS.toString())
3518
+ }));
3519
+ const tracerProvider = new BasicTracerProvider({
3520
+ resource,
3521
+ spanProcessors
3522
+ });
3523
+ import_api7.trace.setGlobalTracerProvider(tracerProvider);
3524
+ setTracerProvider(tracerProvider);
3525
+ }
3526
+ }
3527
+ const shutdownTelemetry = async () => {
3528
+ const timeoutMs = parseInt(process.env.CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS || "2000");
3529
+ try {
3530
+ endInteractionSpan();
3531
+ const shutdownPromises = [meterProvider.shutdown()];
3532
+ const loggerProvider = getLoggerProvider();
3533
+ if (loggerProvider) {
3534
+ shutdownPromises.push(loggerProvider.shutdown());
3535
+ }
3536
+ const tracerProvider = getTracerProvider();
3537
+ if (tracerProvider) {
3538
+ shutdownPromises.push(tracerProvider.shutdown());
3539
+ }
3540
+ await Promise.race([
3541
+ Promise.all(shutdownPromises),
3542
+ telemetryTimeout(timeoutMs, "OpenTelemetry shutdown timeout")
3543
+ ]);
3544
+ } catch (error) {
3545
+ if (error instanceof Error && error.message.includes("timeout")) {
3546
+ logForDebugging(`
3547
+ OpenTelemetry telemetry flush timed out after ${timeoutMs}ms
3548
+
3549
+ To resolve this issue, you can:
3550
+ 1. Increase the timeout by setting CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS env var (e.g., 5000 for 5 seconds)
3551
+ 2. Check if your OpenTelemetry backend is experiencing scalability issues
3552
+ 3. Disable OpenTelemetry by unsetting CLAUDE_CODE_ENABLE_TELEMETRY env var
3553
+
3554
+ Current timeout: ${timeoutMs}ms
3555
+ `, { level: "error" });
3556
+ }
3557
+ throw error;
3558
+ }
3559
+ };
3560
+ registerCleanup(shutdownTelemetry);
3561
+ return meterProvider.getMeter("com.anthropic.claude_code", "2.1.888");
3562
+ }
3563
+ async function flushTelemetry() {
3564
+ const meterProvider = getMeterProvider();
3565
+ if (!meterProvider) {
3566
+ return;
3567
+ }
3568
+ const timeoutMs = parseInt(process.env.CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS || "5000");
3569
+ try {
3570
+ const flushPromises = [meterProvider.forceFlush()];
3571
+ const loggerProvider = getLoggerProvider();
3572
+ if (loggerProvider) {
3573
+ flushPromises.push(loggerProvider.forceFlush());
3574
+ }
3575
+ const tracerProvider = getTracerProvider();
3576
+ if (tracerProvider) {
3577
+ flushPromises.push(tracerProvider.forceFlush());
3578
+ }
3579
+ await Promise.race([
3580
+ Promise.all(flushPromises),
3581
+ telemetryTimeout(timeoutMs, "OpenTelemetry flush timeout")
3582
+ ]);
3583
+ logForDebugging("Telemetry flushed successfully");
3584
+ } catch (error) {
3585
+ if (error instanceof TelemetryTimeoutError) {
3586
+ logForDebugging(`Telemetry flush timed out after ${timeoutMs}ms. Some metrics may not be exported.`, { level: "warn" });
3587
+ } else {
3588
+ logForDebugging(`Telemetry flush failed: ${errorMessage(error)}`, {
3589
+ level: "error"
3590
+ });
3591
+ }
3592
+ }
3593
+ }
3594
+ function parseOtelHeadersEnvVar() {
3595
+ const headers = {};
3596
+ const envHeaders = process.env.OTEL_EXPORTER_OTLP_HEADERS;
3597
+ if (envHeaders) {
3598
+ for (const pair of envHeaders.split(",")) {
3599
+ const [key, ...valueParts] = pair.split("=");
3600
+ if (key && valueParts.length > 0) {
3601
+ headers[key.trim()] = valueParts.join("=").trim();
3602
+ }
3603
+ }
3604
+ }
3605
+ return headers;
3606
+ }
3607
+ function getOTLPExporterConfig() {
3608
+ const proxyUrl = getProxyUrl();
3609
+ const mtlsConfig = getMTLSConfig();
3610
+ const settings = getSettings_DEPRECATED();
3611
+ const config = {};
3612
+ const staticHeaders = parseOtelHeadersEnvVar();
3613
+ if (settings?.otelHeadersHelper) {
3614
+ config.headers = async () => {
3615
+ const dynamicHeaders = getOtelHeadersFromHelper();
3616
+ return { ...staticHeaders, ...dynamicHeaders };
3617
+ };
3618
+ } else if (Object.keys(staticHeaders).length > 0) {
3619
+ config.headers = async () => staticHeaders;
3620
+ }
3621
+ const otelEndpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
3622
+ if (!proxyUrl || otelEndpoint && shouldBypassProxy(otelEndpoint)) {
3623
+ const caCerts2 = getCACertificates();
3624
+ if (mtlsConfig || caCerts2) {
3625
+ config.httpAgentOptions = {
3626
+ ...mtlsConfig,
3627
+ ...caCerts2 && { ca: caCerts2 }
3628
+ };
3629
+ }
3630
+ return config;
3631
+ }
3632
+ const caCerts = getCACertificates();
3633
+ const agentFactory = (_protocol) => {
3634
+ const proxyAgent = mtlsConfig || caCerts ? new HttpsProxyAgent(proxyUrl, {
3635
+ ...mtlsConfig && {
3636
+ cert: mtlsConfig.cert,
3637
+ key: mtlsConfig.key,
3638
+ passphrase: mtlsConfig.passphrase
3639
+ },
3640
+ ...caCerts && { ca: caCerts }
3641
+ }) : new HttpsProxyAgent(proxyUrl);
3642
+ return proxyAgent;
3643
+ };
3644
+ config.httpAgentOptions = agentFactory;
3645
+ return config;
3646
+ }
3647
+ var import_api7, import_api_logs, import_semantic_conventions, DEFAULT_METRICS_EXPORT_INTERVAL_MS = 60000, DEFAULT_LOGS_EXPORT_INTERVAL_MS = 5000, DEFAULT_TRACES_EXPORT_INTERVAL_MS = 5000, TelemetryTimeoutError;
3648
+ var init_instrumentation = __esm(() => {
3649
+ init_esm2();
3650
+ init_esm3();
3651
+ init_esm5();
3652
+ init_esm4();
3653
+ init_dist();
3654
+ init_state();
3655
+ init_auth();
3656
+ init_platform();
3657
+ init_caCerts();
3658
+ init_cleanupRegistry();
3659
+ init_debug();
3660
+ init_envUtils();
3661
+ init_errors();
3662
+ init_mtls();
3663
+ init_proxy();
3664
+ init_settings();
3665
+ init_slowOperations();
3666
+ init_startupProfiler();
3667
+ init_betaSessionTracing();
3668
+ init_bigqueryExporter();
3669
+ init_logger();
3670
+ init_perfettoTracing();
3671
+ init_sessionTracing();
3672
+ import_api7 = __toESM(require_src(), 1);
3673
+ import_api_logs = __toESM(require_src3(), 1);
3674
+ import_semantic_conventions = __toESM(require_src2(), 1);
3675
+ TelemetryTimeoutError = class TelemetryTimeoutError extends Error {
3676
+ };
3677
+ });
3678
+ init_instrumentation();
3679
+
3680
+ export {
3681
+ parseExporterTypes,
3682
+ isTelemetryEnabled,
3683
+ initializeTelemetry,
3684
+ flushTelemetry,
3685
+ bootstrapTelemetry
3686
+ };