@aigne/afs-cli 1.11.0-beta.1 → 1.11.0-beta.11

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 (348) hide show
  1. package/README.md +262 -15
  2. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  3. package/dist/_virtual/rolldown_runtime.mjs +7 -0
  4. package/dist/cli.cjs +40 -0
  5. package/dist/cli.d.cts +2 -0
  6. package/dist/cli.d.mts +2 -1
  7. package/dist/cli.mjs +36 -24
  8. package/dist/cli.mjs.map +1 -0
  9. package/dist/config/afs-loader.cjs +578 -0
  10. package/dist/config/afs-loader.d.cts +19 -0
  11. package/dist/config/afs-loader.d.cts.map +1 -0
  12. package/dist/config/afs-loader.d.mts +19 -0
  13. package/dist/config/afs-loader.d.mts.map +1 -0
  14. package/dist/config/afs-loader.mjs +576 -0
  15. package/dist/config/afs-loader.mjs.map +1 -0
  16. package/dist/config/env.cjs +46 -0
  17. package/dist/config/env.mjs +46 -0
  18. package/dist/config/env.mjs.map +1 -0
  19. package/dist/config/loader.cjs +219 -0
  20. package/dist/config/loader.mjs +217 -0
  21. package/dist/config/loader.mjs.map +1 -0
  22. package/dist/config/mount-commands.cjs +226 -0
  23. package/dist/config/mount-commands.d.cts +14 -0
  24. package/dist/config/mount-commands.d.cts.map +1 -0
  25. package/dist/config/mount-commands.d.mts +14 -0
  26. package/dist/config/mount-commands.d.mts.map +1 -0
  27. package/dist/config/mount-commands.mjs +220 -0
  28. package/dist/config/mount-commands.mjs.map +1 -0
  29. package/dist/config/schema.cjs +99 -0
  30. package/dist/config/schema.mjs +98 -0
  31. package/dist/config/schema.mjs.map +1 -0
  32. package/dist/core/commands/delete.cjs +41 -0
  33. package/dist/core/commands/delete.d.cts +18 -0
  34. package/dist/core/commands/delete.d.cts.map +1 -0
  35. package/dist/core/commands/delete.d.mts +18 -0
  36. package/dist/core/commands/delete.d.mts.map +1 -0
  37. package/dist/core/commands/delete.mjs +42 -0
  38. package/dist/core/commands/delete.mjs.map +1 -0
  39. package/dist/core/commands/exec.cjs +98 -0
  40. package/dist/core/commands/exec.d.cts +26 -0
  41. package/dist/core/commands/exec.d.cts.map +1 -0
  42. package/dist/core/commands/exec.d.mts +26 -0
  43. package/dist/core/commands/exec.d.mts.map +1 -0
  44. package/dist/core/commands/exec.mjs +99 -0
  45. package/dist/core/commands/exec.mjs.map +1 -0
  46. package/dist/core/commands/explain.cjs +278 -0
  47. package/dist/core/commands/explain.d.cts +25 -0
  48. package/dist/core/commands/explain.d.cts.map +1 -0
  49. package/dist/core/commands/explain.d.mts +25 -0
  50. package/dist/core/commands/explain.d.mts.map +1 -0
  51. package/dist/core/commands/explain.mjs +279 -0
  52. package/dist/core/commands/explain.mjs.map +1 -0
  53. package/dist/core/commands/explore.cjs +30 -0
  54. package/dist/core/commands/explore.d.mts +2 -0
  55. package/dist/core/commands/explore.mjs +31 -0
  56. package/dist/core/commands/explore.mjs.map +1 -0
  57. package/dist/core/commands/index.cjs +36 -0
  58. package/dist/core/commands/index.d.cts +21 -0
  59. package/dist/core/commands/index.d.cts.map +1 -0
  60. package/dist/core/commands/index.d.mts +24 -0
  61. package/dist/core/commands/index.d.mts.map +1 -0
  62. package/dist/core/commands/index.mjs +37 -0
  63. package/dist/core/commands/index.mjs.map +1 -0
  64. package/dist/core/commands/ls.cjs +57 -0
  65. package/dist/core/commands/ls.d.cts +21 -0
  66. package/dist/core/commands/ls.d.cts.map +1 -0
  67. package/dist/core/commands/ls.d.mts +21 -0
  68. package/dist/core/commands/ls.d.mts.map +1 -0
  69. package/dist/core/commands/ls.mjs +58 -0
  70. package/dist/core/commands/ls.mjs.map +1 -0
  71. package/dist/core/commands/mount.cjs +222 -0
  72. package/dist/core/commands/mount.d.cts +35 -0
  73. package/dist/core/commands/mount.d.cts.map +1 -0
  74. package/dist/core/commands/mount.d.mts +35 -0
  75. package/dist/core/commands/mount.d.mts.map +1 -0
  76. package/dist/core/commands/mount.mjs +223 -0
  77. package/dist/core/commands/mount.mjs.map +1 -0
  78. package/dist/core/commands/read.cjs +48 -0
  79. package/dist/core/commands/read.d.cts +17 -0
  80. package/dist/core/commands/read.d.cts.map +1 -0
  81. package/dist/core/commands/read.d.mts +17 -0
  82. package/dist/core/commands/read.d.mts.map +1 -0
  83. package/dist/core/commands/read.mjs +49 -0
  84. package/dist/core/commands/read.mjs.map +1 -0
  85. package/dist/core/commands/search.cjs +40 -0
  86. package/dist/core/commands/search.d.mts +2 -0
  87. package/dist/core/commands/search.mjs +41 -0
  88. package/dist/core/commands/search.mjs.map +1 -0
  89. package/dist/core/commands/serve.cjs +267 -0
  90. package/dist/core/commands/serve.d.mts +2 -0
  91. package/dist/core/commands/serve.mjs +267 -0
  92. package/dist/core/commands/serve.mjs.map +1 -0
  93. package/dist/core/commands/stat.cjs +53 -0
  94. package/dist/core/commands/stat.d.cts +17 -0
  95. package/dist/core/commands/stat.d.cts.map +1 -0
  96. package/dist/core/commands/stat.d.mts +17 -0
  97. package/dist/core/commands/stat.d.mts.map +1 -0
  98. package/dist/core/commands/stat.mjs +54 -0
  99. package/dist/core/commands/stat.mjs.map +1 -0
  100. package/dist/core/commands/types.cjs +18 -0
  101. package/dist/core/commands/types.d.cts +54 -0
  102. package/dist/core/commands/types.d.cts.map +1 -0
  103. package/dist/core/commands/types.d.mts +54 -0
  104. package/dist/core/commands/types.d.mts.map +1 -0
  105. package/dist/core/commands/types.mjs +19 -0
  106. package/dist/core/commands/types.mjs.map +1 -0
  107. package/dist/core/commands/write.cjs +70 -0
  108. package/dist/core/commands/write.d.cts +20 -0
  109. package/dist/core/commands/write.d.cts.map +1 -0
  110. package/dist/core/commands/write.d.mts +20 -0
  111. package/dist/core/commands/write.d.mts.map +1 -0
  112. package/dist/core/commands/write.mjs +71 -0
  113. package/dist/core/commands/write.mjs.map +1 -0
  114. package/dist/core/executor/index.cjs +196 -0
  115. package/dist/core/executor/index.d.cts +77 -0
  116. package/dist/core/executor/index.d.cts.map +1 -0
  117. package/dist/core/executor/index.d.mts +77 -0
  118. package/dist/core/executor/index.d.mts.map +1 -0
  119. package/dist/core/executor/index.mjs +195 -0
  120. package/dist/core/executor/index.mjs.map +1 -0
  121. package/dist/core/formatters/delete.cjs +37 -0
  122. package/dist/core/formatters/delete.d.cts +18 -0
  123. package/dist/core/formatters/delete.d.cts.map +1 -0
  124. package/dist/core/formatters/delete.d.mts +18 -0
  125. package/dist/core/formatters/delete.d.mts.map +1 -0
  126. package/dist/core/formatters/delete.mjs +37 -0
  127. package/dist/core/formatters/delete.mjs.map +1 -0
  128. package/dist/core/formatters/exec.cjs +60 -0
  129. package/dist/core/formatters/exec.d.cts +18 -0
  130. package/dist/core/formatters/exec.d.cts.map +1 -0
  131. package/dist/core/formatters/exec.d.mts +18 -0
  132. package/dist/core/formatters/exec.d.mts.map +1 -0
  133. package/dist/core/formatters/exec.mjs +60 -0
  134. package/dist/core/formatters/exec.mjs.map +1 -0
  135. package/dist/core/formatters/explain.cjs +99 -0
  136. package/dist/core/formatters/explain.d.cts +11 -0
  137. package/dist/core/formatters/explain.d.cts.map +1 -0
  138. package/dist/core/formatters/explain.d.mts +11 -0
  139. package/dist/core/formatters/explain.d.mts.map +1 -0
  140. package/dist/core/formatters/explain.mjs +98 -0
  141. package/dist/core/formatters/explain.mjs.map +1 -0
  142. package/dist/core/formatters/index.d.mts +9 -0
  143. package/dist/core/formatters/ls.cjs +179 -0
  144. package/dist/core/formatters/ls.d.cts +20 -0
  145. package/dist/core/formatters/ls.d.cts.map +1 -0
  146. package/dist/core/formatters/ls.d.mts +20 -0
  147. package/dist/core/formatters/ls.d.mts.map +1 -0
  148. package/dist/core/formatters/ls.mjs +179 -0
  149. package/dist/core/formatters/ls.mjs.map +1 -0
  150. package/dist/core/formatters/mount.cjs +55 -0
  151. package/dist/core/formatters/mount.d.cts +15 -0
  152. package/dist/core/formatters/mount.d.cts.map +1 -0
  153. package/dist/core/formatters/mount.d.mts +15 -0
  154. package/dist/core/formatters/mount.d.mts.map +1 -0
  155. package/dist/core/formatters/mount.mjs +55 -0
  156. package/dist/core/formatters/mount.mjs.map +1 -0
  157. package/dist/core/formatters/read.cjs +100 -0
  158. package/dist/core/formatters/read.d.cts +22 -0
  159. package/dist/core/formatters/read.d.cts.map +1 -0
  160. package/dist/core/formatters/read.d.mts +22 -0
  161. package/dist/core/formatters/read.d.mts.map +1 -0
  162. package/dist/core/formatters/read.mjs +100 -0
  163. package/dist/core/formatters/read.mjs.map +1 -0
  164. package/dist/core/formatters/search.cjs +44 -0
  165. package/dist/core/formatters/search.d.mts +1 -0
  166. package/dist/core/formatters/search.mjs +44 -0
  167. package/dist/core/formatters/search.mjs.map +1 -0
  168. package/dist/core/formatters/stat.cjs +155 -0
  169. package/dist/core/formatters/stat.d.cts +15 -0
  170. package/dist/core/formatters/stat.d.cts.map +1 -0
  171. package/dist/core/formatters/stat.d.mts +15 -0
  172. package/dist/core/formatters/stat.d.mts.map +1 -0
  173. package/dist/core/formatters/stat.mjs +155 -0
  174. package/dist/core/formatters/stat.mjs.map +1 -0
  175. package/dist/core/formatters/write.cjs +51 -0
  176. package/dist/core/formatters/write.d.cts +22 -0
  177. package/dist/core/formatters/write.d.cts.map +1 -0
  178. package/dist/core/formatters/write.d.mts +22 -0
  179. package/dist/core/formatters/write.d.mts.map +1 -0
  180. package/dist/core/formatters/write.mjs +51 -0
  181. package/dist/core/formatters/write.mjs.map +1 -0
  182. package/dist/core/helpers/exec-args.cjs +142 -0
  183. package/dist/core/helpers/exec-args.d.cts +46 -0
  184. package/dist/core/helpers/exec-args.d.cts.map +1 -0
  185. package/dist/core/helpers/exec-args.d.mts +46 -0
  186. package/dist/core/helpers/exec-args.d.mts.map +1 -0
  187. package/dist/core/helpers/exec-args.mjs +139 -0
  188. package/dist/core/helpers/exec-args.mjs.map +1 -0
  189. package/dist/core/helpers/stdin.cjs +41 -0
  190. package/dist/core/helpers/stdin.d.cts +15 -0
  191. package/dist/core/helpers/stdin.d.cts.map +1 -0
  192. package/dist/core/helpers/stdin.d.mts +15 -0
  193. package/dist/core/helpers/stdin.d.mts.map +1 -0
  194. package/dist/core/helpers/stdin.mjs +41 -0
  195. package/dist/core/helpers/stdin.mjs.map +1 -0
  196. package/dist/core/index.cjs +49 -0
  197. package/dist/core/index.d.cts +24 -0
  198. package/dist/core/index.d.mts +25 -0
  199. package/dist/core/index.mjs +24 -0
  200. package/dist/core/path-utils.cjs +1 -0
  201. package/dist/core/path-utils.mjs +3 -0
  202. package/dist/core/types.d.cts +24 -0
  203. package/dist/core/types.d.cts.map +1 -0
  204. package/dist/core/types.d.mts +24 -0
  205. package/dist/core/types.d.mts.map +1 -0
  206. package/dist/credential/auth-server.cjs +247 -0
  207. package/dist/credential/auth-server.mjs +247 -0
  208. package/dist/credential/auth-server.mjs.map +1 -0
  209. package/dist/credential/cli-auth-context.cjs +86 -0
  210. package/dist/credential/cli-auth-context.d.mts +1 -0
  211. package/dist/credential/cli-auth-context.mjs +86 -0
  212. package/dist/credential/cli-auth-context.mjs.map +1 -0
  213. package/dist/credential/index.cjs +5 -0
  214. package/dist/credential/index.d.mts +4 -0
  215. package/dist/credential/index.mjs +7 -0
  216. package/dist/credential/mcp-auth-context.cjs +192 -0
  217. package/dist/credential/mcp-auth-context.d.mts +1 -0
  218. package/dist/credential/mcp-auth-context.mjs +192 -0
  219. package/dist/credential/mcp-auth-context.mjs.map +1 -0
  220. package/dist/credential/resolver.cjs +127 -0
  221. package/dist/credential/resolver.d.mts +1 -0
  222. package/dist/credential/resolver.mjs +127 -0
  223. package/dist/credential/resolver.mjs.map +1 -0
  224. package/dist/credential/store.cjs +106 -0
  225. package/dist/credential/store.d.cts +30 -0
  226. package/dist/credential/store.d.cts.map +1 -0
  227. package/dist/credential/store.d.mts +30 -0
  228. package/dist/credential/store.d.mts.map +1 -0
  229. package/dist/credential/store.mjs +106 -0
  230. package/dist/credential/store.mjs.map +1 -0
  231. package/dist/errors.cjs +18 -0
  232. package/dist/errors.mjs +18 -0
  233. package/dist/errors.mjs.map +1 -0
  234. package/dist/explorer/actions.cjs +311 -0
  235. package/dist/explorer/actions.mjs +305 -0
  236. package/dist/explorer/actions.mjs.map +1 -0
  237. package/dist/explorer/components/dialog.cjs +508 -0
  238. package/dist/explorer/components/dialog.mjs +509 -0
  239. package/dist/explorer/components/dialog.mjs.map +1 -0
  240. package/dist/explorer/components/file-list.cjs +107 -0
  241. package/dist/explorer/components/file-list.mjs +107 -0
  242. package/dist/explorer/components/file-list.mjs.map +1 -0
  243. package/dist/explorer/components/function-bar.cjs +55 -0
  244. package/dist/explorer/components/function-bar.mjs +55 -0
  245. package/dist/explorer/components/function-bar.mjs.map +1 -0
  246. package/dist/explorer/components/index.cjs +5 -0
  247. package/dist/explorer/components/index.mjs +7 -0
  248. package/dist/explorer/components/metadata-panel.cjs +219 -0
  249. package/dist/explorer/components/metadata-panel.mjs +219 -0
  250. package/dist/explorer/components/metadata-panel.mjs.map +1 -0
  251. package/dist/explorer/components/status-bar.cjs +53 -0
  252. package/dist/explorer/components/status-bar.mjs +54 -0
  253. package/dist/explorer/components/status-bar.mjs.map +1 -0
  254. package/dist/explorer/keybindings.cjs +214 -0
  255. package/dist/explorer/keybindings.mjs +213 -0
  256. package/dist/explorer/keybindings.mjs.map +1 -0
  257. package/dist/explorer/screen.cjs +251 -0
  258. package/dist/explorer/screen.d.cts +23 -0
  259. package/dist/explorer/screen.d.cts.map +1 -0
  260. package/dist/explorer/screen.d.mts +23 -0
  261. package/dist/explorer/screen.d.mts.map +1 -0
  262. package/dist/explorer/screen.mjs +250 -0
  263. package/dist/explorer/screen.mjs.map +1 -0
  264. package/dist/explorer/state.cjs +53 -0
  265. package/dist/explorer/state.mjs +53 -0
  266. package/dist/explorer/state.mjs.map +1 -0
  267. package/dist/explorer/theme.cjs +160 -0
  268. package/dist/explorer/theme.mjs +157 -0
  269. package/dist/explorer/theme.mjs.map +1 -0
  270. package/dist/index.cjs +12 -0
  271. package/dist/index.d.cts +6 -0
  272. package/dist/index.d.mts +7 -4
  273. package/dist/index.mjs +7 -2
  274. package/dist/mcp/http-transport.cjs +87 -0
  275. package/dist/mcp/http-transport.mjs +87 -0
  276. package/dist/mcp/http-transport.mjs.map +1 -0
  277. package/dist/mcp/prompts.cjs +48 -0
  278. package/dist/mcp/prompts.mjs +48 -0
  279. package/dist/mcp/prompts.mjs.map +1 -0
  280. package/dist/mcp/resources.cjs +25 -0
  281. package/dist/mcp/resources.mjs +25 -0
  282. package/dist/mcp/resources.mjs.map +1 -0
  283. package/dist/mcp/server.cjs +74 -0
  284. package/dist/mcp/server.mjs +73 -0
  285. package/dist/mcp/server.mjs.map +1 -0
  286. package/dist/mcp/tools.cjs +152 -0
  287. package/dist/mcp/tools.mjs +152 -0
  288. package/dist/mcp/tools.mjs.map +1 -0
  289. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.cts +10 -0
  290. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.cts.map +1 -0
  291. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.mts +10 -0
  292. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.mts.map +1 -0
  293. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.cts +46 -0
  294. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.cts.map +1 -0
  295. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.mts +46 -0
  296. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.mts.map +1 -0
  297. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.cjs +902 -0
  298. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.mjs +902 -0
  299. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.mjs.map +1 -0
  300. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.cjs +6 -0
  301. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.mjs +8 -0
  302. package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.mjs.map +1 -0
  303. package/dist/path-utils.cjs +105 -0
  304. package/dist/path-utils.d.cts +50 -0
  305. package/dist/path-utils.d.cts.map +1 -0
  306. package/dist/path-utils.d.mts +50 -0
  307. package/dist/path-utils.d.mts.map +1 -0
  308. package/dist/path-utils.mjs +104 -0
  309. package/dist/path-utils.mjs.map +1 -0
  310. package/dist/repl.cjs +491 -0
  311. package/dist/repl.d.cts +15 -0
  312. package/dist/repl.d.cts.map +1 -0
  313. package/dist/repl.d.mts +16 -0
  314. package/dist/repl.d.mts.map +1 -0
  315. package/dist/repl.mjs +491 -0
  316. package/dist/repl.mjs.map +1 -0
  317. package/dist/serve.cjs +146 -0
  318. package/dist/serve.d.cts +41 -0
  319. package/dist/serve.d.cts.map +1 -0
  320. package/dist/serve.d.mts +41 -0
  321. package/dist/serve.d.mts.map +1 -0
  322. package/dist/serve.mjs +146 -0
  323. package/dist/serve.mjs.map +1 -0
  324. package/dist/ui/header.cjs +12 -0
  325. package/dist/ui/header.mjs +13 -0
  326. package/dist/ui/header.mjs.map +1 -0
  327. package/dist/ui/index.cjs +8 -0
  328. package/dist/ui/index.mjs +9 -0
  329. package/dist/ui/index.mjs.map +1 -0
  330. package/dist/ui/terminal.cjs +88 -0
  331. package/dist/ui/terminal.mjs +88 -0
  332. package/dist/ui/terminal.mjs.map +1 -0
  333. package/dist/version.cjs +9 -0
  334. package/dist/version.d.cts +5 -0
  335. package/dist/version.d.cts.map +1 -0
  336. package/dist/version.d.mts +5 -0
  337. package/dist/version.d.mts.map +1 -0
  338. package/dist/version.mjs +9 -0
  339. package/dist/version.mjs.map +1 -0
  340. package/package.json +77 -11
  341. package/.turbo/turbo-build.log +0 -18
  342. package/.turbo/turbo-check-types.log +0 -4
  343. package/dist/version--p6A8sKX.mjs +0 -5
  344. package/src/cli.test.ts +0 -8
  345. package/src/cli.ts +0 -29
  346. package/src/index.ts +0 -7
  347. package/src/version.ts +0 -1
  348. package/tsconfig.json +0 -16
@@ -0,0 +1,902 @@
1
+ //#region ../../node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.js
2
+ var Pe = Object.defineProperty;
3
+ var a = (e, t) => Pe(e, "name", {
4
+ value: t,
5
+ configurable: !0
6
+ });
7
+ var P = class {
8
+ type = 3;
9
+ name = "";
10
+ prefix = "";
11
+ value = "";
12
+ suffix = "";
13
+ modifier = 3;
14
+ constructor(t, r, n, c, l, f) {
15
+ this.type = t, this.name = r, this.prefix = n, this.value = c, this.suffix = l, this.modifier = f;
16
+ }
17
+ hasCustomName() {
18
+ return this.name !== "" && typeof this.name != "number";
19
+ }
20
+ };
21
+ a(P, "Part");
22
+ var Re = /[$_\p{ID_Start}]/u, Ee = /[$_\u200C\u200D\p{ID_Continue}]/u, v = ".*";
23
+ function Oe(e, t) {
24
+ return (t ? /^[\x00-\xFF]*$/ : /^[\x00-\x7F]*$/).test(e);
25
+ }
26
+ a(Oe, "isASCII");
27
+ function D(e, t = !1) {
28
+ let r = [], n = 0;
29
+ for (; n < e.length;) {
30
+ let c = e[n], l = a(function(f) {
31
+ if (!t) throw new TypeError(f);
32
+ r.push({
33
+ type: "INVALID_CHAR",
34
+ index: n,
35
+ value: e[n++]
36
+ });
37
+ }, "ErrorOrInvalid");
38
+ if (c === "*") {
39
+ r.push({
40
+ type: "ASTERISK",
41
+ index: n,
42
+ value: e[n++]
43
+ });
44
+ continue;
45
+ }
46
+ if (c === "+" || c === "?") {
47
+ r.push({
48
+ type: "OTHER_MODIFIER",
49
+ index: n,
50
+ value: e[n++]
51
+ });
52
+ continue;
53
+ }
54
+ if (c === "\\") {
55
+ r.push({
56
+ type: "ESCAPED_CHAR",
57
+ index: n++,
58
+ value: e[n++]
59
+ });
60
+ continue;
61
+ }
62
+ if (c === "{") {
63
+ r.push({
64
+ type: "OPEN",
65
+ index: n,
66
+ value: e[n++]
67
+ });
68
+ continue;
69
+ }
70
+ if (c === "}") {
71
+ r.push({
72
+ type: "CLOSE",
73
+ index: n,
74
+ value: e[n++]
75
+ });
76
+ continue;
77
+ }
78
+ if (c === ":") {
79
+ let f = "", s = n + 1;
80
+ for (; s < e.length;) {
81
+ let i = e.substr(s, 1);
82
+ if (s === n + 1 && Re.test(i) || s !== n + 1 && Ee.test(i)) {
83
+ f += e[s++];
84
+ continue;
85
+ }
86
+ break;
87
+ }
88
+ if (!f) {
89
+ l(`Missing parameter name at ${n}`);
90
+ continue;
91
+ }
92
+ r.push({
93
+ type: "NAME",
94
+ index: n,
95
+ value: f
96
+ }), n = s;
97
+ continue;
98
+ }
99
+ if (c === "(") {
100
+ let f = 1, s = "", i = n + 1, o = !1;
101
+ if (e[i] === "?") {
102
+ l(`Pattern cannot start with "?" at ${i}`);
103
+ continue;
104
+ }
105
+ for (; i < e.length;) {
106
+ if (!Oe(e[i], !1)) {
107
+ l(`Invalid character '${e[i]}' at ${i}.`), o = !0;
108
+ break;
109
+ }
110
+ if (e[i] === "\\") {
111
+ s += e[i++] + e[i++];
112
+ continue;
113
+ }
114
+ if (e[i] === ")") {
115
+ if (f--, f === 0) {
116
+ i++;
117
+ break;
118
+ }
119
+ } else if (e[i] === "(" && (f++, e[i + 1] !== "?")) {
120
+ l(`Capturing groups are not allowed at ${i}`), o = !0;
121
+ break;
122
+ }
123
+ s += e[i++];
124
+ }
125
+ if (o) continue;
126
+ if (f) {
127
+ l(`Unbalanced pattern at ${n}`);
128
+ continue;
129
+ }
130
+ if (!s) {
131
+ l(`Missing pattern at ${n}`);
132
+ continue;
133
+ }
134
+ r.push({
135
+ type: "REGEX",
136
+ index: n,
137
+ value: s
138
+ }), n = i;
139
+ continue;
140
+ }
141
+ r.push({
142
+ type: "CHAR",
143
+ index: n,
144
+ value: e[n++]
145
+ });
146
+ }
147
+ return r.push({
148
+ type: "END",
149
+ index: n,
150
+ value: ""
151
+ }), r;
152
+ }
153
+ a(D, "lexer");
154
+ function F(e, t = {}) {
155
+ let r = D(e);
156
+ t.delimiter ??= "/#?", t.prefixes ??= "./";
157
+ let n = `[^${x(t.delimiter)}]+?`, c = [], l = 0, f = 0, i = /* @__PURE__ */ new Set(), o = a((u) => {
158
+ if (f < r.length && r[f].type === u) return r[f++].value;
159
+ }, "tryConsume"), h = a(() => o("OTHER_MODIFIER") ?? o("ASTERISK"), "tryConsumeModifier"), p = a((u) => {
160
+ let d = o(u);
161
+ if (d !== void 0) return d;
162
+ let { type: g, index: y } = r[f];
163
+ throw new TypeError(`Unexpected ${g} at ${y}, expected ${u}`);
164
+ }, "mustConsume"), A = a(() => {
165
+ let u = "", d;
166
+ for (; d = o("CHAR") ?? o("ESCAPED_CHAR");) u += d;
167
+ return u;
168
+ }, "consumeText"), xe = a((u) => u, "DefaultEncodePart"), N = t.encodePart || xe, H = "", $ = a((u) => {
169
+ H += u;
170
+ }, "appendToPendingFixedValue"), M = a(() => {
171
+ H.length && (c.push(new P(3, "", "", N(H), "", 3)), H = "");
172
+ }, "maybeAddPartFromPendingFixedValue"), X = a((u, d, g, y, Z) => {
173
+ let m = 3;
174
+ switch (Z) {
175
+ case "?":
176
+ m = 1;
177
+ break;
178
+ case "*":
179
+ m = 0;
180
+ break;
181
+ case "+":
182
+ m = 2;
183
+ break;
184
+ }
185
+ if (!d && !g && m === 3) {
186
+ $(u);
187
+ return;
188
+ }
189
+ if (M(), !d && !g) {
190
+ if (!u) return;
191
+ c.push(new P(3, "", "", N(u), "", m));
192
+ return;
193
+ }
194
+ let S;
195
+ g ? g === "*" ? S = v : S = g : S = n;
196
+ let k = 2;
197
+ S === n ? (k = 1, S = "") : S === v && (k = 0, S = "");
198
+ let E;
199
+ if (d ? E = d : g && (E = l++), i.has(E)) throw new TypeError(`Duplicate name '${E}'.`);
200
+ i.add(E), c.push(new P(k, E, N(u), S, N(y), m));
201
+ }, "addPart");
202
+ for (; f < r.length;) {
203
+ let u = o("CHAR"), d = o("NAME"), g = o("REGEX");
204
+ if (!d && !g && (g = o("ASTERISK")), d || g) {
205
+ let m = u ?? "";
206
+ t.prefixes.indexOf(m) === -1 && ($(m), m = ""), M();
207
+ let S = h();
208
+ X(m, d, g, "", S);
209
+ continue;
210
+ }
211
+ let y = u ?? o("ESCAPED_CHAR");
212
+ if (y) {
213
+ $(y);
214
+ continue;
215
+ }
216
+ if (o("OPEN")) {
217
+ let m = A(), S = o("NAME"), k = o("REGEX");
218
+ !S && !k && (k = o("ASTERISK"));
219
+ let E = A();
220
+ p("CLOSE");
221
+ let be = h();
222
+ X(m, S, k, E, be);
223
+ continue;
224
+ }
225
+ M(), p("END");
226
+ }
227
+ return c;
228
+ }
229
+ a(F, "parse");
230
+ function x(e) {
231
+ return e.replace(/([.+*?^${}()[\]|/\\])/g, "\\$1");
232
+ }
233
+ a(x, "escapeString");
234
+ function B(e) {
235
+ return e && e.ignoreCase ? "ui" : "u";
236
+ }
237
+ a(B, "flags");
238
+ function q(e, t, r) {
239
+ return W(F(e, r), t, r);
240
+ }
241
+ a(q, "stringToRegexp");
242
+ function T(e) {
243
+ switch (e) {
244
+ case 0: return "*";
245
+ case 1: return "?";
246
+ case 2: return "+";
247
+ case 3: return "";
248
+ }
249
+ }
250
+ a(T, "modifierToString");
251
+ function W(e, t, r = {}) {
252
+ r.delimiter ??= "/#?", r.prefixes ??= "./", r.sensitive ??= !1, r.strict ??= !1, r.end ??= !0, r.start ??= !0, r.endsWith = "";
253
+ let n = r.start ? "^" : "";
254
+ for (let s of e) {
255
+ if (s.type === 3) {
256
+ s.modifier === 3 ? n += x(s.value) : n += `(?:${x(s.value)})${T(s.modifier)}`;
257
+ continue;
258
+ }
259
+ t && t.push(s.name);
260
+ let i = `[^${x(r.delimiter)}]+?`, o = s.value;
261
+ if (s.type === 1 ? o = i : s.type === 0 && (o = v), !s.prefix.length && !s.suffix.length) {
262
+ s.modifier === 3 || s.modifier === 1 ? n += `(${o})${T(s.modifier)}` : n += `((?:${o})${T(s.modifier)})`;
263
+ continue;
264
+ }
265
+ if (s.modifier === 3 || s.modifier === 1) {
266
+ n += `(?:${x(s.prefix)}(${o})${x(s.suffix)})`, n += T(s.modifier);
267
+ continue;
268
+ }
269
+ n += `(?:${x(s.prefix)}`, n += `((?:${o})(?:`, n += x(s.suffix), n += x(s.prefix), n += `(?:${o}))*)${x(s.suffix)})`, s.modifier === 0 && (n += "?");
270
+ }
271
+ let c = `[${x(r.endsWith)}]|$`, l = `[${x(r.delimiter)}]`;
272
+ if (r.end) return r.strict || (n += `${l}?`), r.endsWith.length ? n += `(?=${c})` : n += "$", new RegExp(n, B(r));
273
+ r.strict || (n += `(?:${l}(?=${c}))?`);
274
+ let f = !1;
275
+ if (e.length) {
276
+ let s = e[e.length - 1];
277
+ s.type === 3 && s.modifier === 3 && (f = r.delimiter.indexOf(s) > -1);
278
+ }
279
+ return f || (n += `(?=${l}|${c})`), new RegExp(n, B(r));
280
+ }
281
+ a(W, "partsToRegexp");
282
+ var b = {
283
+ delimiter: "",
284
+ prefixes: "",
285
+ sensitive: !0,
286
+ strict: !0
287
+ }, J = {
288
+ delimiter: ".",
289
+ prefixes: "",
290
+ sensitive: !0,
291
+ strict: !0
292
+ }, Q = {
293
+ delimiter: "/",
294
+ prefixes: "/",
295
+ sensitive: !0,
296
+ strict: !0
297
+ };
298
+ function ee(e, t) {
299
+ return e.length ? e[0] === "/" ? !0 : !t || e.length < 2 ? !1 : (e[0] == "\\" || e[0] == "{") && e[1] == "/" : !1;
300
+ }
301
+ a(ee, "isAbsolutePathname");
302
+ function te(e, t) {
303
+ return e.startsWith(t) ? e.substring(t.length, e.length) : e;
304
+ }
305
+ a(te, "maybeStripPrefix");
306
+ function ke(e, t) {
307
+ return e.endsWith(t) ? e.substr(0, e.length - t.length) : e;
308
+ }
309
+ a(ke, "maybeStripSuffix");
310
+ function _(e) {
311
+ return !e || e.length < 2 ? !1 : e[0] === "[" || (e[0] === "\\" || e[0] === "{") && e[1] === "[";
312
+ }
313
+ a(_, "treatAsIPv6Hostname");
314
+ var re = [
315
+ "ftp",
316
+ "file",
317
+ "http",
318
+ "https",
319
+ "ws",
320
+ "wss"
321
+ ];
322
+ function U(e) {
323
+ if (!e) return !0;
324
+ for (let t of re) if (e.test(t)) return !0;
325
+ return !1;
326
+ }
327
+ a(U, "isSpecialScheme");
328
+ function ne(e, t) {
329
+ if (e = te(e, "#"), t || e === "") return e;
330
+ let r = new URL("https://example.com");
331
+ return r.hash = e, r.hash ? r.hash.substring(1, r.hash.length) : "";
332
+ }
333
+ a(ne, "canonicalizeHash");
334
+ function se(e, t) {
335
+ if (e = te(e, "?"), t || e === "") return e;
336
+ let r = new URL("https://example.com");
337
+ return r.search = e, r.search ? r.search.substring(1, r.search.length) : "";
338
+ }
339
+ a(se, "canonicalizeSearch");
340
+ function ie(e, t) {
341
+ return t || e === "" ? e : _(e) ? K(e) : j(e);
342
+ }
343
+ a(ie, "canonicalizeHostname");
344
+ function ae(e, t) {
345
+ if (t || e === "") return e;
346
+ let r = new URL("https://example.com");
347
+ return r.password = e, r.password;
348
+ }
349
+ a(ae, "canonicalizePassword");
350
+ function oe(e, t) {
351
+ if (t || e === "") return e;
352
+ let r = new URL("https://example.com");
353
+ return r.username = e, r.username;
354
+ }
355
+ a(oe, "canonicalizeUsername");
356
+ function ce(e, t, r) {
357
+ if (r || e === "") return e;
358
+ if (t && !re.includes(t)) return new URL(`${t}:${e}`).pathname;
359
+ let n = e[0] == "/";
360
+ return e = new URL(n ? e : "/-" + e, "https://example.com").pathname, n || (e = e.substring(2, e.length)), e;
361
+ }
362
+ a(ce, "canonicalizePathname");
363
+ function le(e, t, r) {
364
+ return z(t) === e && (e = ""), r || e === "" ? e : G(e);
365
+ }
366
+ a(le, "canonicalizePort");
367
+ function fe(e, t) {
368
+ return e = ke(e, ":"), t || e === "" ? e : w(e);
369
+ }
370
+ a(fe, "canonicalizeProtocol");
371
+ function z(e) {
372
+ switch (e) {
373
+ case "ws":
374
+ case "http": return "80";
375
+ case "wws":
376
+ case "https": return "443";
377
+ case "ftp": return "21";
378
+ default: return "";
379
+ }
380
+ }
381
+ a(z, "defaultPortForProtocol");
382
+ function w(e) {
383
+ if (e === "") return e;
384
+ if (/^[-+.A-Za-z0-9]*$/.test(e)) return e.toLowerCase();
385
+ throw new TypeError(`Invalid protocol '${e}'.`);
386
+ }
387
+ a(w, "protocolEncodeCallback");
388
+ function he(e) {
389
+ if (e === "") return e;
390
+ let t = new URL("https://example.com");
391
+ return t.username = e, t.username;
392
+ }
393
+ a(he, "usernameEncodeCallback");
394
+ function ue(e) {
395
+ if (e === "") return e;
396
+ let t = new URL("https://example.com");
397
+ return t.password = e, t.password;
398
+ }
399
+ a(ue, "passwordEncodeCallback");
400
+ function j(e) {
401
+ if (e === "") return e;
402
+ if (/[\t\n\r #%/:<>?@[\]^\\|]/g.test(e)) throw new TypeError(`Invalid hostname '${e}'`);
403
+ let t = new URL("https://example.com");
404
+ return t.hostname = e, t.hostname;
405
+ }
406
+ a(j, "hostnameEncodeCallback");
407
+ function K(e) {
408
+ if (e === "") return e;
409
+ if (/[^0-9a-fA-F[\]:]/g.test(e)) throw new TypeError(`Invalid IPv6 hostname '${e}'`);
410
+ return e.toLowerCase();
411
+ }
412
+ a(K, "ipv6HostnameEncodeCallback");
413
+ function G(e) {
414
+ if (e === "" || /^[0-9]*$/.test(e) && parseInt(e) <= 65535) return e;
415
+ throw new TypeError(`Invalid port '${e}'.`);
416
+ }
417
+ a(G, "portEncodeCallback");
418
+ function de(e) {
419
+ if (e === "") return e;
420
+ let t = new URL("https://example.com");
421
+ return t.pathname = e[0] !== "/" ? "/-" + e : e, e[0] !== "/" ? t.pathname.substring(2, t.pathname.length) : t.pathname;
422
+ }
423
+ a(de, "standardURLPathnameEncodeCallback");
424
+ function pe(e) {
425
+ return e === "" ? e : new URL(`data:${e}`).pathname;
426
+ }
427
+ a(pe, "pathURLPathnameEncodeCallback");
428
+ function ge(e) {
429
+ if (e === "") return e;
430
+ let t = new URL("https://example.com");
431
+ return t.search = e, t.search.substring(1, t.search.length);
432
+ }
433
+ a(ge, "searchEncodeCallback");
434
+ function me(e) {
435
+ if (e === "") return e;
436
+ let t = new URL("https://example.com");
437
+ return t.hash = e, t.hash.substring(1, t.hash.length);
438
+ }
439
+ a(me, "hashEncodeCallback");
440
+ var C = class {
441
+ #i;
442
+ #n = [];
443
+ #t = {};
444
+ #e = 0;
445
+ #s = 1;
446
+ #l = 0;
447
+ #o = 0;
448
+ #d = 0;
449
+ #p = 0;
450
+ #g = !1;
451
+ constructor(t) {
452
+ this.#i = t;
453
+ }
454
+ get result() {
455
+ return this.#t;
456
+ }
457
+ parse() {
458
+ for (this.#n = D(this.#i, !0); this.#e < this.#n.length; this.#e += this.#s) {
459
+ if (this.#s = 1, this.#n[this.#e].type === "END") {
460
+ if (this.#o === 0) {
461
+ this.#b(), this.#f() ? this.#r(9, 1) : this.#h() ? this.#r(8, 1) : this.#r(7, 0);
462
+ continue;
463
+ } else if (this.#o === 2) {
464
+ this.#u(5);
465
+ continue;
466
+ }
467
+ this.#r(10, 0);
468
+ break;
469
+ }
470
+ if (this.#d > 0) if (this.#A()) this.#d -= 1;
471
+ else continue;
472
+ if (this.#T()) {
473
+ this.#d += 1;
474
+ continue;
475
+ }
476
+ switch (this.#o) {
477
+ case 0:
478
+ this.#P() && this.#u(1);
479
+ break;
480
+ case 1:
481
+ if (this.#P()) {
482
+ this.#C();
483
+ let t = 7, r = 1;
484
+ this.#E() ? (t = 2, r = 3) : this.#g && (t = 2), this.#r(t, r);
485
+ }
486
+ break;
487
+ case 2:
488
+ this.#S() ? this.#u(3) : (this.#x() || this.#h() || this.#f()) && this.#u(5);
489
+ break;
490
+ case 3:
491
+ this.#O() ? this.#r(4, 1) : this.#S() && this.#r(5, 1);
492
+ break;
493
+ case 4:
494
+ this.#S() && this.#r(5, 1);
495
+ break;
496
+ case 5:
497
+ this.#y() ? this.#p += 1 : this.#w() && (this.#p -= 1), this.#k() && !this.#p ? this.#r(6, 1) : this.#x() ? this.#r(7, 0) : this.#h() ? this.#r(8, 1) : this.#f() && this.#r(9, 1);
498
+ break;
499
+ case 6:
500
+ this.#x() ? this.#r(7, 0) : this.#h() ? this.#r(8, 1) : this.#f() && this.#r(9, 1);
501
+ break;
502
+ case 7:
503
+ this.#h() ? this.#r(8, 1) : this.#f() && this.#r(9, 1);
504
+ break;
505
+ case 8:
506
+ this.#f() && this.#r(9, 1);
507
+ break;
508
+ case 9: break;
509
+ case 10: break;
510
+ }
511
+ }
512
+ this.#t.hostname !== void 0 && this.#t.port === void 0 && (this.#t.port = "");
513
+ }
514
+ #r(t, r) {
515
+ switch (this.#o) {
516
+ case 0: break;
517
+ case 1:
518
+ this.#t.protocol = this.#c();
519
+ break;
520
+ case 2: break;
521
+ case 3:
522
+ this.#t.username = this.#c();
523
+ break;
524
+ case 4:
525
+ this.#t.password = this.#c();
526
+ break;
527
+ case 5:
528
+ this.#t.hostname = this.#c();
529
+ break;
530
+ case 6:
531
+ this.#t.port = this.#c();
532
+ break;
533
+ case 7:
534
+ this.#t.pathname = this.#c();
535
+ break;
536
+ case 8:
537
+ this.#t.search = this.#c();
538
+ break;
539
+ case 9:
540
+ this.#t.hash = this.#c();
541
+ break;
542
+ case 10: break;
543
+ }
544
+ this.#o !== 0 && t !== 10 && ([
545
+ 1,
546
+ 2,
547
+ 3,
548
+ 4
549
+ ].includes(this.#o) && [
550
+ 6,
551
+ 7,
552
+ 8,
553
+ 9
554
+ ].includes(t) && (this.#t.hostname ??= ""), [
555
+ 1,
556
+ 2,
557
+ 3,
558
+ 4,
559
+ 5,
560
+ 6
561
+ ].includes(this.#o) && [8, 9].includes(t) && (this.#t.pathname ??= this.#g ? "/" : ""), [
562
+ 1,
563
+ 2,
564
+ 3,
565
+ 4,
566
+ 5,
567
+ 6,
568
+ 7
569
+ ].includes(this.#o) && t === 9 && (this.#t.search ??= "")), this.#R(t, r);
570
+ }
571
+ #R(t, r) {
572
+ this.#o = t, this.#l = this.#e + r, this.#e += r, this.#s = 0;
573
+ }
574
+ #b() {
575
+ this.#e = this.#l, this.#s = 0;
576
+ }
577
+ #u(t) {
578
+ this.#b(), this.#o = t;
579
+ }
580
+ #m(t) {
581
+ return t < 0 && (t = this.#n.length - t), t < this.#n.length ? this.#n[t] : this.#n[this.#n.length - 1];
582
+ }
583
+ #a(t, r) {
584
+ let n = this.#m(t);
585
+ return n.value === r && (n.type === "CHAR" || n.type === "ESCAPED_CHAR" || n.type === "INVALID_CHAR");
586
+ }
587
+ #P() {
588
+ return this.#a(this.#e, ":");
589
+ }
590
+ #E() {
591
+ return this.#a(this.#e + 1, "/") && this.#a(this.#e + 2, "/");
592
+ }
593
+ #S() {
594
+ return this.#a(this.#e, "@");
595
+ }
596
+ #O() {
597
+ return this.#a(this.#e, ":");
598
+ }
599
+ #k() {
600
+ return this.#a(this.#e, ":");
601
+ }
602
+ #x() {
603
+ return this.#a(this.#e, "/");
604
+ }
605
+ #h() {
606
+ if (this.#a(this.#e, "?")) return !0;
607
+ if (this.#n[this.#e].value !== "?") return !1;
608
+ let t = this.#m(this.#e - 1);
609
+ return t.type !== "NAME" && t.type !== "REGEX" && t.type !== "CLOSE" && t.type !== "ASTERISK";
610
+ }
611
+ #f() {
612
+ return this.#a(this.#e, "#");
613
+ }
614
+ #T() {
615
+ return this.#n[this.#e].type == "OPEN";
616
+ }
617
+ #A() {
618
+ return this.#n[this.#e].type == "CLOSE";
619
+ }
620
+ #y() {
621
+ return this.#a(this.#e, "[");
622
+ }
623
+ #w() {
624
+ return this.#a(this.#e, "]");
625
+ }
626
+ #c() {
627
+ let t = this.#n[this.#e], r = this.#m(this.#l).index;
628
+ return this.#i.substring(r, t.index);
629
+ }
630
+ #C() {
631
+ let t = {};
632
+ Object.assign(t, b), t.encodePart = w;
633
+ this.#g = U(q(this.#c(), void 0, t));
634
+ }
635
+ };
636
+ a(C, "Parser");
637
+ var V = [
638
+ "protocol",
639
+ "username",
640
+ "password",
641
+ "hostname",
642
+ "port",
643
+ "pathname",
644
+ "search",
645
+ "hash"
646
+ ], O = "*";
647
+ function Se(e, t) {
648
+ if (typeof e != "string") throw new TypeError("parameter 1 is not of type 'string'.");
649
+ let r = new URL(e, t);
650
+ return {
651
+ protocol: r.protocol.substring(0, r.protocol.length - 1),
652
+ username: r.username,
653
+ password: r.password,
654
+ hostname: r.hostname,
655
+ port: r.port,
656
+ pathname: r.pathname,
657
+ search: r.search !== "" ? r.search.substring(1, r.search.length) : void 0,
658
+ hash: r.hash !== "" ? r.hash.substring(1, r.hash.length) : void 0
659
+ };
660
+ }
661
+ a(Se, "extractValues");
662
+ function R(e, t) {
663
+ return t ? I(e) : e;
664
+ }
665
+ a(R, "processBaseURLString");
666
+ function L(e, t, r) {
667
+ let n;
668
+ if (typeof t.baseURL == "string") try {
669
+ n = new URL(t.baseURL), t.protocol === void 0 && (e.protocol = R(n.protocol.substring(0, n.protocol.length - 1), r)), !r && t.protocol === void 0 && t.hostname === void 0 && t.port === void 0 && t.username === void 0 && (e.username = R(n.username, r)), !r && t.protocol === void 0 && t.hostname === void 0 && t.port === void 0 && t.username === void 0 && t.password === void 0 && (e.password = R(n.password, r)), t.protocol === void 0 && t.hostname === void 0 && (e.hostname = R(n.hostname, r)), t.protocol === void 0 && t.hostname === void 0 && t.port === void 0 && (e.port = R(n.port, r)), t.protocol === void 0 && t.hostname === void 0 && t.port === void 0 && t.pathname === void 0 && (e.pathname = R(n.pathname, r)), t.protocol === void 0 && t.hostname === void 0 && t.port === void 0 && t.pathname === void 0 && t.search === void 0 && (e.search = R(n.search.substring(1, n.search.length), r)), t.protocol === void 0 && t.hostname === void 0 && t.port === void 0 && t.pathname === void 0 && t.search === void 0 && t.hash === void 0 && (e.hash = R(n.hash.substring(1, n.hash.length), r));
670
+ } catch {
671
+ throw new TypeError(`invalid baseURL '${t.baseURL}'.`);
672
+ }
673
+ if (typeof t.protocol == "string" && (e.protocol = fe(t.protocol, r)), typeof t.username == "string" && (e.username = oe(t.username, r)), typeof t.password == "string" && (e.password = ae(t.password, r)), typeof t.hostname == "string" && (e.hostname = ie(t.hostname, r)), typeof t.port == "string" && (e.port = le(t.port, e.protocol, r)), typeof t.pathname == "string") {
674
+ if (e.pathname = t.pathname, n && !ee(e.pathname, r)) {
675
+ let c = n.pathname.lastIndexOf("/");
676
+ c >= 0 && (e.pathname = R(n.pathname.substring(0, c + 1), r) + e.pathname);
677
+ }
678
+ e.pathname = ce(e.pathname, e.protocol, r);
679
+ }
680
+ return typeof t.search == "string" && (e.search = se(t.search, r)), typeof t.hash == "string" && (e.hash = ne(t.hash, r)), e;
681
+ }
682
+ a(L, "applyInit");
683
+ function I(e) {
684
+ return e.replace(/([+*?:{}()\\])/g, "\\$1");
685
+ }
686
+ a(I, "escapePatternString");
687
+ function Te(e) {
688
+ return e.replace(/([.+*?^${}()[\]|/\\])/g, "\\$1");
689
+ }
690
+ a(Te, "escapeRegexpString");
691
+ function Ae(e, t) {
692
+ t.delimiter ??= "/#?", t.prefixes ??= "./", t.sensitive ??= !1, t.strict ??= !1, t.end ??= !0, t.start ??= !0, t.endsWith = "";
693
+ let r = ".*", n = `[^${Te(t.delimiter)}]+?`, c = /[$_\u200C\u200D\p{ID_Continue}]/u, l = "";
694
+ for (let f = 0; f < e.length; ++f) {
695
+ let s = e[f];
696
+ if (s.type === 3) {
697
+ if (s.modifier === 3) {
698
+ l += I(s.value);
699
+ continue;
700
+ }
701
+ l += `{${I(s.value)}}${T(s.modifier)}`;
702
+ continue;
703
+ }
704
+ let i = s.hasCustomName(), o = !!s.suffix.length || !!s.prefix.length && (s.prefix.length !== 1 || !t.prefixes.includes(s.prefix)), h = f > 0 ? e[f - 1] : null, p = f < e.length - 1 ? e[f + 1] : null;
705
+ if (!o && i && s.type === 1 && s.modifier === 3 && p && !p.prefix.length && !p.suffix.length) if (p.type === 3) {
706
+ let A = p.value.length > 0 ? p.value[0] : "";
707
+ o = c.test(A);
708
+ } else o = !p.hasCustomName();
709
+ if (!o && !s.prefix.length && h && h.type === 3) {
710
+ let A = h.value[h.value.length - 1];
711
+ o = t.prefixes.includes(A);
712
+ }
713
+ o && (l += "{"), l += I(s.prefix), i && (l += `:${s.name}`), s.type === 2 ? l += `(${s.value})` : s.type === 1 ? i || (l += `(${n})`) : s.type === 0 && (!i && (!h || h.type === 3 || h.modifier !== 3 || o || s.prefix !== "") ? l += "*" : l += `(${r})`), s.type === 1 && i && s.suffix.length && c.test(s.suffix[0]) && (l += "\\"), l += I(s.suffix), o && (l += "}"), s.modifier !== 3 && (l += T(s.modifier));
714
+ }
715
+ return l;
716
+ }
717
+ a(Ae, "partsToPattern");
718
+ var Y = class {
719
+ #i;
720
+ #n = {};
721
+ #t = {};
722
+ #e = {};
723
+ #s = {};
724
+ #l = !1;
725
+ constructor(t = {}, r, n) {
726
+ try {
727
+ let c;
728
+ if (typeof r == "string" ? c = r : n = r, typeof t == "string") {
729
+ let i = new C(t);
730
+ if (i.parse(), t = i.result, c === void 0 && typeof t.protocol != "string") throw new TypeError("A base URL must be provided for a relative constructor string.");
731
+ t.baseURL = c;
732
+ } else {
733
+ if (!t || typeof t != "object") throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");
734
+ if (c) throw new TypeError("parameter 1 is not of type 'string'.");
735
+ }
736
+ typeof n > "u" && (n = { ignoreCase: !1 });
737
+ let l = { ignoreCase: n.ignoreCase === !0 };
738
+ this.#i = L({
739
+ pathname: O,
740
+ protocol: O,
741
+ username: O,
742
+ password: O,
743
+ hostname: O,
744
+ port: O,
745
+ search: O,
746
+ hash: O
747
+ }, t, !0), z(this.#i.protocol) === this.#i.port && (this.#i.port = "");
748
+ let s;
749
+ for (s of V) {
750
+ if (!(s in this.#i)) continue;
751
+ let i = {}, o = this.#i[s];
752
+ switch (this.#t[s] = [], s) {
753
+ case "protocol":
754
+ Object.assign(i, b), i.encodePart = w;
755
+ break;
756
+ case "username":
757
+ Object.assign(i, b), i.encodePart = he;
758
+ break;
759
+ case "password":
760
+ Object.assign(i, b), i.encodePart = ue;
761
+ break;
762
+ case "hostname":
763
+ Object.assign(i, J), _(o) ? i.encodePart = K : i.encodePart = j;
764
+ break;
765
+ case "port":
766
+ Object.assign(i, b), i.encodePart = G;
767
+ break;
768
+ case "pathname":
769
+ U(this.#n.protocol) ? (Object.assign(i, Q, l), i.encodePart = de) : (Object.assign(i, b, l), i.encodePart = pe);
770
+ break;
771
+ case "search":
772
+ Object.assign(i, b, l), i.encodePart = ge;
773
+ break;
774
+ case "hash":
775
+ Object.assign(i, b, l), i.encodePart = me;
776
+ break;
777
+ }
778
+ try {
779
+ this.#s[s] = F(o, i), this.#n[s] = W(this.#s[s], this.#t[s], i), this.#e[s] = Ae(this.#s[s], i), this.#l = this.#l || this.#s[s].some((h) => h.type === 2);
780
+ } catch {
781
+ throw new TypeError(`invalid ${s} pattern '${this.#i[s]}'.`);
782
+ }
783
+ }
784
+ } catch (c) {
785
+ throw new TypeError(`Failed to construct 'URLPattern': ${c.message}`);
786
+ }
787
+ }
788
+ get [Symbol.toStringTag]() {
789
+ return "URLPattern";
790
+ }
791
+ test(t = {}, r) {
792
+ let n = {
793
+ pathname: "",
794
+ protocol: "",
795
+ username: "",
796
+ password: "",
797
+ hostname: "",
798
+ port: "",
799
+ search: "",
800
+ hash: ""
801
+ };
802
+ if (typeof t != "string" && r) throw new TypeError("parameter 1 is not of type 'string'.");
803
+ if (typeof t > "u") return !1;
804
+ try {
805
+ typeof t == "object" ? n = L(n, t, !1) : n = L(n, Se(t, r), !1);
806
+ } catch {
807
+ return !1;
808
+ }
809
+ let c;
810
+ for (c of V) if (!this.#n[c].exec(n[c])) return !1;
811
+ return !0;
812
+ }
813
+ exec(t = {}, r) {
814
+ let n = {
815
+ pathname: "",
816
+ protocol: "",
817
+ username: "",
818
+ password: "",
819
+ hostname: "",
820
+ port: "",
821
+ search: "",
822
+ hash: ""
823
+ };
824
+ if (typeof t != "string" && r) throw new TypeError("parameter 1 is not of type 'string'.");
825
+ if (typeof t > "u") return;
826
+ try {
827
+ typeof t == "object" ? n = L(n, t, !1) : n = L(n, Se(t, r), !1);
828
+ } catch {
829
+ return null;
830
+ }
831
+ let c = {};
832
+ r ? c.inputs = [t, r] : c.inputs = [t];
833
+ let l;
834
+ for (l of V) {
835
+ let f = this.#n[l].exec(n[l]);
836
+ if (!f) return null;
837
+ let s = {};
838
+ for (let [i, o] of this.#t[l].entries()) if (typeof o == "string" || typeof o == "number") s[o] = f[i + 1];
839
+ c[l] = {
840
+ input: n[l] ?? "",
841
+ groups: s
842
+ };
843
+ }
844
+ return c;
845
+ }
846
+ static compareComponent(t, r, n) {
847
+ let c = a((i, o) => {
848
+ for (let h of [
849
+ "type",
850
+ "modifier",
851
+ "prefix",
852
+ "value",
853
+ "suffix"
854
+ ]) {
855
+ if (i[h] < o[h]) return -1;
856
+ if (i[h] === o[h]) continue;
857
+ return 1;
858
+ }
859
+ return 0;
860
+ }, "comparePart"), l = new P(3, "", "", "", "", 3), f = new P(0, "", "", "", "", 3), s = a((i, o) => {
861
+ let h = 0;
862
+ for (; h < Math.min(i.length, o.length); ++h) {
863
+ let p = c(i[h], o[h]);
864
+ if (p) return p;
865
+ }
866
+ return i.length === o.length ? 0 : c(i[h] ?? l, o[h] ?? l);
867
+ }, "comparePartList");
868
+ return !r.#e[t] && !n.#e[t] ? 0 : r.#e[t] && !n.#e[t] ? s(r.#s[t], [f]) : !r.#e[t] && n.#e[t] ? s([f], n.#s[t]) : s(r.#s[t], n.#s[t]);
869
+ }
870
+ get protocol() {
871
+ return this.#e.protocol;
872
+ }
873
+ get username() {
874
+ return this.#e.username;
875
+ }
876
+ get password() {
877
+ return this.#e.password;
878
+ }
879
+ get hostname() {
880
+ return this.#e.hostname;
881
+ }
882
+ get port() {
883
+ return this.#e.port;
884
+ }
885
+ get pathname() {
886
+ return this.#e.pathname;
887
+ }
888
+ get search() {
889
+ return this.#e.search;
890
+ }
891
+ get hash() {
892
+ return this.#e.hash;
893
+ }
894
+ get hasRegExpGroups() {
895
+ return this.#l;
896
+ }
897
+ };
898
+ a(Y, "URLPattern");
899
+
900
+ //#endregion
901
+ export { Y };
902
+ //# sourceMappingURL=urlpattern.mjs.map