@redocly/cli 2.33.1 → 2.34.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 (581) hide show
  1. package/LICENSE +7 -0
  2. package/THIRD_PARTY_NOTICES +767 -0
  3. package/lib/chunks/2ULY6UWW.js +13374 -0
  4. package/lib/chunks/4DNBVE5S.js +23 -0
  5. package/lib/chunks/5ILQMFXK.js +59 -0
  6. package/lib/chunks/7GOGGHM5.js +92239 -0
  7. package/lib/chunks/A6JSOHCP.js +41 -0
  8. package/lib/chunks/AIT3U3JT.js +22 -0
  9. package/lib/chunks/EIHBO33S.js +1133 -0
  10. package/lib/chunks/FDUPOI4C.js +19036 -0
  11. package/lib/chunks/FO6BDVGE.js +25 -0
  12. package/lib/chunks/FP2VGYMF.js +90 -0
  13. package/lib/chunks/GRMVFQAA.js +17782 -0
  14. package/lib/chunks/ICAVAH7N.js +387 -0
  15. package/lib/chunks/OEYVENNB.js +37533 -0
  16. package/lib/chunks/TS33ZDKX.js +35 -0
  17. package/lib/chunks/VUDTNFRL.js +42 -0
  18. package/lib/chunks/VXIQEZPR.js +2564 -0
  19. package/lib/chunks/W7G5WVPB.js +44 -0
  20. package/lib/chunks/XHPY6UJF.js +1638 -0
  21. package/lib/chunks/Y6DTFCLS.js +15 -0
  22. package/lib/chunks/YA5P3RI2.js +13 -0
  23. package/lib/chunks/ZIYSHX6D.js +3617 -0
  24. package/lib/index.js +13606 -620
  25. package/package.json +13 -53
  26. package/lib/auth/device-flow.d.ts +0 -24
  27. package/lib/auth/device-flow.d.ts.map +0 -1
  28. package/lib/auth/device-flow.js +0 -140
  29. package/lib/auth/device-flow.js.map +0 -1
  30. package/lib/auth/oauth-client.d.ts +0 -18
  31. package/lib/auth/oauth-client.d.ts.map +0 -1
  32. package/lib/auth/oauth-client.js +0 -117
  33. package/lib/auth/oauth-client.js.map +0 -1
  34. package/lib/commands/auth.d.ts +0 -12
  35. package/lib/commands/auth.d.ts.map +0 -1
  36. package/lib/commands/auth.js +0 -34
  37. package/lib/commands/auth.js.map +0 -1
  38. package/lib/commands/build-docs/index.d.ts +0 -4
  39. package/lib/commands/build-docs/index.d.ts.map +0 -1
  40. package/lib/commands/build-docs/index.js +0 -38
  41. package/lib/commands/build-docs/index.js.map +0 -1
  42. package/lib/commands/build-docs/template.hbs +0 -23
  43. package/lib/commands/build-docs/types.d.ts +0 -24
  44. package/lib/commands/build-docs/types.d.ts.map +0 -1
  45. package/lib/commands/build-docs/types.js +0 -2
  46. package/lib/commands/build-docs/types.js.map +0 -1
  47. package/lib/commands/build-docs/utils.d.ts +0 -8
  48. package/lib/commands/build-docs/utils.d.ts.map +0 -1
  49. package/lib/commands/build-docs/utils.js +0 -84
  50. package/lib/commands/build-docs/utils.js.map +0 -1
  51. package/lib/commands/bundle.d.ts +0 -20
  52. package/lib/commands/bundle.d.ts.map +0 -1
  53. package/lib/commands/bundle.js +0 -93
  54. package/lib/commands/bundle.js.map +0 -1
  55. package/lib/commands/eject.d.ts +0 -10
  56. package/lib/commands/eject.d.ts.map +0 -1
  57. package/lib/commands/eject.js +0 -26
  58. package/lib/commands/eject.js.map +0 -1
  59. package/lib/commands/generate-arazzo.d.ts +0 -8
  60. package/lib/commands/generate-arazzo.d.ts.map +0 -1
  61. package/lib/commands/generate-arazzo.js +0 -25
  62. package/lib/commands/generate-arazzo.js.map +0 -1
  63. package/lib/commands/join/index.d.ts +0 -4
  64. package/lib/commands/join/index.d.ts.map +0 -1
  65. package/lib/commands/join/index.js +0 -141
  66. package/lib/commands/join/index.js.map +0 -1
  67. package/lib/commands/join/types.d.ts +0 -22
  68. package/lib/commands/join/types.d.ts.map +0 -1
  69. package/lib/commands/join/types.js +0 -2
  70. package/lib/commands/join/types.js.map +0 -1
  71. package/lib/commands/join/utils/add-components-prefix.d.ts +0 -2
  72. package/lib/commands/join/utils/add-components-prefix.d.ts.map +0 -1
  73. package/lib/commands/join/utils/add-components-prefix.js +0 -9
  74. package/lib/commands/join/utils/add-components-prefix.js.map +0 -1
  75. package/lib/commands/join/utils/add-info-section.d.ts +0 -2
  76. package/lib/commands/join/utils/add-info-section.d.ts.map +0 -1
  77. package/lib/commands/join/utils/add-info-section.js +0 -19
  78. package/lib/commands/join/utils/add-info-section.js.map +0 -1
  79. package/lib/commands/join/utils/add-prefix.d.ts +0 -2
  80. package/lib/commands/join/utils/add-prefix.d.ts.map +0 -1
  81. package/lib/commands/join/utils/add-prefix.js +0 -4
  82. package/lib/commands/join/utils/add-prefix.js.map +0 -1
  83. package/lib/commands/join/utils/add-security-prefix.d.ts +0 -2
  84. package/lib/commands/join/utils/add-security-prefix.d.ts.map +0 -1
  85. package/lib/commands/join/utils/add-security-prefix.js +0 -12
  86. package/lib/commands/join/utils/add-security-prefix.js.map +0 -1
  87. package/lib/commands/join/utils/collect-components.d.ts +0 -7
  88. package/lib/commands/join/utils/collect-components.d.ts.map +0 -1
  89. package/lib/commands/join/utils/collect-components.js +0 -26
  90. package/lib/commands/join/utils/collect-components.js.map +0 -1
  91. package/lib/commands/join/utils/collect-external-docs.d.ts +0 -7
  92. package/lib/commands/join/utils/collect-external-docs.d.ts.map +0 -1
  93. package/lib/commands/join/utils/collect-external-docs.js +0 -15
  94. package/lib/commands/join/utils/collect-external-docs.js.map +0 -1
  95. package/lib/commands/join/utils/collect-paths.d.ts +0 -9
  96. package/lib/commands/join/utils/collect-paths.d.ts.map +0 -1
  97. package/lib/commands/join/utils/collect-paths.js +0 -172
  98. package/lib/commands/join/utils/collect-paths.js.map +0 -1
  99. package/lib/commands/join/utils/collect-webhooks.d.ts +0 -8
  100. package/lib/commands/join/utils/collect-webhooks.d.ts.map +0 -1
  101. package/lib/commands/join/utils/collect-webhooks.js +0 -46
  102. package/lib/commands/join/utils/collect-webhooks.js.map +0 -1
  103. package/lib/commands/join/utils/duplicate-tag-description-warning.d.ts +0 -2
  104. package/lib/commands/join/utils/duplicate-tag-description-warning.d.ts.map +0 -1
  105. package/lib/commands/join/utils/duplicate-tag-description-warning.js +0 -8
  106. package/lib/commands/join/utils/duplicate-tag-description-warning.js.map +0 -1
  107. package/lib/commands/join/utils/filter-conflicts.d.ts +0 -2
  108. package/lib/commands/join/utils/filter-conflicts.d.ts.map +0 -1
  109. package/lib/commands/join/utils/filter-conflicts.js +0 -4
  110. package/lib/commands/join/utils/filter-conflicts.js.map +0 -1
  111. package/lib/commands/join/utils/format-tags.d.ts +0 -4
  112. package/lib/commands/join/utils/format-tags.d.ts.map +0 -1
  113. package/lib/commands/join/utils/format-tags.js +0 -4
  114. package/lib/commands/join/utils/format-tags.js.map +0 -1
  115. package/lib/commands/join/utils/get-api-filename.d.ts +0 -2
  116. package/lib/commands/join/utils/get-api-filename.d.ts.map +0 -1
  117. package/lib/commands/join/utils/get-api-filename.js +0 -5
  118. package/lib/commands/join/utils/get-api-filename.js.map +0 -1
  119. package/lib/commands/join/utils/get-info-prefix.d.ts +0 -2
  120. package/lib/commands/join/utils/get-info-prefix.d.ts.map +0 -1
  121. package/lib/commands/join/utils/get-info-prefix.js +0 -17
  122. package/lib/commands/join/utils/get-info-prefix.js.map +0 -1
  123. package/lib/commands/join/utils/index.d.ts +0 -19
  124. package/lib/commands/join/utils/index.d.ts.map +0 -1
  125. package/lib/commands/join/utils/index.js +0 -19
  126. package/lib/commands/join/utils/index.js.map +0 -1
  127. package/lib/commands/join/utils/iterate-potential-conflicts.d.ts +0 -5
  128. package/lib/commands/join/utils/iterate-potential-conflicts.d.ts.map +0 -1
  129. package/lib/commands/join/utils/iterate-potential-conflicts.js +0 -53
  130. package/lib/commands/join/utils/iterate-potential-conflicts.js.map +0 -1
  131. package/lib/commands/join/utils/populate-tags.d.ts +0 -7
  132. package/lib/commands/join/utils/populate-tags.d.ts.map +0 -1
  133. package/lib/commands/join/utils/populate-tags.js +0 -77
  134. package/lib/commands/join/utils/populate-tags.js.map +0 -1
  135. package/lib/commands/join/utils/prefix-tag-suggestion.d.ts +0 -2
  136. package/lib/commands/join/utils/prefix-tag-suggestion.d.ts.map +0 -1
  137. package/lib/commands/join/utils/prefix-tag-suggestion.js +0 -6
  138. package/lib/commands/join/utils/prefix-tag-suggestion.js.map +0 -1
  139. package/lib/commands/join/utils/replace-$-refs.d.ts +0 -2
  140. package/lib/commands/join/utils/replace-$-refs.d.ts.map +0 -1
  141. package/lib/commands/join/utils/replace-$-refs.js +0 -29
  142. package/lib/commands/join/utils/replace-$-refs.js.map +0 -1
  143. package/lib/commands/join/utils/show-conflicts.d.ts +0 -2
  144. package/lib/commands/join/utils/show-conflicts.d.ts.map +0 -1
  145. package/lib/commands/join/utils/show-conflicts.js +0 -8
  146. package/lib/commands/join/utils/show-conflicts.js.map +0 -1
  147. package/lib/commands/lint.d.ts +0 -15
  148. package/lib/commands/lint.d.ts.map +0 -1
  149. package/lib/commands/lint.js +0 -112
  150. package/lib/commands/lint.js.map +0 -1
  151. package/lib/commands/preview-project/constants.d.ts +0 -15
  152. package/lib/commands/preview-project/constants.d.ts.map +0 -1
  153. package/lib/commands/preview-project/constants.js +0 -20
  154. package/lib/commands/preview-project/constants.js.map +0 -1
  155. package/lib/commands/preview-project/index.d.ts +0 -4
  156. package/lib/commands/preview-project/index.d.ts.map +0 -1
  157. package/lib/commands/preview-project/index.js +0 -54
  158. package/lib/commands/preview-project/index.js.map +0 -1
  159. package/lib/commands/preview-project/types.d.ts +0 -11
  160. package/lib/commands/preview-project/types.d.ts.map +0 -1
  161. package/lib/commands/preview-project/types.js +0 -2
  162. package/lib/commands/preview-project/types.js.map +0 -1
  163. package/lib/commands/respect/connection-client.d.ts +0 -12
  164. package/lib/commands/respect/connection-client.d.ts.map +0 -1
  165. package/lib/commands/respect/connection-client.js +0 -73
  166. package/lib/commands/respect/connection-client.js.map +0 -1
  167. package/lib/commands/respect/display-files-summary-table.d.ts +0 -12
  168. package/lib/commands/respect/display-files-summary-table.d.ts.map +0 -1
  169. package/lib/commands/respect/display-files-summary-table.js +0 -65
  170. package/lib/commands/respect/display-files-summary-table.js.map +0 -1
  171. package/lib/commands/respect/har-logs/har-logs.d.ts +0 -6
  172. package/lib/commands/respect/har-logs/har-logs.d.ts.map +0 -1
  173. package/lib/commands/respect/har-logs/har-logs.js +0 -28
  174. package/lib/commands/respect/har-logs/har-logs.js.map +0 -1
  175. package/lib/commands/respect/har-logs/helpers/add-headers.d.ts +0 -2
  176. package/lib/commands/respect/har-logs/helpers/add-headers.d.ts.map +0 -1
  177. package/lib/commands/respect/har-logs/helpers/add-headers.js +0 -17
  178. package/lib/commands/respect/har-logs/helpers/add-headers.js.map +0 -1
  179. package/lib/commands/respect/har-logs/helpers/build-headers.d.ts +0 -10
  180. package/lib/commands/respect/har-logs/helpers/build-headers.d.ts.map +0 -1
  181. package/lib/commands/respect/har-logs/helpers/build-headers.js +0 -33
  182. package/lib/commands/respect/har-logs/helpers/build-headers.js.map +0 -1
  183. package/lib/commands/respect/har-logs/helpers/build-request-cookies.d.ts +0 -2
  184. package/lib/commands/respect/har-logs/helpers/build-request-cookies.d.ts.map +0 -1
  185. package/lib/commands/respect/har-logs/helpers/build-request-cookies.js +0 -18
  186. package/lib/commands/respect/har-logs/helpers/build-request-cookies.js.map +0 -1
  187. package/lib/commands/respect/har-logs/helpers/build-response-cookies.d.ts +0 -2
  188. package/lib/commands/respect/har-logs/helpers/build-response-cookies.d.ts.map +0 -1
  189. package/lib/commands/respect/har-logs/helpers/build-response-cookies.js +0 -40
  190. package/lib/commands/respect/har-logs/helpers/build-response-cookies.js.map +0 -1
  191. package/lib/commands/respect/har-logs/helpers/get-duration.d.ts +0 -2
  192. package/lib/commands/respect/har-logs/helpers/get-duration.d.ts.map +0 -1
  193. package/lib/commands/respect/har-logs/helpers/get-duration.js +0 -6
  194. package/lib/commands/respect/har-logs/helpers/get-duration.js.map +0 -1
  195. package/lib/commands/respect/har-logs/index.d.ts +0 -2
  196. package/lib/commands/respect/har-logs/index.d.ts.map +0 -1
  197. package/lib/commands/respect/har-logs/index.js +0 -2
  198. package/lib/commands/respect/har-logs/index.js.map +0 -1
  199. package/lib/commands/respect/har-logs/with-har.d.ts +0 -7
  200. package/lib/commands/respect/har-logs/with-har.d.ts.map +0 -1
  201. package/lib/commands/respect/har-logs/with-har.js +0 -182
  202. package/lib/commands/respect/har-logs/with-har.js.map +0 -1
  203. package/lib/commands/respect/index.d.ts +0 -27
  204. package/lib/commands/respect/index.d.ts.map +0 -1
  205. package/lib/commands/respect/index.js +0 -115
  206. package/lib/commands/respect/index.js.map +0 -1
  207. package/lib/commands/respect/json-logs.d.ts +0 -11
  208. package/lib/commands/respect/json-logs.d.ts.map +0 -1
  209. package/lib/commands/respect/json-logs.js +0 -85
  210. package/lib/commands/respect/json-logs.js.map +0 -1
  211. package/lib/commands/respect/mtls/resolve-mtls-certificates.d.ts +0 -9
  212. package/lib/commands/respect/mtls/resolve-mtls-certificates.d.ts.map +0 -1
  213. package/lib/commands/respect/mtls/resolve-mtls-certificates.js +0 -48
  214. package/lib/commands/respect/mtls/resolve-mtls-certificates.js.map +0 -1
  215. package/lib/commands/respect/mtls/validate-mtls-command-option.d.ts +0 -3
  216. package/lib/commands/respect/mtls/validate-mtls-command-option.d.ts.map +0 -1
  217. package/lib/commands/respect/mtls/validate-mtls-command-option.js +0 -55
  218. package/lib/commands/respect/mtls/validate-mtls-command-option.js.map +0 -1
  219. package/lib/commands/score/collect-metrics.d.ts +0 -17
  220. package/lib/commands/score/collect-metrics.d.ts.map +0 -1
  221. package/lib/commands/score/collect-metrics.js +0 -195
  222. package/lib/commands/score/collect-metrics.js.map +0 -1
  223. package/lib/commands/score/collectors/dependency-graph.d.ts +0 -9
  224. package/lib/commands/score/collectors/dependency-graph.d.ts.map +0 -1
  225. package/lib/commands/score/collectors/dependency-graph.js +0 -61
  226. package/lib/commands/score/collectors/dependency-graph.js.map +0 -1
  227. package/lib/commands/score/collectors/document-metrics.d.ts +0 -69
  228. package/lib/commands/score/collectors/document-metrics.d.ts.map +0 -1
  229. package/lib/commands/score/collectors/document-metrics.js +0 -343
  230. package/lib/commands/score/collectors/document-metrics.js.map +0 -1
  231. package/lib/commands/score/constants.d.ts +0 -4
  232. package/lib/commands/score/constants.d.ts.map +0 -1
  233. package/lib/commands/score/constants.js +0 -47
  234. package/lib/commands/score/constants.js.map +0 -1
  235. package/lib/commands/score/formatters/json.d.ts +0 -3
  236. package/lib/commands/score/formatters/json.d.ts.map +0 -1
  237. package/lib/commands/score/formatters/json.js +0 -20
  238. package/lib/commands/score/formatters/json.js.map +0 -1
  239. package/lib/commands/score/formatters/stylish.d.ts +0 -4
  240. package/lib/commands/score/formatters/stylish.d.ts.map +0 -1
  241. package/lib/commands/score/formatters/stylish.js +0 -235
  242. package/lib/commands/score/formatters/stylish.js.map +0 -1
  243. package/lib/commands/score/hotspots.d.ts +0 -3
  244. package/lib/commands/score/hotspots.d.ts.map +0 -1
  245. package/lib/commands/score/hotspots.js +0 -70
  246. package/lib/commands/score/hotspots.js.map +0 -1
  247. package/lib/commands/score/index.d.ts +0 -11
  248. package/lib/commands/score/index.d.ts.map +0 -1
  249. package/lib/commands/score/index.js +0 -69
  250. package/lib/commands/score/index.js.map +0 -1
  251. package/lib/commands/score/scoring.d.ts +0 -14
  252. package/lib/commands/score/scoring.d.ts.map +0 -1
  253. package/lib/commands/score/scoring.js +0 -136
  254. package/lib/commands/score/scoring.js.map +0 -1
  255. package/lib/commands/score/types.d.ts +0 -119
  256. package/lib/commands/score/types.d.ts.map +0 -1
  257. package/lib/commands/score/types.js +0 -2
  258. package/lib/commands/score/types.js.map +0 -1
  259. package/lib/commands/score/utils.d.ts +0 -2
  260. package/lib/commands/score/utils.d.ts.map +0 -1
  261. package/lib/commands/score/utils.js +0 -8
  262. package/lib/commands/score/utils.js.map +0 -1
  263. package/lib/commands/scorecard-classic/auth/login-handler.d.ts +0 -3
  264. package/lib/commands/scorecard-classic/auth/login-handler.d.ts.map +0 -1
  265. package/lib/commands/scorecard-classic/auth/login-handler.js +0 -31
  266. package/lib/commands/scorecard-classic/auth/login-handler.js.map +0 -1
  267. package/lib/commands/scorecard-classic/formatters/checkstyle-formatter.d.ts +0 -3
  268. package/lib/commands/scorecard-classic/formatters/checkstyle-formatter.d.ts.map +0 -1
  269. package/lib/commands/scorecard-classic/formatters/checkstyle-formatter.js +0 -28
  270. package/lib/commands/scorecard-classic/formatters/checkstyle-formatter.js.map +0 -1
  271. package/lib/commands/scorecard-classic/formatters/json-formatter.d.ts +0 -27
  272. package/lib/commands/scorecard-classic/formatters/json-formatter.d.ts.map +0 -1
  273. package/lib/commands/scorecard-classic/formatters/json-formatter.js +0 -67
  274. package/lib/commands/scorecard-classic/formatters/json-formatter.js.map +0 -1
  275. package/lib/commands/scorecard-classic/formatters/junit-formatter.d.ts +0 -3
  276. package/lib/commands/scorecard-classic/formatters/junit-formatter.d.ts.map +0 -1
  277. package/lib/commands/scorecard-classic/formatters/junit-formatter.js +0 -67
  278. package/lib/commands/scorecard-classic/formatters/junit-formatter.js.map +0 -1
  279. package/lib/commands/scorecard-classic/formatters/stylish-formatter.d.ts +0 -3
  280. package/lib/commands/scorecard-classic/formatters/stylish-formatter.d.ts.map +0 -1
  281. package/lib/commands/scorecard-classic/formatters/stylish-formatter.js +0 -57
  282. package/lib/commands/scorecard-classic/formatters/stylish-formatter.js.map +0 -1
  283. package/lib/commands/scorecard-classic/index.d.ts +0 -4
  284. package/lib/commands/scorecard-classic/index.d.ts.map +0 -1
  285. package/lib/commands/scorecard-classic/index.js +0 -120
  286. package/lib/commands/scorecard-classic/index.js.map +0 -1
  287. package/lib/commands/scorecard-classic/remote/fetch-scorecard.d.ts +0 -9
  288. package/lib/commands/scorecard-classic/remote/fetch-scorecard.d.ts.map +0 -1
  289. package/lib/commands/scorecard-classic/remote/fetch-scorecard.js +0 -126
  290. package/lib/commands/scorecard-classic/remote/fetch-scorecard.js.map +0 -1
  291. package/lib/commands/scorecard-classic/targets-handler/targets-handler.d.ts +0 -13
  292. package/lib/commands/scorecard-classic/targets-handler/targets-handler.d.ts.map +0 -1
  293. package/lib/commands/scorecard-classic/targets-handler/targets-handler.js +0 -55
  294. package/lib/commands/scorecard-classic/targets-handler/targets-handler.js.map +0 -1
  295. package/lib/commands/scorecard-classic/types.d.ts +0 -27
  296. package/lib/commands/scorecard-classic/types.d.ts.map +0 -1
  297. package/lib/commands/scorecard-classic/types.js +0 -2
  298. package/lib/commands/scorecard-classic/types.js.map +0 -1
  299. package/lib/commands/scorecard-classic/validation/plugin-evaluator.d.ts +0 -3
  300. package/lib/commands/scorecard-classic/validation/plugin-evaluator.d.ts.map +0 -1
  301. package/lib/commands/scorecard-classic/validation/plugin-evaluator.js +0 -45
  302. package/lib/commands/scorecard-classic/validation/plugin-evaluator.js.map +0 -1
  303. package/lib/commands/scorecard-classic/validation/project-url.d.ts +0 -2
  304. package/lib/commands/scorecard-classic/validation/project-url.d.ts.map +0 -1
  305. package/lib/commands/scorecard-classic/validation/project-url.js +0 -11
  306. package/lib/commands/scorecard-classic/validation/project-url.js.map +0 -1
  307. package/lib/commands/scorecard-classic/validation/validate-scorecard.d.ts +0 -21
  308. package/lib/commands/scorecard-classic/validation/validate-scorecard.d.ts.map +0 -1
  309. package/lib/commands/scorecard-classic/validation/validate-scorecard.js +0 -87
  310. package/lib/commands/scorecard-classic/validation/validate-scorecard.js.map +0 -1
  311. package/lib/commands/split/asyncapi/constants.d.ts +0 -6
  312. package/lib/commands/split/asyncapi/constants.d.ts.map +0 -1
  313. package/lib/commands/split/asyncapi/constants.js +0 -71
  314. package/lib/commands/split/asyncapi/constants.js.map +0 -1
  315. package/lib/commands/split/asyncapi/find-asyncapi-component-types.d.ts +0 -2
  316. package/lib/commands/split/asyncapi/find-asyncapi-component-types.d.ts.map +0 -1
  317. package/lib/commands/split/asyncapi/find-asyncapi-component-types.js +0 -8
  318. package/lib/commands/split/asyncapi/find-asyncapi-component-types.js.map +0 -1
  319. package/lib/commands/split/asyncapi/gather-asyncapi-component-files.d.ts +0 -9
  320. package/lib/commands/split/asyncapi/gather-asyncapi-component-files.d.ts.map +0 -1
  321. package/lib/commands/split/asyncapi/gather-asyncapi-component-files.js +0 -28
  322. package/lib/commands/split/asyncapi/gather-asyncapi-component-files.js.map +0 -1
  323. package/lib/commands/split/asyncapi/iterate-asyncapi-channels.d.ts +0 -10
  324. package/lib/commands/split/asyncapi/iterate-asyncapi-channels.d.ts.map +0 -1
  325. package/lib/commands/split/asyncapi/iterate-asyncapi-channels.js +0 -27
  326. package/lib/commands/split/asyncapi/iterate-asyncapi-channels.js.map +0 -1
  327. package/lib/commands/split/asyncapi/iterate-asyncapi-components.d.ts +0 -10
  328. package/lib/commands/split/asyncapi/iterate-asyncapi-components.d.ts.map +0 -1
  329. package/lib/commands/split/asyncapi/iterate-asyncapi-components.js +0 -41
  330. package/lib/commands/split/asyncapi/iterate-asyncapi-components.js.map +0 -1
  331. package/lib/commands/split/asyncapi/iterate-asyncapi-operations.d.ts +0 -11
  332. package/lib/commands/split/asyncapi/iterate-asyncapi-operations.d.ts.map +0 -1
  333. package/lib/commands/split/asyncapi/iterate-asyncapi-operations.js +0 -26
  334. package/lib/commands/split/asyncapi/iterate-asyncapi-operations.js.map +0 -1
  335. package/lib/commands/split/asyncapi/remove-asyncapi-empty-components.d.ts +0 -3
  336. package/lib/commands/split/asyncapi/remove-asyncapi-empty-components.d.ts.map +0 -1
  337. package/lib/commands/split/asyncapi/remove-asyncapi-empty-components.js +0 -13
  338. package/lib/commands/split/asyncapi/remove-asyncapi-empty-components.js.map +0 -1
  339. package/lib/commands/split/asyncapi/split-asyncapi-definition.d.ts +0 -9
  340. package/lib/commands/split/asyncapi/split-asyncapi-definition.d.ts.map +0 -1
  341. package/lib/commands/split/asyncapi/split-asyncapi-definition.js +0 -51
  342. package/lib/commands/split/asyncapi/split-asyncapi-definition.js.map +0 -1
  343. package/lib/commands/split/constants.d.ts +0 -7
  344. package/lib/commands/split/constants.d.ts.map +0 -1
  345. package/lib/commands/split/constants.js +0 -7
  346. package/lib/commands/split/constants.js.map +0 -1
  347. package/lib/commands/split/index.d.ts +0 -6
  348. package/lib/commands/split/index.d.ts.map +0 -1
  349. package/lib/commands/split/index.js +0 -46
  350. package/lib/commands/split/index.js.map +0 -1
  351. package/lib/commands/split/oas/constants.d.ts +0 -3
  352. package/lib/commands/split/oas/constants.d.ts.map +0 -1
  353. package/lib/commands/split/oas/constants.js +0 -23
  354. package/lib/commands/split/oas/constants.js.map +0 -1
  355. package/lib/commands/split/oas/split-oas-definition.d.ts +0 -3
  356. package/lib/commands/split/oas/split-oas-definition.d.ts.map +0 -1
  357. package/lib/commands/split/oas/split-oas-definition.js +0 -19
  358. package/lib/commands/split/oas/split-oas-definition.js.map +0 -1
  359. package/lib/commands/split/types.d.ts +0 -28
  360. package/lib/commands/split/types.d.ts.map +0 -1
  361. package/lib/commands/split/types.js +0 -2
  362. package/lib/commands/split/types.js.map +0 -1
  363. package/lib/commands/split/utils/crawl.d.ts +0 -2
  364. package/lib/commands/split/utils/crawl.d.ts.map +0 -1
  365. package/lib/commands/split/utils/crawl.js +0 -15
  366. package/lib/commands/split/utils/crawl.js.map +0 -1
  367. package/lib/commands/split/utils/create-component-dir.d.ts +0 -2
  368. package/lib/commands/split/utils/create-component-dir.d.ts.map +0 -1
  369. package/lib/commands/split/utils/create-component-dir.js +0 -8
  370. package/lib/commands/split/utils/create-component-dir.js.map +0 -1
  371. package/lib/commands/split/utils/does-file-differ.d.ts +0 -2
  372. package/lib/commands/split/utils/does-file-differ.d.ts.map +0 -1
  373. package/lib/commands/split/utils/does-file-differ.js +0 -7
  374. package/lib/commands/split/utils/does-file-differ.js.map +0 -1
  375. package/lib/commands/split/utils/extract-filename-from-path.d.ts +0 -2
  376. package/lib/commands/split/utils/extract-filename-from-path.d.ts.map +0 -1
  377. package/lib/commands/split/utils/extract-filename-from-path.js +0 -5
  378. package/lib/commands/split/utils/extract-filename-from-path.js.map +0 -1
  379. package/lib/commands/split/utils/find-component-type.d.ts +0 -3
  380. package/lib/commands/split/utils/find-component-type.d.ts.map +0 -1
  381. package/lib/commands/split/utils/find-component-type.js +0 -8
  382. package/lib/commands/split/utils/find-component-type.js.map +0 -1
  383. package/lib/commands/split/utils/gather-components-files.d.ts +0 -4
  384. package/lib/commands/split/utils/gather-components-files.d.ts.map +0 -1
  385. package/lib/commands/split/utils/gather-components-files.js +0 -12
  386. package/lib/commands/split/utils/gather-components-files.js.map +0 -1
  387. package/lib/commands/split/utils/get-file-name-path.d.ts +0 -2
  388. package/lib/commands/split/utils/get-file-name-path.d.ts.map +0 -1
  389. package/lib/commands/split/utils/get-file-name-path.js +0 -5
  390. package/lib/commands/split/utils/get-file-name-path.js.map +0 -1
  391. package/lib/commands/split/utils/implicitly-reference-discriminator.d.ts +0 -2
  392. package/lib/commands/split/utils/implicitly-reference-discriminator.d.ts.map +0 -1
  393. package/lib/commands/split/utils/implicitly-reference-discriminator.js +0 -31
  394. package/lib/commands/split/utils/implicitly-reference-discriminator.js.map +0 -1
  395. package/lib/commands/split/utils/is-not-security-component-type.d.ts +0 -2
  396. package/lib/commands/split/utils/is-not-security-component-type.d.ts.map +0 -1
  397. package/lib/commands/split/utils/is-not-security-component-type.js +0 -4
  398. package/lib/commands/split/utils/is-not-security-component-type.js.map +0 -1
  399. package/lib/commands/split/utils/is-supported-extension.d.ts +0 -2
  400. package/lib/commands/split/utils/is-supported-extension.d.ts.map +0 -1
  401. package/lib/commands/split/utils/is-supported-extension.js +0 -4
  402. package/lib/commands/split/utils/is-supported-extension.js.map +0 -1
  403. package/lib/commands/split/utils/iterate-components.d.ts +0 -3
  404. package/lib/commands/split/utils/iterate-components.d.ts.map +0 -1
  405. package/lib/commands/split/utils/iterate-components.js +0 -55
  406. package/lib/commands/split/utils/iterate-components.js.map +0 -1
  407. package/lib/commands/split/utils/iterate-path-items.d.ts +0 -3
  408. package/lib/commands/split/utils/iterate-path-items.d.ts.map +0 -1
  409. package/lib/commands/split/utils/iterate-path-items.js +0 -42
  410. package/lib/commands/split/utils/iterate-path-items.js.map +0 -1
  411. package/lib/commands/split/utils/remove-empty-components.d.ts +0 -4
  412. package/lib/commands/split/utils/remove-empty-components.d.ts.map +0 -1
  413. package/lib/commands/split/utils/remove-empty-components.js +0 -10
  414. package/lib/commands/split/utils/remove-empty-components.js.map +0 -1
  415. package/lib/commands/split/utils/replace-$-refs.d.ts +0 -3
  416. package/lib/commands/split/utils/replace-$-refs.d.ts.map +0 -1
  417. package/lib/commands/split/utils/replace-$-refs.js +0 -34
  418. package/lib/commands/split/utils/replace-$-refs.js.map +0 -1
  419. package/lib/commands/split/utils/replace-channel-refs.d.ts +0 -3
  420. package/lib/commands/split/utils/replace-channel-refs.d.ts.map +0 -1
  421. package/lib/commands/split/utils/replace-channel-refs.js +0 -30
  422. package/lib/commands/split/utils/replace-channel-refs.js.map +0 -1
  423. package/lib/commands/split/utils/starts-with-components.d.ts +0 -2
  424. package/lib/commands/split/utils/starts-with-components.d.ts.map +0 -1
  425. package/lib/commands/split/utils/starts-with-components.js +0 -5
  426. package/lib/commands/split/utils/starts-with-components.js.map +0 -1
  427. package/lib/commands/split/utils/traverse-directory-deep.d.ts +0 -3
  428. package/lib/commands/split/utils/traverse-directory-deep.d.ts.map +0 -1
  429. package/lib/commands/split/utils/traverse-directory-deep.js +0 -27
  430. package/lib/commands/split/utils/traverse-directory-deep.js.map +0 -1
  431. package/lib/commands/stats/index.d.ts +0 -9
  432. package/lib/commands/stats/index.d.ts.map +0 -1
  433. package/lib/commands/stats/index.js +0 -42
  434. package/lib/commands/stats/index.js.map +0 -1
  435. package/lib/commands/stats/print-stats/index.d.ts +0 -3
  436. package/lib/commands/stats/print-stats/index.d.ts.map +0 -1
  437. package/lib/commands/stats/print-stats/index.js +0 -22
  438. package/lib/commands/stats/print-stats/index.js.map +0 -1
  439. package/lib/commands/stats/print-stats/json.d.ts +0 -3
  440. package/lib/commands/stats/print-stats/json.d.ts.map +0 -1
  441. package/lib/commands/stats/print-stats/json.js +0 -13
  442. package/lib/commands/stats/print-stats/json.js.map +0 -1
  443. package/lib/commands/stats/print-stats/markdown.d.ts +0 -3
  444. package/lib/commands/stats/print-stats/markdown.d.ts.map +0 -1
  445. package/lib/commands/stats/print-stats/markdown.js +0 -10
  446. package/lib/commands/stats/print-stats/markdown.js.map +0 -1
  447. package/lib/commands/stats/print-stats/stylish.d.ts +0 -3
  448. package/lib/commands/stats/print-stats/stylish.d.ts.map +0 -1
  449. package/lib/commands/stats/print-stats/stylish.js +0 -11
  450. package/lib/commands/stats/print-stats/stylish.js.map +0 -1
  451. package/lib/commands/stats/visitor-and-accumulator-resolver.d.ts +0 -103
  452. package/lib/commands/stats/visitor-and-accumulator-resolver.d.ts.map +0 -1
  453. package/lib/commands/stats/visitor-and-accumulator-resolver.js +0 -46
  454. package/lib/commands/stats/visitor-and-accumulator-resolver.js.map +0 -1
  455. package/lib/commands/translations.d.ts +0 -8
  456. package/lib/commands/translations.d.ts.map +0 -1
  457. package/lib/commands/translations.js +0 -18
  458. package/lib/commands/translations.js.map +0 -1
  459. package/lib/index.d.ts +0 -3
  460. package/lib/index.d.ts.map +0 -1
  461. package/lib/index.js.map +0 -1
  462. package/lib/reunite/api/api-client.d.ts +0 -83
  463. package/lib/reunite/api/api-client.d.ts.map +0 -1
  464. package/lib/reunite/api/api-client.js +0 -262
  465. package/lib/reunite/api/api-client.js.map +0 -1
  466. package/lib/reunite/api/api-keys.d.ts +0 -2
  467. package/lib/reunite/api/api-keys.d.ts.map +0 -1
  468. package/lib/reunite/api/api-keys.js +0 -7
  469. package/lib/reunite/api/api-keys.js.map +0 -1
  470. package/lib/reunite/api/domains.d.ts +0 -12
  471. package/lib/reunite/api/domains.d.ts.map +0 -1
  472. package/lib/reunite/api/domains.js +0 -52
  473. package/lib/reunite/api/domains.js.map +0 -1
  474. package/lib/reunite/api/index.d.ts +0 -4
  475. package/lib/reunite/api/index.d.ts.map +0 -1
  476. package/lib/reunite/api/index.js +0 -4
  477. package/lib/reunite/api/index.js.map +0 -1
  478. package/lib/reunite/api/types.d.ts +0 -103
  479. package/lib/reunite/api/types.d.ts.map +0 -1
  480. package/lib/reunite/api/types.js +0 -2
  481. package/lib/reunite/api/types.js.map +0 -1
  482. package/lib/reunite/commands/push-status.d.ts +0 -24
  483. package/lib/reunite/commands/push-status.d.ts.map +0 -1
  484. package/lib/reunite/commands/push-status.js +0 -199
  485. package/lib/reunite/commands/push-status.js.map +0 -1
  486. package/lib/reunite/commands/push.d.ts +0 -28
  487. package/lib/reunite/commands/push.d.ts.map +0 -1
  488. package/lib/reunite/commands/push.js +0 -135
  489. package/lib/reunite/commands/push.js.map +0 -1
  490. package/lib/reunite/commands/utils.d.ts +0 -26
  491. package/lib/reunite/commands/utils.d.ts.map +0 -1
  492. package/lib/reunite/commands/utils.js +0 -49
  493. package/lib/reunite/commands/utils.js.map +0 -1
  494. package/lib/reunite/utils.d.ts +0 -3
  495. package/lib/reunite/utils.d.ts.map +0 -1
  496. package/lib/reunite/utils.js +0 -3
  497. package/lib/reunite/utils.js.map +0 -1
  498. package/lib/types.d.ts +0 -33
  499. package/lib/types.d.ts.map +0 -1
  500. package/lib/types.js +0 -2
  501. package/lib/types.js.map +0 -1
  502. package/lib/utils/assert-node-version.d.ts +0 -2
  503. package/lib/utils/assert-node-version.d.ts.map +0 -1
  504. package/lib/utils/assert-node-version.js +0 -14
  505. package/lib/utils/assert-node-version.js.map +0 -1
  506. package/lib/utils/constants.d.ts +0 -5
  507. package/lib/utils/constants.d.ts.map +0 -1
  508. package/lib/utils/constants.js +0 -5
  509. package/lib/utils/constants.js.map +0 -1
  510. package/lib/utils/error.d.ts +0 -4
  511. package/lib/utils/error.d.ts.map +0 -1
  512. package/lib/utils/error.js +0 -8
  513. package/lib/utils/error.js.map +0 -1
  514. package/lib/utils/fetch-with-timeout.d.ts +0 -6
  515. package/lib/utils/fetch-with-timeout.d.ts.map +0 -1
  516. package/lib/utils/fetch-with-timeout.js +0 -24
  517. package/lib/utils/fetch-with-timeout.js.map +0 -1
  518. package/lib/utils/get-command-name-from-args.d.ts +0 -3
  519. package/lib/utils/get-command-name-from-args.d.ts.map +0 -1
  520. package/lib/utils/get-command-name-from-args.js +0 -4
  521. package/lib/utils/get-command-name-from-args.js.map +0 -1
  522. package/lib/utils/json-stringify-with-array-buffer.d.ts +0 -2
  523. package/lib/utils/json-stringify-with-array-buffer.d.ts.map +0 -1
  524. package/lib/utils/json-stringify-with-array-buffer.js +0 -32
  525. package/lib/utils/json-stringify-with-array-buffer.js.map +0 -1
  526. package/lib/utils/miscellaneous.d.ts +0 -46
  527. package/lib/utils/miscellaneous.d.ts.map +0 -1
  528. package/lib/utils/miscellaneous.js +0 -443
  529. package/lib/utils/miscellaneous.js.map +0 -1
  530. package/lib/utils/network-check.d.ts +0 -2
  531. package/lib/utils/network-check.d.ts.map +0 -1
  532. package/lib/utils/network-check.js +0 -12
  533. package/lib/utils/network-check.js.map +0 -1
  534. package/lib/utils/otel.d.ts +0 -8
  535. package/lib/utils/otel.d.ts.map +0 -1
  536. package/lib/utils/otel.js +0 -40
  537. package/lib/utils/otel.js.map +0 -1
  538. package/lib/utils/package.d.ts +0 -2
  539. package/lib/utils/package.d.ts.map +0 -1
  540. package/lib/utils/package.js +0 -4
  541. package/lib/utils/package.js.map +0 -1
  542. package/lib/utils/platform.d.ts +0 -17
  543. package/lib/utils/platform.d.ts.map +0 -1
  544. package/lib/utils/platform.js +0 -30
  545. package/lib/utils/platform.js.map +0 -1
  546. package/lib/utils/proxy-agent.d.ts +0 -5
  547. package/lib/utils/proxy-agent.d.ts.map +0 -1
  548. package/lib/utils/proxy-agent.js +0 -41
  549. package/lib/utils/proxy-agent.js.map +0 -1
  550. package/lib/utils/read-env-variables.d.ts +0 -2
  551. package/lib/utils/read-env-variables.d.ts.map +0 -1
  552. package/lib/utils/read-env-variables.js +0 -18
  553. package/lib/utils/read-env-variables.js.map +0 -1
  554. package/lib/utils/spinner.d.ts +0 -11
  555. package/lib/utils/spinner.d.ts.map +0 -1
  556. package/lib/utils/spinner.js +0 -44
  557. package/lib/utils/spinner.js.map +0 -1
  558. package/lib/utils/strip-ansi-codes.d.ts +0 -2
  559. package/lib/utils/strip-ansi-codes.d.ts.map +0 -1
  560. package/lib/utils/strip-ansi-codes.js +0 -6
  561. package/lib/utils/strip-ansi-codes.js.map +0 -1
  562. package/lib/utils/telemetry.d.ts +0 -26
  563. package/lib/utils/telemetry.d.ts.map +0 -1
  564. package/lib/utils/telemetry.js +0 -291
  565. package/lib/utils/telemetry.js.map +0 -1
  566. package/lib/utils/update-version-notifier.d.ts +0 -3
  567. package/lib/utils/update-version-notifier.d.ts.map +0 -1
  568. package/lib/utils/update-version-notifier.js +0 -100
  569. package/lib/utils/update-version-notifier.js.map +0 -1
  570. package/lib/utils/validate-mount-path.d.ts +0 -2
  571. package/lib/utils/validate-mount-path.d.ts.map +0 -1
  572. package/lib/utils/validate-mount-path.js +0 -7
  573. package/lib/utils/validate-mount-path.js.map +0 -1
  574. package/lib/utils/validate-positive-number.d.ts +0 -2
  575. package/lib/utils/validate-positive-number.d.ts.map +0 -1
  576. package/lib/utils/validate-positive-number.js +0 -13
  577. package/lib/utils/validate-positive-number.js.map +0 -1
  578. package/lib/wrapper.d.ts +0 -11
  579. package/lib/wrapper.d.ts.map +0 -1
  580. package/lib/wrapper.js +0 -99
  581. package/lib/wrapper.js.map +0 -1
@@ -0,0 +1,3617 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ const require = __createRequire(import.meta.url);
3
+ import {
4
+ ConfigValidationError,
5
+ HandledError,
6
+ ResolveError,
7
+ YamlParseError,
8
+ blue,
9
+ formatProblems,
10
+ getTotals,
11
+ gray,
12
+ green,
13
+ isAbsoluteUrl,
14
+ isEmptyObject,
15
+ isNotEmptyArray,
16
+ isNotEmptyObject,
17
+ lint,
18
+ lintConfig,
19
+ loadConfig,
20
+ logger,
21
+ parseYaml,
22
+ pluralize,
23
+ red,
24
+ stringifyYaml,
25
+ yellow
26
+ } from "./OEYVENNB.js";
27
+
28
+ // src/utils/error.ts
29
+ var AbortFlowError = class extends Error {
30
+ };
31
+ function exitWithError(message) {
32
+ throw new HandledError(message);
33
+ }
34
+
35
+ // src/commands/lint.ts
36
+ import { performance as performance3 } from "perf_hooks";
37
+
38
+ // src/utils/get-command-name-from-args.ts
39
+ function getCommandNameFromArgs(argv) {
40
+ return argv?._?.[0] ?? "";
41
+ }
42
+
43
+ // ../../node_modules/glob/dist/esm/index.min.js
44
+ import { fileURLToPath as Wi } from "node:url";
45
+ import { posix as mi, win32 as re } from "node:path";
46
+ import { fileURLToPath as gi } from "node:url";
47
+ import { lstatSync as wi, readdir as yi, readdirSync as bi, readlinkSync as Si, realpathSync as Ei } from "fs";
48
+ import * as xi from "node:fs";
49
+ import { lstat as Ci, readdir as Ti, readlink as Ai, realpath as ki } from "node:fs/promises";
50
+ import { EventEmitter as ee } from "node:events";
51
+ import Pe from "node:stream";
52
+ import { StringDecoder as ni } from "node:string_decoder";
53
+ var Gt = (n7, t, e) => {
54
+ let s = n7 instanceof RegExp ? ce(n7, e) : n7, i = t instanceof RegExp ? ce(t, e) : t, r = s !== null && i != null && ss(s, i, e);
55
+ return r && { start: r[0], end: r[1], pre: e.slice(0, r[0]), body: e.slice(r[0] + s.length, r[1]), post: e.slice(r[1] + i.length) };
56
+ };
57
+ var ce = (n7, t) => {
58
+ let e = t.match(n7);
59
+ return e ? e[0] : null;
60
+ };
61
+ var ss = (n7, t, e) => {
62
+ let s, i, r, o, h, a = e.indexOf(n7), l = e.indexOf(t, a + 1), u = a;
63
+ if (a >= 0 && l > 0) {
64
+ if (n7 === t) return [a, l];
65
+ for (s = [], r = e.length; u >= 0 && !h; ) {
66
+ if (u === a) s.push(u), a = e.indexOf(n7, u + 1);
67
+ else if (s.length === 1) {
68
+ let c = s.pop();
69
+ c !== void 0 && (h = [c, l]);
70
+ } else i = s.pop(), i !== void 0 && i < r && (r = i, o = l), l = e.indexOf(t, u + 1);
71
+ u = a < l && a >= 0 ? a : l;
72
+ }
73
+ s.length && o !== void 0 && (h = [r, o]);
74
+ }
75
+ return h;
76
+ };
77
+ var fe = "\0SLASH" + Math.random() + "\0";
78
+ var ue = "\0OPEN" + Math.random() + "\0";
79
+ var qt = "\0CLOSE" + Math.random() + "\0";
80
+ var de = "\0COMMA" + Math.random() + "\0";
81
+ var pe = "\0PERIOD" + Math.random() + "\0";
82
+ var is = new RegExp(fe, "g");
83
+ var rs = new RegExp(ue, "g");
84
+ var ns = new RegExp(qt, "g");
85
+ var os = new RegExp(de, "g");
86
+ var hs = new RegExp(pe, "g");
87
+ var as = /\\\\/g;
88
+ var ls = /\\{/g;
89
+ var cs = /\\}/g;
90
+ var fs = /\\,/g;
91
+ var us = /\\./g;
92
+ var ds = 1e5;
93
+ function Ht(n7) {
94
+ return isNaN(n7) ? n7.charCodeAt(0) : parseInt(n7, 10);
95
+ }
96
+ function ps(n7) {
97
+ return n7.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs, de).replace(us, pe);
98
+ }
99
+ function ms(n7) {
100
+ return n7.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os, ",").replace(hs, ".");
101
+ }
102
+ function me(n7) {
103
+ if (!n7) return [""];
104
+ let t = [], e = Gt("{", "}", n7);
105
+ if (!e) return n7.split(",");
106
+ let { pre: s, body: i, post: r } = e, o = s.split(",");
107
+ o[o.length - 1] += "{" + i + "}";
108
+ let h = me(r);
109
+ return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
110
+ }
111
+ function ge(n7, t = {}) {
112
+ if (!n7) return [];
113
+ let { max: e = ds } = t;
114
+ return n7.slice(0, 2) === "{}" && (n7 = "\\{\\}" + n7.slice(2)), ht(ps(n7), e, true).map(ms);
115
+ }
116
+ function gs(n7) {
117
+ return "{" + n7 + "}";
118
+ }
119
+ function ws(n7) {
120
+ return /^-?0\d/.test(n7);
121
+ }
122
+ function ys(n7, t) {
123
+ return n7 <= t;
124
+ }
125
+ function bs(n7, t) {
126
+ return n7 >= t;
127
+ }
128
+ function ht(n7, t, e) {
129
+ let s = [], i = Gt("{", "}", n7);
130
+ if (!i) return [n7];
131
+ let r = i.pre, o = i.post.length ? ht(i.post, t, false) : [""];
132
+ if (/\$$/.test(i.pre)) for (let h = 0; h < o.length && h < t; h++) {
133
+ let a = r + "{" + i.body + "}" + o[h];
134
+ s.push(a);
135
+ }
136
+ else {
137
+ let h = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), l = h || a, u = i.body.indexOf(",") >= 0;
138
+ if (!l && !u) return i.post.match(/,(?!,).*\}/) ? (n7 = i.pre + "{" + i.body + qt + i.post, ht(n7, t, true)) : [n7];
139
+ let c;
140
+ if (l) c = i.body.split(/\.\./);
141
+ else if (c = me(i.body), c.length === 1 && c[0] !== void 0 && (c = ht(c[0], t, false).map(gs), c.length === 1)) return o.map((f) => i.pre + c[0] + f);
142
+ let d;
143
+ if (l && c[0] !== void 0 && c[1] !== void 0) {
144
+ let f = Ht(c[0]), m = Ht(c[1]), p = Math.max(c[0].length, c[1].length), w = c.length === 3 && c[2] !== void 0 ? Math.abs(Ht(c[2])) : 1, g = ys;
145
+ m < f && (w *= -1, g = bs);
146
+ let E = c.some(ws);
147
+ d = [];
148
+ for (let y = f; g(y, m); y += w) {
149
+ let b;
150
+ if (a) b = String.fromCharCode(y), b === "\\" && (b = "");
151
+ else if (b = String(y), E) {
152
+ let z = p - b.length;
153
+ if (z > 0) {
154
+ let $ = new Array(z + 1).join("0");
155
+ y < 0 ? b = "-" + $ + b.slice(1) : b = $ + b;
156
+ }
157
+ }
158
+ d.push(b);
159
+ }
160
+ } else {
161
+ d = [];
162
+ for (let f = 0; f < c.length; f++) d.push.apply(d, ht(c[f], t, false));
163
+ }
164
+ for (let f = 0; f < d.length; f++) for (let m = 0; m < o.length && s.length < t; m++) {
165
+ let p = r + d[f] + o[m];
166
+ (!e || l || p) && s.push(p);
167
+ }
168
+ }
169
+ return s;
170
+ }
171
+ var at = (n7) => {
172
+ if (typeof n7 != "string") throw new TypeError("invalid pattern");
173
+ if (n7.length > 65536) throw new TypeError("pattern is too long");
174
+ };
175
+ var Ss = { "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true], "[:alpha:]": ["\\p{L}\\p{Nl}", true], "[:ascii:]": ["\\x00-\\x7f", false], "[:blank:]": ["\\p{Zs}\\t", true], "[:cntrl:]": ["\\p{Cc}", true], "[:digit:]": ["\\p{Nd}", true], "[:graph:]": ["\\p{Z}\\p{C}", true, true], "[:lower:]": ["\\p{Ll}", true], "[:print:]": ["\\p{C}", true], "[:punct:]": ["\\p{P}", true], "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true], "[:upper:]": ["\\p{Lu}", true], "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true], "[:xdigit:]": ["A-Fa-f0-9", false] };
176
+ var lt = (n7) => n7.replace(/[[\]\\-]/g, "\\$&");
177
+ var Es = (n7) => n7.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
178
+ var we = (n7) => n7.join("");
179
+ var ye = (n7, t) => {
180
+ let e = t;
181
+ if (n7.charAt(e) !== "[") throw new Error("not in a brace expression");
182
+ let s = [], i = [], r = e + 1, o = false, h = false, a = false, l = false, u = e, c = "";
183
+ t: for (; r < n7.length; ) {
184
+ let p = n7.charAt(r);
185
+ if ((p === "!" || p === "^") && r === e + 1) {
186
+ l = true, r++;
187
+ continue;
188
+ }
189
+ if (p === "]" && o && !a) {
190
+ u = r + 1;
191
+ break;
192
+ }
193
+ if (o = true, p === "\\" && !a) {
194
+ a = true, r++;
195
+ continue;
196
+ }
197
+ if (p === "[" && !a) {
198
+ for (let [w, [g, S, E]] of Object.entries(Ss)) if (n7.startsWith(w, r)) {
199
+ if (c) return ["$.", false, n7.length - e, true];
200
+ r += w.length, E ? i.push(g) : s.push(g), h = h || S;
201
+ continue t;
202
+ }
203
+ }
204
+ if (a = false, c) {
205
+ p > c ? s.push(lt(c) + "-" + lt(p)) : p === c && s.push(lt(p)), c = "", r++;
206
+ continue;
207
+ }
208
+ if (n7.startsWith("-]", r + 1)) {
209
+ s.push(lt(p + "-")), r += 2;
210
+ continue;
211
+ }
212
+ if (n7.startsWith("-", r + 1)) {
213
+ c = p, r += 2;
214
+ continue;
215
+ }
216
+ s.push(lt(p)), r++;
217
+ }
218
+ if (u < r) return ["", false, 0, false];
219
+ if (!s.length && !i.length) return ["$.", false, n7.length - e, true];
220
+ if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !l) {
221
+ let p = s[0].length === 2 ? s[0].slice(-1) : s[0];
222
+ return [Es(p), false, u - e, false];
223
+ }
224
+ let d = "[" + (l ? "^" : "") + we(s) + "]", f = "[" + (l ? "" : "^") + we(i) + "]";
225
+ return [s.length && i.length ? "(" + d + "|" + f + ")" : s.length ? d : f, h, u - e, true];
226
+ };
227
+ var W = (n7, { windowsPathsNoEscape: t = false, magicalBraces: e = true } = {}) => e ? t ? n7.replace(/\[([^\/\\])\]/g, "$1") : n7.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1") : t ? n7.replace(/\[([^\/\\{}])\]/g, "$1") : n7.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
228
+ var xs = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
229
+ var be = (n7) => xs.has(n7);
230
+ var vs = "(?!(?:^|/)\\.\\.?(?:$|/))";
231
+ var Ct = "(?!\\.)";
232
+ var Cs = /* @__PURE__ */ new Set(["[", "."]);
233
+ var Ts = /* @__PURE__ */ new Set(["..", "."]);
234
+ var As = new Set("().*{}+?[]^$\\!");
235
+ var ks = (n7) => n7.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
236
+ var Kt = "[^/]";
237
+ var Se = Kt + "*?";
238
+ var Ee = Kt + "+?";
239
+ var Q = class n {
240
+ type;
241
+ #t;
242
+ #s;
243
+ #n = false;
244
+ #r = [];
245
+ #o;
246
+ #S;
247
+ #w;
248
+ #c = false;
249
+ #h;
250
+ #u;
251
+ #f = false;
252
+ constructor(t, e, s = {}) {
253
+ this.type = t, t && (this.#s = true), this.#o = e, this.#t = this.#o ? this.#o.#t : this, this.#h = this.#t === this ? s : this.#t.#h, this.#w = this.#t === this ? [] : this.#t.#w, t === "!" && !this.#t.#c && this.#w.push(this), this.#S = this.#o ? this.#o.#r.length : 0;
254
+ }
255
+ get hasMagic() {
256
+ if (this.#s !== void 0) return this.#s;
257
+ for (let t of this.#r) if (typeof t != "string" && (t.type || t.hasMagic)) return this.#s = true;
258
+ return this.#s;
259
+ }
260
+ toString() {
261
+ return this.#u !== void 0 ? this.#u : this.type ? this.#u = this.type + "(" + this.#r.map((t) => String(t)).join("|") + ")" : this.#u = this.#r.map((t) => String(t)).join("");
262
+ }
263
+ #a() {
264
+ if (this !== this.#t) throw new Error("should only call on root");
265
+ if (this.#c) return this;
266
+ this.toString(), this.#c = true;
267
+ let t;
268
+ for (; t = this.#w.pop(); ) {
269
+ if (t.type !== "!") continue;
270
+ let e = t, s = e.#o;
271
+ for (; s; ) {
272
+ for (let i = e.#S + 1; !s.type && i < s.#r.length; i++) for (let r of t.#r) {
273
+ if (typeof r == "string") throw new Error("string part in extglob AST??");
274
+ r.copyIn(s.#r[i]);
275
+ }
276
+ e = s, s = e.#o;
277
+ }
278
+ }
279
+ return this;
280
+ }
281
+ push(...t) {
282
+ for (let e of t) if (e !== "") {
283
+ if (typeof e != "string" && !(e instanceof n && e.#o === this)) throw new Error("invalid part: " + e);
284
+ this.#r.push(e);
285
+ }
286
+ }
287
+ toJSON() {
288
+ let t = this.type === null ? this.#r.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#r.map((e) => e.toJSON())];
289
+ return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#c && this.#o?.type === "!") && t.push({}), t;
290
+ }
291
+ isStart() {
292
+ if (this.#t === this) return true;
293
+ if (!this.#o?.isStart()) return false;
294
+ if (this.#S === 0) return true;
295
+ let t = this.#o;
296
+ for (let e = 0; e < this.#S; e++) {
297
+ let s = t.#r[e];
298
+ if (!(s instanceof n && s.type === "!")) return false;
299
+ }
300
+ return true;
301
+ }
302
+ isEnd() {
303
+ if (this.#t === this || this.#o?.type === "!") return true;
304
+ if (!this.#o?.isEnd()) return false;
305
+ if (!this.type) return this.#o?.isEnd();
306
+ let t = this.#o ? this.#o.#r.length : 0;
307
+ return this.#S === t - 1;
308
+ }
309
+ copyIn(t) {
310
+ typeof t == "string" ? this.push(t) : this.push(t.clone(this));
311
+ }
312
+ clone(t) {
313
+ let e = new n(this.type, t);
314
+ for (let s of this.#r) e.copyIn(s);
315
+ return e;
316
+ }
317
+ static #i(t, e, s, i) {
318
+ let r = false, o = false, h = -1, a = false;
319
+ if (e.type === null) {
320
+ let f = s, m = "";
321
+ for (; f < t.length; ) {
322
+ let p = t.charAt(f++);
323
+ if (r || p === "\\") {
324
+ r = !r, m += p;
325
+ continue;
326
+ }
327
+ if (o) {
328
+ f === h + 1 ? (p === "^" || p === "!") && (a = true) : p === "]" && !(f === h + 2 && a) && (o = false), m += p;
329
+ continue;
330
+ } else if (p === "[") {
331
+ o = true, h = f, a = false, m += p;
332
+ continue;
333
+ }
334
+ if (!i.noext && be(p) && t.charAt(f) === "(") {
335
+ e.push(m), m = "";
336
+ let w = new n(p, e);
337
+ f = n.#i(t, w, f, i), e.push(w);
338
+ continue;
339
+ }
340
+ m += p;
341
+ }
342
+ return e.push(m), f;
343
+ }
344
+ let l = s + 1, u = new n(null, e), c = [], d = "";
345
+ for (; l < t.length; ) {
346
+ let f = t.charAt(l++);
347
+ if (r || f === "\\") {
348
+ r = !r, d += f;
349
+ continue;
350
+ }
351
+ if (o) {
352
+ l === h + 1 ? (f === "^" || f === "!") && (a = true) : f === "]" && !(l === h + 2 && a) && (o = false), d += f;
353
+ continue;
354
+ } else if (f === "[") {
355
+ o = true, h = l, a = false, d += f;
356
+ continue;
357
+ }
358
+ if (be(f) && t.charAt(l) === "(") {
359
+ u.push(d), d = "";
360
+ let m = new n(f, u);
361
+ u.push(m), l = n.#i(t, m, l, i);
362
+ continue;
363
+ }
364
+ if (f === "|") {
365
+ u.push(d), d = "", c.push(u), u = new n(null, e);
366
+ continue;
367
+ }
368
+ if (f === ")") return d === "" && e.#r.length === 0 && (e.#f = true), u.push(d), d = "", e.push(...c, u), l;
369
+ d += f;
370
+ }
371
+ return e.type = null, e.#s = void 0, e.#r = [t.substring(s - 1)], l;
372
+ }
373
+ static fromGlob(t, e = {}) {
374
+ let s = new n(null, void 0, e);
375
+ return n.#i(t, s, 0, e), s;
376
+ }
377
+ toMMPattern() {
378
+ if (this !== this.#t) return this.#t.toMMPattern();
379
+ let t = this.toString(), [e, s, i, r] = this.toRegExpSource();
380
+ if (!(i || this.#s || this.#h.nocase && !this.#h.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase())) return s;
381
+ let h = (this.#h.nocase ? "i" : "") + (r ? "u" : "");
382
+ return Object.assign(new RegExp(`^${e}$`, h), { _src: e, _glob: t });
383
+ }
384
+ get options() {
385
+ return this.#h;
386
+ }
387
+ toRegExpSource(t) {
388
+ let e = t ?? !!this.#h.dot;
389
+ if (this.#t === this && this.#a(), !this.type) {
390
+ let a = this.isStart() && this.isEnd() && !this.#r.some((f) => typeof f != "string"), l = this.#r.map((f) => {
391
+ let [m, p, w, g] = typeof f == "string" ? n.#E(f, this.#s, a) : f.toRegExpSource(t);
392
+ return this.#s = this.#s || w, this.#n = this.#n || g, m;
393
+ }).join(""), u = "";
394
+ if (this.isStart() && typeof this.#r[0] == "string" && !(this.#r.length === 1 && Ts.has(this.#r[0]))) {
395
+ let m = Cs, p = e && m.has(l.charAt(0)) || l.startsWith("\\.") && m.has(l.charAt(2)) || l.startsWith("\\.\\.") && m.has(l.charAt(4)), w = !e && !t && m.has(l.charAt(0));
396
+ u = p ? vs : w ? Ct : "";
397
+ }
398
+ let c = "";
399
+ return this.isEnd() && this.#t.#c && this.#o?.type === "!" && (c = "(?:$|\\/)"), [u + l + c, W(l), this.#s = !!this.#s, this.#n];
400
+ }
401
+ let s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e);
402
+ if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
403
+ let a = this.toString();
404
+ return this.#r = [a], this.type = null, this.#s = void 0, [a, W(this.toString()), false, false];
405
+ }
406
+ let o = !s || t || e || !Ct ? "" : this.#d(true);
407
+ o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
408
+ let h = "";
409
+ if (this.type === "!" && this.#f) h = (this.isStart() && !e ? Ct : "") + Ee;
410
+ else {
411
+ let a = this.type === "!" ? "))" + (this.isStart() && !e && !t ? Ct : "") + Se + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
412
+ h = i + r + a;
413
+ }
414
+ return [h, W(r), this.#s = !!this.#s, this.#n];
415
+ }
416
+ #d(t) {
417
+ return this.#r.map((e) => {
418
+ if (typeof e == "string") throw new Error("string type in extglob ast??");
419
+ let [s, i, r, o] = e.toRegExpSource(t);
420
+ return this.#n = this.#n || o, s;
421
+ }).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
422
+ }
423
+ static #E(t, e, s = false) {
424
+ let i = false, r = "", o = false, h = false;
425
+ for (let a = 0; a < t.length; a++) {
426
+ let l = t.charAt(a);
427
+ if (i) {
428
+ i = false, r += (As.has(l) ? "\\" : "") + l;
429
+ continue;
430
+ }
431
+ if (l === "*") {
432
+ if (h) continue;
433
+ h = true, r += s && /^[*]+$/.test(t) ? Ee : Se, e = true;
434
+ continue;
435
+ } else h = false;
436
+ if (l === "\\") {
437
+ a === t.length - 1 ? r += "\\\\" : i = true;
438
+ continue;
439
+ }
440
+ if (l === "[") {
441
+ let [u, c, d, f] = ye(t, a);
442
+ if (d) {
443
+ r += u, o = o || c, a += d - 1, e = e || f;
444
+ continue;
445
+ }
446
+ }
447
+ if (l === "?") {
448
+ r += Kt, e = true;
449
+ continue;
450
+ }
451
+ r += ks(l);
452
+ }
453
+ return [r, W(t), !!e, o];
454
+ }
455
+ };
456
+ var tt = (n7, { windowsPathsNoEscape: t = false, magicalBraces: e = false } = {}) => e ? t ? n7.replace(/[?*()[\]{}]/g, "[$&]") : n7.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n7.replace(/[?*()[\]]/g, "[$&]") : n7.replace(/[?*()[\]\\]/g, "\\$&");
457
+ var O = (n7, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? false : new D(t, e).match(n7));
458
+ var Rs = /^\*+([^+@!?\*\[\(]*)$/;
459
+ var Os = (n7) => (t) => !t.startsWith(".") && t.endsWith(n7);
460
+ var Fs = (n7) => (t) => t.endsWith(n7);
461
+ var Ds = (n7) => (n7 = n7.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n7));
462
+ var Ms = (n7) => (n7 = n7.toLowerCase(), (t) => t.toLowerCase().endsWith(n7));
463
+ var Ns = /^\*+\.\*+$/;
464
+ var _s = (n7) => !n7.startsWith(".") && n7.includes(".");
465
+ var Ls = (n7) => n7 !== "." && n7 !== ".." && n7.includes(".");
466
+ var Ws = /^\.\*+$/;
467
+ var Ps = (n7) => n7 !== "." && n7 !== ".." && n7.startsWith(".");
468
+ var js = /^\*+$/;
469
+ var Is = (n7) => n7.length !== 0 && !n7.startsWith(".");
470
+ var zs = (n7) => n7.length !== 0 && n7 !== "." && n7 !== "..";
471
+ var Bs = /^\?+([^+@!?\*\[\(]*)?$/;
472
+ var Us = ([n7, t = ""]) => {
473
+ let e = Ce([n7]);
474
+ return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
475
+ };
476
+ var $s = ([n7, t = ""]) => {
477
+ let e = Te([n7]);
478
+ return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
479
+ };
480
+ var Gs = ([n7, t = ""]) => {
481
+ let e = Te([n7]);
482
+ return t ? (s) => e(s) && s.endsWith(t) : e;
483
+ };
484
+ var Hs = ([n7, t = ""]) => {
485
+ let e = Ce([n7]);
486
+ return t ? (s) => e(s) && s.endsWith(t) : e;
487
+ };
488
+ var Ce = ([n7]) => {
489
+ let t = n7.length;
490
+ return (e) => e.length === t && !e.startsWith(".");
491
+ };
492
+ var Te = ([n7]) => {
493
+ let t = n7.length;
494
+ return (e) => e.length === t && e !== "." && e !== "..";
495
+ };
496
+ var Ae = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
497
+ var xe = { win32: { sep: "\\" }, posix: { sep: "/" } };
498
+ var qs = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
499
+ O.sep = qs;
500
+ var A = /* @__PURE__ */ Symbol("globstar **");
501
+ O.GLOBSTAR = A;
502
+ var Ks = "[^/]";
503
+ var Vs = Ks + "*?";
504
+ var Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
505
+ var Xs = "(?:(?!(?:\\/|^)\\.).)*?";
506
+ var Js = (n7, t = {}) => (e) => O(e, n7, t);
507
+ O.filter = Js;
508
+ var N = (n7, t = {}) => Object.assign({}, n7, t);
509
+ var Zs = (n7) => {
510
+ if (!n7 || typeof n7 != "object" || !Object.keys(n7).length) return O;
511
+ let t = O;
512
+ return Object.assign((s, i, r = {}) => t(s, i, N(n7, r)), { Minimatch: class extends t.Minimatch {
513
+ constructor(i, r = {}) {
514
+ super(i, N(n7, r));
515
+ }
516
+ static defaults(i) {
517
+ return t.defaults(N(n7, i)).Minimatch;
518
+ }
519
+ }, AST: class extends t.AST {
520
+ constructor(i, r, o = {}) {
521
+ super(i, r, N(n7, o));
522
+ }
523
+ static fromGlob(i, r = {}) {
524
+ return t.AST.fromGlob(i, N(n7, r));
525
+ }
526
+ }, unescape: (s, i = {}) => t.unescape(s, N(n7, i)), escape: (s, i = {}) => t.escape(s, N(n7, i)), filter: (s, i = {}) => t.filter(s, N(n7, i)), defaults: (s) => t.defaults(N(n7, s)), makeRe: (s, i = {}) => t.makeRe(s, N(n7, i)), braceExpand: (s, i = {}) => t.braceExpand(s, N(n7, i)), match: (s, i, r = {}) => t.match(s, i, N(n7, r)), sep: t.sep, GLOBSTAR: A });
527
+ };
528
+ O.defaults = Zs;
529
+ var ke = (n7, t = {}) => (at(n7), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n7) ? [n7] : ge(n7, { max: t.braceExpandMax }));
530
+ O.braceExpand = ke;
531
+ var Qs = (n7, t = {}) => new D(n7, t).makeRe();
532
+ O.makeRe = Qs;
533
+ var ti = (n7, t, e = {}) => {
534
+ let s = new D(t, e);
535
+ return n7 = n7.filter((i) => s.match(i)), s.options.nonull && !n7.length && n7.push(t), n7;
536
+ };
537
+ O.match = ti;
538
+ var ve = /[?*]|[+@!]\(.*?\)|\[|\]/;
539
+ var ei = (n7) => n7.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
540
+ var D = class {
541
+ options;
542
+ set;
543
+ pattern;
544
+ windowsPathsNoEscape;
545
+ nonegate;
546
+ negate;
547
+ comment;
548
+ empty;
549
+ preserveMultipleSlashes;
550
+ partial;
551
+ globSet;
552
+ globParts;
553
+ nocase;
554
+ isWindows;
555
+ platform;
556
+ windowsNoMagicRoot;
557
+ regexp;
558
+ constructor(t, e = {}) {
559
+ at(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ae, this.isWindows = this.platform === "win32";
560
+ let s = "allowWindowsEscape";
561
+ this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e[s] === false, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = false, this.nonegate = !!e.nonegate, this.comment = false, this.empty = false, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
562
+ }
563
+ hasMagic() {
564
+ if (this.options.magicalBraces && this.set.length > 1) return true;
565
+ for (let t of this.set) for (let e of t) if (typeof e != "string") return true;
566
+ return false;
567
+ }
568
+ debug(...t) {
569
+ }
570
+ make() {
571
+ let t = this.pattern, e = this.options;
572
+ if (!e.nocomment && t.charAt(0) === "#") {
573
+ this.comment = true;
574
+ return;
575
+ }
576
+ if (!t) {
577
+ this.empty = true;
578
+ return;
579
+ }
580
+ this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet);
581
+ let s = this.globSet.map((r) => this.slashSplit(r));
582
+ this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts);
583
+ let i = this.globParts.map((r, o, h) => {
584
+ if (this.isWindows && this.windowsNoMagicRoot) {
585
+ let a = r[0] === "" && r[1] === "" && (r[2] === "?" || !ve.test(r[2])) && !ve.test(r[3]), l = /^[a-z]:/i.test(r[0]);
586
+ if (a) return [...r.slice(0, 4), ...r.slice(4).map((u) => this.parse(u))];
587
+ if (l) return [r[0], ...r.slice(1).map((u) => this.parse(u))];
588
+ }
589
+ return r.map((a) => this.parse(a));
590
+ });
591
+ if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(false) === -1), this.isWindows) for (let r = 0; r < this.set.length; r++) {
592
+ let o = this.set[r];
593
+ o[0] === "" && o[1] === "" && this.globParts[r][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
594
+ }
595
+ this.debug(this.pattern, this.set);
596
+ }
597
+ preprocess(t) {
598
+ if (this.options.noglobstar) for (let s = 0; s < t.length; s++) for (let i = 0; i < t[s].length; i++) t[s][i] === "**" && (t[s][i] = "*");
599
+ let { optimizationLevel: e = 1 } = this.options;
600
+ return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
601
+ }
602
+ adjascentGlobstarOptimize(t) {
603
+ return t.map((e) => {
604
+ let s = -1;
605
+ for (; (s = e.indexOf("**", s + 1)) !== -1; ) {
606
+ let i = s;
607
+ for (; e[i + 1] === "**"; ) i++;
608
+ i !== s && e.splice(s, i - s);
609
+ }
610
+ return e;
611
+ });
612
+ }
613
+ levelOneOptimize(t) {
614
+ return t.map((e) => (e = e.reduce((s, i) => {
615
+ let r = s[s.length - 1];
616
+ return i === "**" && r === "**" ? s : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i), s);
617
+ }, []), e.length === 0 ? [""] : e));
618
+ }
619
+ levelTwoFileOptimize(t) {
620
+ Array.isArray(t) || (t = this.slashSplit(t));
621
+ let e = false;
622
+ do {
623
+ if (e = false, !this.preserveMultipleSlashes) {
624
+ for (let i = 1; i < t.length - 1; i++) {
625
+ let r = t[i];
626
+ i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = true, t.splice(i, 1), i--);
627
+ }
628
+ t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = true, t.pop());
629
+ }
630
+ let s = 0;
631
+ for (; (s = t.indexOf("..", s + 1)) !== -1; ) {
632
+ let i = t[s - 1];
633
+ i && i !== "." && i !== ".." && i !== "**" && (e = true, t.splice(s - 1, 2), s -= 2);
634
+ }
635
+ } while (e);
636
+ return t.length === 0 ? [""] : t;
637
+ }
638
+ firstPhasePreProcess(t) {
639
+ let e = false;
640
+ do {
641
+ e = false;
642
+ for (let s of t) {
643
+ let i = -1;
644
+ for (; (i = s.indexOf("**", i + 1)) !== -1; ) {
645
+ let o = i;
646
+ for (; s[o + 1] === "**"; ) o++;
647
+ o > i && s.splice(i + 1, o - i);
648
+ let h = s[i + 1], a = s[i + 2], l = s[i + 3];
649
+ if (h !== ".." || !a || a === "." || a === ".." || !l || l === "." || l === "..") continue;
650
+ e = true, s.splice(i, 1);
651
+ let u = s.slice(0);
652
+ u[i] = "**", t.push(u), i--;
653
+ }
654
+ if (!this.preserveMultipleSlashes) {
655
+ for (let o = 1; o < s.length - 1; o++) {
656
+ let h = s[o];
657
+ o === 1 && h === "" && s[0] === "" || (h === "." || h === "") && (e = true, s.splice(o, 1), o--);
658
+ }
659
+ s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = true, s.pop());
660
+ }
661
+ let r = 0;
662
+ for (; (r = s.indexOf("..", r + 1)) !== -1; ) {
663
+ let o = s[r - 1];
664
+ if (o && o !== "." && o !== ".." && o !== "**") {
665
+ e = true;
666
+ let a = r === 1 && s[r + 1] === "**" ? ["."] : [];
667
+ s.splice(r - 1, 2, ...a), s.length === 0 && s.push(""), r -= 2;
668
+ }
669
+ }
670
+ }
671
+ } while (e);
672
+ return t;
673
+ }
674
+ secondPhasePreProcess(t) {
675
+ for (let e = 0; e < t.length - 1; e++) for (let s = e + 1; s < t.length; s++) {
676
+ let i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
677
+ if (i) {
678
+ t[e] = [], t[s] = i;
679
+ break;
680
+ }
681
+ }
682
+ return t.filter((e) => e.length);
683
+ }
684
+ partsMatch(t, e, s = false) {
685
+ let i = 0, r = 0, o = [], h = "";
686
+ for (; i < t.length && r < e.length; ) if (t[i] === e[r]) o.push(h === "b" ? e[r] : t[i]), i++, r++;
687
+ else if (s && t[i] === "**" && e[r] === t[i + 1]) o.push(t[i]), i++;
688
+ else if (s && e[r] === "**" && t[i] === e[r + 1]) o.push(e[r]), r++;
689
+ else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
690
+ if (h === "b") return false;
691
+ h = "a", o.push(t[i]), i++, r++;
692
+ } else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
693
+ if (h === "a") return false;
694
+ h = "b", o.push(e[r]), i++, r++;
695
+ } else return false;
696
+ return t.length === e.length && o;
697
+ }
698
+ parseNegate() {
699
+ if (this.nonegate) return;
700
+ let t = this.pattern, e = false, s = 0;
701
+ for (let i = 0; i < t.length && t.charAt(i) === "!"; i++) e = !e, s++;
702
+ s && (this.pattern = t.slice(s)), this.negate = e;
703
+ }
704
+ matchOne(t, e, s = false) {
705
+ let i = this.options;
706
+ if (this.isWindows) {
707
+ let p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), w = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), g = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), S = !g && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), E = w ? 3 : p ? 0 : void 0, y = S ? 3 : g ? 0 : void 0;
708
+ if (typeof E == "number" && typeof y == "number") {
709
+ let [b, z] = [t[E], e[y]];
710
+ b.toLowerCase() === z.toLowerCase() && (e[y] = b, y > E ? e = e.slice(y) : E > y && (t = t.slice(E)));
711
+ }
712
+ }
713
+ let { optimizationLevel: r = 1 } = this.options;
714
+ r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.length);
715
+ for (var o = 0, h = 0, a = t.length, l = e.length; o < a && h < l; o++, h++) {
716
+ this.debug("matchOne loop");
717
+ var u = e[h], c = t[o];
718
+ if (this.debug(e, u, c), u === false) return false;
719
+ if (u === A) {
720
+ this.debug("GLOBSTAR", [e, u, c]);
721
+ var d = o, f = h + 1;
722
+ if (f === l) {
723
+ for (this.debug("** at the end"); o < a; o++) if (t[o] === "." || t[o] === ".." || !i.dot && t[o].charAt(0) === ".") return false;
724
+ return true;
725
+ }
726
+ for (; d < a; ) {
727
+ var m = t[d];
728
+ if (this.debug(`
729
+ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) return this.debug("globstar found match!", d, a, m), true;
730
+ if (m === "." || m === ".." || !i.dot && m.charAt(0) === ".") {
731
+ this.debug("dot detected!", t, d, e, f);
732
+ break;
733
+ }
734
+ this.debug("globstar swallow a segment, and continue"), d++;
735
+ }
736
+ return !!(s && (this.debug(`
737
+ >>> no match, partial?`, t, d, e, f), d === a));
738
+ }
739
+ let p;
740
+ if (typeof u == "string" ? (p = c === u, this.debug("string match", u, c, p)) : (p = u.test(c), this.debug("pattern match", u, c, p)), !p) return false;
741
+ }
742
+ if (o === a && h === l) return true;
743
+ if (o === a) return s;
744
+ if (h === l) return o === a - 1 && t[o] === "";
745
+ throw new Error("wtf?");
746
+ }
747
+ braceExpand() {
748
+ return ke(this.pattern, this.options);
749
+ }
750
+ parse(t) {
751
+ at(t);
752
+ let e = this.options;
753
+ if (t === "**") return A;
754
+ if (t === "") return "";
755
+ let s, i = null;
756
+ (s = t.match(js)) ? i = e.dot ? zs : Is : (s = t.match(Rs)) ? i = (e.nocase ? e.dot ? Ms : Ds : e.dot ? Fs : Os)(s[1]) : (s = t.match(Bs)) ? i = (e.nocase ? e.dot ? $s : Us : e.dot ? Gs : Hs)(s) : (s = t.match(Ns)) ? i = e.dot ? Ls : _s : (s = t.match(Ws)) && (i = Ps);
757
+ let r = Q.fromGlob(t, this.options).toMMPattern();
758
+ return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
759
+ }
760
+ makeRe() {
761
+ if (this.regexp || this.regexp === false) return this.regexp;
762
+ let t = this.set;
763
+ if (!t.length) return this.regexp = false, this.regexp;
764
+ let e = this.options, s = e.noglobstar ? Vs : e.dot ? Ys : Xs, i = new Set(e.nocase ? ["i"] : []), r = t.map((a) => {
765
+ let l = a.map((c) => {
766
+ if (c instanceof RegExp) for (let d of c.flags.split("")) i.add(d);
767
+ return typeof c == "string" ? ei(c) : c === A ? A : c._src;
768
+ });
769
+ l.forEach((c, d) => {
770
+ let f = l[d + 1], m = l[d - 1];
771
+ c !== A || m === A || (m === void 0 ? f !== void 0 && f !== A ? l[d + 1] = "(?:\\/|" + s + "\\/)?" + f : l[d] = s : f === void 0 ? l[d - 1] = m + "(?:\\/|\\/" + s + ")?" : f !== A && (l[d - 1] = m + "(?:\\/|\\/" + s + "\\/)" + f, l[d + 1] = A));
772
+ });
773
+ let u = l.filter((c) => c !== A);
774
+ if (this.partial && u.length >= 1) {
775
+ let c = [];
776
+ for (let d = 1; d <= u.length; d++) c.push(u.slice(0, d).join("/"));
777
+ return "(?:" + c.join("|") + ")";
778
+ }
779
+ return u.join("/");
780
+ }).join("|"), [o, h] = t.length > 1 ? ["(?:", ")"] : ["", ""];
781
+ r = "^" + o + r + h + "$", this.partial && (r = "^(?:\\/|" + o + r.slice(1, -1) + h + ")$"), this.negate && (r = "^(?!" + r + ").+$");
782
+ try {
783
+ this.regexp = new RegExp(r, [...i].join(""));
784
+ } catch {
785
+ this.regexp = false;
786
+ }
787
+ return this.regexp;
788
+ }
789
+ slashSplit(t) {
790
+ return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^\/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
791
+ }
792
+ match(t, e = this.partial) {
793
+ if (this.debug("match", t, this.pattern), this.comment) return false;
794
+ if (this.empty) return t === "";
795
+ if (t === "/" && e) return true;
796
+ let s = this.options;
797
+ this.isWindows && (t = t.split("\\").join("/"));
798
+ let i = this.slashSplit(t);
799
+ this.debug(this.pattern, "split", i);
800
+ let r = this.set;
801
+ this.debug(this.pattern, "set", r);
802
+ let o = i[i.length - 1];
803
+ if (!o) for (let h = i.length - 2; !o && h >= 0; h--) o = i[h];
804
+ for (let h = 0; h < r.length; h++) {
805
+ let a = r[h], l = i;
806
+ if (s.matchBase && a.length === 1 && (l = [o]), this.matchOne(l, a, e)) return s.flipNegate ? true : !this.negate;
807
+ }
808
+ return s.flipNegate ? false : this.negate;
809
+ }
810
+ static defaults(t) {
811
+ return O.defaults(t).Minimatch;
812
+ }
813
+ };
814
+ O.AST = Q;
815
+ O.Minimatch = D;
816
+ O.escape = tt;
817
+ O.unescape = W;
818
+ var si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
819
+ var Oe = /* @__PURE__ */ new Set();
820
+ var Vt = typeof process == "object" && process ? process : {};
821
+ var Fe = (n7, t, e, s) => {
822
+ typeof Vt.emitWarning == "function" ? Vt.emitWarning(n7, t, e, s) : console.error(`[${e}] ${t}: ${n7}`);
823
+ };
824
+ var At = globalThis.AbortController;
825
+ var Re = globalThis.AbortSignal;
826
+ if (typeof At > "u") {
827
+ Re = class {
828
+ onabort;
829
+ _onabort = [];
830
+ reason;
831
+ aborted = false;
832
+ addEventListener(e, s) {
833
+ this._onabort.push(s);
834
+ }
835
+ }, At = class {
836
+ constructor() {
837
+ t();
838
+ }
839
+ signal = new Re();
840
+ abort(e) {
841
+ if (!this.signal.aborted) {
842
+ this.signal.reason = e, this.signal.aborted = true;
843
+ for (let s of this.signal._onabort) s(e);
844
+ this.signal.onabort?.(e);
845
+ }
846
+ }
847
+ };
848
+ let n7 = Vt.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
849
+ n7 && (n7 = false, Fe("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
850
+ };
851
+ }
852
+ var ii = (n7) => !Oe.has(n7);
853
+ var q = (n7) => n7 && n7 === Math.floor(n7) && n7 > 0 && isFinite(n7);
854
+ var De = (n7) => q(n7) ? n7 <= Math.pow(2, 8) ? Uint8Array : n7 <= Math.pow(2, 16) ? Uint16Array : n7 <= Math.pow(2, 32) ? Uint32Array : n7 <= Number.MAX_SAFE_INTEGER ? Tt : null : null;
855
+ var Tt = class extends Array {
856
+ constructor(n7) {
857
+ super(n7), this.fill(0);
858
+ }
859
+ };
860
+ var ri = class ct {
861
+ heap;
862
+ length;
863
+ static #t = false;
864
+ static create(t) {
865
+ let e = De(t);
866
+ if (!e) return [];
867
+ ct.#t = true;
868
+ let s = new ct(t, e);
869
+ return ct.#t = false, s;
870
+ }
871
+ constructor(t, e) {
872
+ if (!ct.#t) throw new TypeError("instantiate Stack using Stack.create(n)");
873
+ this.heap = new e(t), this.length = 0;
874
+ }
875
+ push(t) {
876
+ this.heap[this.length++] = t;
877
+ }
878
+ pop() {
879
+ return this.heap[--this.length];
880
+ }
881
+ };
882
+ var ft = class Me {
883
+ #t;
884
+ #s;
885
+ #n;
886
+ #r;
887
+ #o;
888
+ #S;
889
+ #w;
890
+ #c;
891
+ get perf() {
892
+ return this.#c;
893
+ }
894
+ ttl;
895
+ ttlResolution;
896
+ ttlAutopurge;
897
+ updateAgeOnGet;
898
+ updateAgeOnHas;
899
+ allowStale;
900
+ noDisposeOnSet;
901
+ noUpdateTTL;
902
+ maxEntrySize;
903
+ sizeCalculation;
904
+ noDeleteOnFetchRejection;
905
+ noDeleteOnStaleGet;
906
+ allowStaleOnFetchAbort;
907
+ allowStaleOnFetchRejection;
908
+ ignoreFetchAbort;
909
+ #h;
910
+ #u;
911
+ #f;
912
+ #a;
913
+ #i;
914
+ #d;
915
+ #E;
916
+ #b;
917
+ #p;
918
+ #R;
919
+ #m;
920
+ #C;
921
+ #T;
922
+ #g;
923
+ #y;
924
+ #x;
925
+ #A;
926
+ #e;
927
+ #_;
928
+ static unsafeExposeInternals(t) {
929
+ return { starts: t.#T, ttls: t.#g, autopurgeTimers: t.#y, sizes: t.#C, keyMap: t.#f, keyList: t.#a, valList: t.#i, next: t.#d, prev: t.#E, get head() {
930
+ return t.#b;
931
+ }, get tail() {
932
+ return t.#p;
933
+ }, free: t.#R, isBackgroundFetch: (e) => t.#l(e), backgroundFetch: (e, s, i, r) => t.#U(e, s, i, r), moveToTail: (e) => t.#W(e), indexes: (e) => t.#F(e), rindexes: (e) => t.#D(e), isStale: (e) => t.#v(e) };
934
+ }
935
+ get max() {
936
+ return this.#t;
937
+ }
938
+ get maxSize() {
939
+ return this.#s;
940
+ }
941
+ get calculatedSize() {
942
+ return this.#u;
943
+ }
944
+ get size() {
945
+ return this.#h;
946
+ }
947
+ get fetchMethod() {
948
+ return this.#S;
949
+ }
950
+ get memoMethod() {
951
+ return this.#w;
952
+ }
953
+ get dispose() {
954
+ return this.#n;
955
+ }
956
+ get onInsert() {
957
+ return this.#r;
958
+ }
959
+ get disposeAfter() {
960
+ return this.#o;
961
+ }
962
+ constructor(t) {
963
+ let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: r, updateAgeOnGet: o, updateAgeOnHas: h, allowStale: a, dispose: l, onInsert: u, disposeAfter: c, noDisposeOnSet: d, noUpdateTTL: f, maxSize: m = 0, maxEntrySize: p = 0, sizeCalculation: w, fetchMethod: g, memoMethod: S, noDeleteOnFetchRejection: E, noDeleteOnStaleGet: y, allowStaleOnFetchRejection: b, allowStaleOnFetchAbort: z, ignoreFetchAbort: $, perf: J } = t;
964
+ if (J !== void 0 && typeof J?.now != "function") throw new TypeError("perf option must have a now() method if specified");
965
+ if (this.#c = J ?? si, e !== 0 && !q(e)) throw new TypeError("max option must be a nonnegative integer");
966
+ let Z = e ? De(e) : Array;
967
+ if (!Z) throw new Error("invalid max value: " + e);
968
+ if (this.#t = e, this.#s = m, this.maxEntrySize = p || this.#s, this.sizeCalculation = w, this.sizeCalculation) {
969
+ if (!this.#s && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
970
+ if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
971
+ }
972
+ if (S !== void 0 && typeof S != "function") throw new TypeError("memoMethod must be a function if defined");
973
+ if (this.#w = S, g !== void 0 && typeof g != "function") throw new TypeError("fetchMethod must be a function if specified");
974
+ if (this.#S = g, this.#A = !!g, this.#f = /* @__PURE__ */ new Map(), this.#a = new Array(e).fill(void 0), this.#i = new Array(e).fill(void 0), this.#d = new Z(e), this.#E = new Z(e), this.#b = 0, this.#p = 0, this.#R = ri.create(e), this.#h = 0, this.#u = 0, typeof l == "function" && (this.#n = l), typeof u == "function" && (this.#r = u), typeof c == "function" ? (this.#o = c, this.#m = []) : (this.#o = void 0, this.#m = void 0), this.#x = !!this.#n, this.#_ = !!this.#r, this.#e = !!this.#o, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!f, this.noDeleteOnFetchRejection = !!E, this.allowStaleOnFetchRejection = !!b, this.allowStaleOnFetchAbort = !!z, this.ignoreFetchAbort = !!$, this.maxEntrySize !== 0) {
975
+ if (this.#s !== 0 && !q(this.#s)) throw new TypeError("maxSize must be a positive integer if specified");
976
+ if (!q(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
977
+ this.#G();
978
+ }
979
+ if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!y, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!h, this.ttlResolution = q(i) || i === 0 ? i : 1, this.ttlAutopurge = !!r, this.ttl = s || 0, this.ttl) {
980
+ if (!q(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
981
+ this.#M();
982
+ }
983
+ if (this.#t === 0 && this.ttl === 0 && this.#s === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
984
+ if (!this.ttlAutopurge && !this.#t && !this.#s) {
985
+ let $t = "LRU_CACHE_UNBOUNDED";
986
+ ii($t) && (Oe.add($t), Fe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", $t, Me));
987
+ }
988
+ }
989
+ getRemainingTTL(t) {
990
+ return this.#f.has(t) ? 1 / 0 : 0;
991
+ }
992
+ #M() {
993
+ let t = new Tt(this.#t), e = new Tt(this.#t);
994
+ this.#g = t, this.#T = e;
995
+ let s = this.ttlAutopurge ? new Array(this.#t) : void 0;
996
+ this.#y = s, this.#j = (o, h, a = this.#c.now()) => {
997
+ if (e[o] = h !== 0 ? a : 0, t[o] = h, s?.[o] && (clearTimeout(s[o]), s[o] = void 0), h !== 0 && s) {
998
+ let l = setTimeout(() => {
999
+ this.#v(o) && this.#O(this.#a[o], "expire");
1000
+ }, h + 1);
1001
+ l.unref && l.unref(), s[o] = l;
1002
+ }
1003
+ }, this.#k = (o) => {
1004
+ e[o] = t[o] !== 0 ? this.#c.now() : 0;
1005
+ }, this.#N = (o, h) => {
1006
+ if (t[h]) {
1007
+ let a = t[h], l = e[h];
1008
+ if (!a || !l) return;
1009
+ o.ttl = a, o.start = l, o.now = i || r();
1010
+ let u = o.now - l;
1011
+ o.remainingTTL = a - u;
1012
+ }
1013
+ };
1014
+ let i = 0, r = () => {
1015
+ let o = this.#c.now();
1016
+ if (this.ttlResolution > 0) {
1017
+ i = o;
1018
+ let h = setTimeout(() => i = 0, this.ttlResolution);
1019
+ h.unref && h.unref();
1020
+ }
1021
+ return o;
1022
+ };
1023
+ this.getRemainingTTL = (o) => {
1024
+ let h = this.#f.get(o);
1025
+ if (h === void 0) return 0;
1026
+ let a = t[h], l = e[h];
1027
+ if (!a || !l) return 1 / 0;
1028
+ let u = (i || r()) - l;
1029
+ return a - u;
1030
+ }, this.#v = (o) => {
1031
+ let h = e[o], a = t[o];
1032
+ return !!a && !!h && (i || r()) - h > a;
1033
+ };
1034
+ }
1035
+ #k = () => {
1036
+ };
1037
+ #N = () => {
1038
+ };
1039
+ #j = () => {
1040
+ };
1041
+ #v = () => false;
1042
+ #G() {
1043
+ let t = new Tt(this.#t);
1044
+ this.#u = 0, this.#C = t, this.#P = (e) => {
1045
+ this.#u -= t[e], t[e] = 0;
1046
+ }, this.#I = (e, s, i, r) => {
1047
+ if (this.#l(s)) return 0;
1048
+ if (!q(i)) if (r) {
1049
+ if (typeof r != "function") throw new TypeError("sizeCalculation must be a function");
1050
+ if (i = r(s, e), !q(i)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
1051
+ } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
1052
+ return i;
1053
+ }, this.#L = (e, s, i) => {
1054
+ if (t[e] = s, this.#s) {
1055
+ let r = this.#s - t[e];
1056
+ for (; this.#u > r; ) this.#B(true);
1057
+ }
1058
+ this.#u += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#u);
1059
+ };
1060
+ }
1061
+ #P = (t) => {
1062
+ };
1063
+ #L = (t, e, s) => {
1064
+ };
1065
+ #I = (t, e, s, i) => {
1066
+ if (s || i) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
1067
+ return 0;
1068
+ };
1069
+ *#F({ allowStale: t = this.allowStale } = {}) {
1070
+ if (this.#h) for (let e = this.#p; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#b)); ) e = this.#E[e];
1071
+ }
1072
+ *#D({ allowStale: t = this.allowStale } = {}) {
1073
+ if (this.#h) for (let e = this.#b; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#p)); ) e = this.#d[e];
1074
+ }
1075
+ #z(t) {
1076
+ return t !== void 0 && this.#f.get(this.#a[t]) === t;
1077
+ }
1078
+ *entries() {
1079
+ for (let t of this.#F()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
1080
+ }
1081
+ *rentries() {
1082
+ for (let t of this.#D()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
1083
+ }
1084
+ *keys() {
1085
+ for (let t of this.#F()) {
1086
+ let e = this.#a[t];
1087
+ e !== void 0 && !this.#l(this.#i[t]) && (yield e);
1088
+ }
1089
+ }
1090
+ *rkeys() {
1091
+ for (let t of this.#D()) {
1092
+ let e = this.#a[t];
1093
+ e !== void 0 && !this.#l(this.#i[t]) && (yield e);
1094
+ }
1095
+ }
1096
+ *values() {
1097
+ for (let t of this.#F()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
1098
+ }
1099
+ *rvalues() {
1100
+ for (let t of this.#D()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
1101
+ }
1102
+ [Symbol.iterator]() {
1103
+ return this.entries();
1104
+ }
1105
+ [Symbol.toStringTag] = "LRUCache";
1106
+ find(t, e = {}) {
1107
+ for (let s of this.#F()) {
1108
+ let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
1109
+ if (r !== void 0 && t(r, this.#a[s], this)) return this.get(this.#a[s], e);
1110
+ }
1111
+ }
1112
+ forEach(t, e = this) {
1113
+ for (let s of this.#F()) {
1114
+ let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
1115
+ r !== void 0 && t.call(e, r, this.#a[s], this);
1116
+ }
1117
+ }
1118
+ rforEach(t, e = this) {
1119
+ for (let s of this.#D()) {
1120
+ let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
1121
+ r !== void 0 && t.call(e, r, this.#a[s], this);
1122
+ }
1123
+ }
1124
+ purgeStale() {
1125
+ let t = false;
1126
+ for (let e of this.#D({ allowStale: true })) this.#v(e) && (this.#O(this.#a[e], "expire"), t = true);
1127
+ return t;
1128
+ }
1129
+ info(t) {
1130
+ let e = this.#f.get(t);
1131
+ if (e === void 0) return;
1132
+ let s = this.#i[e], i = this.#l(s) ? s.__staleWhileFetching : s;
1133
+ if (i === void 0) return;
1134
+ let r = { value: i };
1135
+ if (this.#g && this.#T) {
1136
+ let o = this.#g[e], h = this.#T[e];
1137
+ if (o && h) {
1138
+ let a = o - (this.#c.now() - h);
1139
+ r.ttl = a, r.start = Date.now();
1140
+ }
1141
+ }
1142
+ return this.#C && (r.size = this.#C[e]), r;
1143
+ }
1144
+ dump() {
1145
+ let t = [];
1146
+ for (let e of this.#F({ allowStale: true })) {
1147
+ let s = this.#a[e], i = this.#i[e], r = this.#l(i) ? i.__staleWhileFetching : i;
1148
+ if (r === void 0 || s === void 0) continue;
1149
+ let o = { value: r };
1150
+ if (this.#g && this.#T) {
1151
+ o.ttl = this.#g[e];
1152
+ let h = this.#c.now() - this.#T[e];
1153
+ o.start = Math.floor(Date.now() - h);
1154
+ }
1155
+ this.#C && (o.size = this.#C[e]), t.unshift([s, o]);
1156
+ }
1157
+ return t;
1158
+ }
1159
+ load(t) {
1160
+ this.clear();
1161
+ for (let [e, s] of t) {
1162
+ if (s.start) {
1163
+ let i = Date.now() - s.start;
1164
+ s.start = this.#c.now() - i;
1165
+ }
1166
+ this.set(e, s.value, s);
1167
+ }
1168
+ }
1169
+ set(t, e, s = {}) {
1170
+ if (e === void 0) return this.delete(t), this;
1171
+ let { ttl: i = this.ttl, start: r, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: a } = s, { noUpdateTTL: l = this.noUpdateTTL } = s, u = this.#I(t, e, s.size || 0, h);
1172
+ if (this.maxEntrySize && u > this.maxEntrySize) return a && (a.set = "miss", a.maxEntrySizeExceeded = true), this.#O(t, "set"), this;
1173
+ let c = this.#h === 0 ? void 0 : this.#f.get(t);
1174
+ if (c === void 0) c = this.#h === 0 ? this.#p : this.#R.length !== 0 ? this.#R.pop() : this.#h === this.#t ? this.#B(false) : this.#h, this.#a[c] = t, this.#i[c] = e, this.#f.set(t, c), this.#d[this.#p] = c, this.#E[c] = this.#p, this.#p = c, this.#h++, this.#L(c, u, a), a && (a.set = "add"), l = false, this.#_ && this.#r?.(e, t, "add");
1175
+ else {
1176
+ this.#W(c);
1177
+ let d = this.#i[c];
1178
+ if (e !== d) {
1179
+ if (this.#A && this.#l(d)) {
1180
+ d.__abortController.abort(new Error("replaced"));
1181
+ let { __staleWhileFetching: f } = d;
1182
+ f !== void 0 && !o && (this.#x && this.#n?.(f, t, "set"), this.#e && this.#m?.push([f, t, "set"]));
1183
+ } else o || (this.#x && this.#n?.(d, t, "set"), this.#e && this.#m?.push([d, t, "set"]));
1184
+ if (this.#P(c), this.#L(c, u, a), this.#i[c] = e, a) {
1185
+ a.set = "replace";
1186
+ let f = d && this.#l(d) ? d.__staleWhileFetching : d;
1187
+ f !== void 0 && (a.oldValue = f);
1188
+ }
1189
+ } else a && (a.set = "update");
1190
+ this.#_ && this.onInsert?.(e, t, e === d ? "update" : "replace");
1191
+ }
1192
+ if (i !== 0 && !this.#g && this.#M(), this.#g && (l || this.#j(c, i, r), a && this.#N(a, c)), !o && this.#e && this.#m) {
1193
+ let d = this.#m, f;
1194
+ for (; f = d?.shift(); ) this.#o?.(...f);
1195
+ }
1196
+ return this;
1197
+ }
1198
+ pop() {
1199
+ try {
1200
+ for (; this.#h; ) {
1201
+ let t = this.#i[this.#b];
1202
+ if (this.#B(true), this.#l(t)) {
1203
+ if (t.__staleWhileFetching) return t.__staleWhileFetching;
1204
+ } else if (t !== void 0) return t;
1205
+ }
1206
+ } finally {
1207
+ if (this.#e && this.#m) {
1208
+ let t = this.#m, e;
1209
+ for (; e = t?.shift(); ) this.#o?.(...e);
1210
+ }
1211
+ }
1212
+ }
1213
+ #B(t) {
1214
+ let e = this.#b, s = this.#a[e], i = this.#i[e];
1215
+ return this.#A && this.#l(i) ? i.__abortController.abort(new Error("evicted")) : (this.#x || this.#e) && (this.#x && this.#n?.(i, s, "evict"), this.#e && this.#m?.push([i, s, "evict"])), this.#P(e), this.#y?.[e] && (clearTimeout(this.#y[e]), this.#y[e] = void 0), t && (this.#a[e] = void 0, this.#i[e] = void 0, this.#R.push(e)), this.#h === 1 ? (this.#b = this.#p = 0, this.#R.length = 0) : this.#b = this.#d[e], this.#f.delete(s), this.#h--, e;
1216
+ }
1217
+ has(t, e = {}) {
1218
+ let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, r = this.#f.get(t);
1219
+ if (r !== void 0) {
1220
+ let o = this.#i[r];
1221
+ if (this.#l(o) && o.__staleWhileFetching === void 0) return false;
1222
+ if (this.#v(r)) i && (i.has = "stale", this.#N(i, r));
1223
+ else return s && this.#k(r), i && (i.has = "hit", this.#N(i, r)), true;
1224
+ } else i && (i.has = "miss");
1225
+ return false;
1226
+ }
1227
+ peek(t, e = {}) {
1228
+ let { allowStale: s = this.allowStale } = e, i = this.#f.get(t);
1229
+ if (i === void 0 || !s && this.#v(i)) return;
1230
+ let r = this.#i[i];
1231
+ return this.#l(r) ? r.__staleWhileFetching : r;
1232
+ }
1233
+ #U(t, e, s, i) {
1234
+ let r = e === void 0 ? void 0 : this.#i[e];
1235
+ if (this.#l(r)) return r;
1236
+ let o = new At(), { signal: h } = s;
1237
+ h?.addEventListener("abort", () => o.abort(h.reason), { signal: o.signal });
1238
+ let a = { signal: o.signal, options: s, context: i }, l = (p, w = false) => {
1239
+ let { aborted: g } = o.signal, S = s.ignoreFetchAbort && p !== void 0, E = s.ignoreFetchAbort || !!(s.allowStaleOnFetchAbort && p !== void 0);
1240
+ if (s.status && (g && !w ? (s.status.fetchAborted = true, s.status.fetchError = o.signal.reason, S && (s.status.fetchAbortIgnored = true)) : s.status.fetchResolved = true), g && !S && !w) return c(o.signal.reason, E);
1241
+ let y = f, b = this.#i[e];
1242
+ return (b === f || S && w && b === void 0) && (p === void 0 ? y.__staleWhileFetching !== void 0 ? this.#i[e] = y.__staleWhileFetching : this.#O(t, "fetch") : (s.status && (s.status.fetchUpdated = true), this.set(t, p, a.options))), p;
1243
+ }, u = (p) => (s.status && (s.status.fetchRejected = true, s.status.fetchError = p), c(p, false)), c = (p, w) => {
1244
+ let { aborted: g } = o.signal, S = g && s.allowStaleOnFetchAbort, E = S || s.allowStaleOnFetchRejection, y = E || s.noDeleteOnFetchRejection, b = f;
1245
+ if (this.#i[e] === f && (!y || !w && b.__staleWhileFetching === void 0 ? this.#O(t, "fetch") : S || (this.#i[e] = b.__staleWhileFetching)), E) return s.status && b.__staleWhileFetching !== void 0 && (s.status.returnedStale = true), b.__staleWhileFetching;
1246
+ if (b.__returned === b) throw p;
1247
+ }, d = (p, w) => {
1248
+ let g = this.#S?.(t, r, a);
1249
+ g && g instanceof Promise && g.then((S) => p(S === void 0 ? void 0 : S), w), o.signal.addEventListener("abort", () => {
1250
+ (!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (p(void 0), s.allowStaleOnFetchAbort && (p = (S) => l(S, true)));
1251
+ });
1252
+ };
1253
+ s.status && (s.status.fetchDispatched = true);
1254
+ let f = new Promise(d).then(l, u), m = Object.assign(f, { __abortController: o, __staleWhileFetching: r, __returned: void 0 });
1255
+ return e === void 0 ? (this.set(t, m, { ...a.options, status: void 0 }), e = this.#f.get(t)) : this.#i[e] = m, m;
1256
+ }
1257
+ #l(t) {
1258
+ if (!this.#A) return false;
1259
+ let e = t;
1260
+ return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof At;
1261
+ }
1262
+ async fetch(t, e = {}) {
1263
+ let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: h = this.noDisposeOnSet, size: a = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: u = this.noUpdateTTL, noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: m = this.allowStaleOnFetchAbort, context: p, forceRefresh: w = false, status: g, signal: S } = e;
1264
+ if (!this.#A) return g && (g.fetch = "get"), this.get(t, { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, status: g });
1265
+ let E = { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, ttl: o, noDisposeOnSet: h, size: a, sizeCalculation: l, noUpdateTTL: u, noDeleteOnFetchRejection: c, allowStaleOnFetchRejection: d, allowStaleOnFetchAbort: m, ignoreFetchAbort: f, status: g, signal: S }, y = this.#f.get(t);
1266
+ if (y === void 0) {
1267
+ g && (g.fetch = "miss");
1268
+ let b = this.#U(t, y, E, p);
1269
+ return b.__returned = b;
1270
+ } else {
1271
+ let b = this.#i[y];
1272
+ if (this.#l(b)) {
1273
+ let Z = s && b.__staleWhileFetching !== void 0;
1274
+ return g && (g.fetch = "inflight", Z && (g.returnedStale = true)), Z ? b.__staleWhileFetching : b.__returned = b;
1275
+ }
1276
+ let z = this.#v(y);
1277
+ if (!w && !z) return g && (g.fetch = "hit"), this.#W(y), i && this.#k(y), g && this.#N(g, y), b;
1278
+ let $ = this.#U(t, y, E, p), J = $.__staleWhileFetching !== void 0 && s;
1279
+ return g && (g.fetch = z ? "stale" : "refresh", J && z && (g.returnedStale = true)), J ? $.__staleWhileFetching : $.__returned = $;
1280
+ }
1281
+ }
1282
+ async forceFetch(t, e = {}) {
1283
+ let s = await this.fetch(t, e);
1284
+ if (s === void 0) throw new Error("fetch() returned undefined");
1285
+ return s;
1286
+ }
1287
+ memo(t, e = {}) {
1288
+ let s = this.#w;
1289
+ if (!s) throw new Error("no memoMethod provided to constructor");
1290
+ let { context: i, forceRefresh: r, ...o } = e, h = this.get(t, o);
1291
+ if (!r && h !== void 0) return h;
1292
+ let a = s(t, h, { options: o, context: i });
1293
+ return this.set(t, a, o), a;
1294
+ }
1295
+ get(t, e = {}) {
1296
+ let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: o } = e, h = this.#f.get(t);
1297
+ if (h !== void 0) {
1298
+ let a = this.#i[h], l = this.#l(a);
1299
+ return o && this.#N(o, h), this.#v(h) ? (o && (o.get = "stale"), l ? (o && s && a.__staleWhileFetching !== void 0 && (o.returnedStale = true), s ? a.__staleWhileFetching : void 0) : (r || this.#O(t, "expire"), o && s && (o.returnedStale = true), s ? a : void 0)) : (o && (o.get = "hit"), l ? a.__staleWhileFetching : (this.#W(h), i && this.#k(h), a));
1300
+ } else o && (o.get = "miss");
1301
+ }
1302
+ #$(t, e) {
1303
+ this.#E[e] = t, this.#d[t] = e;
1304
+ }
1305
+ #W(t) {
1306
+ t !== this.#p && (t === this.#b ? this.#b = this.#d[t] : this.#$(this.#E[t], this.#d[t]), this.#$(this.#p, t), this.#p = t);
1307
+ }
1308
+ delete(t) {
1309
+ return this.#O(t, "delete");
1310
+ }
1311
+ #O(t, e) {
1312
+ let s = false;
1313
+ if (this.#h !== 0) {
1314
+ let i = this.#f.get(t);
1315
+ if (i !== void 0) if (this.#y?.[i] && (clearTimeout(this.#y?.[i]), this.#y[i] = void 0), s = true, this.#h === 1) this.#H(e);
1316
+ else {
1317
+ this.#P(i);
1318
+ let r = this.#i[i];
1319
+ if (this.#l(r) ? r.__abortController.abort(new Error("deleted")) : (this.#x || this.#e) && (this.#x && this.#n?.(r, t, e), this.#e && this.#m?.push([r, t, e])), this.#f.delete(t), this.#a[i] = void 0, this.#i[i] = void 0, i === this.#p) this.#p = this.#E[i];
1320
+ else if (i === this.#b) this.#b = this.#d[i];
1321
+ else {
1322
+ let o = this.#E[i];
1323
+ this.#d[o] = this.#d[i];
1324
+ let h = this.#d[i];
1325
+ this.#E[h] = this.#E[i];
1326
+ }
1327
+ this.#h--, this.#R.push(i);
1328
+ }
1329
+ }
1330
+ if (this.#e && this.#m?.length) {
1331
+ let i = this.#m, r;
1332
+ for (; r = i?.shift(); ) this.#o?.(...r);
1333
+ }
1334
+ return s;
1335
+ }
1336
+ clear() {
1337
+ return this.#H("delete");
1338
+ }
1339
+ #H(t) {
1340
+ for (let e of this.#D({ allowStale: true })) {
1341
+ let s = this.#i[e];
1342
+ if (this.#l(s)) s.__abortController.abort(new Error("deleted"));
1343
+ else {
1344
+ let i = this.#a[e];
1345
+ this.#x && this.#n?.(s, i, t), this.#e && this.#m?.push([s, i, t]);
1346
+ }
1347
+ }
1348
+ if (this.#f.clear(), this.#i.fill(void 0), this.#a.fill(void 0), this.#g && this.#T) {
1349
+ this.#g.fill(0), this.#T.fill(0);
1350
+ for (let e of this.#y ?? []) e !== void 0 && clearTimeout(e);
1351
+ this.#y?.fill(void 0);
1352
+ }
1353
+ if (this.#C && this.#C.fill(0), this.#b = 0, this.#p = 0, this.#R.length = 0, this.#u = 0, this.#h = 0, this.#e && this.#m) {
1354
+ let e = this.#m, s;
1355
+ for (; s = e?.shift(); ) this.#o?.(...s);
1356
+ }
1357
+ }
1358
+ };
1359
+ var Ne = typeof process == "object" && process ? process : { stdout: null, stderr: null };
1360
+ var oi = (n7) => !!n7 && typeof n7 == "object" && (n7 instanceof V || n7 instanceof Pe || hi(n7) || ai(n7));
1361
+ var hi = (n7) => !!n7 && typeof n7 == "object" && n7 instanceof ee && typeof n7.pipe == "function" && n7.pipe !== Pe.Writable.prototype.pipe;
1362
+ var ai = (n7) => !!n7 && typeof n7 == "object" && n7 instanceof ee && typeof n7.write == "function" && typeof n7.end == "function";
1363
+ var G = /* @__PURE__ */ Symbol("EOF");
1364
+ var H = /* @__PURE__ */ Symbol("maybeEmitEnd");
1365
+ var K = /* @__PURE__ */ Symbol("emittedEnd");
1366
+ var kt = /* @__PURE__ */ Symbol("emittingEnd");
1367
+ var ut = /* @__PURE__ */ Symbol("emittedError");
1368
+ var Rt = /* @__PURE__ */ Symbol("closed");
1369
+ var _e = /* @__PURE__ */ Symbol("read");
1370
+ var Ot = /* @__PURE__ */ Symbol("flush");
1371
+ var Le = /* @__PURE__ */ Symbol("flushChunk");
1372
+ var P = /* @__PURE__ */ Symbol("encoding");
1373
+ var et = /* @__PURE__ */ Symbol("decoder");
1374
+ var v = /* @__PURE__ */ Symbol("flowing");
1375
+ var dt = /* @__PURE__ */ Symbol("paused");
1376
+ var st = /* @__PURE__ */ Symbol("resume");
1377
+ var C = /* @__PURE__ */ Symbol("buffer");
1378
+ var F = /* @__PURE__ */ Symbol("pipes");
1379
+ var T = /* @__PURE__ */ Symbol("bufferLength");
1380
+ var Yt = /* @__PURE__ */ Symbol("bufferPush");
1381
+ var Ft = /* @__PURE__ */ Symbol("bufferShift");
1382
+ var k = /* @__PURE__ */ Symbol("objectMode");
1383
+ var x = /* @__PURE__ */ Symbol("destroyed");
1384
+ var Xt = /* @__PURE__ */ Symbol("error");
1385
+ var Jt = /* @__PURE__ */ Symbol("emitData");
1386
+ var We = /* @__PURE__ */ Symbol("emitEnd");
1387
+ var Zt = /* @__PURE__ */ Symbol("emitEnd2");
1388
+ var B = /* @__PURE__ */ Symbol("async");
1389
+ var Qt = /* @__PURE__ */ Symbol("abort");
1390
+ var Dt = /* @__PURE__ */ Symbol("aborted");
1391
+ var pt = /* @__PURE__ */ Symbol("signal");
1392
+ var Y = /* @__PURE__ */ Symbol("dataListeners");
1393
+ var M = /* @__PURE__ */ Symbol("discarded");
1394
+ var mt = (n7) => Promise.resolve().then(n7);
1395
+ var li = (n7) => n7();
1396
+ var ci = (n7) => n7 === "end" || n7 === "finish" || n7 === "prefinish";
1397
+ var fi = (n7) => n7 instanceof ArrayBuffer || !!n7 && typeof n7 == "object" && n7.constructor && n7.constructor.name === "ArrayBuffer" && n7.byteLength >= 0;
1398
+ var ui = (n7) => !Buffer.isBuffer(n7) && ArrayBuffer.isView(n7);
1399
+ var Mt = class {
1400
+ src;
1401
+ dest;
1402
+ opts;
1403
+ ondrain;
1404
+ constructor(t, e, s) {
1405
+ this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[st](), this.dest.on("drain", this.ondrain);
1406
+ }
1407
+ unpipe() {
1408
+ this.dest.removeListener("drain", this.ondrain);
1409
+ }
1410
+ proxyErrors(t) {
1411
+ }
1412
+ end() {
1413
+ this.unpipe(), this.opts.end && this.dest.end();
1414
+ }
1415
+ };
1416
+ var te = class extends Mt {
1417
+ unpipe() {
1418
+ this.src.removeListener("error", this.proxyErrors), super.unpipe();
1419
+ }
1420
+ constructor(t, e, s) {
1421
+ super(t, e, s), this.proxyErrors = (i) => e.emit("error", i), t.on("error", this.proxyErrors);
1422
+ }
1423
+ };
1424
+ var di = (n7) => !!n7.objectMode;
1425
+ var pi = (n7) => !n7.objectMode && !!n7.encoding && n7.encoding !== "buffer";
1426
+ var V = class extends ee {
1427
+ [v] = false;
1428
+ [dt] = false;
1429
+ [F] = [];
1430
+ [C] = [];
1431
+ [k];
1432
+ [P];
1433
+ [B];
1434
+ [et];
1435
+ [G] = false;
1436
+ [K] = false;
1437
+ [kt] = false;
1438
+ [Rt] = false;
1439
+ [ut] = null;
1440
+ [T] = 0;
1441
+ [x] = false;
1442
+ [pt];
1443
+ [Dt] = false;
1444
+ [Y] = 0;
1445
+ [M] = false;
1446
+ writable = true;
1447
+ readable = true;
1448
+ constructor(...t) {
1449
+ let e = t[0] || {};
1450
+ if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
1451
+ di(e) ? (this[k] = true, this[P] = null) : pi(e) ? (this[P] = e.encoding, this[k] = false) : (this[k] = false, this[P] = null), this[B] = !!e.async, this[et] = this[P] ? new ni(this[P]) : null, e && e.debugExposeBuffer === true && Object.defineProperty(this, "buffer", { get: () => this[C] }), e && e.debugExposePipes === true && Object.defineProperty(this, "pipes", { get: () => this[F] });
1452
+ let { signal: s } = e;
1453
+ s && (this[pt] = s, s.aborted ? this[Qt]() : s.addEventListener("abort", () => this[Qt]()));
1454
+ }
1455
+ get bufferLength() {
1456
+ return this[T];
1457
+ }
1458
+ get encoding() {
1459
+ return this[P];
1460
+ }
1461
+ set encoding(t) {
1462
+ throw new Error("Encoding must be set at instantiation time");
1463
+ }
1464
+ setEncoding(t) {
1465
+ throw new Error("Encoding must be set at instantiation time");
1466
+ }
1467
+ get objectMode() {
1468
+ return this[k];
1469
+ }
1470
+ set objectMode(t) {
1471
+ throw new Error("objectMode must be set at instantiation time");
1472
+ }
1473
+ get async() {
1474
+ return this[B];
1475
+ }
1476
+ set async(t) {
1477
+ this[B] = this[B] || !!t;
1478
+ }
1479
+ [Qt]() {
1480
+ this[Dt] = true, this.emit("abort", this[pt]?.reason), this.destroy(this[pt]?.reason);
1481
+ }
1482
+ get aborted() {
1483
+ return this[Dt];
1484
+ }
1485
+ set aborted(t) {
1486
+ }
1487
+ write(t, e, s) {
1488
+ if (this[Dt]) return false;
1489
+ if (this[G]) throw new Error("write after end");
1490
+ if (this[x]) return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
1491
+ typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
1492
+ let i = this[B] ? mt : li;
1493
+ if (!this[k] && !Buffer.isBuffer(t)) {
1494
+ if (ui(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
1495
+ else if (fi(t)) t = Buffer.from(t);
1496
+ else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
1497
+ }
1498
+ return this[k] ? (this[v] && this[T] !== 0 && this[Ot](true), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : t.length ? (typeof t == "string" && !(e === this[P] && !this[et]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[P] && (t = this[et].write(t)), this[v] && this[T] !== 0 && this[Ot](true), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : (this[T] !== 0 && this.emit("readable"), s && i(s), this[v]);
1499
+ }
1500
+ read(t) {
1501
+ if (this[x]) return null;
1502
+ if (this[M] = false, this[T] === 0 || t === 0 || t && t > this[T]) return this[H](), null;
1503
+ this[k] && (t = null), this[C].length > 1 && !this[k] && (this[C] = [this[P] ? this[C].join("") : Buffer.concat(this[C], this[T])]);
1504
+ let e = this[_e](t || null, this[C][0]);
1505
+ return this[H](), e;
1506
+ }
1507
+ [_e](t, e) {
1508
+ if (this[k]) this[Ft]();
1509
+ else {
1510
+ let s = e;
1511
+ t === s.length || t === null ? this[Ft]() : typeof s == "string" ? (this[C][0] = s.slice(t), e = s.slice(0, t), this[T] -= t) : (this[C][0] = s.subarray(t), e = s.subarray(0, t), this[T] -= t);
1512
+ }
1513
+ return this.emit("data", e), !this[C].length && !this[G] && this.emit("drain"), e;
1514
+ }
1515
+ end(t, e, s) {
1516
+ return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[G] = true, this.writable = false, (this[v] || !this[dt]) && this[H](), this;
1517
+ }
1518
+ [st]() {
1519
+ this[x] || (!this[Y] && !this[F].length && (this[M] = true), this[dt] = false, this[v] = true, this.emit("resume"), this[C].length ? this[Ot]() : this[G] ? this[H]() : this.emit("drain"));
1520
+ }
1521
+ resume() {
1522
+ return this[st]();
1523
+ }
1524
+ pause() {
1525
+ this[v] = false, this[dt] = true, this[M] = false;
1526
+ }
1527
+ get destroyed() {
1528
+ return this[x];
1529
+ }
1530
+ get flowing() {
1531
+ return this[v];
1532
+ }
1533
+ get paused() {
1534
+ return this[dt];
1535
+ }
1536
+ [Yt](t) {
1537
+ this[k] ? this[T] += 1 : this[T] += t.length, this[C].push(t);
1538
+ }
1539
+ [Ft]() {
1540
+ return this[k] ? this[T] -= 1 : this[T] -= this[C][0].length, this[C].shift();
1541
+ }
1542
+ [Ot](t = false) {
1543
+ do
1544
+ ;
1545
+ while (this[Le](this[Ft]()) && this[C].length);
1546
+ !t && !this[C].length && !this[G] && this.emit("drain");
1547
+ }
1548
+ [Le](t) {
1549
+ return this.emit("data", t), this[v];
1550
+ }
1551
+ pipe(t, e) {
1552
+ if (this[x]) return t;
1553
+ this[M] = false;
1554
+ let s = this[K];
1555
+ return e = e || {}, t === Ne.stdout || t === Ne.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F].push(e.proxyErrors ? new te(this, t, e) : new Mt(this, t, e)), this[B] ? mt(() => this[st]()) : this[st]()), t;
1556
+ }
1557
+ unpipe(t) {
1558
+ let e = this[F].find((s) => s.dest === t);
1559
+ e && (this[F].length === 1 ? (this[v] && this[Y] === 0 && (this[v] = false), this[F] = []) : this[F].splice(this[F].indexOf(e), 1), e.unpipe());
1560
+ }
1561
+ addListener(t, e) {
1562
+ return this.on(t, e);
1563
+ }
1564
+ on(t, e) {
1565
+ let s = super.on(t, e);
1566
+ if (t === "data") this[M] = false, this[Y]++, !this[F].length && !this[v] && this[st]();
1567
+ else if (t === "readable" && this[T] !== 0) super.emit("readable");
1568
+ else if (ci(t) && this[K]) super.emit(t), this.removeAllListeners(t);
1569
+ else if (t === "error" && this[ut]) {
1570
+ let i = e;
1571
+ this[B] ? mt(() => i.call(this, this[ut])) : i.call(this, this[ut]);
1572
+ }
1573
+ return s;
1574
+ }
1575
+ removeListener(t, e) {
1576
+ return this.off(t, e);
1577
+ }
1578
+ off(t, e) {
1579
+ let s = super.off(t, e);
1580
+ return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M] && !this[F].length && (this[v] = false)), s;
1581
+ }
1582
+ removeAllListeners(t) {
1583
+ let e = super.removeAllListeners(t);
1584
+ return (t === "data" || t === void 0) && (this[Y] = 0, !this[M] && !this[F].length && (this[v] = false)), e;
1585
+ }
1586
+ get emittedEnd() {
1587
+ return this[K];
1588
+ }
1589
+ [H]() {
1590
+ !this[kt] && !this[K] && !this[x] && this[C].length === 0 && this[G] && (this[kt] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Rt] && this.emit("close"), this[kt] = false);
1591
+ }
1592
+ emit(t, ...e) {
1593
+ let s = e[0];
1594
+ if (t !== "error" && t !== "close" && t !== x && this[x]) return false;
1595
+ if (t === "data") return !this[k] && !s ? false : this[B] ? (mt(() => this[Jt](s)), true) : this[Jt](s);
1596
+ if (t === "end") return this[We]();
1597
+ if (t === "close") {
1598
+ if (this[Rt] = true, !this[K] && !this[x]) return false;
1599
+ let r = super.emit("close");
1600
+ return this.removeAllListeners("close"), r;
1601
+ } else if (t === "error") {
1602
+ this[ut] = s, super.emit(Xt, s);
1603
+ let r = !this[pt] || this.listeners("error").length ? super.emit("error", s) : false;
1604
+ return this[H](), r;
1605
+ } else if (t === "resume") {
1606
+ let r = super.emit("resume");
1607
+ return this[H](), r;
1608
+ } else if (t === "finish" || t === "prefinish") {
1609
+ let r = super.emit(t);
1610
+ return this.removeAllListeners(t), r;
1611
+ }
1612
+ let i = super.emit(t, ...e);
1613
+ return this[H](), i;
1614
+ }
1615
+ [Jt](t) {
1616
+ for (let s of this[F]) s.dest.write(t) === false && this.pause();
1617
+ let e = this[M] ? false : super.emit("data", t);
1618
+ return this[H](), e;
1619
+ }
1620
+ [We]() {
1621
+ return this[K] ? false : (this[K] = true, this.readable = false, this[B] ? (mt(() => this[Zt]()), true) : this[Zt]());
1622
+ }
1623
+ [Zt]() {
1624
+ if (this[et]) {
1625
+ let e = this[et].end();
1626
+ if (e) {
1627
+ for (let s of this[F]) s.dest.write(e);
1628
+ this[M] || super.emit("data", e);
1629
+ }
1630
+ }
1631
+ for (let e of this[F]) e.end();
1632
+ let t = super.emit("end");
1633
+ return this.removeAllListeners("end"), t;
1634
+ }
1635
+ async collect() {
1636
+ let t = Object.assign([], { dataLength: 0 });
1637
+ this[k] || (t.dataLength = 0);
1638
+ let e = this.promise();
1639
+ return this.on("data", (s) => {
1640
+ t.push(s), this[k] || (t.dataLength += s.length);
1641
+ }), await e, t;
1642
+ }
1643
+ async concat() {
1644
+ if (this[k]) throw new Error("cannot concat in objectMode");
1645
+ let t = await this.collect();
1646
+ return this[P] ? t.join("") : Buffer.concat(t, t.dataLength);
1647
+ }
1648
+ async promise() {
1649
+ return new Promise((t, e) => {
1650
+ this.on(x, () => e(new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
1651
+ });
1652
+ }
1653
+ [Symbol.asyncIterator]() {
1654
+ this[M] = false;
1655
+ let t = false, e = async () => (this.pause(), t = true, { value: void 0, done: true });
1656
+ return { next: () => {
1657
+ if (t) return e();
1658
+ let i = this.read();
1659
+ if (i !== null) return Promise.resolve({ done: false, value: i });
1660
+ if (this[G]) return e();
1661
+ let r, o, h = (c) => {
1662
+ this.off("data", a), this.off("end", l), this.off(x, u), e(), o(c);
1663
+ }, a = (c) => {
1664
+ this.off("error", h), this.off("end", l), this.off(x, u), this.pause(), r({ value: c, done: !!this[G] });
1665
+ }, l = () => {
1666
+ this.off("error", h), this.off("data", a), this.off(x, u), e(), r({ done: true, value: void 0 });
1667
+ }, u = () => h(new Error("stream destroyed"));
1668
+ return new Promise((c, d) => {
1669
+ o = d, r = c, this.once(x, u), this.once("error", h), this.once("end", l), this.once("data", a);
1670
+ });
1671
+ }, throw: e, return: e, [Symbol.asyncIterator]() {
1672
+ return this;
1673
+ } };
1674
+ }
1675
+ [Symbol.iterator]() {
1676
+ this[M] = false;
1677
+ let t = false, e = () => (this.pause(), this.off(Xt, e), this.off(x, e), this.off("end", e), t = true, { done: true, value: void 0 }), s = () => {
1678
+ if (t) return e();
1679
+ let i = this.read();
1680
+ return i === null ? e() : { done: false, value: i };
1681
+ };
1682
+ return this.once("end", e), this.once(Xt, e), this.once(x, e), { next: s, throw: e, return: e, [Symbol.iterator]() {
1683
+ return this;
1684
+ } };
1685
+ }
1686
+ destroy(t) {
1687
+ if (this[x]) return t ? this.emit("error", t) : this.emit(x), this;
1688
+ this[x] = true, this[M] = true, this[C].length = 0, this[T] = 0;
1689
+ let e = this;
1690
+ return typeof e.close == "function" && !this[Rt] && e.close(), t ? this.emit("error", t) : this.emit(x), this;
1691
+ }
1692
+ static get isStream() {
1693
+ return oi;
1694
+ }
1695
+ };
1696
+ var vi = Ei.native;
1697
+ var wt = { lstatSync: wi, readdir: yi, readdirSync: bi, readlinkSync: Si, realpathSync: vi, promises: { lstat: Ci, readdir: Ti, readlink: Ai, realpath: ki } };
1698
+ var Ue = (n7) => !n7 || n7 === wt || n7 === xi ? wt : { ...wt, ...n7, promises: { ...wt.promises, ...n7.promises || {} } };
1699
+ var $e = /^\\\\\?\\([a-z]:)\\?$/i;
1700
+ var Ri = (n7) => n7.replace(/\//g, "\\").replace($e, "$1\\");
1701
+ var Oi = /[\\\/]/;
1702
+ var L = 0;
1703
+ var Ge = 1;
1704
+ var He = 2;
1705
+ var U = 4;
1706
+ var qe = 6;
1707
+ var Ke = 8;
1708
+ var X = 10;
1709
+ var Ve = 12;
1710
+ var _ = 15;
1711
+ var gt = ~_;
1712
+ var se = 16;
1713
+ var je = 32;
1714
+ var yt = 64;
1715
+ var j = 128;
1716
+ var Nt = 256;
1717
+ var Lt = 512;
1718
+ var Ie = yt | j | Lt;
1719
+ var Fi = 1023;
1720
+ var ie = (n7) => n7.isFile() ? Ke : n7.isDirectory() ? U : n7.isSymbolicLink() ? X : n7.isCharacterDevice() ? He : n7.isBlockDevice() ? qe : n7.isSocket() ? Ve : n7.isFIFO() ? Ge : L;
1721
+ var ze = new ft({ max: 2 ** 12 });
1722
+ var bt = (n7) => {
1723
+ let t = ze.get(n7);
1724
+ if (t) return t;
1725
+ let e = n7.normalize("NFKD");
1726
+ return ze.set(n7, e), e;
1727
+ };
1728
+ var Be = new ft({ max: 2 ** 12 });
1729
+ var _t = (n7) => {
1730
+ let t = Be.get(n7);
1731
+ if (t) return t;
1732
+ let e = bt(n7.toLowerCase());
1733
+ return Be.set(n7, e), e;
1734
+ };
1735
+ var Wt = class extends ft {
1736
+ constructor() {
1737
+ super({ max: 256 });
1738
+ }
1739
+ };
1740
+ var ne = class extends ft {
1741
+ constructor(t = 16 * 1024) {
1742
+ super({ maxSize: t, sizeCalculation: (e) => e.length + 1 });
1743
+ }
1744
+ };
1745
+ var Ye = /* @__PURE__ */ Symbol("PathScurry setAsCwd");
1746
+ var R = class {
1747
+ name;
1748
+ root;
1749
+ roots;
1750
+ parent;
1751
+ nocase;
1752
+ isCWD = false;
1753
+ #t;
1754
+ #s;
1755
+ get dev() {
1756
+ return this.#s;
1757
+ }
1758
+ #n;
1759
+ get mode() {
1760
+ return this.#n;
1761
+ }
1762
+ #r;
1763
+ get nlink() {
1764
+ return this.#r;
1765
+ }
1766
+ #o;
1767
+ get uid() {
1768
+ return this.#o;
1769
+ }
1770
+ #S;
1771
+ get gid() {
1772
+ return this.#S;
1773
+ }
1774
+ #w;
1775
+ get rdev() {
1776
+ return this.#w;
1777
+ }
1778
+ #c;
1779
+ get blksize() {
1780
+ return this.#c;
1781
+ }
1782
+ #h;
1783
+ get ino() {
1784
+ return this.#h;
1785
+ }
1786
+ #u;
1787
+ get size() {
1788
+ return this.#u;
1789
+ }
1790
+ #f;
1791
+ get blocks() {
1792
+ return this.#f;
1793
+ }
1794
+ #a;
1795
+ get atimeMs() {
1796
+ return this.#a;
1797
+ }
1798
+ #i;
1799
+ get mtimeMs() {
1800
+ return this.#i;
1801
+ }
1802
+ #d;
1803
+ get ctimeMs() {
1804
+ return this.#d;
1805
+ }
1806
+ #E;
1807
+ get birthtimeMs() {
1808
+ return this.#E;
1809
+ }
1810
+ #b;
1811
+ get atime() {
1812
+ return this.#b;
1813
+ }
1814
+ #p;
1815
+ get mtime() {
1816
+ return this.#p;
1817
+ }
1818
+ #R;
1819
+ get ctime() {
1820
+ return this.#R;
1821
+ }
1822
+ #m;
1823
+ get birthtime() {
1824
+ return this.#m;
1825
+ }
1826
+ #C;
1827
+ #T;
1828
+ #g;
1829
+ #y;
1830
+ #x;
1831
+ #A;
1832
+ #e;
1833
+ #_;
1834
+ #M;
1835
+ #k;
1836
+ get parentPath() {
1837
+ return (this.parent || this).fullpath();
1838
+ }
1839
+ get path() {
1840
+ return this.parentPath;
1841
+ }
1842
+ constructor(t, e = L, s, i, r, o, h) {
1843
+ this.name = t, this.#C = r ? _t(t) : bt(t), this.#e = e & Fi, this.nocase = r, this.roots = i, this.root = s || this, this.#_ = o, this.#g = h.fullpath, this.#x = h.relative, this.#A = h.relativePosix, this.parent = h.parent, this.parent ? this.#t = this.parent.#t : this.#t = Ue(h.fs);
1844
+ }
1845
+ depth() {
1846
+ return this.#T !== void 0 ? this.#T : this.parent ? this.#T = this.parent.depth() + 1 : this.#T = 0;
1847
+ }
1848
+ childrenCache() {
1849
+ return this.#_;
1850
+ }
1851
+ resolve(t) {
1852
+ if (!t) return this;
1853
+ let e = this.getRootString(t), i = t.substring(e.length).split(this.splitSep);
1854
+ return e ? this.getRoot(e).#N(i) : this.#N(i);
1855
+ }
1856
+ #N(t) {
1857
+ let e = this;
1858
+ for (let s of t) e = e.child(s);
1859
+ return e;
1860
+ }
1861
+ children() {
1862
+ let t = this.#_.get(this);
1863
+ if (t) return t;
1864
+ let e = Object.assign([], { provisional: 0 });
1865
+ return this.#_.set(this, e), this.#e &= ~se, e;
1866
+ }
1867
+ child(t, e) {
1868
+ if (t === "" || t === ".") return this;
1869
+ if (t === "..") return this.parent || this;
1870
+ let s = this.children(), i = this.nocase ? _t(t) : bt(t);
1871
+ for (let a of s) if (a.#C === i) return a;
1872
+ let r = this.parent ? this.sep : "", o = this.#g ? this.#g + r + t : void 0, h = this.newChild(t, L, { ...e, parent: this, fullpath: o });
1873
+ return this.canReaddir() || (h.#e |= j), s.push(h), h;
1874
+ }
1875
+ relative() {
1876
+ if (this.isCWD) return "";
1877
+ if (this.#x !== void 0) return this.#x;
1878
+ let t = this.name, e = this.parent;
1879
+ if (!e) return this.#x = this.name;
1880
+ let s = e.relative();
1881
+ return s + (!s || !e.parent ? "" : this.sep) + t;
1882
+ }
1883
+ relativePosix() {
1884
+ if (this.sep === "/") return this.relative();
1885
+ if (this.isCWD) return "";
1886
+ if (this.#A !== void 0) return this.#A;
1887
+ let t = this.name, e = this.parent;
1888
+ if (!e) return this.#A = this.fullpathPosix();
1889
+ let s = e.relativePosix();
1890
+ return s + (!s || !e.parent ? "" : "/") + t;
1891
+ }
1892
+ fullpath() {
1893
+ if (this.#g !== void 0) return this.#g;
1894
+ let t = this.name, e = this.parent;
1895
+ if (!e) return this.#g = this.name;
1896
+ let i = e.fullpath() + (e.parent ? this.sep : "") + t;
1897
+ return this.#g = i;
1898
+ }
1899
+ fullpathPosix() {
1900
+ if (this.#y !== void 0) return this.#y;
1901
+ if (this.sep === "/") return this.#y = this.fullpath();
1902
+ if (!this.parent) {
1903
+ let i = this.fullpath().replace(/\\/g, "/");
1904
+ return /^[a-z]:\//i.test(i) ? this.#y = `//?/${i}` : this.#y = i;
1905
+ }
1906
+ let t = this.parent, e = t.fullpathPosix(), s = e + (!e || !t.parent ? "" : "/") + this.name;
1907
+ return this.#y = s;
1908
+ }
1909
+ isUnknown() {
1910
+ return (this.#e & _) === L;
1911
+ }
1912
+ isType(t) {
1913
+ return this[`is${t}`]();
1914
+ }
1915
+ getType() {
1916
+ return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : this.isSocket() ? "Socket" : "Unknown";
1917
+ }
1918
+ isFile() {
1919
+ return (this.#e & _) === Ke;
1920
+ }
1921
+ isDirectory() {
1922
+ return (this.#e & _) === U;
1923
+ }
1924
+ isCharacterDevice() {
1925
+ return (this.#e & _) === He;
1926
+ }
1927
+ isBlockDevice() {
1928
+ return (this.#e & _) === qe;
1929
+ }
1930
+ isFIFO() {
1931
+ return (this.#e & _) === Ge;
1932
+ }
1933
+ isSocket() {
1934
+ return (this.#e & _) === Ve;
1935
+ }
1936
+ isSymbolicLink() {
1937
+ return (this.#e & X) === X;
1938
+ }
1939
+ lstatCached() {
1940
+ return this.#e & je ? this : void 0;
1941
+ }
1942
+ readlinkCached() {
1943
+ return this.#M;
1944
+ }
1945
+ realpathCached() {
1946
+ return this.#k;
1947
+ }
1948
+ readdirCached() {
1949
+ let t = this.children();
1950
+ return t.slice(0, t.provisional);
1951
+ }
1952
+ canReadlink() {
1953
+ if (this.#M) return true;
1954
+ if (!this.parent) return false;
1955
+ let t = this.#e & _;
1956
+ return !(t !== L && t !== X || this.#e & Nt || this.#e & j);
1957
+ }
1958
+ calledReaddir() {
1959
+ return !!(this.#e & se);
1960
+ }
1961
+ isENOENT() {
1962
+ return !!(this.#e & j);
1963
+ }
1964
+ isNamed(t) {
1965
+ return this.nocase ? this.#C === _t(t) : this.#C === bt(t);
1966
+ }
1967
+ async readlink() {
1968
+ let t = this.#M;
1969
+ if (t) return t;
1970
+ if (this.canReadlink() && this.parent) try {
1971
+ let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e);
1972
+ if (s) return this.#M = s;
1973
+ } catch (e) {
1974
+ this.#D(e.code);
1975
+ return;
1976
+ }
1977
+ }
1978
+ readlinkSync() {
1979
+ let t = this.#M;
1980
+ if (t) return t;
1981
+ if (this.canReadlink() && this.parent) try {
1982
+ let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e);
1983
+ if (s) return this.#M = s;
1984
+ } catch (e) {
1985
+ this.#D(e.code);
1986
+ return;
1987
+ }
1988
+ }
1989
+ #j(t) {
1990
+ this.#e |= se;
1991
+ for (let e = t.provisional; e < t.length; e++) {
1992
+ let s = t[e];
1993
+ s && s.#v();
1994
+ }
1995
+ }
1996
+ #v() {
1997
+ this.#e & j || (this.#e = (this.#e | j) & gt, this.#G());
1998
+ }
1999
+ #G() {
2000
+ let t = this.children();
2001
+ t.provisional = 0;
2002
+ for (let e of t) e.#v();
2003
+ }
2004
+ #P() {
2005
+ this.#e |= Lt, this.#L();
2006
+ }
2007
+ #L() {
2008
+ if (this.#e & yt) return;
2009
+ let t = this.#e;
2010
+ (t & _) === U && (t &= gt), this.#e = t | yt, this.#G();
2011
+ }
2012
+ #I(t = "") {
2013
+ t === "ENOTDIR" || t === "EPERM" ? this.#L() : t === "ENOENT" ? this.#v() : this.children().provisional = 0;
2014
+ }
2015
+ #F(t = "") {
2016
+ t === "ENOTDIR" ? this.parent.#L() : t === "ENOENT" && this.#v();
2017
+ }
2018
+ #D(t = "") {
2019
+ let e = this.#e;
2020
+ e |= Nt, t === "ENOENT" && (e |= j), (t === "EINVAL" || t === "UNKNOWN") && (e &= gt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#L();
2021
+ }
2022
+ #z(t, e) {
2023
+ return this.#U(t, e) || this.#B(t, e);
2024
+ }
2025
+ #B(t, e) {
2026
+ let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _;
2027
+ return r !== U && r !== X && r !== L && (i.#e |= yt), e.unshift(i), e.provisional++, i;
2028
+ }
2029
+ #U(t, e) {
2030
+ for (let s = e.provisional; s < e.length; s++) {
2031
+ let i = e[s];
2032
+ if ((this.nocase ? _t(t.name) : bt(t.name)) === i.#C) return this.#l(t, i, s, e);
2033
+ }
2034
+ }
2035
+ #l(t, e, s, i) {
2036
+ let r = e.name;
2037
+ return e.#e = e.#e & gt | ie(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e;
2038
+ }
2039
+ async lstat() {
2040
+ if ((this.#e & j) === 0) try {
2041
+ return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
2042
+ } catch (t) {
2043
+ this.#F(t.code);
2044
+ }
2045
+ }
2046
+ lstatSync() {
2047
+ if ((this.#e & j) === 0) try {
2048
+ return this.#$(this.#t.lstatSync(this.fullpath())), this;
2049
+ } catch (t) {
2050
+ this.#F(t.code);
2051
+ }
2052
+ }
2053
+ #$(t) {
2054
+ let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: o, blocks: h, ctime: a, ctimeMs: l, dev: u, gid: c, ino: d, mode: f, mtime: m, mtimeMs: p, nlink: w, rdev: g, size: S, uid: E } = t;
2055
+ this.#b = e, this.#a = s, this.#m = i, this.#E = r, this.#c = o, this.#f = h, this.#R = a, this.#d = l, this.#s = u, this.#S = c, this.#h = d, this.#n = f, this.#p = m, this.#i = p, this.#r = w, this.#w = g, this.#u = S, this.#o = E;
2056
+ let y = ie(t);
2057
+ this.#e = this.#e & gt | y | je, y !== L && y !== U && y !== X && (this.#e |= yt);
2058
+ }
2059
+ #W = [];
2060
+ #O = false;
2061
+ #H(t) {
2062
+ this.#O = false;
2063
+ let e = this.#W.slice();
2064
+ this.#W.length = 0, e.forEach((s) => s(null, t));
2065
+ }
2066
+ readdirCB(t, e = false) {
2067
+ if (!this.canReaddir()) {
2068
+ e ? t(null, []) : queueMicrotask(() => t(null, []));
2069
+ return;
2070
+ }
2071
+ let s = this.children();
2072
+ if (this.calledReaddir()) {
2073
+ let r = s.slice(0, s.provisional);
2074
+ e ? t(null, r) : queueMicrotask(() => t(null, r));
2075
+ return;
2076
+ }
2077
+ if (this.#W.push(t), this.#O) return;
2078
+ this.#O = true;
2079
+ let i = this.fullpath();
2080
+ this.#t.readdir(i, { withFileTypes: true }, (r, o) => {
2081
+ if (r) this.#I(r.code), s.provisional = 0;
2082
+ else {
2083
+ for (let h of o) this.#z(h, s);
2084
+ this.#j(s);
2085
+ }
2086
+ this.#H(s.slice(0, s.provisional));
2087
+ });
2088
+ }
2089
+ #q;
2090
+ async readdir() {
2091
+ if (!this.canReaddir()) return [];
2092
+ let t = this.children();
2093
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
2094
+ let e = this.fullpath();
2095
+ if (this.#q) await this.#q;
2096
+ else {
2097
+ let s = () => {
2098
+ };
2099
+ this.#q = new Promise((i) => s = i);
2100
+ try {
2101
+ for (let i of await this.#t.promises.readdir(e, { withFileTypes: true })) this.#z(i, t);
2102
+ this.#j(t);
2103
+ } catch (i) {
2104
+ this.#I(i.code), t.provisional = 0;
2105
+ }
2106
+ this.#q = void 0, s();
2107
+ }
2108
+ return t.slice(0, t.provisional);
2109
+ }
2110
+ readdirSync() {
2111
+ if (!this.canReaddir()) return [];
2112
+ let t = this.children();
2113
+ if (this.calledReaddir()) return t.slice(0, t.provisional);
2114
+ let e = this.fullpath();
2115
+ try {
2116
+ for (let s of this.#t.readdirSync(e, { withFileTypes: true })) this.#z(s, t);
2117
+ this.#j(t);
2118
+ } catch (s) {
2119
+ this.#I(s.code), t.provisional = 0;
2120
+ }
2121
+ return t.slice(0, t.provisional);
2122
+ }
2123
+ canReaddir() {
2124
+ if (this.#e & Ie) return false;
2125
+ let t = _ & this.#e;
2126
+ return t === L || t === U || t === X;
2127
+ }
2128
+ shouldWalk(t, e) {
2129
+ return (this.#e & U) === U && !(this.#e & Ie) && !t.has(this) && (!e || e(this));
2130
+ }
2131
+ async realpath() {
2132
+ if (this.#k) return this.#k;
2133
+ if (!((Lt | Nt | j) & this.#e)) try {
2134
+ let t = await this.#t.promises.realpath(this.fullpath());
2135
+ return this.#k = this.resolve(t);
2136
+ } catch {
2137
+ this.#P();
2138
+ }
2139
+ }
2140
+ realpathSync() {
2141
+ if (this.#k) return this.#k;
2142
+ if (!((Lt | Nt | j) & this.#e)) try {
2143
+ let t = this.#t.realpathSync(this.fullpath());
2144
+ return this.#k = this.resolve(t);
2145
+ } catch {
2146
+ this.#P();
2147
+ }
2148
+ }
2149
+ [Ye](t) {
2150
+ if (t === this) return;
2151
+ t.isCWD = false, this.isCWD = true;
2152
+ let e = /* @__PURE__ */ new Set([]), s = [], i = this;
2153
+ for (; i && i.parent; ) e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
2154
+ for (i = t; i && i.parent && !e.has(i); ) i.#x = void 0, i.#A = void 0, i = i.parent;
2155
+ }
2156
+ };
2157
+ var Pt = class n2 extends R {
2158
+ sep = "\\";
2159
+ splitSep = Oi;
2160
+ constructor(t, e = L, s, i, r, o, h) {
2161
+ super(t, e, s, i, r, o, h);
2162
+ }
2163
+ newChild(t, e = L, s = {}) {
2164
+ return new n2(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2165
+ }
2166
+ getRootString(t) {
2167
+ return re.parse(t).root;
2168
+ }
2169
+ getRoot(t) {
2170
+ if (t = Ri(t.toUpperCase()), t === this.root.name) return this.root;
2171
+ for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s;
2172
+ return this.roots[t] = new it(t, this).root;
2173
+ }
2174
+ sameRoot(t, e = this.root.name) {
2175
+ return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
2176
+ }
2177
+ };
2178
+ var jt = class n3 extends R {
2179
+ splitSep = "/";
2180
+ sep = "/";
2181
+ constructor(t, e = L, s, i, r, o, h) {
2182
+ super(t, e, s, i, r, o, h);
2183
+ }
2184
+ getRootString(t) {
2185
+ return t.startsWith("/") ? "/" : "";
2186
+ }
2187
+ getRoot(t) {
2188
+ return this.root;
2189
+ }
2190
+ newChild(t, e = L, s = {}) {
2191
+ return new n3(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2192
+ }
2193
+ };
2194
+ var It = class {
2195
+ root;
2196
+ rootPath;
2197
+ roots;
2198
+ cwd;
2199
+ #t;
2200
+ #s;
2201
+ #n;
2202
+ nocase;
2203
+ #r;
2204
+ constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: o = wt } = {}) {
2205
+ this.#r = Ue(o), (t instanceof URL || t.startsWith("file://")) && (t = gi(t));
2206
+ let h = e.resolve(t);
2207
+ this.roots = /* @__PURE__ */ Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt(), this.#s = new Wt(), this.#n = new ne(r);
2208
+ let a = h.substring(this.rootPath.length).split(s);
2209
+ if (a.length === 1 && !a[0] && a.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor");
2210
+ this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root;
2211
+ let l = this.root, u = a.length - 1, c = e.sep, d = this.rootPath, f = false;
2212
+ for (let m of a) {
2213
+ let p = u--;
2214
+ l = l.child(m, { relative: new Array(p).fill("..").join(c), relativePosix: new Array(p).fill("..").join("/"), fullpath: d += (f ? "" : c) + m }), f = true;
2215
+ }
2216
+ this.cwd = l;
2217
+ }
2218
+ depth(t = this.cwd) {
2219
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
2220
+ }
2221
+ childrenCache() {
2222
+ return this.#n;
2223
+ }
2224
+ resolve(...t) {
2225
+ let e = "";
2226
+ for (let r = t.length - 1; r >= 0; r--) {
2227
+ let o = t[r];
2228
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
2229
+ }
2230
+ let s = this.#t.get(e);
2231
+ if (s !== void 0) return s;
2232
+ let i = this.cwd.resolve(e).fullpath();
2233
+ return this.#t.set(e, i), i;
2234
+ }
2235
+ resolvePosix(...t) {
2236
+ let e = "";
2237
+ for (let r = t.length - 1; r >= 0; r--) {
2238
+ let o = t[r];
2239
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
2240
+ }
2241
+ let s = this.#s.get(e);
2242
+ if (s !== void 0) return s;
2243
+ let i = this.cwd.resolve(e).fullpathPosix();
2244
+ return this.#s.set(e, i), i;
2245
+ }
2246
+ relative(t = this.cwd) {
2247
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
2248
+ }
2249
+ relativePosix(t = this.cwd) {
2250
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
2251
+ }
2252
+ basename(t = this.cwd) {
2253
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
2254
+ }
2255
+ dirname(t = this.cwd) {
2256
+ return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
2257
+ }
2258
+ async readdir(t = this.cwd, e = { withFileTypes: true }) {
2259
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2260
+ let { withFileTypes: s } = e;
2261
+ if (t.canReaddir()) {
2262
+ let i = await t.readdir();
2263
+ return s ? i : i.map((r) => r.name);
2264
+ } else return [];
2265
+ }
2266
+ readdirSync(t = this.cwd, e = { withFileTypes: true }) {
2267
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2268
+ let { withFileTypes: s = true } = e;
2269
+ return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
2270
+ }
2271
+ async lstat(t = this.cwd) {
2272
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
2273
+ }
2274
+ lstatSync(t = this.cwd) {
2275
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
2276
+ }
2277
+ async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
2278
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2279
+ let s = await t.readlink();
2280
+ return e ? s : s?.fullpath();
2281
+ }
2282
+ readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
2283
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2284
+ let s = t.readlinkSync();
2285
+ return e ? s : s?.fullpath();
2286
+ }
2287
+ async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
2288
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2289
+ let s = await t.realpath();
2290
+ return e ? s : s?.fullpath();
2291
+ }
2292
+ realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
2293
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
2294
+ let s = t.realpathSync();
2295
+ return e ? s : s?.fullpath();
2296
+ }
2297
+ async walk(t = this.cwd, e = {}) {
2298
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2299
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = [];
2300
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
2301
+ let a = /* @__PURE__ */ new Set(), l = (c, d) => {
2302
+ a.add(c), c.readdirCB((f, m) => {
2303
+ if (f) return d(f);
2304
+ let p = m.length;
2305
+ if (!p) return d();
2306
+ let w = () => {
2307
+ --p === 0 && d();
2308
+ };
2309
+ for (let g of m) (!r || r(g)) && h.push(s ? g : g.fullpath()), i && g.isSymbolicLink() ? g.realpath().then((S) => S?.isUnknown() ? S.lstat() : S).then((S) => S?.shouldWalk(a, o) ? l(S, w) : w()) : g.shouldWalk(a, o) ? l(g, w) : w();
2310
+ }, true);
2311
+ }, u = t;
2312
+ return new Promise((c, d) => {
2313
+ l(u, (f) => {
2314
+ if (f) return d(f);
2315
+ c(h);
2316
+ });
2317
+ });
2318
+ }
2319
+ walkSync(t = this.cwd, e = {}) {
2320
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2321
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = [];
2322
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
2323
+ let a = /* @__PURE__ */ new Set([t]);
2324
+ for (let l of a) {
2325
+ let u = l.readdirSync();
2326
+ for (let c of u) {
2327
+ (!r || r(c)) && h.push(s ? c : c.fullpath());
2328
+ let d = c;
2329
+ if (c.isSymbolicLink()) {
2330
+ if (!(i && (d = c.realpathSync()))) continue;
2331
+ d.isUnknown() && d.lstatSync();
2332
+ }
2333
+ d.shouldWalk(a, o) && a.add(d);
2334
+ }
2335
+ }
2336
+ return h;
2337
+ }
2338
+ [Symbol.asyncIterator]() {
2339
+ return this.iterate();
2340
+ }
2341
+ iterate(t = this.cwd, e = {}) {
2342
+ return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
2343
+ }
2344
+ [Symbol.iterator]() {
2345
+ return this.iterateSync();
2346
+ }
2347
+ *iterateSync(t = this.cwd, e = {}) {
2348
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2349
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e;
2350
+ (!r || r(t)) && (yield s ? t : t.fullpath());
2351
+ let h = /* @__PURE__ */ new Set([t]);
2352
+ for (let a of h) {
2353
+ let l = a.readdirSync();
2354
+ for (let u of l) {
2355
+ (!r || r(u)) && (yield s ? u : u.fullpath());
2356
+ let c = u;
2357
+ if (u.isSymbolicLink()) {
2358
+ if (!(i && (c = u.realpathSync()))) continue;
2359
+ c.isUnknown() && c.lstatSync();
2360
+ }
2361
+ c.shouldWalk(h, o) && h.add(c);
2362
+ }
2363
+ }
2364
+ }
2365
+ stream(t = this.cwd, e = {}) {
2366
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2367
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = new V({ objectMode: true });
2368
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
2369
+ let a = /* @__PURE__ */ new Set(), l = [t], u = 0, c = () => {
2370
+ let d = false;
2371
+ for (; !d; ) {
2372
+ let f = l.shift();
2373
+ if (!f) {
2374
+ u === 0 && h.end();
2375
+ return;
2376
+ }
2377
+ u++, a.add(f);
2378
+ let m = (w, g, S = false) => {
2379
+ if (w) return h.emit("error", w);
2380
+ if (i && !S) {
2381
+ let E = [];
2382
+ for (let y of g) y.isSymbolicLink() && E.push(y.realpath().then((b) => b?.isUnknown() ? b.lstat() : b));
2383
+ if (E.length) {
2384
+ Promise.all(E).then(() => m(null, g, true));
2385
+ return;
2386
+ }
2387
+ }
2388
+ for (let E of g) E && (!r || r(E)) && (h.write(s ? E : E.fullpath()) || (d = true));
2389
+ u--;
2390
+ for (let E of g) {
2391
+ let y = E.realpathCached() || E;
2392
+ y.shouldWalk(a, o) && l.push(y);
2393
+ }
2394
+ d && !h.flowing ? h.once("drain", c) : p || c();
2395
+ }, p = true;
2396
+ f.readdirCB(m, true), p = false;
2397
+ }
2398
+ };
2399
+ return c(), h;
2400
+ }
2401
+ streamSync(t = this.cwd, e = {}) {
2402
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
2403
+ let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: o } = e, h = new V({ objectMode: true }), a = /* @__PURE__ */ new Set();
2404
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
2405
+ let l = [t], u = 0, c = () => {
2406
+ let d = false;
2407
+ for (; !d; ) {
2408
+ let f = l.shift();
2409
+ if (!f) {
2410
+ u === 0 && h.end();
2411
+ return;
2412
+ }
2413
+ u++, a.add(f);
2414
+ let m = f.readdirSync();
2415
+ for (let p of m) (!r || r(p)) && (h.write(s ? p : p.fullpath()) || (d = true));
2416
+ u--;
2417
+ for (let p of m) {
2418
+ let w = p;
2419
+ if (p.isSymbolicLink()) {
2420
+ if (!(i && (w = p.realpathSync()))) continue;
2421
+ w.isUnknown() && w.lstatSync();
2422
+ }
2423
+ w.shouldWalk(a, o) && l.push(w);
2424
+ }
2425
+ }
2426
+ d && !h.flowing && h.once("drain", c);
2427
+ };
2428
+ return c(), h;
2429
+ }
2430
+ chdir(t = this.cwd) {
2431
+ let e = this.cwd;
2432
+ this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye](e);
2433
+ }
2434
+ };
2435
+ var it = class extends It {
2436
+ sep = "\\";
2437
+ constructor(t = process.cwd(), e = {}) {
2438
+ let { nocase: s = true } = e;
2439
+ super(t, re, "\\", { ...e, nocase: s }), this.nocase = s;
2440
+ for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase;
2441
+ }
2442
+ parseRootPath(t) {
2443
+ return re.parse(t).root.toUpperCase();
2444
+ }
2445
+ newRoot(t) {
2446
+ return new Pt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
2447
+ }
2448
+ isAbsolute(t) {
2449
+ return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
2450
+ }
2451
+ };
2452
+ var rt = class extends It {
2453
+ sep = "/";
2454
+ constructor(t = process.cwd(), e = {}) {
2455
+ let { nocase: s = false } = e;
2456
+ super(t, mi, "/", { ...e, nocase: s }), this.nocase = s;
2457
+ }
2458
+ parseRootPath(t) {
2459
+ return "/";
2460
+ }
2461
+ newRoot(t) {
2462
+ return new jt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
2463
+ }
2464
+ isAbsolute(t) {
2465
+ return t.startsWith("/");
2466
+ }
2467
+ };
2468
+ var St = class extends rt {
2469
+ constructor(t = process.cwd(), e = {}) {
2470
+ let { nocase: s = true } = e;
2471
+ super(t, { ...e, nocase: s });
2472
+ }
2473
+ };
2474
+ var Cr = process.platform === "win32" ? Pt : jt;
2475
+ var Xe = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
2476
+ var Di = (n7) => n7.length >= 1;
2477
+ var Mi = (n7) => n7.length >= 1;
2478
+ var Ni = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
2479
+ var nt = class n4 {
2480
+ #t;
2481
+ #s;
2482
+ #n;
2483
+ length;
2484
+ #r;
2485
+ #o;
2486
+ #S;
2487
+ #w;
2488
+ #c;
2489
+ #h;
2490
+ #u = true;
2491
+ constructor(t, e, s, i) {
2492
+ if (!Di(t)) throw new TypeError("empty pattern list");
2493
+ if (!Mi(e)) throw new TypeError("empty glob list");
2494
+ if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths");
2495
+ if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range");
2496
+ if (this.#t = t, this.#s = e, this.#n = s, this.#r = i, this.#n === 0) {
2497
+ if (this.isUNC()) {
2498
+ let [r, o, h, a, ...l] = this.#t, [u, c, d, f, ...m] = this.#s;
2499
+ l[0] === "" && (l.shift(), m.shift());
2500
+ let p = [r, o, h, a, ""].join("/"), w = [u, c, d, f, ""].join("/");
2501
+ this.#t = [p, ...l], this.#s = [w, ...m], this.length = this.#t.length;
2502
+ } else if (this.isDrive() || this.isAbsolute()) {
2503
+ let [r, ...o] = this.#t, [h, ...a] = this.#s;
2504
+ o[0] === "" && (o.shift(), a.shift());
2505
+ let l = r + "/", u = h + "/";
2506
+ this.#t = [l, ...o], this.#s = [u, ...a], this.length = this.#t.length;
2507
+ }
2508
+ }
2509
+ }
2510
+ [Ni]() {
2511
+ return "Pattern <" + this.#s.slice(this.#n).join("/") + ">";
2512
+ }
2513
+ pattern() {
2514
+ return this.#t[this.#n];
2515
+ }
2516
+ isString() {
2517
+ return typeof this.#t[this.#n] == "string";
2518
+ }
2519
+ isGlobstar() {
2520
+ return this.#t[this.#n] === A;
2521
+ }
2522
+ isRegExp() {
2523
+ return this.#t[this.#n] instanceof RegExp;
2524
+ }
2525
+ globString() {
2526
+ return this.#S = this.#S || (this.#n === 0 ? this.isAbsolute() ? this.#s[0] + this.#s.slice(1).join("/") : this.#s.join("/") : this.#s.slice(this.#n).join("/"));
2527
+ }
2528
+ hasMore() {
2529
+ return this.length > this.#n + 1;
2530
+ }
2531
+ rest() {
2532
+ return this.#o !== void 0 ? this.#o : this.hasMore() ? (this.#o = new n4(this.#t, this.#s, this.#n + 1, this.#r), this.#o.#h = this.#h, this.#o.#c = this.#c, this.#o.#w = this.#w, this.#o) : this.#o = null;
2533
+ }
2534
+ isUNC() {
2535
+ let t = this.#t;
2536
+ return this.#c !== void 0 ? this.#c : this.#c = this.#r === "win32" && this.#n === 0 && t[0] === "" && t[1] === "" && typeof t[2] == "string" && !!t[2] && typeof t[3] == "string" && !!t[3];
2537
+ }
2538
+ isDrive() {
2539
+ let t = this.#t;
2540
+ return this.#w !== void 0 ? this.#w : this.#w = this.#r === "win32" && this.#n === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]);
2541
+ }
2542
+ isAbsolute() {
2543
+ let t = this.#t;
2544
+ return this.#h !== void 0 ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
2545
+ }
2546
+ root() {
2547
+ let t = this.#t[0];
2548
+ return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
2549
+ }
2550
+ checkFollowGlobstar() {
2551
+ return !(this.#n === 0 || !this.isGlobstar() || !this.#u);
2552
+ }
2553
+ markFollowGlobstar() {
2554
+ return this.#n === 0 || !this.isGlobstar() || !this.#u ? false : (this.#u = false, true);
2555
+ }
2556
+ };
2557
+ var _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
2558
+ var ot = class {
2559
+ relative;
2560
+ relativeChildren;
2561
+ absolute;
2562
+ absoluteChildren;
2563
+ platform;
2564
+ mmopts;
2565
+ constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: o = _i }) {
2566
+ this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = o, this.mmopts = { dot: true, nobrace: e, nocase: s, noext: i, noglobstar: r, optimizationLevel: 2, platform: o, nocomment: true, nonegate: true };
2567
+ for (let h of t) this.add(h);
2568
+ }
2569
+ add(t) {
2570
+ let e = new D(t, this.mmopts);
2571
+ for (let s = 0; s < e.set.length; s++) {
2572
+ let i = e.set[s], r = e.globParts[s];
2573
+ if (!i || !r) throw new Error("invalid pattern object");
2574
+ for (; i[0] === "." && r[0] === "."; ) i.shift(), r.shift();
2575
+ let o = new nt(i, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
2576
+ l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
2577
+ }
2578
+ }
2579
+ ignored(t) {
2580
+ let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
2581
+ for (let o of this.relative) if (o.match(i) || o.match(r)) return true;
2582
+ for (let o of this.absolute) if (o.match(e) || o.match(s)) return true;
2583
+ return false;
2584
+ }
2585
+ childrenIgnored(t) {
2586
+ let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
2587
+ for (let i of this.relativeChildren) if (i.match(s)) return true;
2588
+ for (let i of this.absoluteChildren) if (i.match(e)) return true;
2589
+ return false;
2590
+ }
2591
+ };
2592
+ var oe = class n5 {
2593
+ store;
2594
+ constructor(t = /* @__PURE__ */ new Map()) {
2595
+ this.store = t;
2596
+ }
2597
+ copy() {
2598
+ return new n5(new Map(this.store));
2599
+ }
2600
+ hasWalked(t, e) {
2601
+ return this.store.get(t.fullpath())?.has(e.globString());
2602
+ }
2603
+ storeWalked(t, e) {
2604
+ let s = t.fullpath(), i = this.store.get(s);
2605
+ i ? i.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()]));
2606
+ }
2607
+ };
2608
+ var he = class {
2609
+ store = /* @__PURE__ */ new Map();
2610
+ add(t, e, s) {
2611
+ let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
2612
+ this.store.set(t, r === void 0 ? i : i & r);
2613
+ }
2614
+ entries() {
2615
+ return [...this.store.entries()].map(([t, e]) => [t, !!(e & 2), !!(e & 1)]);
2616
+ }
2617
+ };
2618
+ var ae = class {
2619
+ store = /* @__PURE__ */ new Map();
2620
+ add(t, e) {
2621
+ if (!t.canReaddir()) return;
2622
+ let s = this.store.get(t);
2623
+ s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
2624
+ }
2625
+ get(t) {
2626
+ let e = this.store.get(t);
2627
+ if (!e) throw new Error("attempting to walk unknown path");
2628
+ return e;
2629
+ }
2630
+ entries() {
2631
+ return this.keys().map((t) => [t, this.store.get(t)]);
2632
+ }
2633
+ keys() {
2634
+ return [...this.store.keys()].filter((t) => t.canReaddir());
2635
+ }
2636
+ };
2637
+ var Et = class n6 {
2638
+ hasWalkedCache;
2639
+ matches = new he();
2640
+ subwalks = new ae();
2641
+ patterns;
2642
+ follow;
2643
+ dot;
2644
+ opts;
2645
+ constructor(t, e) {
2646
+ this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe();
2647
+ }
2648
+ processPatterns(t, e) {
2649
+ this.patterns = e;
2650
+ let s = e.map((i) => [t, i]);
2651
+ for (let [i, r] of s) {
2652
+ this.hasWalkedCache.storeWalked(i, r);
2653
+ let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== false;
2654
+ if (o) {
2655
+ i = i.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
2656
+ let c = r.rest();
2657
+ if (c) r = c;
2658
+ else {
2659
+ this.matches.add(i, true, false);
2660
+ continue;
2661
+ }
2662
+ }
2663
+ if (i.isENOENT()) continue;
2664
+ let a, l, u = false;
2665
+ for (; typeof (a = r.pattern()) == "string" && (l = r.rest()); ) i = i.resolve(a), r = l, u = true;
2666
+ if (a = r.pattern(), l = r.rest(), u) {
2667
+ if (this.hasWalkedCache.hasWalked(i, r)) continue;
2668
+ this.hasWalkedCache.storeWalked(i, r);
2669
+ }
2670
+ if (typeof a == "string") {
2671
+ let c = a === ".." || a === "" || a === ".";
2672
+ this.matches.add(i.resolve(a), h, c);
2673
+ continue;
2674
+ } else if (a === A) {
2675
+ (!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
2676
+ let c = l?.pattern(), d = l?.rest();
2677
+ if (!l || (c === "" || c === ".") && !d) this.matches.add(i, h, c === "" || c === ".");
2678
+ else if (c === "..") {
2679
+ let f = i.parent || i;
2680
+ d ? this.hasWalkedCache.hasWalked(f, d) || this.subwalks.add(f, d) : this.matches.add(f, h, true);
2681
+ }
2682
+ } else a instanceof RegExp && this.subwalks.add(i, r);
2683
+ }
2684
+ return this;
2685
+ }
2686
+ subwalkTargets() {
2687
+ return this.subwalks.keys();
2688
+ }
2689
+ child() {
2690
+ return new n6(this.opts, this.hasWalkedCache);
2691
+ }
2692
+ filterEntries(t, e) {
2693
+ let s = this.subwalks.get(t), i = this.child();
2694
+ for (let r of e) for (let o of s) {
2695
+ let h = o.isAbsolute(), a = o.pattern(), l = o.rest();
2696
+ a === A ? i.testGlobstar(r, o, l, h) : a instanceof RegExp ? i.testRegExp(r, a, l, h) : i.testString(r, a, l, h);
2697
+ }
2698
+ return i;
2699
+ }
2700
+ testGlobstar(t, e, s, i) {
2701
+ if ((this.dot || !t.name.startsWith(".")) && (e.hasMore() || this.matches.add(t, i, false), t.canReaddir() && (this.follow || !t.isSymbolicLink() ? this.subwalks.add(t, e) : t.isSymbolicLink() && (s && e.checkFollowGlobstar() ? this.subwalks.add(t, s) : e.markFollowGlobstar() && this.subwalks.add(t, e)))), s) {
2702
+ let r = s.pattern();
2703
+ if (typeof r == "string" && r !== ".." && r !== "" && r !== ".") this.testString(t, r, s.rest(), i);
2704
+ else if (r === "..") {
2705
+ let o = t.parent || t;
2706
+ this.subwalks.add(o, s);
2707
+ } else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
2708
+ }
2709
+ }
2710
+ testRegExp(t, e, s, i) {
2711
+ e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false));
2712
+ }
2713
+ testString(t, e, s, i) {
2714
+ t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false));
2715
+ }
2716
+ };
2717
+ var Li = (n7, t) => typeof n7 == "string" ? new ot([n7], t) : Array.isArray(n7) ? new ot(n7, t) : n7;
2718
+ var zt = class {
2719
+ path;
2720
+ patterns;
2721
+ opts;
2722
+ seen = /* @__PURE__ */ new Set();
2723
+ paused = false;
2724
+ aborted = false;
2725
+ #t = [];
2726
+ #s;
2727
+ #n;
2728
+ signal;
2729
+ maxDepth;
2730
+ includeChildMatches;
2731
+ constructor(t, e, s) {
2732
+ if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== false, (s.ignore || !this.includeChildMatches) && (this.#s = Li(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#s.add != "function")) {
2733
+ let i = "cannot ignore child matches, ignore lacks add() method.";
2734
+ throw new Error(i);
2735
+ }
2736
+ this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
2737
+ this.#t.length = 0;
2738
+ }));
2739
+ }
2740
+ #r(t) {
2741
+ return this.seen.has(t) || !!this.#s?.ignored?.(t);
2742
+ }
2743
+ #o(t) {
2744
+ return !!this.#s?.childrenIgnored?.(t);
2745
+ }
2746
+ pause() {
2747
+ this.paused = true;
2748
+ }
2749
+ resume() {
2750
+ if (this.signal?.aborted) return;
2751
+ this.paused = false;
2752
+ let t;
2753
+ for (; !this.paused && (t = this.#t.shift()); ) t();
2754
+ }
2755
+ onResume(t) {
2756
+ this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
2757
+ }
2758
+ async matchCheck(t, e) {
2759
+ if (e && this.opts.nodir) return;
2760
+ let s;
2761
+ if (this.opts.realpath) {
2762
+ if (s = t.realpathCached() || await t.realpath(), !s) return;
2763
+ t = s;
2764
+ }
2765
+ let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
2766
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
2767
+ let o = await r.realpath();
2768
+ o && (o.isUnknown() || this.opts.stat) && await o.lstat();
2769
+ }
2770
+ return this.matchCheckTest(r, e);
2771
+ }
2772
+ matchCheckTest(t, e) {
2773
+ return t && (this.maxDepth === 1 / 0 || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#r(t) ? t : void 0;
2774
+ }
2775
+ matchCheckSync(t, e) {
2776
+ if (e && this.opts.nodir) return;
2777
+ let s;
2778
+ if (this.opts.realpath) {
2779
+ if (s = t.realpathCached() || t.realpathSync(), !s) return;
2780
+ t = s;
2781
+ }
2782
+ let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
2783
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
2784
+ let o = r.realpathSync();
2785
+ o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
2786
+ }
2787
+ return this.matchCheckTest(r, e);
2788
+ }
2789
+ matchFinish(t, e) {
2790
+ if (this.#r(t)) return;
2791
+ if (!this.includeChildMatches && this.#s?.add) {
2792
+ let r = `${t.relativePosix()}/**`;
2793
+ this.#s.add(r);
2794
+ }
2795
+ let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
2796
+ this.seen.add(t);
2797
+ let i = this.opts.mark && t.isDirectory() ? this.#n : "";
2798
+ if (this.opts.withFileTypes) this.matchEmit(t);
2799
+ else if (s) {
2800
+ let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
2801
+ this.matchEmit(r + i);
2802
+ } else {
2803
+ let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
2804
+ this.matchEmit(r ? o + r + i : "." + i);
2805
+ }
2806
+ }
2807
+ async match(t, e, s) {
2808
+ let i = await this.matchCheck(t, s);
2809
+ i && this.matchFinish(i, e);
2810
+ }
2811
+ matchSync(t, e, s) {
2812
+ let i = this.matchCheckSync(t, s);
2813
+ i && this.matchFinish(i, e);
2814
+ }
2815
+ walkCB(t, e, s) {
2816
+ this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
2817
+ }
2818
+ walkCB2(t, e, s, i) {
2819
+ if (this.#o(t)) return i();
2820
+ if (this.signal?.aborted && i(), this.paused) {
2821
+ this.onResume(() => this.walkCB2(t, e, s, i));
2822
+ return;
2823
+ }
2824
+ s.processPatterns(t, e);
2825
+ let r = 1, o = () => {
2826
+ --r === 0 && i();
2827
+ };
2828
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
2829
+ for (let h of s.subwalkTargets()) {
2830
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
2831
+ r++;
2832
+ let a = h.readdirCached();
2833
+ h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, u) => this.walkCB3(h, u, s, o), true);
2834
+ }
2835
+ o();
2836
+ }
2837
+ walkCB3(t, e, s, i) {
2838
+ s = s.filterEntries(t, e);
2839
+ let r = 1, o = () => {
2840
+ --r === 0 && i();
2841
+ };
2842
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
2843
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2(h, a, s.child(), o);
2844
+ o();
2845
+ }
2846
+ walkCBSync(t, e, s) {
2847
+ this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
2848
+ }
2849
+ walkCB2Sync(t, e, s, i) {
2850
+ if (this.#o(t)) return i();
2851
+ if (this.signal?.aborted && i(), this.paused) {
2852
+ this.onResume(() => this.walkCB2Sync(t, e, s, i));
2853
+ return;
2854
+ }
2855
+ s.processPatterns(t, e);
2856
+ let r = 1, o = () => {
2857
+ --r === 0 && i();
2858
+ };
2859
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
2860
+ for (let h of s.subwalkTargets()) {
2861
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
2862
+ r++;
2863
+ let a = h.readdirSync();
2864
+ this.walkCB3Sync(h, a, s, o);
2865
+ }
2866
+ o();
2867
+ }
2868
+ walkCB3Sync(t, e, s, i) {
2869
+ s = s.filterEntries(t, e);
2870
+ let r = 1, o = () => {
2871
+ --r === 0 && i();
2872
+ };
2873
+ for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
2874
+ for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
2875
+ o();
2876
+ }
2877
+ };
2878
+ var xt = class extends zt {
2879
+ matches = /* @__PURE__ */ new Set();
2880
+ constructor(t, e, s) {
2881
+ super(t, e, s);
2882
+ }
2883
+ matchEmit(t) {
2884
+ this.matches.add(t);
2885
+ }
2886
+ async walk() {
2887
+ if (this.signal?.aborted) throw this.signal.reason;
2888
+ return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
2889
+ this.walkCB(this.path, this.patterns, () => {
2890
+ this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
2891
+ });
2892
+ }), this.matches;
2893
+ }
2894
+ walkSync() {
2895
+ if (this.signal?.aborted) throw this.signal.reason;
2896
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
2897
+ if (this.signal?.aborted) throw this.signal.reason;
2898
+ }), this.matches;
2899
+ }
2900
+ };
2901
+ var vt = class extends zt {
2902
+ results;
2903
+ constructor(t, e, s) {
2904
+ super(t, e, s), this.results = new V({ signal: this.signal, objectMode: true }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
2905
+ }
2906
+ matchEmit(t) {
2907
+ this.results.write(t), this.results.flowing || this.pause();
2908
+ }
2909
+ stream() {
2910
+ let t = this.path;
2911
+ return t.isUnknown() ? t.lstat().then(() => {
2912
+ this.walkCB(t, this.patterns, () => this.results.end());
2913
+ }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
2914
+ }
2915
+ streamSync() {
2916
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
2917
+ }
2918
+ };
2919
+ var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
2920
+ var I = class {
2921
+ absolute;
2922
+ cwd;
2923
+ root;
2924
+ dot;
2925
+ dotRelative;
2926
+ follow;
2927
+ ignore;
2928
+ magicalBraces;
2929
+ mark;
2930
+ matchBase;
2931
+ maxDepth;
2932
+ nobrace;
2933
+ nocase;
2934
+ nodir;
2935
+ noext;
2936
+ noglobstar;
2937
+ pattern;
2938
+ platform;
2939
+ realpath;
2940
+ scurry;
2941
+ stat;
2942
+ signal;
2943
+ windowsPathsNoEscape;
2944
+ withFileTypes;
2945
+ includeChildMatches;
2946
+ opts;
2947
+ patterns;
2948
+ constructor(t, e) {
2949
+ if (!e) throw new TypeError("glob options required");
2950
+ if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = Wi(e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace, this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== false, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : 1 / 0, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true");
2951
+ if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === false, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
2952
+ if (e.noglobstar) throw new TypeError("base matching requires globstar");
2953
+ t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
2954
+ }
2955
+ if (this.pattern = t, this.platform = e.platform || Pi, this.opts = { ...e, platform: this.platform }, e.scurry) {
2956
+ if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
2957
+ } else {
2958
+ let a = e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe;
2959
+ this.scurry = new a(this.cwd, { nocase: e.nocase, fs: e.fs });
2960
+ }
2961
+ this.nocase = this.scurry.nocase;
2962
+ let s = this.platform === "darwin" || this.platform === "win32", i = { braceExpandMax: 1e4, ...e, dot: this.dot, matchBase: this.matchBase, nobrace: this.nobrace, nocase: this.nocase, nocaseMagicOnly: s, nocomment: true, noext: this.noext, nonegate: true, optimizationLevel: 2, platform: this.platform, windowsPathsNoEscape: this.windowsPathsNoEscape, debug: !!this.opts.debug }, r = this.pattern.map((a) => new D(a, i)), [o, h] = r.reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
2963
+ this.patterns = o.map((a, l) => {
2964
+ let u = h[l];
2965
+ if (!u) throw new Error("invalid pattern object");
2966
+ return new nt(a, u, 0, this.platform);
2967
+ });
2968
+ }
2969
+ async walk() {
2970
+ return [...await new xt(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walk()];
2971
+ }
2972
+ walkSync() {
2973
+ return [...new xt(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walkSync()];
2974
+ }
2975
+ stream() {
2976
+ return new vt(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).stream();
2977
+ }
2978
+ streamSync() {
2979
+ return new vt(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).streamSync();
2980
+ }
2981
+ iterateSync() {
2982
+ return this.streamSync()[Symbol.iterator]();
2983
+ }
2984
+ [Symbol.iterator]() {
2985
+ return this.iterateSync();
2986
+ }
2987
+ iterate() {
2988
+ return this.stream()[Symbol.asyncIterator]();
2989
+ }
2990
+ [Symbol.asyncIterator]() {
2991
+ return this.iterate();
2992
+ }
2993
+ };
2994
+ var le = (n7, t = {}) => {
2995
+ Array.isArray(n7) || (n7 = [n7]);
2996
+ for (let e of n7) if (new D(e, t).hasMagic()) return true;
2997
+ return false;
2998
+ };
2999
+ function Bt(n7, t = {}) {
3000
+ return new I(n7, t).streamSync();
3001
+ }
3002
+ function Qe(n7, t = {}) {
3003
+ return new I(n7, t).stream();
3004
+ }
3005
+ function ts(n7, t = {}) {
3006
+ return new I(n7, t).walkSync();
3007
+ }
3008
+ async function Je(n7, t = {}) {
3009
+ return new I(n7, t).walk();
3010
+ }
3011
+ function Ut(n7, t = {}) {
3012
+ return new I(n7, t).iterateSync();
3013
+ }
3014
+ function es(n7, t = {}) {
3015
+ return new I(n7, t).iterate();
3016
+ }
3017
+ var ji = Bt;
3018
+ var Ii = Object.assign(Qe, { sync: Bt });
3019
+ var zi = Ut;
3020
+ var Bi = Object.assign(es, { sync: Ut });
3021
+ var Ui = Object.assign(ts, { stream: Bt, iterate: Ut });
3022
+ var Ze = Object.assign(Je, { glob: Je, globSync: ts, sync: Ui, globStream: Qe, stream: Ii, globStreamSync: Bt, streamSync: ji, globIterate: es, iterate: Bi, globIterateSync: Ut, iterateSync: zi, Glob: I, hasMagic: le, escape: tt, unescape: W });
3023
+ Ze.glob = Ze;
3024
+
3025
+ // src/utils/miscellaneous.ts
3026
+ import * as fs2 from "node:fs";
3027
+ import { basename, dirname, extname, join, resolve, relative } from "node:path";
3028
+ import * as process2 from "node:process";
3029
+ import { performance as performance2 } from "perf_hooks";
3030
+
3031
+ // src/types.ts
3032
+ var outputExtensions = ["json", "yaml", "yml"];
3033
+
3034
+ // src/utils/miscellaneous.ts
3035
+ async function getFallbackApisOrExit(argsApis, config) {
3036
+ const shouldFallbackToAllDefinitions = !isNotEmptyArray(argsApis) && isNotEmptyObject(config.resolvedConfig.apis);
3037
+ const res = shouldFallbackToAllDefinitions ? fallbackToAllDefinitions(config) : await expandGlobsInEntrypoints(argsApis, config);
3038
+ const filteredInvalidEntrypoints = res.filter(({ path }) => !isApiPathValid(path));
3039
+ if (isNotEmptyArray(filteredInvalidEntrypoints)) {
3040
+ for (const { path } of filteredInvalidEntrypoints) {
3041
+ logger.warn(`
3042
+ ${formatPath(path)} ${red(`does not exist or is invalid.
3043
+
3044
+ `)}`);
3045
+ }
3046
+ exitWithError("Please provide a valid path.");
3047
+ }
3048
+ if (res.length === 0) {
3049
+ exitWithError(
3050
+ "No APIs were provided. Specify an API via the command argument or define one in your config."
3051
+ );
3052
+ }
3053
+ return res;
3054
+ }
3055
+ function getConfigDirectory(config) {
3056
+ return config.configPath ? dirname(config.configPath) : process2.cwd();
3057
+ }
3058
+ function isApiPathValid(apiPath) {
3059
+ if (!apiPath.trim()) {
3060
+ exitWithError("Path cannot be empty.");
3061
+ return;
3062
+ }
3063
+ return fs2.existsSync(apiPath) || isAbsoluteUrl(apiPath) ? apiPath : void 0;
3064
+ }
3065
+ function fallbackToAllDefinitions(config) {
3066
+ return Object.entries(config.resolvedConfig.apis || {}).map(([alias, { root, output }]) => ({
3067
+ path: isAbsoluteUrl(root) ? root : resolve(getConfigDirectory(config), root),
3068
+ alias,
3069
+ output: output && resolve(getConfigDirectory(config), output)
3070
+ }));
3071
+ }
3072
+ function getAliasOrPath(config, aliasOrPath) {
3073
+ const configDir = getConfigDirectory(config);
3074
+ const aliasApi = config.resolvedConfig.apis?.[aliasOrPath];
3075
+ return aliasApi ? {
3076
+ path: isAbsoluteUrl(aliasApi.root) ? aliasApi.root : resolve(configDir, aliasApi.root),
3077
+ alias: aliasOrPath,
3078
+ output: aliasApi.output && resolve(configDir, aliasApi.output)
3079
+ } : {
3080
+ path: aliasOrPath,
3081
+ // find alias by path, take the first match
3082
+ alias: Object.entries(config.resolvedConfig.apis || {}).find(([_alias, api]) => {
3083
+ return resolve(configDir, api.root) === resolve(aliasOrPath);
3084
+ })?.[0] ?? void 0
3085
+ };
3086
+ }
3087
+ async function expandGlobsInEntrypoints(argApis, config) {
3088
+ return (await Promise.all(
3089
+ argApis.map(async (aliasOrPath) => {
3090
+ const shouldResolveGlob = le(aliasOrPath) && !isAbsoluteUrl(aliasOrPath);
3091
+ if (shouldResolveGlob) {
3092
+ const data = await Ze(aliasOrPath, {
3093
+ cwd: getConfigDirectory(config)
3094
+ });
3095
+ return data.map((g) => getAliasOrPath(config, g));
3096
+ }
3097
+ return getAliasOrPath(config, aliasOrPath);
3098
+ })
3099
+ )).flat();
3100
+ }
3101
+ function getExecutionTime(startedAt) {
3102
+ return process2.env.NODE_ENV === "test" ? "<test>ms" : `${Math.ceil(performance2.now() - startedAt)}ms`;
3103
+ }
3104
+ function printExecutionTime(commandName, startedAt, api) {
3105
+ const elapsed = getExecutionTime(startedAt);
3106
+ logger.info(gray(`
3107
+ ${api}: ${commandName} processed in ${elapsed}
3108
+
3109
+ `));
3110
+ }
3111
+ function pathToFilename(path, pathSeparator) {
3112
+ if (path === "/") {
3113
+ return pathSeparator;
3114
+ }
3115
+ return path.replaceAll("~1", "/").replaceAll("~0", "~").replace(/^\//, "").replaceAll("/", pathSeparator);
3116
+ }
3117
+ function escapeLanguageName(lang) {
3118
+ return lang.replace(/#/g, "_sharp").replace(/\//, "_").replace(/\s/g, "");
3119
+ }
3120
+ function langToExt(lang) {
3121
+ const langObj = {
3122
+ php: ".php",
3123
+ "c#": ".cs",
3124
+ shell: ".sh",
3125
+ curl: ".sh",
3126
+ bash: ".sh",
3127
+ javascript: ".js",
3128
+ js: ".js",
3129
+ python: ".py",
3130
+ c: ".c",
3131
+ "c++": ".cpp",
3132
+ coffeescript: ".litcoffee",
3133
+ dart: ".dart",
3134
+ elixir: ".ex",
3135
+ go: ".go",
3136
+ groovy: ".groovy",
3137
+ java: ".java",
3138
+ kotlin: ".kt",
3139
+ "objective-c": ".m",
3140
+ perl: ".pl",
3141
+ powershell: ".ps1",
3142
+ ruby: ".rb",
3143
+ rust: ".rs",
3144
+ scala: ".sc",
3145
+ swift: ".swift",
3146
+ typescript: ".ts",
3147
+ tsx: ".tsx",
3148
+ "visual basic": ".vb",
3149
+ "c/al": ".al"
3150
+ };
3151
+ return langObj[lang.toLowerCase()] ?? "";
3152
+ }
3153
+ var CircularJSONNotSupportedError = class _CircularJSONNotSupportedError extends Error {
3154
+ constructor(originalError) {
3155
+ super(originalError.message);
3156
+ this.originalError = originalError;
3157
+ Object.setPrototypeOf(this, _CircularJSONNotSupportedError.prototype);
3158
+ }
3159
+ originalError;
3160
+ };
3161
+ function dumpBundle(obj, format, dereference) {
3162
+ if (format === "json") {
3163
+ try {
3164
+ return JSON.stringify(obj, null, 2);
3165
+ } catch (e) {
3166
+ if (e.message.indexOf("circular") > -1) {
3167
+ throw new CircularJSONNotSupportedError(e);
3168
+ }
3169
+ throw e;
3170
+ }
3171
+ } else {
3172
+ return stringifyYaml(obj, {
3173
+ noRefs: !dereference,
3174
+ lineWidth: -1
3175
+ });
3176
+ }
3177
+ }
3178
+ function saveBundle(filename, output) {
3179
+ fs2.mkdirSync(dirname(filename), { recursive: true });
3180
+ fs2.writeFileSync(filename, output);
3181
+ }
3182
+ function readYaml(filename) {
3183
+ return parseYaml(fs2.readFileSync(filename, "utf-8"), { filename });
3184
+ }
3185
+ function writeToFileByExtension(data, filePath, noRefs) {
3186
+ const ext = getAndValidateFileExtension(filePath);
3187
+ if (ext === "json") {
3188
+ writeJson(data, filePath);
3189
+ return;
3190
+ }
3191
+ writeYaml(data, filePath, noRefs);
3192
+ }
3193
+ function writeYaml(data, filename, noRefs = false) {
3194
+ const content = stringifyYaml(data, { noRefs });
3195
+ if (process2.env.NODE_ENV === "test") {
3196
+ logger.info(content);
3197
+ return;
3198
+ }
3199
+ fs2.mkdirSync(dirname(filename), { recursive: true });
3200
+ fs2.writeFileSync(filename, content);
3201
+ }
3202
+ function writeJson(data, filename) {
3203
+ const content = JSON.stringify(data, null, 2);
3204
+ if (process2.env.NODE_ENV === "test") {
3205
+ logger.info(content);
3206
+ return;
3207
+ }
3208
+ fs2.mkdirSync(dirname(filename), { recursive: true });
3209
+ fs2.writeFileSync(filename, content);
3210
+ }
3211
+ function getAndValidateFileExtension(fileName) {
3212
+ const ext = fileName.split(".").pop();
3213
+ if (outputExtensions.includes(ext)) {
3214
+ return ext;
3215
+ }
3216
+ logger.warn(`Unsupported file extension: ${ext}. Using yaml.
3217
+ `);
3218
+ return "yaml";
3219
+ }
3220
+ function handleError(e, ref) {
3221
+ switch (e.constructor) {
3222
+ case HandledError: {
3223
+ throw e;
3224
+ }
3225
+ case ResolveError:
3226
+ exitWithError(`Failed to resolve API description at ${ref}:
3227
+
3228
+ - ${e.message}`);
3229
+ break;
3230
+ case YamlParseError:
3231
+ exitWithError(`Failed to parse API description at ${ref}:
3232
+
3233
+ - ${e.message}`);
3234
+ break;
3235
+ case CircularJSONNotSupportedError: {
3236
+ exitWithError(
3237
+ `Detected circular reference which can't be converted to JSON.
3238
+ Try to use ${blue("yaml")} output or remove ${blue("--dereferenced")}.`
3239
+ );
3240
+ break;
3241
+ }
3242
+ case SyntaxError:
3243
+ exitWithError(`Syntax error: ${e.message} ${e.stack?.split("\n\n")?.[0]}`);
3244
+ break;
3245
+ case ConfigValidationError:
3246
+ exitWithError(e.message);
3247
+ break;
3248
+ default: {
3249
+ exitWithError(`Something went wrong when processing ${ref}:
3250
+
3251
+ - ${e.message}`);
3252
+ }
3253
+ }
3254
+ }
3255
+ function printLintTotals(totals, definitionsCount) {
3256
+ const ignored = totals.ignored ? yellow(`${totals.ignored} ${pluralize("problem is", totals.ignored)} explicitly ignored.
3257
+
3258
+ `) : "";
3259
+ if (totals.errors > 0) {
3260
+ logger.error(
3261
+ `\u274C Validation failed with ${totals.errors} ${pluralize("error", totals.errors)}${totals.warnings > 0 ? ` and ${totals.warnings} ${pluralize("warning", totals.warnings)}` : ""}.
3262
+ ${ignored}`
3263
+ );
3264
+ } else if (totals.warnings > 0) {
3265
+ logger.info(
3266
+ green(`Woohoo! Your API ${pluralize("description is", definitionsCount)} valid. \u{1F389}
3267
+ `)
3268
+ );
3269
+ logger.warn(
3270
+ `You have ${totals.warnings} ${pluralize("warning", totals.warnings)}.
3271
+ ${ignored}`
3272
+ );
3273
+ } else {
3274
+ logger.info(
3275
+ green(
3276
+ `Woohoo! Your API ${pluralize("description is", definitionsCount)} valid. \u{1F389}
3277
+ ${ignored}`
3278
+ )
3279
+ );
3280
+ }
3281
+ if (totals.errors > 0) {
3282
+ logger.info(
3283
+ gray(`run \`redocly lint --generate-ignore-file\` to add all problems to the ignore file.
3284
+ `)
3285
+ );
3286
+ }
3287
+ logger.info("\n");
3288
+ }
3289
+ function printConfigLintTotals(totals, command) {
3290
+ if (totals.errors > 0) {
3291
+ logger.error(`\u274C Your config has ${totals.errors} ${pluralize("error", totals.errors)}.
3292
+ `);
3293
+ } else if (totals.warnings > 0) {
3294
+ logger.warn(
3295
+ `\u26A0\uFE0F Your config has ${totals.warnings} ${pluralize("warning", totals.warnings)}.
3296
+ `
3297
+ );
3298
+ } else if (command === "check-config") {
3299
+ logger.info(green("\u2705 Your config is valid.\n"));
3300
+ }
3301
+ }
3302
+ function getOutputFileName({
3303
+ entrypoint,
3304
+ output,
3305
+ argvOutput,
3306
+ ext,
3307
+ entries
3308
+ }) {
3309
+ let outputFile = output || argvOutput;
3310
+ if (!outputFile) {
3311
+ return { ext: ext || "yaml" };
3312
+ }
3313
+ if (entries > 1 && argvOutput) {
3314
+ ext = ext || extname(entrypoint).substring(1);
3315
+ if (!outputExtensions.includes(ext)) {
3316
+ throw new Error(`Invalid file extension: ${ext}.`);
3317
+ }
3318
+ outputFile = join(argvOutput, basename(entrypoint, extname(entrypoint))) + "." + ext;
3319
+ } else {
3320
+ ext = ext || extname(outputFile).substring(1) || extname(entrypoint).substring(1);
3321
+ if (!outputExtensions.includes(ext)) {
3322
+ throw new Error(`Invalid file extension: ${ext}.`);
3323
+ }
3324
+ outputFile = join(dirname(outputFile), basename(outputFile, extname(outputFile))) + "." + ext;
3325
+ }
3326
+ return { outputFile, ext };
3327
+ }
3328
+ function printUnusedWarnings(config) {
3329
+ const { preprocessors, rules, decorators } = config.getUnusedRules();
3330
+ if (rules.length) {
3331
+ logger.warn(
3332
+ `[WARNING] Unused rules found in ${blue(config.configPath || "")}: ${rules.join(", ")}.
3333
+ `
3334
+ );
3335
+ }
3336
+ if (preprocessors.length) {
3337
+ logger.warn(
3338
+ `[WARNING] Unused preprocessors found in ${blue(
3339
+ config.configPath || ""
3340
+ )}: ${preprocessors.join(", ")}.
3341
+ `
3342
+ );
3343
+ }
3344
+ if (decorators.length) {
3345
+ logger.warn(
3346
+ `[WARNING] Unused decorators found in ${blue(config.configPath || "")}: ${decorators.join(
3347
+ ", "
3348
+ )}.
3349
+ `
3350
+ );
3351
+ }
3352
+ if (rules.length || preprocessors.length) {
3353
+ logger.warn(`Check the spelling and verify the added plugin prefix.
3354
+ `);
3355
+ }
3356
+ }
3357
+ async function loadConfigAndHandleErrors(argv, version) {
3358
+ try {
3359
+ const config = await loadConfig({
3360
+ configPath: argv.config,
3361
+ customExtends: argv.extends
3362
+ });
3363
+ await handleLintConfig(argv, version, config);
3364
+ return config;
3365
+ } catch (e) {
3366
+ handleError(e, "");
3367
+ }
3368
+ }
3369
+ function isAsync2Definition(doc) {
3370
+ return doc.asyncapi?.startsWith("2");
3371
+ }
3372
+ var oas2OrderedKeys = [
3373
+ "swagger",
3374
+ "info",
3375
+ "host",
3376
+ "basePath",
3377
+ "schemes",
3378
+ "consumes",
3379
+ "produces",
3380
+ "security",
3381
+ "tags",
3382
+ "externalDocs",
3383
+ "paths",
3384
+ "definitions",
3385
+ "parameters",
3386
+ "responses",
3387
+ "securityDefinitions"
3388
+ ];
3389
+ var oas3OrderedKeys = [
3390
+ "openapi",
3391
+ "info",
3392
+ "jsonSchemaDialect",
3393
+ "servers",
3394
+ "security",
3395
+ "tags",
3396
+ "externalDocs",
3397
+ "paths",
3398
+ "webhooks",
3399
+ "x-webhooks",
3400
+ "components"
3401
+ ];
3402
+ var asyncApi2OrderedKeys = [
3403
+ "asyncapi",
3404
+ "id",
3405
+ "info",
3406
+ "externalDocs",
3407
+ "tags",
3408
+ "defaultContentType",
3409
+ "servers",
3410
+ "channels",
3411
+ "components"
3412
+ ];
3413
+ var asyncApi3OrderedKeys = [
3414
+ "asyncapi",
3415
+ "info",
3416
+ "defaultContentType",
3417
+ "servers",
3418
+ "channels",
3419
+ "operations",
3420
+ "components"
3421
+ ];
3422
+ function sortTopLevelKeys(document) {
3423
+ if ("asyncapi" in document) {
3424
+ return isAsync2Definition(document) ? sortDocumentKeys(document, asyncApi2OrderedKeys) : sortDocumentKeys(document, asyncApi3OrderedKeys);
3425
+ }
3426
+ if ("swagger" in document) {
3427
+ return sortDocumentKeys(document, oas2OrderedKeys);
3428
+ }
3429
+ return sortDocumentKeys(document, oas3OrderedKeys);
3430
+ }
3431
+ function sortDocumentKeys(document, orderedKeys) {
3432
+ const result = {};
3433
+ for (const key of orderedKeys) {
3434
+ if (document.hasOwnProperty(key)) {
3435
+ result[key] = document[key];
3436
+ }
3437
+ }
3438
+ return Object.assign(result, document);
3439
+ }
3440
+ function checkIfRulesetExist(rules) {
3441
+ const ruleset = {
3442
+ ...rules.oas2,
3443
+ ...rules.oas3_0,
3444
+ ...rules.oas3_1,
3445
+ ...rules.oas3_2,
3446
+ ...rules.async2,
3447
+ ...rules.async3,
3448
+ ...rules.arazzo1,
3449
+ ...rules.overlay1
3450
+ };
3451
+ if (isEmptyObject(ruleset)) {
3452
+ exitWithError(
3453
+ "\u26A0\uFE0F No rules were configured. Learn how to configure rules: https://redocly.com/docs/cli/rules/"
3454
+ );
3455
+ }
3456
+ }
3457
+ function cleanColors(input) {
3458
+ return input.replace(/\x1b\[\d+m/g, "");
3459
+ }
3460
+ function formatPath(path) {
3461
+ if (isAbsoluteUrl(path)) {
3462
+ return path;
3463
+ }
3464
+ return relative(process2.cwd(), path);
3465
+ }
3466
+ function capitalize(s) {
3467
+ if (s?.length > 0) {
3468
+ return s[0].toUpperCase() + s.slice(1);
3469
+ }
3470
+ return s;
3471
+ }
3472
+
3473
+ // src/commands/lint.ts
3474
+ async function handleLint({
3475
+ argv,
3476
+ config,
3477
+ version,
3478
+ collectSpecData
3479
+ }) {
3480
+ const apis = await getFallbackApisOrExit(argv.apis, config);
3481
+ const totals = { errors: 0, warnings: 0, ignored: 0 };
3482
+ let totalIgnored = 0;
3483
+ const isAggregatedXmlFormat = argv.format === "checkstyle" || argv.format === "junit";
3484
+ const aggregatedResults = [];
3485
+ for (const { path, alias } of apis) {
3486
+ try {
3487
+ const startedAt = performance3.now();
3488
+ const aliasConfig = config.forAlias(alias);
3489
+ checkIfRulesetExist(aliasConfig.rules);
3490
+ aliasConfig.skipRules(argv["skip-rule"]);
3491
+ aliasConfig.skipPreprocessors(argv["skip-preprocessor"]);
3492
+ if (typeof config.document?.parsed === "undefined" && !argv.extends) {
3493
+ logger.info(
3494
+ `No configurations were provided -- using built in ${blue(
3495
+ "recommended"
3496
+ )} configuration by default.
3497
+
3498
+ `
3499
+ );
3500
+ }
3501
+ if (alias === void 0) {
3502
+ logger.info(gray(`validating ${formatPath(path)}...
3503
+ `));
3504
+ } else {
3505
+ logger.info(
3506
+ gray(`validating ${formatPath(path)} using lint rules for api '${alias}'...
3507
+ `)
3508
+ );
3509
+ }
3510
+ const results = await lint({
3511
+ ref: path,
3512
+ config: aliasConfig,
3513
+ collectSpecData
3514
+ });
3515
+ const fileTotals = getTotals(results);
3516
+ totals.errors += fileTotals.errors;
3517
+ totals.warnings += fileTotals.warnings;
3518
+ totals.ignored += fileTotals.ignored;
3519
+ if (argv["generate-ignore-file"]) {
3520
+ config.clearIgnoreForRef(path);
3521
+ for (const m of results) {
3522
+ config.addIgnore(m);
3523
+ totalIgnored++;
3524
+ }
3525
+ } else if (isAggregatedXmlFormat) {
3526
+ aggregatedResults.push(...results);
3527
+ } else {
3528
+ formatProblems(results, {
3529
+ format: argv.format,
3530
+ maxProblems: argv["max-problems"],
3531
+ totals: fileTotals,
3532
+ version,
3533
+ command: "lint"
3534
+ });
3535
+ }
3536
+ const elapsed = getExecutionTime(startedAt);
3537
+ logger.info(gray(`${formatPath(path)}: validated in ${elapsed}
3538
+
3539
+ `));
3540
+ } catch (e) {
3541
+ handleError(e, path);
3542
+ }
3543
+ }
3544
+ if (isAggregatedXmlFormat && !argv["generate-ignore-file"]) {
3545
+ formatProblems(aggregatedResults, {
3546
+ format: argv.format,
3547
+ maxProblems: argv["max-problems"],
3548
+ totals,
3549
+ version,
3550
+ command: "lint"
3551
+ });
3552
+ }
3553
+ if (argv["generate-ignore-file"]) {
3554
+ config.saveIgnore();
3555
+ logger.info(`Explicitly ignored ${totalIgnored} ${pluralize("problem", totalIgnored)}.
3556
+
3557
+ `);
3558
+ } else {
3559
+ printLintTotals(totals, apis.length);
3560
+ }
3561
+ printUnusedWarnings(config);
3562
+ if (!(totals.errors === 0 || argv["generate-ignore-file"])) {
3563
+ throw new AbortFlowError("Lint failed.");
3564
+ }
3565
+ }
3566
+ async function handleLintConfig(argv, version, config) {
3567
+ if (argv["lint-config"] === "off" || config.document === void 0) {
3568
+ return;
3569
+ }
3570
+ if (argv.format === "json" || argv.format === "junit" || argv.format === "checkstyle") {
3571
+ return;
3572
+ }
3573
+ const command = argv ? getCommandNameFromArgs(argv) : void 0;
3574
+ const problems = await lintConfig({
3575
+ config,
3576
+ severity: argv["lint-config"] || "warn"
3577
+ });
3578
+ const fileTotals = getTotals(problems);
3579
+ formatProblems(problems, {
3580
+ format: argv.format,
3581
+ maxProblems: argv["max-problems"],
3582
+ totals: fileTotals,
3583
+ version,
3584
+ command: "check-config"
3585
+ });
3586
+ printConfigLintTotals(fileTotals, command);
3587
+ if (fileTotals.errors > 0) {
3588
+ throw new ConfigValidationError();
3589
+ }
3590
+ }
3591
+
3592
+ export {
3593
+ AbortFlowError,
3594
+ exitWithError,
3595
+ handleLint,
3596
+ outputExtensions,
3597
+ getFallbackApisOrExit,
3598
+ getAliasOrPath,
3599
+ getExecutionTime,
3600
+ printExecutionTime,
3601
+ pathToFilename,
3602
+ escapeLanguageName,
3603
+ langToExt,
3604
+ dumpBundle,
3605
+ saveBundle,
3606
+ readYaml,
3607
+ writeToFileByExtension,
3608
+ getAndValidateFileExtension,
3609
+ handleError,
3610
+ getOutputFileName,
3611
+ printUnusedWarnings,
3612
+ loadConfigAndHandleErrors,
3613
+ sortTopLevelKeys,
3614
+ cleanColors,
3615
+ formatPath,
3616
+ capitalize
3617
+ };