react-native-consumet 1.5.0 → 2.0.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 (1055) hide show
  1. package/Consumet.podspec +11 -2
  2. package/README.md +30 -14
  3. package/android/build.gradle +9 -8
  4. package/android/generated/java/com/consumet/NativeConsumetSpec.java +0 -4
  5. package/android/generated/jni/CMakeLists.txt +1 -9
  6. package/android/generated/jni/RNConsumetSpec-generated.cpp +0 -6
  7. package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI.h +56 -93
  8. package/android/src/androidTest/AndroidManifest.xml +4 -0
  9. package/android/src/androidTest/java/com/consumet/DeobfuscatorModuleTest.kt +88 -0
  10. package/android/src/androidTest/java/com/consumet/SynchronyEngineTest.kt +75 -0
  11. package/android/src/androidTest/java/com/consumet/TestSupport.kt +115 -0
  12. package/android/src/androidTest/java/com/consumet/WebViewContractTest.kt +125 -0
  13. package/android/src/main/java/com/consumet/ConsumetModule.kt +0 -13
  14. package/android/src/main/java/com/consumet/DdosGuardModule.kt +26 -60
  15. package/android/src/main/java/com/consumet/DeobfuscatorModule.kt +59 -68
  16. package/android/src/main/java/com/consumet/HttpRequestModule.kt +171 -285
  17. package/android/src/main/java/com/consumet/Synchrony.kt +65 -0
  18. package/android/src/main/java/com/consumet/SynchronyScriptCache.kt +121 -0
  19. package/android/src/main/java/com/consumet/WebViewDebugging.kt +36 -0
  20. package/android/src/main/java/com/consumet/WebViewTask.kt +101 -0
  21. package/ios/Consumet.h +1 -1
  22. package/ios/Consumet.mm +703 -8
  23. package/ios/RCConsumetSynchronyCache.h +51 -0
  24. package/ios/RCConsumetSynchronyCache.m +246 -0
  25. package/ios/generated/Package.swift +66 -0
  26. package/ios/generated/ReactAppDependencyProvider/RCTAppDependencyProvider.h +25 -0
  27. package/ios/generated/ReactAppDependencyProvider/RCTAppDependencyProvider.mm +40 -0
  28. package/ios/generated/ReactAppDependencyProvider/ReactAppDependencyProvider.podspec +34 -0
  29. package/ios/generated/ReactCodegen/RCTModuleProviders.h +16 -0
  30. package/ios/generated/ReactCodegen/RCTModuleProviders.mm +51 -0
  31. package/ios/generated/ReactCodegen/RCTModulesConformingToProtocolsProvider.h +18 -0
  32. package/ios/generated/ReactCodegen/RCTModulesConformingToProtocolsProvider.mm +54 -0
  33. package/ios/generated/ReactCodegen/RCTThirdPartyComponentsProvider.h +16 -0
  34. package/ios/generated/ReactCodegen/RCTThirdPartyComponentsProvider.mm +30 -0
  35. package/ios/generated/ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.h +14 -0
  36. package/ios/generated/ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.mm +19 -0
  37. package/ios/generated/{RNConsumetSpec → ReactCodegen/RNConsumetSpec}/RNConsumetSpec-generated.mm +0 -7
  38. package/ios/generated/{RNConsumetSpec → ReactCodegen/RNConsumetSpec}/RNConsumetSpec.h +0 -2
  39. package/ios/generated/ReactCodegen/RNConsumetSpecJSI.h +88 -0
  40. package/ios/generated/ReactCodegen/ReactCodegen.podspec +114 -0
  41. package/lib/commonjs/NativeConsumet.ts +68 -2
  42. package/lib/commonjs/extension-registry.json +229 -61
  43. package/lib/commonjs/extension-registry.json.sig +1 -0
  44. package/lib/commonjs/extractors/asianload.js +11 -5
  45. package/lib/commonjs/extractors/asianload.js.map +1 -1
  46. package/lib/commonjs/extractors/filemoon.js +11 -6
  47. package/lib/commonjs/extractors/filemoon.js.map +1 -1
  48. package/lib/commonjs/extractors/flixcloud.js +0 -2
  49. package/lib/commonjs/extractors/flixcloud.js.map +1 -1
  50. package/lib/commonjs/extractors/gdflix.js +0 -2
  51. package/lib/commonjs/extractors/gdflix.js.map +1 -1
  52. package/lib/commonjs/extractors/gofile.js +0 -2
  53. package/lib/commonjs/extractors/gofile.js.map +1 -1
  54. package/lib/commonjs/extractors/gogocdn.js +13 -7
  55. package/lib/commonjs/extractors/gogocdn.js.map +1 -1
  56. package/lib/commonjs/extractors/hubcloud.js +0 -2
  57. package/lib/commonjs/extractors/hubcloud.js.map +1 -1
  58. package/lib/commonjs/extractors/index.js +28 -29
  59. package/lib/commonjs/extractors/index.js.map +1 -1
  60. package/lib/commonjs/extractors/kwik.js +0 -2
  61. package/lib/commonjs/extractors/kwik.js.map +1 -1
  62. package/lib/commonjs/extractors/megaplay.js +0 -2
  63. package/lib/commonjs/extractors/megaplay.js.map +1 -1
  64. package/lib/commonjs/extractors/megaup.js +2 -6
  65. package/lib/commonjs/extractors/megaup.js.map +1 -1
  66. package/lib/commonjs/extractors/mixdrop.js +10 -5
  67. package/lib/commonjs/extractors/mixdrop.js.map +1 -1
  68. package/lib/commonjs/extractors/mp4player.js +11 -6
  69. package/lib/commonjs/extractors/mp4player.js.map +1 -1
  70. package/lib/commonjs/extractors/mp4upload.js +10 -5
  71. package/lib/commonjs/extractors/mp4upload.js.map +1 -1
  72. package/lib/commonjs/extractors/rapidcloud.js +16 -10
  73. package/lib/commonjs/extractors/rapidcloud.js.map +1 -1
  74. package/lib/commonjs/extractors/streamhub.js +11 -6
  75. package/lib/commonjs/extractors/streamhub.js.map +1 -1
  76. package/lib/commonjs/extractors/streamlare.js +13 -8
  77. package/lib/commonjs/extractors/streamlare.js.map +1 -1
  78. package/lib/commonjs/extractors/streamsb.js +11 -6
  79. package/lib/commonjs/extractors/streamsb.js.map +1 -1
  80. package/lib/commonjs/extractors/streamtape.js +10 -5
  81. package/lib/commonjs/extractors/streamtape.js.map +1 -1
  82. package/lib/commonjs/extractors/vidhide.js +4 -4
  83. package/lib/commonjs/extractors/vidhide.js.map +1 -1
  84. package/lib/commonjs/extractors/vidmoly.js +11 -6
  85. package/lib/commonjs/extractors/vidmoly.js.map +1 -1
  86. package/lib/commonjs/extractors/vizcloud.js +11 -6
  87. package/lib/commonjs/extractors/vizcloud.js.map +1 -1
  88. package/lib/commonjs/extractors/voe.js +11 -6
  89. package/lib/commonjs/extractors/voe.js.map +1 -1
  90. package/lib/commonjs/index.js +112 -0
  91. package/lib/commonjs/index.js.map +1 -1
  92. package/lib/commonjs/models/base-provider.js +4 -0
  93. package/lib/commonjs/models/base-provider.js.map +1 -1
  94. package/lib/commonjs/models/extension-manifest.js +0 -4
  95. package/lib/commonjs/models/index.js +7 -0
  96. package/lib/commonjs/models/index.js.map +1 -1
  97. package/lib/commonjs/models/meta-error.js +36 -0
  98. package/lib/commonjs/models/meta-error.js.map +1 -0
  99. package/lib/commonjs/models/types.js +15 -0
  100. package/lib/commonjs/models/types.js.map +1 -1
  101. package/lib/commonjs/providers/anime/anikoto/anikoto.js +14 -10
  102. package/lib/commonjs/providers/anime/anikoto/anikoto.js.map +1 -1
  103. package/lib/commonjs/providers/anime/anikoto/create-anikoto.js +17 -8
  104. package/lib/commonjs/providers/anime/anikoto/create-anikoto.js.map +1 -1
  105. package/lib/commonjs/providers/anime/animekai/animekai.js +14 -8
  106. package/lib/commonjs/providers/anime/animekai/animekai.js.map +1 -1
  107. package/lib/commonjs/providers/anime/animekai/create-animekai.js +6 -4
  108. package/lib/commonjs/providers/anime/animekai/create-animekai.js.map +1 -1
  109. package/lib/commonjs/providers/anime/animepahe/animepahe.js +17 -11
  110. package/lib/commonjs/providers/anime/animepahe/animepahe.js.map +1 -1
  111. package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +6 -15
  112. package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
  113. package/lib/commonjs/providers/anime/animeunity.js +23 -10
  114. package/lib/commonjs/providers/anime/animeunity.js.map +1 -1
  115. package/lib/commonjs/providers/anime/anineko/anineko.js +18 -8
  116. package/lib/commonjs/providers/anime/anineko/anineko.js.map +1 -1
  117. package/lib/commonjs/providers/anime/anineko/create-anineko.js +4 -2
  118. package/lib/commonjs/providers/anime/anineko/create-anineko.js.map +1 -1
  119. package/lib/commonjs/providers/anime/index.js +26 -35
  120. package/lib/commonjs/providers/anime/index.js.map +1 -1
  121. package/lib/commonjs/providers/anime/reanime/create-reanime.js +4 -5
  122. package/lib/commonjs/providers/anime/reanime/create-reanime.js.map +1 -1
  123. package/lib/commonjs/providers/anime/reanime/reanime.js +13 -8
  124. package/lib/commonjs/providers/anime/reanime/reanime.js.map +1 -1
  125. package/lib/commonjs/providers/anime/zoro/create-zoro.js +8 -8
  126. package/lib/commonjs/providers/anime/zoro/create-zoro.js.map +1 -1
  127. package/lib/commonjs/providers/anime/zoro/zoro.js +17 -11
  128. package/lib/commonjs/providers/anime/zoro/zoro.js.map +1 -1
  129. package/lib/commonjs/providers/index.js +8 -8
  130. package/lib/commonjs/providers/index.js.map +1 -1
  131. package/lib/commonjs/providers/light-novels/index.js +6 -7
  132. package/lib/commonjs/providers/light-novels/index.js.map +1 -1
  133. package/lib/commonjs/providers/light-novels/novelupdates.js +32 -11
  134. package/lib/commonjs/providers/light-novels/novelupdates.js.map +1 -1
  135. package/lib/commonjs/providers/light-novels/readlightnovels.js +15 -7
  136. package/lib/commonjs/providers/light-novels/readlightnovels.js.map +1 -1
  137. package/lib/commonjs/providers/manga/asurascans.js +12 -7
  138. package/lib/commonjs/providers/manga/asurascans.js.map +1 -1
  139. package/lib/commonjs/providers/manga/brmangas.js +12 -7
  140. package/lib/commonjs/providers/manga/brmangas.js.map +1 -1
  141. package/lib/commonjs/providers/manga/comick.js +21 -16
  142. package/lib/commonjs/providers/manga/comick.js.map +1 -1
  143. package/lib/commonjs/providers/manga/flamescans.js +12 -7
  144. package/lib/commonjs/providers/manga/flamescans.js.map +1 -1
  145. package/lib/commonjs/providers/manga/index.js +28 -31
  146. package/lib/commonjs/providers/manga/index.js.map +1 -1
  147. package/lib/commonjs/providers/manga/mangadex.js +18 -13
  148. package/lib/commonjs/providers/manga/mangadex.js.map +1 -1
  149. package/lib/commonjs/providers/manga/mangahere.js +13 -8
  150. package/lib/commonjs/providers/manga/mangahere.js.map +1 -1
  151. package/lib/commonjs/providers/manga/mangahost.js +12 -7
  152. package/lib/commonjs/providers/manga/mangahost.js.map +1 -1
  153. package/lib/commonjs/providers/manga/mangakakalot.js +12 -7
  154. package/lib/commonjs/providers/manga/mangakakalot.js.map +1 -1
  155. package/lib/commonjs/providers/manga/mangapark.js +12 -7
  156. package/lib/commonjs/providers/manga/mangapark.js.map +1 -1
  157. package/lib/commonjs/providers/manga/mangapill.js +12 -7
  158. package/lib/commonjs/providers/manga/mangapill.js.map +1 -1
  159. package/lib/commonjs/providers/manga/mangareader.js +13 -8
  160. package/lib/commonjs/providers/manga/mangareader.js.map +1 -1
  161. package/lib/commonjs/providers/manga/mangasee123.js +12 -7
  162. package/lib/commonjs/providers/manga/mangasee123.js.map +1 -1
  163. package/lib/commonjs/providers/manga/readmanga.js +20 -9
  164. package/lib/commonjs/providers/manga/readmanga.js.map +1 -1
  165. package/lib/commonjs/providers/manga/vyvymanga.js +13 -8
  166. package/lib/commonjs/providers/manga/vyvymanga.js.map +1 -1
  167. package/lib/commonjs/providers/meta/anilist.js +560 -1024
  168. package/lib/commonjs/providers/meta/anilist.js.map +1 -1
  169. package/lib/commonjs/providers/meta/index.js +1 -0
  170. package/lib/commonjs/providers/meta/index.js.map +1 -1
  171. package/lib/commonjs/providers/meta/mal.js +86 -89
  172. package/lib/commonjs/providers/meta/mal.js.map +1 -1
  173. package/lib/commonjs/providers/meta/tmdb-api-key.js +29 -0
  174. package/lib/commonjs/providers/meta/tmdb-api-key.js.map +1 -0
  175. package/lib/commonjs/providers/meta/tmdb.js +122 -94
  176. package/lib/commonjs/providers/meta/tmdb.js.map +1 -1
  177. package/lib/commonjs/providers/movies/himovies/create-himovies.js +3 -3
  178. package/lib/commonjs/providers/movies/himovies/create-himovies.js.map +1 -1
  179. package/lib/commonjs/providers/movies/himovies/himovies.js +13 -8
  180. package/lib/commonjs/providers/movies/himovies/himovies.js.map +1 -1
  181. package/lib/commonjs/providers/movies/index.js +20 -30
  182. package/lib/commonjs/providers/movies/index.js.map +1 -1
  183. package/lib/commonjs/providers/movies/multimovies/create-multimovies.js +3 -3
  184. package/lib/commonjs/providers/movies/multimovies/create-multimovies.js.map +1 -1
  185. package/lib/commonjs/providers/movies/multimovies/multimovies.js +13 -8
  186. package/lib/commonjs/providers/movies/multimovies/multimovies.js.map +1 -1
  187. package/lib/commonjs/providers/movies/multistream/index.js +28 -17
  188. package/lib/commonjs/providers/movies/multistream/index.js.map +1 -1
  189. package/lib/commonjs/providers/movies/multistream/utils.js +18 -19
  190. package/lib/commonjs/providers/movies/multistream/utils.js.map +1 -1
  191. package/lib/commonjs/providers/movies/netflixmirror/create-netflixmirror.js +451 -185
  192. package/lib/commonjs/providers/movies/netflixmirror/create-netflixmirror.js.map +1 -1
  193. package/lib/commonjs/providers/movies/netflixmirror/disneymirror.js +22 -0
  194. package/lib/commonjs/providers/movies/netflixmirror/disneymirror.js.map +1 -0
  195. package/lib/commonjs/providers/movies/netflixmirror/netflixmirror.js +11 -24
  196. package/lib/commonjs/providers/movies/netflixmirror/netflixmirror.js.map +1 -1
  197. package/lib/commonjs/providers/movies/netflixmirror/netmirror-parser.js +30 -0
  198. package/lib/commonjs/providers/movies/netflixmirror/netmirror-parser.js.map +1 -0
  199. package/lib/commonjs/providers/movies/netflixmirror/primemirror.js +22 -0
  200. package/lib/commonjs/providers/movies/netflixmirror/primemirror.js.map +1 -0
  201. package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js +67 -50
  202. package/lib/commonjs/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
  203. package/lib/commonjs/providers/movies/vegamovies/vegamovies.js +11 -14
  204. package/lib/commonjs/providers/movies/vegamovies/vegamovies.js.map +1 -1
  205. package/lib/commonjs/providers/movies/yflix/create-yflix.js +2 -2
  206. package/lib/commonjs/providers/movies/yflix/create-yflix.js.map +1 -1
  207. package/lib/commonjs/providers/movies/yflix/yflix.js +13 -6
  208. package/lib/commonjs/providers/movies/yflix/yflix.js.map +1 -1
  209. package/lib/commonjs/providers/provider-args.js +17 -0
  210. package/lib/commonjs/providers/provider-args.js.map +1 -0
  211. package/lib/commonjs/registry-signing-keys.js +26 -0
  212. package/lib/commonjs/registry-signing-keys.js.map +1 -0
  213. package/lib/commonjs/utils/ExtractorManager.js +136 -247
  214. package/lib/commonjs/utils/ExtractorManager.js.map +1 -1
  215. package/lib/commonjs/utils/ProviderManager.js +179 -259
  216. package/lib/commonjs/utils/ProviderManager.js.map +1 -1
  217. package/lib/commonjs/utils/create-extractor-context.js +0 -1
  218. package/lib/commonjs/utils/create-extractor-context.js.map +1 -1
  219. package/lib/commonjs/utils/create-provider-context.js +37 -29
  220. package/lib/commonjs/utils/create-provider-context.js.map +1 -1
  221. package/lib/commonjs/utils/extension-integrity.js +62 -0
  222. package/lib/commonjs/utils/extension-integrity.js.map +1 -0
  223. package/lib/commonjs/utils/extension-modules.js +109 -0
  224. package/lib/commonjs/utils/extension-modules.js.map +1 -0
  225. package/lib/commonjs/utils/extension-utils.js +46 -40
  226. package/lib/commonjs/utils/extension-utils.js.map +1 -1
  227. package/lib/commonjs/utils/fetch-with-timeout.js +76 -0
  228. package/lib/commonjs/utils/fetch-with-timeout.js.map +1 -0
  229. package/lib/commonjs/utils/index.js +77 -2
  230. package/lib/commonjs/utils/index.js.map +1 -1
  231. package/lib/commonjs/utils/meta-http.js +42 -0
  232. package/lib/commonjs/utils/meta-http.js.map +1 -0
  233. package/lib/commonjs/utils/provider-maps.js +26 -18
  234. package/lib/commonjs/utils/provider-maps.js.map +1 -1
  235. package/lib/commonjs/utils/queries.js +24 -11
  236. package/lib/commonjs/utils/queries.js.map +1 -1
  237. package/lib/commonjs/utils/registry-schema.js +263 -0
  238. package/lib/commonjs/utils/registry-schema.js.map +1 -0
  239. package/lib/commonjs/utils/registry-signature.js +180 -0
  240. package/lib/commonjs/utils/registry-signature.js.map +1 -0
  241. package/lib/commonjs/utils/url-polyfill.js +1075 -426
  242. package/lib/commonjs/utils/url-polyfill.js.map +1 -1
  243. package/lib/commonjs/utils/utils.js +2 -30
  244. package/lib/commonjs/utils/utils.js.map +1 -1
  245. package/lib/module/NativeConsumet.ts +68 -2
  246. package/lib/module/extension-registry.json +229 -61
  247. package/lib/module/extension-registry.json.sig +1 -0
  248. package/lib/module/extractors/asianload.js +10 -5
  249. package/lib/module/extractors/asianload.js.map +1 -1
  250. package/lib/module/extractors/filemoon.js +10 -5
  251. package/lib/module/extractors/filemoon.js.map +1 -1
  252. package/lib/module/extractors/flixcloud.js +0 -1
  253. package/lib/module/extractors/flixcloud.js.map +1 -1
  254. package/lib/module/extractors/gdflix.js +0 -1
  255. package/lib/module/extractors/gdflix.js.map +1 -1
  256. package/lib/module/extractors/gofile.js +0 -1
  257. package/lib/module/extractors/gofile.js.map +1 -1
  258. package/lib/module/extractors/gogocdn.js +12 -7
  259. package/lib/module/extractors/gogocdn.js.map +1 -1
  260. package/lib/module/extractors/hubcloud.js +0 -1
  261. package/lib/module/extractors/hubcloud.js.map +1 -1
  262. package/lib/module/extractors/index.js +24 -25
  263. package/lib/module/extractors/index.js.map +1 -1
  264. package/lib/module/extractors/kwik.js +0 -1
  265. package/lib/module/extractors/kwik.js.map +1 -1
  266. package/lib/module/extractors/megaplay.js +0 -1
  267. package/lib/module/extractors/megaplay.js.map +1 -1
  268. package/lib/module/extractors/megaup.js +2 -4
  269. package/lib/module/extractors/megaup.js.map +1 -1
  270. package/lib/module/extractors/mixdrop.js +9 -4
  271. package/lib/module/extractors/mixdrop.js.map +1 -1
  272. package/lib/module/extractors/mp4player.js +10 -5
  273. package/lib/module/extractors/mp4player.js.map +1 -1
  274. package/lib/module/extractors/mp4upload.js +9 -4
  275. package/lib/module/extractors/mp4upload.js.map +1 -1
  276. package/lib/module/extractors/rapidcloud.js +15 -10
  277. package/lib/module/extractors/rapidcloud.js.map +1 -1
  278. package/lib/module/extractors/streamhub.js +10 -5
  279. package/lib/module/extractors/streamhub.js.map +1 -1
  280. package/lib/module/extractors/streamlare.js +11 -6
  281. package/lib/module/extractors/streamlare.js.map +1 -1
  282. package/lib/module/extractors/streamsb.js +10 -5
  283. package/lib/module/extractors/streamsb.js.map +1 -1
  284. package/lib/module/extractors/streamtape.js +9 -4
  285. package/lib/module/extractors/streamtape.js.map +1 -1
  286. package/lib/module/extractors/vidhide.js +4 -3
  287. package/lib/module/extractors/vidhide.js.map +1 -1
  288. package/lib/module/extractors/vidmoly.js +10 -5
  289. package/lib/module/extractors/vidmoly.js.map +1 -1
  290. package/lib/module/extractors/vizcloud.js +10 -5
  291. package/lib/module/extractors/vizcloud.js.map +1 -1
  292. package/lib/module/extractors/voe.js +10 -5
  293. package/lib/module/extractors/voe.js.map +1 -1
  294. package/lib/module/index.js +11 -7
  295. package/lib/module/index.js.map +1 -1
  296. package/lib/module/models/base-provider.js +4 -0
  297. package/lib/module/models/base-provider.js.map +1 -1
  298. package/lib/module/models/extension-manifest.js +0 -2
  299. package/lib/module/models/index.js +2 -1
  300. package/lib/module/models/index.js.map +1 -1
  301. package/lib/module/models/meta-error.js +31 -0
  302. package/lib/module/models/meta-error.js.map +1 -0
  303. package/lib/module/models/types.js +21 -0
  304. package/lib/module/models/types.js.map +1 -1
  305. package/lib/module/providers/anime/anikoto/anikoto.js +13 -8
  306. package/lib/module/providers/anime/anikoto/anikoto.js.map +1 -1
  307. package/lib/module/providers/anime/anikoto/create-anikoto.js +17 -8
  308. package/lib/module/providers/anime/anikoto/create-anikoto.js.map +1 -1
  309. package/lib/module/providers/anime/animekai/animekai.js +13 -6
  310. package/lib/module/providers/anime/animekai/animekai.js.map +1 -1
  311. package/lib/module/providers/anime/animekai/create-animekai.js +6 -4
  312. package/lib/module/providers/anime/animekai/create-animekai.js.map +1 -1
  313. package/lib/module/providers/anime/animepahe/animepahe.js +13 -8
  314. package/lib/module/providers/anime/animepahe/animepahe.js.map +1 -1
  315. package/lib/module/providers/anime/animepahe/create-animepahe.js +6 -15
  316. package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
  317. package/lib/module/providers/anime/animeunity.js +21 -9
  318. package/lib/module/providers/anime/animeunity.js.map +1 -1
  319. package/lib/module/providers/anime/anineko/anineko.js +17 -6
  320. package/lib/module/providers/anime/anineko/anineko.js.map +1 -1
  321. package/lib/module/providers/anime/anineko/create-anineko.js +4 -2
  322. package/lib/module/providers/anime/anineko/create-anineko.js.map +1 -1
  323. package/lib/module/providers/anime/index.js +13 -21
  324. package/lib/module/providers/anime/index.js.map +1 -1
  325. package/lib/module/providers/anime/reanime/create-reanime.js +3 -4
  326. package/lib/module/providers/anime/reanime/create-reanime.js.map +1 -1
  327. package/lib/module/providers/anime/reanime/reanime.js +12 -6
  328. package/lib/module/providers/anime/reanime/reanime.js.map +1 -1
  329. package/lib/module/providers/anime/zoro/create-zoro.js +8 -9
  330. package/lib/module/providers/anime/zoro/create-zoro.js.map +1 -1
  331. package/lib/module/providers/anime/zoro/zoro.js +13 -8
  332. package/lib/module/providers/anime/zoro/zoro.js.map +1 -1
  333. package/lib/module/providers/index.js +4 -4
  334. package/lib/module/providers/index.js.map +1 -1
  335. package/lib/module/providers/light-novels/index.js +3 -3
  336. package/lib/module/providers/light-novels/index.js.map +1 -1
  337. package/lib/module/providers/light-novels/novelupdates.js +29 -11
  338. package/lib/module/providers/light-novels/novelupdates.js.map +1 -1
  339. package/lib/module/providers/light-novels/readlightnovels.js +12 -7
  340. package/lib/module/providers/light-novels/readlightnovels.js.map +1 -1
  341. package/lib/module/providers/manga/asurascans.js +11 -6
  342. package/lib/module/providers/manga/asurascans.js.map +1 -1
  343. package/lib/module/providers/manga/brmangas.js +11 -6
  344. package/lib/module/providers/manga/brmangas.js.map +1 -1
  345. package/lib/module/providers/manga/comick.js +20 -16
  346. package/lib/module/providers/manga/comick.js.map +1 -1
  347. package/lib/module/providers/manga/flamescans.js +11 -6
  348. package/lib/module/providers/manga/flamescans.js.map +1 -1
  349. package/lib/module/providers/manga/index.js +14 -16
  350. package/lib/module/providers/manga/index.js.map +1 -1
  351. package/lib/module/providers/manga/mangadex.js +17 -13
  352. package/lib/module/providers/manga/mangadex.js.map +1 -1
  353. package/lib/module/providers/manga/mangahere.js +12 -7
  354. package/lib/module/providers/manga/mangahere.js.map +1 -1
  355. package/lib/module/providers/manga/mangahost.js +11 -6
  356. package/lib/module/providers/manga/mangahost.js.map +1 -1
  357. package/lib/module/providers/manga/mangakakalot.js +11 -6
  358. package/lib/module/providers/manga/mangakakalot.js.map +1 -1
  359. package/lib/module/providers/manga/mangapark.js +11 -6
  360. package/lib/module/providers/manga/mangapark.js.map +1 -1
  361. package/lib/module/providers/manga/mangapill.js +11 -7
  362. package/lib/module/providers/manga/mangapill.js.map +1 -1
  363. package/lib/module/providers/manga/mangareader.js +12 -8
  364. package/lib/module/providers/manga/mangareader.js.map +1 -1
  365. package/lib/module/providers/manga/mangasee123.js +11 -7
  366. package/lib/module/providers/manga/mangasee123.js.map +1 -1
  367. package/lib/module/providers/manga/readmanga.js +19 -8
  368. package/lib/module/providers/manga/readmanga.js.map +1 -1
  369. package/lib/module/providers/manga/vyvymanga.js +12 -7
  370. package/lib/module/providers/manga/vyvymanga.js.map +1 -1
  371. package/lib/module/providers/meta/anilist.js +562 -1024
  372. package/lib/module/providers/meta/anilist.js.map +1 -1
  373. package/lib/module/providers/meta/index.js +1 -0
  374. package/lib/module/providers/meta/index.js.map +1 -1
  375. package/lib/module/providers/meta/mal.js +87 -89
  376. package/lib/module/providers/meta/mal.js.map +1 -1
  377. package/lib/module/providers/meta/tmdb-api-key.js +24 -0
  378. package/lib/module/providers/meta/tmdb-api-key.js.map +1 -0
  379. package/lib/module/providers/meta/tmdb.js +123 -93
  380. package/lib/module/providers/meta/tmdb.js.map +1 -1
  381. package/lib/module/providers/movies/himovies/create-himovies.js +3 -3
  382. package/lib/module/providers/movies/himovies/create-himovies.js.map +1 -1
  383. package/lib/module/providers/movies/himovies/himovies.js +12 -9
  384. package/lib/module/providers/movies/himovies/himovies.js.map +1 -1
  385. package/lib/module/providers/movies/index.js +14 -11
  386. package/lib/module/providers/movies/index.js.map +1 -1
  387. package/lib/module/providers/movies/multimovies/create-multimovies.js +3 -3
  388. package/lib/module/providers/movies/multimovies/create-multimovies.js.map +1 -1
  389. package/lib/module/providers/movies/multimovies/multimovies.js +12 -8
  390. package/lib/module/providers/movies/multimovies/multimovies.js.map +1 -1
  391. package/lib/module/providers/movies/multistream/index.js +27 -17
  392. package/lib/module/providers/movies/multistream/index.js.map +1 -1
  393. package/lib/module/providers/movies/multistream/utils.js +8 -9
  394. package/lib/module/providers/movies/multistream/utils.js.map +1 -1
  395. package/lib/module/providers/movies/netflixmirror/create-netflixmirror.js +449 -185
  396. package/lib/module/providers/movies/netflixmirror/create-netflixmirror.js.map +1 -1
  397. package/lib/module/providers/movies/netflixmirror/disneymirror.js +17 -0
  398. package/lib/module/providers/movies/netflixmirror/disneymirror.js.map +1 -0
  399. package/lib/module/providers/movies/netflixmirror/netflixmirror.js +9 -24
  400. package/lib/module/providers/movies/netflixmirror/netflixmirror.js.map +1 -1
  401. package/lib/module/providers/movies/netflixmirror/netmirror-parser.js +25 -0
  402. package/lib/module/providers/movies/netflixmirror/netmirror-parser.js.map +1 -0
  403. package/lib/module/providers/movies/netflixmirror/primemirror.js +17 -0
  404. package/lib/module/providers/movies/netflixmirror/primemirror.js.map +1 -0
  405. package/lib/module/providers/movies/vegamovies/create-vegamovies.js +67 -50
  406. package/lib/module/providers/movies/vegamovies/create-vegamovies.js.map +1 -1
  407. package/lib/module/providers/movies/vegamovies/vegamovies.js +12 -10
  408. package/lib/module/providers/movies/vegamovies/vegamovies.js.map +1 -1
  409. package/lib/module/providers/movies/yflix/create-yflix.js +2 -2
  410. package/lib/module/providers/movies/yflix/create-yflix.js.map +1 -1
  411. package/lib/module/providers/movies/yflix/yflix.js +12 -6
  412. package/lib/module/providers/movies/yflix/yflix.js.map +1 -1
  413. package/lib/module/providers/provider-args.js +14 -0
  414. package/lib/module/providers/provider-args.js.map +1 -0
  415. package/lib/module/registry-signing-keys.js +22 -0
  416. package/lib/module/registry-signing-keys.js.map +1 -0
  417. package/lib/module/utils/ExtractorManager.js +138 -248
  418. package/lib/module/utils/ExtractorManager.js.map +1 -1
  419. package/lib/module/utils/ProviderManager.js +178 -258
  420. package/lib/module/utils/ProviderManager.js.map +1 -1
  421. package/lib/module/utils/create-extractor-context.js +1 -2
  422. package/lib/module/utils/create-extractor-context.js.map +1 -1
  423. package/lib/module/utils/create-provider-context.js +39 -30
  424. package/lib/module/utils/create-provider-context.js.map +1 -1
  425. package/lib/module/utils/extension-integrity.js +52 -0
  426. package/lib/module/utils/extension-integrity.js.map +1 -0
  427. package/lib/module/utils/extension-modules.js +101 -0
  428. package/lib/module/utils/extension-modules.js.map +1 -0
  429. package/lib/module/utils/extension-utils.js +46 -40
  430. package/lib/module/utils/extension-utils.js.map +1 -1
  431. package/lib/module/utils/fetch-with-timeout.js +71 -0
  432. package/lib/module/utils/fetch-with-timeout.js.map +1 -0
  433. package/lib/module/utils/index.js +6 -3
  434. package/lib/module/utils/index.js.map +1 -1
  435. package/lib/module/utils/meta-http.js +37 -0
  436. package/lib/module/utils/meta-http.js.map +1 -0
  437. package/lib/module/utils/provider-maps.js +26 -18
  438. package/lib/module/utils/provider-maps.js.map +1 -1
  439. package/lib/module/utils/queries.js +22 -9
  440. package/lib/module/utils/queries.js.map +1 -1
  441. package/lib/module/utils/registry-schema.js +255 -0
  442. package/lib/module/utils/registry-schema.js.map +1 -0
  443. package/lib/module/utils/registry-signature.js +168 -0
  444. package/lib/module/utils/registry-signature.js.map +1 -0
  445. package/lib/module/utils/url-polyfill.js +1073 -425
  446. package/lib/module/utils/url-polyfill.js.map +1 -1
  447. package/lib/module/utils/utils.js +0 -26
  448. package/lib/module/utils/utils.js.map +1 -1
  449. package/lib/typescript/commonjs/src/NativeConsumet.d.ts +68 -2
  450. package/lib/typescript/commonjs/src/NativeConsumet.d.ts.map +1 -1
  451. package/lib/typescript/commonjs/src/extractors/asianload.d.ts +5 -3
  452. package/lib/typescript/commonjs/src/extractors/asianload.d.ts.map +1 -1
  453. package/lib/typescript/commonjs/src/extractors/filemoon.d.ts +5 -3
  454. package/lib/typescript/commonjs/src/extractors/filemoon.d.ts.map +1 -1
  455. package/lib/typescript/commonjs/src/extractors/flixcloud.d.ts +0 -1
  456. package/lib/typescript/commonjs/src/extractors/flixcloud.d.ts.map +1 -1
  457. package/lib/typescript/commonjs/src/extractors/gdflix.d.ts +0 -1
  458. package/lib/typescript/commonjs/src/extractors/gdflix.d.ts.map +1 -1
  459. package/lib/typescript/commonjs/src/extractors/gofile.d.ts +0 -1
  460. package/lib/typescript/commonjs/src/extractors/gofile.d.ts.map +1 -1
  461. package/lib/typescript/commonjs/src/extractors/gogocdn.d.ts +5 -3
  462. package/lib/typescript/commonjs/src/extractors/gogocdn.d.ts.map +1 -1
  463. package/lib/typescript/commonjs/src/extractors/hubcloud.d.ts +0 -1
  464. package/lib/typescript/commonjs/src/extractors/hubcloud.d.ts.map +1 -1
  465. package/lib/typescript/commonjs/src/extractors/index.d.ts +24 -25
  466. package/lib/typescript/commonjs/src/extractors/index.d.ts.map +1 -1
  467. package/lib/typescript/commonjs/src/extractors/kwik.d.ts +0 -1
  468. package/lib/typescript/commonjs/src/extractors/kwik.d.ts.map +1 -1
  469. package/lib/typescript/commonjs/src/extractors/megaplay.d.ts +0 -1
  470. package/lib/typescript/commonjs/src/extractors/megaplay.d.ts.map +1 -1
  471. package/lib/typescript/commonjs/src/extractors/megaup.d.ts +0 -1
  472. package/lib/typescript/commonjs/src/extractors/megaup.d.ts.map +1 -1
  473. package/lib/typescript/commonjs/src/extractors/mixdrop.d.ts +5 -3
  474. package/lib/typescript/commonjs/src/extractors/mixdrop.d.ts.map +1 -1
  475. package/lib/typescript/commonjs/src/extractors/mp4player.d.ts +5 -3
  476. package/lib/typescript/commonjs/src/extractors/mp4player.d.ts.map +1 -1
  477. package/lib/typescript/commonjs/src/extractors/mp4upload.d.ts +5 -3
  478. package/lib/typescript/commonjs/src/extractors/mp4upload.d.ts.map +1 -1
  479. package/lib/typescript/commonjs/src/extractors/rapidcloud.d.ts +5 -3
  480. package/lib/typescript/commonjs/src/extractors/rapidcloud.d.ts.map +1 -1
  481. package/lib/typescript/commonjs/src/extractors/streamhub.d.ts +5 -3
  482. package/lib/typescript/commonjs/src/extractors/streamhub.d.ts.map +1 -1
  483. package/lib/typescript/commonjs/src/extractors/streamlare.d.ts +5 -4
  484. package/lib/typescript/commonjs/src/extractors/streamlare.d.ts.map +1 -1
  485. package/lib/typescript/commonjs/src/extractors/streamsb.d.ts +5 -3
  486. package/lib/typescript/commonjs/src/extractors/streamsb.d.ts.map +1 -1
  487. package/lib/typescript/commonjs/src/extractors/streamtape.d.ts +5 -3
  488. package/lib/typescript/commonjs/src/extractors/streamtape.d.ts.map +1 -1
  489. package/lib/typescript/commonjs/src/extractors/vidhide.d.ts +0 -1
  490. package/lib/typescript/commonjs/src/extractors/vidhide.d.ts.map +1 -1
  491. package/lib/typescript/commonjs/src/extractors/vidmoly.d.ts +5 -3
  492. package/lib/typescript/commonjs/src/extractors/vidmoly.d.ts.map +1 -1
  493. package/lib/typescript/commonjs/src/extractors/vizcloud.d.ts +5 -3
  494. package/lib/typescript/commonjs/src/extractors/vizcloud.d.ts.map +1 -1
  495. package/lib/typescript/commonjs/src/extractors/voe.d.ts +5 -3
  496. package/lib/typescript/commonjs/src/extractors/voe.d.ts.map +1 -1
  497. package/lib/typescript/commonjs/src/index.d.ts +15 -9
  498. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  499. package/lib/typescript/commonjs/src/models/base-provider.d.ts +5 -1
  500. package/lib/typescript/commonjs/src/models/base-provider.d.ts.map +1 -1
  501. package/lib/typescript/commonjs/src/models/extension-manifest.d.ts +31 -5
  502. package/lib/typescript/commonjs/src/models/extension-manifest.d.ts.map +1 -1
  503. package/lib/typescript/commonjs/src/models/extractor-context.d.ts +1 -2
  504. package/lib/typescript/commonjs/src/models/extractor-context.d.ts.map +1 -1
  505. package/lib/typescript/commonjs/src/models/index.d.ts +6 -4
  506. package/lib/typescript/commonjs/src/models/index.d.ts.map +1 -1
  507. package/lib/typescript/commonjs/src/models/meta-error.d.ts +20 -0
  508. package/lib/typescript/commonjs/src/models/meta-error.d.ts.map +1 -0
  509. package/lib/typescript/commonjs/src/models/provider-context.d.ts +21 -16
  510. package/lib/typescript/commonjs/src/models/provider-context.d.ts.map +1 -1
  511. package/lib/typescript/commonjs/src/models/types.d.ts +106 -3
  512. package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
  513. package/lib/typescript/commonjs/src/providers/anime/anikoto/anikoto.d.ts +7 -2
  514. package/lib/typescript/commonjs/src/providers/anime/anikoto/anikoto.d.ts.map +1 -1
  515. package/lib/typescript/commonjs/src/providers/anime/anikoto/create-anikoto.d.ts +3 -3
  516. package/lib/typescript/commonjs/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
  517. package/lib/typescript/commonjs/src/providers/anime/animekai/animekai.d.ts +7 -2
  518. package/lib/typescript/commonjs/src/providers/anime/animekai/animekai.d.ts.map +1 -1
  519. package/lib/typescript/commonjs/src/providers/anime/animekai/create-animekai.d.ts +3 -3
  520. package/lib/typescript/commonjs/src/providers/anime/animekai/create-animekai.d.ts.map +1 -1
  521. package/lib/typescript/commonjs/src/providers/anime/animepahe/animepahe.d.ts +7 -2
  522. package/lib/typescript/commonjs/src/providers/anime/animepahe/animepahe.d.ts.map +1 -1
  523. package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts +3 -3
  524. package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
  525. package/lib/typescript/commonjs/src/providers/anime/animeunity.d.ts +11 -3
  526. package/lib/typescript/commonjs/src/providers/anime/animeunity.d.ts.map +1 -1
  527. package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts +7 -2
  528. package/lib/typescript/commonjs/src/providers/anime/anineko/anineko.d.ts.map +1 -1
  529. package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts +3 -3
  530. package/lib/typescript/commonjs/src/providers/anime/anineko/create-anineko.d.ts.map +1 -1
  531. package/lib/typescript/commonjs/src/providers/anime/index.d.ts +13 -22
  532. package/lib/typescript/commonjs/src/providers/anime/index.d.ts.map +1 -1
  533. package/lib/typescript/commonjs/src/providers/anime/reanime/create-reanime.d.ts +1 -2
  534. package/lib/typescript/commonjs/src/providers/anime/reanime/create-reanime.d.ts.map +1 -1
  535. package/lib/typescript/commonjs/src/providers/anime/reanime/reanime.d.ts +7 -2
  536. package/lib/typescript/commonjs/src/providers/anime/reanime/reanime.d.ts.map +1 -1
  537. package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts +3 -3
  538. package/lib/typescript/commonjs/src/providers/anime/zoro/create-zoro.d.ts.map +1 -1
  539. package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts +7 -2
  540. package/lib/typescript/commonjs/src/providers/anime/zoro/zoro.d.ts.map +1 -1
  541. package/lib/typescript/commonjs/src/providers/index.d.ts +4 -4
  542. package/lib/typescript/commonjs/src/providers/index.d.ts.map +1 -1
  543. package/lib/typescript/commonjs/src/providers/light-novels/index.d.ts +3 -4
  544. package/lib/typescript/commonjs/src/providers/light-novels/index.d.ts.map +1 -1
  545. package/lib/typescript/commonjs/src/providers/light-novels/novelupdates.d.ts +7 -3
  546. package/lib/typescript/commonjs/src/providers/light-novels/novelupdates.d.ts.map +1 -1
  547. package/lib/typescript/commonjs/src/providers/light-novels/readlightnovels.d.ts +5 -3
  548. package/lib/typescript/commonjs/src/providers/light-novels/readlightnovels.d.ts.map +1 -1
  549. package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts +5 -3
  550. package/lib/typescript/commonjs/src/providers/manga/asurascans.d.ts.map +1 -1
  551. package/lib/typescript/commonjs/src/providers/manga/brmangas.d.ts +5 -3
  552. package/lib/typescript/commonjs/src/providers/manga/brmangas.d.ts.map +1 -1
  553. package/lib/typescript/commonjs/src/providers/manga/comick.d.ts +7 -4
  554. package/lib/typescript/commonjs/src/providers/manga/comick.d.ts.map +1 -1
  555. package/lib/typescript/commonjs/src/providers/manga/flamescans.d.ts +5 -3
  556. package/lib/typescript/commonjs/src/providers/manga/flamescans.d.ts.map +1 -1
  557. package/lib/typescript/commonjs/src/providers/manga/index.d.ts +14 -17
  558. package/lib/typescript/commonjs/src/providers/manga/index.d.ts.map +1 -1
  559. package/lib/typescript/commonjs/src/providers/manga/mangadex.d.ts +5 -3
  560. package/lib/typescript/commonjs/src/providers/manga/mangadex.d.ts.map +1 -1
  561. package/lib/typescript/commonjs/src/providers/manga/mangahere.d.ts +5 -3
  562. package/lib/typescript/commonjs/src/providers/manga/mangahere.d.ts.map +1 -1
  563. package/lib/typescript/commonjs/src/providers/manga/mangahost.d.ts +5 -3
  564. package/lib/typescript/commonjs/src/providers/manga/mangahost.d.ts.map +1 -1
  565. package/lib/typescript/commonjs/src/providers/manga/mangakakalot.d.ts +5 -3
  566. package/lib/typescript/commonjs/src/providers/manga/mangakakalot.d.ts.map +1 -1
  567. package/lib/typescript/commonjs/src/providers/manga/mangapark.d.ts +5 -3
  568. package/lib/typescript/commonjs/src/providers/manga/mangapark.d.ts.map +1 -1
  569. package/lib/typescript/commonjs/src/providers/manga/mangapill.d.ts +5 -3
  570. package/lib/typescript/commonjs/src/providers/manga/mangapill.d.ts.map +1 -1
  571. package/lib/typescript/commonjs/src/providers/manga/mangareader.d.ts +5 -3
  572. package/lib/typescript/commonjs/src/providers/manga/mangareader.d.ts.map +1 -1
  573. package/lib/typescript/commonjs/src/providers/manga/mangasee123.d.ts +5 -3
  574. package/lib/typescript/commonjs/src/providers/manga/mangasee123.d.ts.map +1 -1
  575. package/lib/typescript/commonjs/src/providers/manga/readmanga.d.ts +11 -3
  576. package/lib/typescript/commonjs/src/providers/manga/readmanga.d.ts.map +1 -1
  577. package/lib/typescript/commonjs/src/providers/manga/vyvymanga.d.ts +5 -3
  578. package/lib/typescript/commonjs/src/providers/manga/vyvymanga.d.ts.map +1 -1
  579. package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts +26 -9
  580. package/lib/typescript/commonjs/src/providers/meta/anilist.d.ts.map +1 -1
  581. package/lib/typescript/commonjs/src/providers/meta/index.d.ts +1 -0
  582. package/lib/typescript/commonjs/src/providers/meta/index.d.ts.map +1 -1
  583. package/lib/typescript/commonjs/src/providers/meta/mal.d.ts +9 -4
  584. package/lib/typescript/commonjs/src/providers/meta/mal.d.ts.map +1 -1
  585. package/lib/typescript/commonjs/src/providers/meta/tmdb-api-key.d.ts +7 -0
  586. package/lib/typescript/commonjs/src/providers/meta/tmdb-api-key.d.ts.map +1 -0
  587. package/lib/typescript/commonjs/src/providers/meta/tmdb.d.ts +18 -5
  588. package/lib/typescript/commonjs/src/providers/meta/tmdb.d.ts.map +1 -1
  589. package/lib/typescript/commonjs/src/providers/movies/himovies/himovies.d.ts +8 -3
  590. package/lib/typescript/commonjs/src/providers/movies/himovies/himovies.d.ts.map +1 -1
  591. package/lib/typescript/commonjs/src/providers/movies/index.d.ts +14 -10
  592. package/lib/typescript/commonjs/src/providers/movies/index.d.ts.map +1 -1
  593. package/lib/typescript/commonjs/src/providers/movies/multimovies/multimovies.d.ts +8 -3
  594. package/lib/typescript/commonjs/src/providers/movies/multimovies/multimovies.d.ts.map +1 -1
  595. package/lib/typescript/commonjs/src/providers/movies/multistream/index.d.ts +10 -3
  596. package/lib/typescript/commonjs/src/providers/movies/multistream/index.d.ts.map +1 -1
  597. package/lib/typescript/commonjs/src/providers/movies/multistream/utils.d.ts +7 -6
  598. package/lib/typescript/commonjs/src/providers/movies/multistream/utils.d.ts.map +1 -1
  599. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/create-netflixmirror.d.ts +2 -6
  600. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/create-netflixmirror.d.ts.map +1 -1
  601. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/disneymirror.d.ts +12 -0
  602. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/disneymirror.d.ts.map +1 -0
  603. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/netflixmirror.d.ts +9 -17
  604. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/netflixmirror.d.ts.map +1 -1
  605. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/netmirror-parser.d.ts +21 -0
  606. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/netmirror-parser.d.ts.map +1 -0
  607. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/primemirror.d.ts +12 -0
  608. package/lib/typescript/commonjs/src/providers/movies/netflixmirror/primemirror.d.ts.map +1 -0
  609. package/lib/typescript/commonjs/src/providers/movies/vegamovies/create-vegamovies.d.ts.map +1 -1
  610. package/lib/typescript/commonjs/src/providers/movies/vegamovies/vegamovies.d.ts +8 -5
  611. package/lib/typescript/commonjs/src/providers/movies/vegamovies/vegamovies.d.ts.map +1 -1
  612. package/lib/typescript/commonjs/src/providers/movies/yflix/yflix.d.ts +8 -3
  613. package/lib/typescript/commonjs/src/providers/movies/yflix/yflix.d.ts.map +1 -1
  614. package/lib/typescript/commonjs/src/providers/provider-args.d.ts +8 -0
  615. package/lib/typescript/commonjs/src/providers/provider-args.d.ts.map +1 -0
  616. package/lib/typescript/commonjs/src/registry-signing-keys.d.ts +18 -0
  617. package/lib/typescript/commonjs/src/registry-signing-keys.d.ts.map +1 -0
  618. package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts +33 -14
  619. package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts.map +1 -1
  620. package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts +72 -19
  621. package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts.map +1 -1
  622. package/lib/typescript/commonjs/src/utils/create-extractor-context.d.ts.map +1 -1
  623. package/lib/typescript/commonjs/src/utils/create-provider-context.d.ts.map +1 -1
  624. package/lib/typescript/commonjs/src/utils/extension-integrity.d.ts +40 -0
  625. package/lib/typescript/commonjs/src/utils/extension-integrity.d.ts.map +1 -0
  626. package/lib/typescript/commonjs/src/utils/extension-modules.d.ts +49 -0
  627. package/lib/typescript/commonjs/src/utils/extension-modules.d.ts.map +1 -0
  628. package/lib/typescript/commonjs/src/utils/extension-utils.d.ts +24 -46
  629. package/lib/typescript/commonjs/src/utils/extension-utils.d.ts.map +1 -1
  630. package/lib/typescript/commonjs/src/utils/fetch-with-timeout.d.ts +29 -0
  631. package/lib/typescript/commonjs/src/utils/fetch-with-timeout.d.ts.map +1 -0
  632. package/lib/typescript/commonjs/src/utils/index.d.ts +11 -4
  633. package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
  634. package/lib/typescript/commonjs/src/utils/meta-http.d.ts +16 -0
  635. package/lib/typescript/commonjs/src/utils/meta-http.d.ts.map +1 -0
  636. package/lib/typescript/commonjs/src/utils/provider-maps.d.ts +14 -7
  637. package/lib/typescript/commonjs/src/utils/provider-maps.d.ts.map +1 -1
  638. package/lib/typescript/commonjs/src/utils/queries.d.ts +17 -8
  639. package/lib/typescript/commonjs/src/utils/queries.d.ts.map +1 -1
  640. package/lib/typescript/commonjs/src/utils/registry-schema.d.ts +66 -0
  641. package/lib/typescript/commonjs/src/utils/registry-schema.d.ts.map +1 -0
  642. package/lib/typescript/commonjs/src/utils/registry-signature.d.ts +66 -0
  643. package/lib/typescript/commonjs/src/utils/registry-signature.d.ts.map +1 -0
  644. package/lib/typescript/commonjs/src/utils/url-polyfill.d.ts +20 -8
  645. package/lib/typescript/commonjs/src/utils/url-polyfill.d.ts.map +1 -1
  646. package/lib/typescript/commonjs/src/utils/utils.d.ts +0 -1
  647. package/lib/typescript/commonjs/src/utils/utils.d.ts.map +1 -1
  648. package/lib/typescript/module/src/NativeConsumet.d.ts +68 -2
  649. package/lib/typescript/module/src/NativeConsumet.d.ts.map +1 -1
  650. package/lib/typescript/module/src/extractors/asianload.d.ts +5 -3
  651. package/lib/typescript/module/src/extractors/asianload.d.ts.map +1 -1
  652. package/lib/typescript/module/src/extractors/filemoon.d.ts +5 -3
  653. package/lib/typescript/module/src/extractors/filemoon.d.ts.map +1 -1
  654. package/lib/typescript/module/src/extractors/flixcloud.d.ts +0 -1
  655. package/lib/typescript/module/src/extractors/flixcloud.d.ts.map +1 -1
  656. package/lib/typescript/module/src/extractors/gdflix.d.ts +0 -1
  657. package/lib/typescript/module/src/extractors/gdflix.d.ts.map +1 -1
  658. package/lib/typescript/module/src/extractors/gofile.d.ts +0 -1
  659. package/lib/typescript/module/src/extractors/gofile.d.ts.map +1 -1
  660. package/lib/typescript/module/src/extractors/gogocdn.d.ts +5 -3
  661. package/lib/typescript/module/src/extractors/gogocdn.d.ts.map +1 -1
  662. package/lib/typescript/module/src/extractors/hubcloud.d.ts +0 -1
  663. package/lib/typescript/module/src/extractors/hubcloud.d.ts.map +1 -1
  664. package/lib/typescript/module/src/extractors/index.d.ts +24 -25
  665. package/lib/typescript/module/src/extractors/index.d.ts.map +1 -1
  666. package/lib/typescript/module/src/extractors/kwik.d.ts +0 -1
  667. package/lib/typescript/module/src/extractors/kwik.d.ts.map +1 -1
  668. package/lib/typescript/module/src/extractors/megaplay.d.ts +0 -1
  669. package/lib/typescript/module/src/extractors/megaplay.d.ts.map +1 -1
  670. package/lib/typescript/module/src/extractors/megaup.d.ts +0 -1
  671. package/lib/typescript/module/src/extractors/megaup.d.ts.map +1 -1
  672. package/lib/typescript/module/src/extractors/mixdrop.d.ts +5 -3
  673. package/lib/typescript/module/src/extractors/mixdrop.d.ts.map +1 -1
  674. package/lib/typescript/module/src/extractors/mp4player.d.ts +5 -3
  675. package/lib/typescript/module/src/extractors/mp4player.d.ts.map +1 -1
  676. package/lib/typescript/module/src/extractors/mp4upload.d.ts +5 -3
  677. package/lib/typescript/module/src/extractors/mp4upload.d.ts.map +1 -1
  678. package/lib/typescript/module/src/extractors/rapidcloud.d.ts +5 -3
  679. package/lib/typescript/module/src/extractors/rapidcloud.d.ts.map +1 -1
  680. package/lib/typescript/module/src/extractors/streamhub.d.ts +5 -3
  681. package/lib/typescript/module/src/extractors/streamhub.d.ts.map +1 -1
  682. package/lib/typescript/module/src/extractors/streamlare.d.ts +5 -4
  683. package/lib/typescript/module/src/extractors/streamlare.d.ts.map +1 -1
  684. package/lib/typescript/module/src/extractors/streamsb.d.ts +5 -3
  685. package/lib/typescript/module/src/extractors/streamsb.d.ts.map +1 -1
  686. package/lib/typescript/module/src/extractors/streamtape.d.ts +5 -3
  687. package/lib/typescript/module/src/extractors/streamtape.d.ts.map +1 -1
  688. package/lib/typescript/module/src/extractors/vidhide.d.ts +0 -1
  689. package/lib/typescript/module/src/extractors/vidhide.d.ts.map +1 -1
  690. package/lib/typescript/module/src/extractors/vidmoly.d.ts +5 -3
  691. package/lib/typescript/module/src/extractors/vidmoly.d.ts.map +1 -1
  692. package/lib/typescript/module/src/extractors/vizcloud.d.ts +5 -3
  693. package/lib/typescript/module/src/extractors/vizcloud.d.ts.map +1 -1
  694. package/lib/typescript/module/src/extractors/voe.d.ts +5 -3
  695. package/lib/typescript/module/src/extractors/voe.d.ts.map +1 -1
  696. package/lib/typescript/module/src/index.d.ts +15 -9
  697. package/lib/typescript/module/src/index.d.ts.map +1 -1
  698. package/lib/typescript/module/src/models/base-provider.d.ts +5 -1
  699. package/lib/typescript/module/src/models/base-provider.d.ts.map +1 -1
  700. package/lib/typescript/module/src/models/extension-manifest.d.ts +31 -5
  701. package/lib/typescript/module/src/models/extension-manifest.d.ts.map +1 -1
  702. package/lib/typescript/module/src/models/extractor-context.d.ts +1 -2
  703. package/lib/typescript/module/src/models/extractor-context.d.ts.map +1 -1
  704. package/lib/typescript/module/src/models/index.d.ts +6 -4
  705. package/lib/typescript/module/src/models/index.d.ts.map +1 -1
  706. package/lib/typescript/module/src/models/meta-error.d.ts +20 -0
  707. package/lib/typescript/module/src/models/meta-error.d.ts.map +1 -0
  708. package/lib/typescript/module/src/models/provider-context.d.ts +21 -16
  709. package/lib/typescript/module/src/models/provider-context.d.ts.map +1 -1
  710. package/lib/typescript/module/src/models/types.d.ts +106 -3
  711. package/lib/typescript/module/src/models/types.d.ts.map +1 -1
  712. package/lib/typescript/module/src/providers/anime/anikoto/anikoto.d.ts +7 -2
  713. package/lib/typescript/module/src/providers/anime/anikoto/anikoto.d.ts.map +1 -1
  714. package/lib/typescript/module/src/providers/anime/anikoto/create-anikoto.d.ts +3 -3
  715. package/lib/typescript/module/src/providers/anime/anikoto/create-anikoto.d.ts.map +1 -1
  716. package/lib/typescript/module/src/providers/anime/animekai/animekai.d.ts +7 -2
  717. package/lib/typescript/module/src/providers/anime/animekai/animekai.d.ts.map +1 -1
  718. package/lib/typescript/module/src/providers/anime/animekai/create-animekai.d.ts +3 -3
  719. package/lib/typescript/module/src/providers/anime/animekai/create-animekai.d.ts.map +1 -1
  720. package/lib/typescript/module/src/providers/anime/animepahe/animepahe.d.ts +7 -2
  721. package/lib/typescript/module/src/providers/anime/animepahe/animepahe.d.ts.map +1 -1
  722. package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts +3 -3
  723. package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
  724. package/lib/typescript/module/src/providers/anime/animeunity.d.ts +11 -3
  725. package/lib/typescript/module/src/providers/anime/animeunity.d.ts.map +1 -1
  726. package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts +7 -2
  727. package/lib/typescript/module/src/providers/anime/anineko/anineko.d.ts.map +1 -1
  728. package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts +3 -3
  729. package/lib/typescript/module/src/providers/anime/anineko/create-anineko.d.ts.map +1 -1
  730. package/lib/typescript/module/src/providers/anime/index.d.ts +13 -22
  731. package/lib/typescript/module/src/providers/anime/index.d.ts.map +1 -1
  732. package/lib/typescript/module/src/providers/anime/reanime/create-reanime.d.ts +1 -2
  733. package/lib/typescript/module/src/providers/anime/reanime/create-reanime.d.ts.map +1 -1
  734. package/lib/typescript/module/src/providers/anime/reanime/reanime.d.ts +7 -2
  735. package/lib/typescript/module/src/providers/anime/reanime/reanime.d.ts.map +1 -1
  736. package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts +3 -3
  737. package/lib/typescript/module/src/providers/anime/zoro/create-zoro.d.ts.map +1 -1
  738. package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts +7 -2
  739. package/lib/typescript/module/src/providers/anime/zoro/zoro.d.ts.map +1 -1
  740. package/lib/typescript/module/src/providers/index.d.ts +4 -4
  741. package/lib/typescript/module/src/providers/index.d.ts.map +1 -1
  742. package/lib/typescript/module/src/providers/light-novels/index.d.ts +3 -4
  743. package/lib/typescript/module/src/providers/light-novels/index.d.ts.map +1 -1
  744. package/lib/typescript/module/src/providers/light-novels/novelupdates.d.ts +7 -3
  745. package/lib/typescript/module/src/providers/light-novels/novelupdates.d.ts.map +1 -1
  746. package/lib/typescript/module/src/providers/light-novels/readlightnovels.d.ts +5 -3
  747. package/lib/typescript/module/src/providers/light-novels/readlightnovels.d.ts.map +1 -1
  748. package/lib/typescript/module/src/providers/manga/asurascans.d.ts +5 -3
  749. package/lib/typescript/module/src/providers/manga/asurascans.d.ts.map +1 -1
  750. package/lib/typescript/module/src/providers/manga/brmangas.d.ts +5 -3
  751. package/lib/typescript/module/src/providers/manga/brmangas.d.ts.map +1 -1
  752. package/lib/typescript/module/src/providers/manga/comick.d.ts +7 -4
  753. package/lib/typescript/module/src/providers/manga/comick.d.ts.map +1 -1
  754. package/lib/typescript/module/src/providers/manga/flamescans.d.ts +5 -3
  755. package/lib/typescript/module/src/providers/manga/flamescans.d.ts.map +1 -1
  756. package/lib/typescript/module/src/providers/manga/index.d.ts +14 -17
  757. package/lib/typescript/module/src/providers/manga/index.d.ts.map +1 -1
  758. package/lib/typescript/module/src/providers/manga/mangadex.d.ts +5 -3
  759. package/lib/typescript/module/src/providers/manga/mangadex.d.ts.map +1 -1
  760. package/lib/typescript/module/src/providers/manga/mangahere.d.ts +5 -3
  761. package/lib/typescript/module/src/providers/manga/mangahere.d.ts.map +1 -1
  762. package/lib/typescript/module/src/providers/manga/mangahost.d.ts +5 -3
  763. package/lib/typescript/module/src/providers/manga/mangahost.d.ts.map +1 -1
  764. package/lib/typescript/module/src/providers/manga/mangakakalot.d.ts +5 -3
  765. package/lib/typescript/module/src/providers/manga/mangakakalot.d.ts.map +1 -1
  766. package/lib/typescript/module/src/providers/manga/mangapark.d.ts +5 -3
  767. package/lib/typescript/module/src/providers/manga/mangapark.d.ts.map +1 -1
  768. package/lib/typescript/module/src/providers/manga/mangapill.d.ts +5 -3
  769. package/lib/typescript/module/src/providers/manga/mangapill.d.ts.map +1 -1
  770. package/lib/typescript/module/src/providers/manga/mangareader.d.ts +5 -3
  771. package/lib/typescript/module/src/providers/manga/mangareader.d.ts.map +1 -1
  772. package/lib/typescript/module/src/providers/manga/mangasee123.d.ts +5 -3
  773. package/lib/typescript/module/src/providers/manga/mangasee123.d.ts.map +1 -1
  774. package/lib/typescript/module/src/providers/manga/readmanga.d.ts +11 -3
  775. package/lib/typescript/module/src/providers/manga/readmanga.d.ts.map +1 -1
  776. package/lib/typescript/module/src/providers/manga/vyvymanga.d.ts +5 -3
  777. package/lib/typescript/module/src/providers/manga/vyvymanga.d.ts.map +1 -1
  778. package/lib/typescript/module/src/providers/meta/anilist.d.ts +26 -9
  779. package/lib/typescript/module/src/providers/meta/anilist.d.ts.map +1 -1
  780. package/lib/typescript/module/src/providers/meta/index.d.ts +1 -0
  781. package/lib/typescript/module/src/providers/meta/index.d.ts.map +1 -1
  782. package/lib/typescript/module/src/providers/meta/mal.d.ts +9 -4
  783. package/lib/typescript/module/src/providers/meta/mal.d.ts.map +1 -1
  784. package/lib/typescript/module/src/providers/meta/tmdb-api-key.d.ts +7 -0
  785. package/lib/typescript/module/src/providers/meta/tmdb-api-key.d.ts.map +1 -0
  786. package/lib/typescript/module/src/providers/meta/tmdb.d.ts +18 -5
  787. package/lib/typescript/module/src/providers/meta/tmdb.d.ts.map +1 -1
  788. package/lib/typescript/module/src/providers/movies/himovies/himovies.d.ts +8 -3
  789. package/lib/typescript/module/src/providers/movies/himovies/himovies.d.ts.map +1 -1
  790. package/lib/typescript/module/src/providers/movies/index.d.ts +14 -10
  791. package/lib/typescript/module/src/providers/movies/index.d.ts.map +1 -1
  792. package/lib/typescript/module/src/providers/movies/multimovies/multimovies.d.ts +8 -3
  793. package/lib/typescript/module/src/providers/movies/multimovies/multimovies.d.ts.map +1 -1
  794. package/lib/typescript/module/src/providers/movies/multistream/index.d.ts +10 -3
  795. package/lib/typescript/module/src/providers/movies/multistream/index.d.ts.map +1 -1
  796. package/lib/typescript/module/src/providers/movies/multistream/utils.d.ts +7 -6
  797. package/lib/typescript/module/src/providers/movies/multistream/utils.d.ts.map +1 -1
  798. package/lib/typescript/module/src/providers/movies/netflixmirror/create-netflixmirror.d.ts +2 -6
  799. package/lib/typescript/module/src/providers/movies/netflixmirror/create-netflixmirror.d.ts.map +1 -1
  800. package/lib/typescript/module/src/providers/movies/netflixmirror/disneymirror.d.ts +12 -0
  801. package/lib/typescript/module/src/providers/movies/netflixmirror/disneymirror.d.ts.map +1 -0
  802. package/lib/typescript/module/src/providers/movies/netflixmirror/netflixmirror.d.ts +9 -17
  803. package/lib/typescript/module/src/providers/movies/netflixmirror/netflixmirror.d.ts.map +1 -1
  804. package/lib/typescript/module/src/providers/movies/netflixmirror/netmirror-parser.d.ts +21 -0
  805. package/lib/typescript/module/src/providers/movies/netflixmirror/netmirror-parser.d.ts.map +1 -0
  806. package/lib/typescript/module/src/providers/movies/netflixmirror/primemirror.d.ts +12 -0
  807. package/lib/typescript/module/src/providers/movies/netflixmirror/primemirror.d.ts.map +1 -0
  808. package/lib/typescript/module/src/providers/movies/vegamovies/create-vegamovies.d.ts.map +1 -1
  809. package/lib/typescript/module/src/providers/movies/vegamovies/vegamovies.d.ts +8 -5
  810. package/lib/typescript/module/src/providers/movies/vegamovies/vegamovies.d.ts.map +1 -1
  811. package/lib/typescript/module/src/providers/movies/yflix/yflix.d.ts +8 -3
  812. package/lib/typescript/module/src/providers/movies/yflix/yflix.d.ts.map +1 -1
  813. package/lib/typescript/module/src/providers/provider-args.d.ts +8 -0
  814. package/lib/typescript/module/src/providers/provider-args.d.ts.map +1 -0
  815. package/lib/typescript/module/src/registry-signing-keys.d.ts +18 -0
  816. package/lib/typescript/module/src/registry-signing-keys.d.ts.map +1 -0
  817. package/lib/typescript/module/src/utils/ExtractorManager.d.ts +33 -14
  818. package/lib/typescript/module/src/utils/ExtractorManager.d.ts.map +1 -1
  819. package/lib/typescript/module/src/utils/ProviderManager.d.ts +72 -19
  820. package/lib/typescript/module/src/utils/ProviderManager.d.ts.map +1 -1
  821. package/lib/typescript/module/src/utils/create-extractor-context.d.ts.map +1 -1
  822. package/lib/typescript/module/src/utils/create-provider-context.d.ts.map +1 -1
  823. package/lib/typescript/module/src/utils/extension-integrity.d.ts +40 -0
  824. package/lib/typescript/module/src/utils/extension-integrity.d.ts.map +1 -0
  825. package/lib/typescript/module/src/utils/extension-modules.d.ts +49 -0
  826. package/lib/typescript/module/src/utils/extension-modules.d.ts.map +1 -0
  827. package/lib/typescript/module/src/utils/extension-utils.d.ts +24 -46
  828. package/lib/typescript/module/src/utils/extension-utils.d.ts.map +1 -1
  829. package/lib/typescript/module/src/utils/fetch-with-timeout.d.ts +29 -0
  830. package/lib/typescript/module/src/utils/fetch-with-timeout.d.ts.map +1 -0
  831. package/lib/typescript/module/src/utils/index.d.ts +11 -4
  832. package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
  833. package/lib/typescript/module/src/utils/meta-http.d.ts +16 -0
  834. package/lib/typescript/module/src/utils/meta-http.d.ts.map +1 -0
  835. package/lib/typescript/module/src/utils/provider-maps.d.ts +14 -7
  836. package/lib/typescript/module/src/utils/provider-maps.d.ts.map +1 -1
  837. package/lib/typescript/module/src/utils/queries.d.ts +17 -8
  838. package/lib/typescript/module/src/utils/queries.d.ts.map +1 -1
  839. package/lib/typescript/module/src/utils/registry-schema.d.ts +66 -0
  840. package/lib/typescript/module/src/utils/registry-schema.d.ts.map +1 -0
  841. package/lib/typescript/module/src/utils/registry-signature.d.ts +66 -0
  842. package/lib/typescript/module/src/utils/registry-signature.d.ts.map +1 -0
  843. package/lib/typescript/module/src/utils/url-polyfill.d.ts +20 -8
  844. package/lib/typescript/module/src/utils/url-polyfill.d.ts.map +1 -1
  845. package/lib/typescript/module/src/utils/utils.d.ts +0 -1
  846. package/lib/typescript/module/src/utils/utils.d.ts.map +1 -1
  847. package/package.json +36 -25
  848. package/src/NativeConsumet.ts +68 -2
  849. package/src/extension-registry.json +229 -61
  850. package/src/extension-registry.json.sig +1 -0
  851. package/src/extractors/asianload.ts +10 -7
  852. package/src/extractors/filemoon.ts +10 -7
  853. package/src/extractors/flixcloud.ts +0 -2
  854. package/src/extractors/gdflix.ts +0 -2
  855. package/src/extractors/gofile.ts +0 -2
  856. package/src/extractors/gogocdn.ts +12 -9
  857. package/src/extractors/hubcloud.ts +0 -2
  858. package/src/extractors/index.ts +24 -51
  859. package/src/extractors/kwik.ts +0 -2
  860. package/src/extractors/megaplay.ts +0 -2
  861. package/src/extractors/megaup.ts +2 -6
  862. package/src/extractors/mixdrop.ts +9 -5
  863. package/src/extractors/mp4player.ts +10 -6
  864. package/src/extractors/mp4upload.ts +9 -5
  865. package/src/extractors/rapidcloud.ts +15 -12
  866. package/src/extractors/streamhub.ts +10 -6
  867. package/src/extractors/streamlare.ts +10 -8
  868. package/src/extractors/streamsb.ts +10 -7
  869. package/src/extractors/streamtape.ts +9 -5
  870. package/src/extractors/vidhide.ts +3 -4
  871. package/src/extractors/vidmoly.ts +10 -6
  872. package/src/extractors/vizcloud.ts +10 -7
  873. package/src/extractors/voe.ts +10 -7
  874. package/src/index.tsx +109 -3
  875. package/src/models/base-provider.ts +6 -1
  876. package/src/models/extension-manifest.ts +35 -6
  877. package/src/models/extractor-context.ts +0 -2
  878. package/src/models/index.ts +13 -1
  879. package/src/models/meta-error.ts +33 -0
  880. package/src/models/provider-context.ts +21 -58
  881. package/src/models/types.ts +110 -3
  882. package/src/providers/anime/anikoto/anikoto.ts +14 -10
  883. package/src/providers/anime/anikoto/create-anikoto.ts +15 -7
  884. package/src/providers/anime/animekai/animekai.ts +14 -9
  885. package/src/providers/anime/animekai/create-animekai.ts +5 -5
  886. package/src/providers/anime/animepahe/animepahe.ts +14 -11
  887. package/src/providers/anime/animepahe/create-animepahe.ts +5 -14
  888. package/src/providers/anime/animeunity.ts +20 -10
  889. package/src/providers/anime/anineko/anineko.ts +18 -8
  890. package/src/providers/anime/anineko/create-anineko.ts +3 -2
  891. package/src/providers/anime/index.ts +13 -21
  892. package/src/providers/anime/reanime/create-reanime.ts +2 -4
  893. package/src/providers/anime/reanime/reanime.ts +13 -9
  894. package/src/providers/anime/zoro/create-zoro.ts +6 -7
  895. package/src/providers/anime/zoro/zoro.ts +14 -11
  896. package/src/providers/index.ts +4 -4
  897. package/src/providers/light-novels/index.ts +3 -3
  898. package/src/providers/light-novels/novelupdates.ts +33 -19
  899. package/src/providers/light-novels/readlightnovels.ts +12 -8
  900. package/src/providers/manga/asurascans.ts +13 -7
  901. package/src/providers/manga/brmangas.ts +11 -7
  902. package/src/providers/manga/comick.ts +17 -12
  903. package/src/providers/manga/flamescans.ts +11 -7
  904. package/src/providers/manga/index.ts +14 -16
  905. package/src/providers/manga/mangadex.ts +18 -14
  906. package/src/providers/manga/mangahere.ts +12 -8
  907. package/src/providers/manga/mangahost.ts +11 -7
  908. package/src/providers/manga/mangakakalot.ts +11 -7
  909. package/src/providers/manga/mangapark.ts +11 -7
  910. package/src/providers/manga/mangapill.ts +11 -7
  911. package/src/providers/manga/mangareader.ts +12 -8
  912. package/src/providers/manga/mangasee123.ts +11 -7
  913. package/src/providers/manga/readmanga.ts +36 -23
  914. package/src/providers/manga/vyvymanga.ts +12 -8
  915. package/src/providers/meta/anilist.ts +566 -1439
  916. package/src/providers/meta/index.ts +6 -1
  917. package/src/providers/meta/mal.ts +102 -139
  918. package/src/providers/meta/tmdb-api-key.ts +27 -0
  919. package/src/providers/meta/tmdb.ts +150 -141
  920. package/src/providers/movies/himovies/create-himovies.ts +3 -3
  921. package/src/providers/movies/himovies/himovies.ts +13 -11
  922. package/src/providers/movies/index.ts +14 -12
  923. package/src/providers/movies/multimovies/create-multimovies.ts +3 -3
  924. package/src/providers/movies/multimovies/multimovies.ts +13 -11
  925. package/src/providers/movies/multistream/index.ts +30 -18
  926. package/src/providers/movies/multistream/utils.ts +27 -15
  927. package/src/providers/movies/netflixmirror/create-netflixmirror.ts +567 -232
  928. package/src/providers/movies/netflixmirror/disneymirror.ts +16 -0
  929. package/src/providers/movies/netflixmirror/netflixmirror.ts +13 -43
  930. package/src/providers/movies/netflixmirror/netmirror-parser.ts +43 -0
  931. package/src/providers/movies/netflixmirror/primemirror.ts +16 -0
  932. package/src/providers/movies/vegamovies/create-vegamovies.ts +85 -60
  933. package/src/providers/movies/vegamovies/vegamovies.ts +13 -13
  934. package/src/providers/movies/yflix/create-yflix.ts +2 -2
  935. package/src/providers/movies/yflix/yflix.ts +13 -10
  936. package/src/providers/provider-args.ts +15 -0
  937. package/src/registry-signing-keys.ts +20 -0
  938. package/src/utils/ExtractorManager.ts +165 -258
  939. package/src/utils/ProviderManager.ts +236 -293
  940. package/src/utils/create-extractor-context.ts +0 -2
  941. package/src/utils/create-provider-context.ts +45 -29
  942. package/src/utils/extension-integrity.ts +82 -0
  943. package/src/utils/extension-modules.ts +123 -0
  944. package/src/utils/extension-utils.ts +45 -42
  945. package/src/utils/fetch-with-timeout.ts +76 -0
  946. package/src/utils/index.ts +31 -4
  947. package/src/utils/meta-http.ts +35 -0
  948. package/src/utils/provider-maps.ts +39 -19
  949. package/src/utils/queries.ts +30 -26
  950. package/src/utils/registry-schema.ts +273 -0
  951. package/src/utils/registry-signature.ts +215 -0
  952. package/src/utils/url-polyfill.ts +1146 -460
  953. package/src/utils/utils.ts +0 -26
  954. package/android/generated/jni/react/renderer/components/RNConsumetSpec/RNConsumetSpecJSI-generated.cpp +0 -75
  955. package/ios/generated/RNConsumetSpecJSI-generated.cpp +0 -75
  956. package/ios/generated/RNConsumetSpecJSI.h +0 -125
  957. package/lib/commonjs/extractors/StreamP2P.js +0 -69
  958. package/lib/commonjs/extractors/StreamP2P.js.map +0 -1
  959. package/lib/commonjs/extractors/kisskh/kkey.js +0 -98
  960. package/lib/commonjs/extractors/kisskh/kkey.js.map +0 -1
  961. package/lib/commonjs/extractors/kisskh/staticdata.js +0 -9
  962. package/lib/commonjs/extractors/kisskh/staticdata.js.map +0 -1
  963. package/lib/commonjs/providers/anime/anify.js +0 -195
  964. package/lib/commonjs/providers/anime/anify.js.map +0 -1
  965. package/lib/commonjs/providers/anime/animedrive.js +0 -228
  966. package/lib/commonjs/providers/anime/animedrive.js.map +0 -1
  967. package/lib/commonjs/providers/anime/animesuge/animesuge.js +0 -78
  968. package/lib/commonjs/providers/anime/animesuge/animesuge.js.map +0 -1
  969. package/lib/commonjs/providers/anime/animesuge/create-animesuge.js +0 -312
  970. package/lib/commonjs/providers/anime/animesuge/create-animesuge.js.map +0 -1
  971. package/lib/commonjs/providers/anime/kickassanime.js +0 -48
  972. package/lib/commonjs/providers/anime/kickassanime.js.map +0 -1
  973. package/lib/commonjs/providers/anime/marin.js +0 -282
  974. package/lib/commonjs/providers/anime/marin.js.map +0 -1
  975. package/lib/commonjs/providers/movies/dramacool.js +0 -397
  976. package/lib/commonjs/providers/movies/dramacool.js.map +0 -1
  977. package/lib/commonjs/providers/movies/yflix.js +0 -561
  978. package/lib/commonjs/providers/movies/yflix.js.map +0 -1
  979. package/lib/module/extractors/StreamP2P.js +0 -63
  980. package/lib/module/extractors/StreamP2P.js.map +0 -1
  981. package/lib/module/extractors/kisskh/kkey.js +0 -92
  982. package/lib/module/extractors/kisskh/kkey.js.map +0 -1
  983. package/lib/module/extractors/kisskh/staticdata.js +0 -5
  984. package/lib/module/extractors/kisskh/staticdata.js.map +0 -1
  985. package/lib/module/providers/anime/anify.js +0 -192
  986. package/lib/module/providers/anime/anify.js.map +0 -1
  987. package/lib/module/providers/anime/animedrive.js +0 -223
  988. package/lib/module/providers/anime/animedrive.js.map +0 -1
  989. package/lib/module/providers/anime/animesuge/animesuge.js +0 -73
  990. package/lib/module/providers/anime/animesuge/animesuge.js.map +0 -1
  991. package/lib/module/providers/anime/animesuge/create-animesuge.js +0 -309
  992. package/lib/module/providers/anime/animesuge/create-animesuge.js.map +0 -1
  993. package/lib/module/providers/anime/kickassanime.js +0 -45
  994. package/lib/module/providers/anime/kickassanime.js.map +0 -1
  995. package/lib/module/providers/anime/marin.js +0 -281
  996. package/lib/module/providers/anime/marin.js.map +0 -1
  997. package/lib/module/providers/movies/dramacool.js +0 -397
  998. package/lib/module/providers/movies/dramacool.js.map +0 -1
  999. package/lib/module/providers/movies/yflix.js +0 -561
  1000. package/lib/module/providers/movies/yflix.js.map +0 -1
  1001. package/lib/typescript/commonjs/src/extractors/StreamP2P.d.ts +0 -10
  1002. package/lib/typescript/commonjs/src/extractors/StreamP2P.d.ts.map +0 -1
  1003. package/lib/typescript/commonjs/src/extractors/kisskh/kkey.d.ts +0 -25
  1004. package/lib/typescript/commonjs/src/extractors/kisskh/kkey.d.ts.map +0 -1
  1005. package/lib/typescript/commonjs/src/extractors/kisskh/staticdata.d.ts +0 -3
  1006. package/lib/typescript/commonjs/src/extractors/kisskh/staticdata.d.ts.map +0 -1
  1007. package/lib/typescript/commonjs/src/providers/anime/anify.d.ts +0 -40
  1008. package/lib/typescript/commonjs/src/providers/anime/anify.d.ts.map +0 -1
  1009. package/lib/typescript/commonjs/src/providers/anime/animedrive.d.ts +0 -33
  1010. package/lib/typescript/commonjs/src/providers/anime/animedrive.d.ts.map +0 -1
  1011. package/lib/typescript/commonjs/src/providers/anime/animesuge/animesuge.d.ts +0 -34
  1012. package/lib/typescript/commonjs/src/providers/anime/animesuge/animesuge.d.ts.map +0 -1
  1013. package/lib/typescript/commonjs/src/providers/anime/animesuge/create-animesuge.d.ts +0 -14
  1014. package/lib/typescript/commonjs/src/providers/anime/animesuge/create-animesuge.d.ts.map +0 -1
  1015. package/lib/typescript/commonjs/src/providers/anime/kickassanime.d.ts +0 -30
  1016. package/lib/typescript/commonjs/src/providers/anime/kickassanime.d.ts.map +0 -1
  1017. package/lib/typescript/commonjs/src/providers/anime/marin.d.ts +0 -32
  1018. package/lib/typescript/commonjs/src/providers/anime/marin.d.ts.map +0 -1
  1019. package/lib/typescript/commonjs/src/providers/movies/dramacool.d.ts +0 -1
  1020. package/lib/typescript/commonjs/src/providers/movies/dramacool.d.ts.map +0 -1
  1021. package/lib/typescript/commonjs/src/providers/movies/yflix.d.ts +0 -1
  1022. package/lib/typescript/commonjs/src/providers/movies/yflix.d.ts.map +0 -1
  1023. package/lib/typescript/module/src/extractors/StreamP2P.d.ts +0 -10
  1024. package/lib/typescript/module/src/extractors/StreamP2P.d.ts.map +0 -1
  1025. package/lib/typescript/module/src/extractors/kisskh/kkey.d.ts +0 -25
  1026. package/lib/typescript/module/src/extractors/kisskh/kkey.d.ts.map +0 -1
  1027. package/lib/typescript/module/src/extractors/kisskh/staticdata.d.ts +0 -3
  1028. package/lib/typescript/module/src/extractors/kisskh/staticdata.d.ts.map +0 -1
  1029. package/lib/typescript/module/src/providers/anime/anify.d.ts +0 -40
  1030. package/lib/typescript/module/src/providers/anime/anify.d.ts.map +0 -1
  1031. package/lib/typescript/module/src/providers/anime/animedrive.d.ts +0 -33
  1032. package/lib/typescript/module/src/providers/anime/animedrive.d.ts.map +0 -1
  1033. package/lib/typescript/module/src/providers/anime/animesuge/animesuge.d.ts +0 -34
  1034. package/lib/typescript/module/src/providers/anime/animesuge/animesuge.d.ts.map +0 -1
  1035. package/lib/typescript/module/src/providers/anime/animesuge/create-animesuge.d.ts +0 -14
  1036. package/lib/typescript/module/src/providers/anime/animesuge/create-animesuge.d.ts.map +0 -1
  1037. package/lib/typescript/module/src/providers/anime/kickassanime.d.ts +0 -30
  1038. package/lib/typescript/module/src/providers/anime/kickassanime.d.ts.map +0 -1
  1039. package/lib/typescript/module/src/providers/anime/marin.d.ts +0 -32
  1040. package/lib/typescript/module/src/providers/anime/marin.d.ts.map +0 -1
  1041. package/lib/typescript/module/src/providers/movies/dramacool.d.ts +0 -1
  1042. package/lib/typescript/module/src/providers/movies/dramacool.d.ts.map +0 -1
  1043. package/lib/typescript/module/src/providers/movies/yflix.d.ts +0 -1
  1044. package/lib/typescript/module/src/providers/movies/yflix.d.ts.map +0 -1
  1045. package/src/extractors/StreamP2P.ts +0 -60
  1046. package/src/extractors/kisskh/kkey.ts +0 -161
  1047. package/src/extractors/kisskh/staticdata.ts +0 -144
  1048. package/src/providers/anime/anify.ts +0 -276
  1049. package/src/providers/anime/animedrive.ts +0 -245
  1050. package/src/providers/anime/animesuge/animesuge.ts +0 -77
  1051. package/src/providers/anime/animesuge/create-animesuge.ts +0 -327
  1052. package/src/providers/anime/kickassanime.ts +0 -51
  1053. package/src/providers/anime/marin.ts +0 -319
  1054. package/src/providers/movies/dramacool.ts +0 -395
  1055. package/src/providers/movies/yflix.ts +0 -559
@@ -1,232 +1,1127 @@
1
+ /**
2
+ * WHATWG URL and URLSearchParams for Hermes, whose global URL support is incomplete.
3
+ *
4
+ * Extensions get these as `ctx.PolyURL` / `ctx.PolyURLSearchParams`, so every provider and extractor
5
+ * inherits their behaviour. The parser follows the URL Standard (https://url.spec.whatwg.org/) state
6
+ * machine, and test/unit/url-polyfill.test.ts checks it against Node's URL. It never uses a global URL.
7
+ *
8
+ * Known gap: hosts are mapped with NFKC, lower-casing and punycode instead of the full UTS #46 table,
9
+ * so exotic internationalised domain names can differ from a browser.
10
+ */
11
+
1
12
  type Nullable<T> = T | null;
2
13
 
3
- const isASCII = (ch: string) => ch.charCodeAt(0) < 128;
14
+ const EOF = -1;
15
+
16
+ /* -----------------------------
17
+ Code points, UTF-8 and percent-encoding
18
+ ----------------------------- */
19
+
20
+ // The code points of a string, with lone surrogates replaced by U+FFFD (USVString conversion).
21
+ function toCodePoints(input: string): number[] {
22
+ const out: number[] = [];
23
+ for (let i = 0; i < input.length; i++) {
24
+ const c = input.charCodeAt(i);
25
+ if (c >= 0xd800 && c <= 0xdbff && i + 1 < input.length) {
26
+ const d = input.charCodeAt(i + 1);
27
+ if (d >= 0xdc00 && d <= 0xdfff) {
28
+ out.push(0x10000 + ((c - 0xd800) << 10) + (d - 0xdc00));
29
+ i++;
30
+ continue;
31
+ }
32
+ }
33
+ out.push(c >= 0xd800 && c <= 0xdfff ? 0xfffd : c);
34
+ }
35
+ return out;
36
+ }
37
+
38
+ function fromCodePoints(codePoints: number[]): string {
39
+ let out = '';
40
+ for (const cp of codePoints) out += String.fromCodePoint(cp);
41
+ return out;
42
+ }
4
43
 
5
- function utf8Encode(str: string): Uint8Array {
6
- // encode JS string to UTF-8 bytes
7
- const encoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : null;
8
- if (encoder) return encoder.encode(str);
9
- // fallback
44
+ function utf8EncodeCodePoint(cp: number, bytes: number[]) {
45
+ if (cp < 0x80) {
46
+ bytes.push(cp);
47
+ } else if (cp < 0x800) {
48
+ bytes.push(0xc0 | (cp >> 6), 0x80 | (cp & 0x3f));
49
+ } else if (cp < 0x10000) {
50
+ bytes.push(0xe0 | (cp >> 12), 0x80 | ((cp >> 6) & 0x3f), 0x80 | (cp & 0x3f));
51
+ } else {
52
+ bytes.push(0xf0 | (cp >> 18), 0x80 | ((cp >> 12) & 0x3f), 0x80 | ((cp >> 6) & 0x3f), 0x80 | (cp & 0x3f));
53
+ }
54
+ }
55
+
56
+ function utf8Encode(input: string): number[] {
10
57
  const bytes: number[] = [];
11
- for (let i = 0; i < str.length; i++) {
12
- let code = str.charCodeAt(i);
13
- if (code < 0x80) bytes.push(code);
14
- else if (code < 0x800) {
15
- bytes.push(0xc0 | (code >> 6));
16
- bytes.push(0x80 | (code & 0x3f));
17
- } else if (code < 0xd800 || code >= 0xe000) {
18
- bytes.push(0xe0 | (code >> 12));
19
- bytes.push(0x80 | ((code >> 6) & 0x3f));
20
- bytes.push(0x80 | (code & 0x3f));
21
- } else {
22
- // surrogate pair
23
- i++;
24
- const code2 = str.charCodeAt(i);
25
- const codePoint = 0x10000 + (((code & 0x3ff) << 10) | (code2 & 0x3ff));
26
- bytes.push(0xf0 | (codePoint >> 18));
27
- bytes.push(0x80 | ((codePoint >> 12) & 0x3f));
28
- bytes.push(0x80 | ((codePoint >> 6) & 0x3f));
29
- bytes.push(0x80 | (codePoint & 0x3f));
58
+ for (const cp of toCodePoints(input)) utf8EncodeCodePoint(cp, bytes);
59
+ return bytes;
60
+ }
61
+
62
+ // UTF-8 decode without BOM, replacing invalid sequences with U+FFFD (WHATWG Encoding).
63
+ function utf8Decode(bytes: number[]): string {
64
+ const out: number[] = [];
65
+ let codePoint = 0;
66
+ let bytesSeen = 0;
67
+ let bytesNeeded = 0;
68
+ let lower = 0x80;
69
+ let upper = 0xbf;
70
+ for (let i = 0; i < bytes.length; i++) {
71
+ const byte = bytes[i]!;
72
+ if (bytesNeeded === 0) {
73
+ if (byte <= 0x7f) {
74
+ out.push(byte);
75
+ } else if (byte >= 0xc2 && byte <= 0xdf) {
76
+ bytesNeeded = 1;
77
+ codePoint = byte & 0x1f;
78
+ } else if (byte >= 0xe0 && byte <= 0xef) {
79
+ if (byte === 0xe0) lower = 0xa0;
80
+ if (byte === 0xed) upper = 0x9f;
81
+ bytesNeeded = 2;
82
+ codePoint = byte & 0xf;
83
+ } else if (byte >= 0xf0 && byte <= 0xf4) {
84
+ if (byte === 0xf0) lower = 0x90;
85
+ if (byte === 0xf4) upper = 0x8f;
86
+ bytesNeeded = 3;
87
+ codePoint = byte & 0x7;
88
+ } else {
89
+ out.push(0xfffd);
90
+ }
91
+ continue;
92
+ }
93
+ if (byte < lower || byte > upper) {
94
+ codePoint = bytesNeeded = bytesSeen = 0;
95
+ lower = 0x80;
96
+ upper = 0xbf;
97
+ out.push(0xfffd);
98
+ i--; // reprocess this byte
99
+ continue;
100
+ }
101
+ lower = 0x80;
102
+ upper = 0xbf;
103
+ codePoint = (codePoint << 6) | (byte & 0x3f);
104
+ bytesSeen++;
105
+ if (bytesSeen === bytesNeeded) {
106
+ out.push(codePoint);
107
+ codePoint = bytesNeeded = bytesSeen = 0;
30
108
  }
31
109
  }
32
- return new Uint8Array(bytes);
110
+ if (bytesNeeded !== 0) out.push(0xfffd);
111
+ return fromCodePoints(out);
33
112
  }
34
113
 
35
- function percentEncodeByte(byte: number) {
36
- return '%' + byte.toString(16).toUpperCase().padStart(2, '0');
114
+ const isASCIIDigit = (c: number) => c >= 0x30 && c <= 0x39;
115
+ const isASCIIAlpha = (c: number) => (c >= 0x41 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a);
116
+ const isASCIIAlphanumeric = (c: number) => isASCIIDigit(c) || isASCIIAlpha(c);
117
+ const isASCIIHex = (c: number) => isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66);
118
+ const lowerASCII = (c: number) => (c >= 0x41 && c <= 0x5a ? c + 0x20 : c);
119
+
120
+ function isASCII(input: string): boolean {
121
+ for (let i = 0; i < input.length; i++) if (input.charCodeAt(i) > 0x7f) return false;
122
+ return true;
37
123
  }
38
124
 
39
- function encodeComponent(str: string, allow = /[A-Za-z0-9\-._~]/) {
40
- // encode like encodeURIComponent but allow customizing safe characters (RegExp)
125
+ // Remove leading and trailing C0 controls and spaces.
126
+ function trimC0ControlOrSpace(input: string): string {
127
+ let start = 0;
128
+ let end = input.length;
129
+ while (start < end && input.charCodeAt(start) <= 0x20) start++;
130
+ while (end > start && input.charCodeAt(end - 1) <= 0x20) end--;
131
+ return input.slice(start, end);
132
+ }
133
+
134
+ // Percent-encode sets, as predicates on a code point. Each set extends another with ASCII characters.
135
+ type EncodeSet = (c: number) => boolean;
136
+
137
+ function charTable(chars: string): boolean[] {
138
+ const table: boolean[] = [];
139
+ for (let i = 0; i < chars.length; i++) table[chars.charCodeAt(i)] = true;
140
+ return table;
141
+ }
142
+
143
+ function extendSet(base: EncodeSet, chars: string): EncodeSet {
144
+ const table = charTable(chars);
145
+ return (c) => base(c) || table[c] === true;
146
+ }
147
+
148
+ const inC0ControlSet: EncodeSet = (c) => c <= 0x1f || c > 0x7e;
149
+ const inFragmentSet = extendSet(inC0ControlSet, ' "<>`');
150
+ const inQuerySet = extendSet(inC0ControlSet, ' "#<>');
151
+ const inSpecialQuerySet = extendSet(inQuerySet, "'");
152
+ const inPathSet = extendSet(inQuerySet, '?^`{}');
153
+ const inUserinfoSet = extendSet(inPathSet, '/:;=@[\\]|');
154
+ const inComponentSet = extendSet(inUserinfoSet, '$%&+,');
155
+ const inFormSet = extendSet(inComponentSet, "!'()~");
156
+
157
+ function percentEncodeCodePoint(cp: number, set: EncodeSet): string {
158
+ if (!set(cp)) return String.fromCodePoint(cp);
159
+ const bytes: number[] = [];
160
+ utf8EncodeCodePoint(cp, bytes);
41
161
  let out = '';
42
- const bytes = utf8Encode(str);
162
+ for (const b of bytes) out += '%' + (b < 0x10 ? '0' : '') + b.toString(16).toUpperCase();
163
+ return out;
164
+ }
165
+
166
+ function percentEncodeString(input: string, set: EncodeSet, spaceAsPlus = false): string {
167
+ let out = '';
168
+ for (const cp of toCodePoints(input)) out += spaceAsPlus && cp === 0x20 ? '+' : percentEncodeCodePoint(cp, set);
169
+ return out;
170
+ }
171
+
172
+ // Percent-decode a string into bytes; a `%` not followed by two hex digits stays as is.
173
+ function percentDecode(input: string): number[] {
174
+ const bytes = utf8Encode(input);
175
+ const out: number[] = [];
43
176
  for (let i = 0; i < bytes.length; i++) {
44
177
  const b = bytes[i]!;
45
- const ch = String.fromCharCode(b);
46
- if (allow.test(ch)) out += ch;
47
- else out += percentEncodeByte(b);
178
+ if (b === 0x25 && i + 2 < bytes.length && isASCIIHex(bytes[i + 1]!) && isASCIIHex(bytes[i + 2]!)) {
179
+ out.push(parseInt(String.fromCharCode(bytes[i + 1]!, bytes[i + 2]!), 16));
180
+ i += 2;
181
+ } else {
182
+ out.push(b);
183
+ }
48
184
  }
49
185
  return out;
50
186
  }
51
187
 
52
- function decodePercentEncoded(str: string) {
53
- // decode percent-encoded UTF-8 sequences
54
- try {
55
- // Replace + with %2B so decodeURIComponent doesn't convert + to space (we treat + literally)
56
- // but in query strings sometimes + is used for space; we keep literal + behavior.
57
- return decodeURIComponent(str);
58
- } catch (e) {
59
- // Be defensive: fallback to manual decode of %XX bytes into utf8 string
60
- const bytes: number[] = [];
61
- for (let i = 0; i < str.length; ) {
62
- const ch = str[i];
63
- if (ch === '%' && i + 2 < str.length) {
64
- const hex = str.substr(i + 1, 2);
65
- const byte = parseInt(hex, 16);
66
- if (!Number.isNaN(byte)) {
67
- bytes.push(byte);
68
- i += 3;
69
- continue;
188
+ /* -----------------------------
189
+ application/x-www-form-urlencoded
190
+ ----------------------------- */
191
+
192
+ function parseFormUrlencoded(input: string): Array<[string, string]> {
193
+ const decode = (s: string) => utf8Decode(percentDecode(s.replace(/\+/g, ' ')));
194
+ const out: Array<[string, string]> = [];
195
+ for (const sequence of input.split('&')) {
196
+ if (sequence === '') continue;
197
+ const eq = sequence.indexOf('=');
198
+ const name = eq === -1 ? sequence : sequence.slice(0, eq);
199
+ const value = eq === -1 ? '' : sequence.slice(eq + 1);
200
+ out.push([decode(name), decode(value)]);
201
+ }
202
+ return out;
203
+ }
204
+
205
+ function serializeFormUrlencoded(list: Array<[string, string]>): string {
206
+ return list
207
+ .map(
208
+ ([name, value]) => `${percentEncodeString(name, inFormSet, true)}=${percentEncodeString(value, inFormSet, true)}`
209
+ )
210
+ .join('&');
211
+ }
212
+
213
+ /* -----------------------------
214
+ Hosts
215
+ ----------------------------- */
216
+
217
+ const FORBIDDEN_HOST_CODE_POINTS = charTable('\u0000\t\n\r #/:<>?@[\\]^|');
218
+ const isForbiddenHostCodePoint = (c: number) => FORBIDDEN_HOST_CODE_POINTS[c] === true;
219
+ const isForbiddenDomainCodePoint = (c: number) => isForbiddenHostCodePoint(c) || c <= 0x1f || c === 0x25 || c === 0x7f;
220
+
221
+ function parseIPv4Number(input: string): number | null {
222
+ if (input === '') return null;
223
+ let radix = 10;
224
+ if (input.length >= 2 && input[0] === '0' && (input[1] === 'x' || input[1] === 'X')) {
225
+ input = input.slice(2);
226
+ radix = 16;
227
+ } else if (input.length >= 2 && input[0] === '0') {
228
+ input = input.slice(1);
229
+ radix = 8;
230
+ }
231
+ if (input === '') return 0;
232
+ const digits = radix === 10 ? /^[0-9]+$/ : radix === 16 ? /^[0-9A-Fa-f]+$/ : /^[0-7]+$/;
233
+ if (!digits.test(input)) return null;
234
+ return parseInt(input, radix);
235
+ }
236
+
237
+ function endsInANumber(input: string): boolean {
238
+ const parts = input.split('.');
239
+ if (parts[parts.length - 1] === '') {
240
+ if (parts.length === 1) return false;
241
+ parts.pop();
242
+ }
243
+ const last = parts[parts.length - 1]!;
244
+ if (/^[0-9]+$/.test(last)) return true;
245
+ return parseIPv4Number(last) !== null;
246
+ }
247
+
248
+ function parseIPv4(input: string): string | null {
249
+ const parts = input.split('.');
250
+ if (parts[parts.length - 1] === '' && parts.length > 1) parts.pop();
251
+ if (parts.length > 4) return null;
252
+ const numbers: number[] = [];
253
+ for (const part of parts) {
254
+ const n = parseIPv4Number(part);
255
+ if (n === null) return null;
256
+ numbers.push(n);
257
+ }
258
+ for (let i = 0; i < numbers.length - 1; i++) if (numbers[i]! > 255) return null;
259
+ let ipv4 = numbers[numbers.length - 1]!;
260
+ if (ipv4 >= Math.pow(256, 5 - numbers.length)) return null;
261
+ for (let i = 0; i < numbers.length - 1; i++) ipv4 += numbers[i]! * Math.pow(256, 3 - i);
262
+ let out = '';
263
+ for (let i = 0; i < 4; i++) {
264
+ out = String(ipv4 % 256) + (i === 0 ? '' : '.') + out;
265
+ ipv4 = Math.floor(ipv4 / 256);
266
+ }
267
+ return out;
268
+ }
269
+
270
+ function parseIPv6(input: string): number[] | null {
271
+ const cps = toCodePoints(input);
272
+ const at = (i: number) => (i < cps.length ? cps[i]! : EOF);
273
+ const address = [0, 0, 0, 0, 0, 0, 0, 0];
274
+ let pieceIndex = 0;
275
+ let compress: number | null = null;
276
+ let pointer = 0;
277
+
278
+ if (at(pointer) === 0x3a) {
279
+ if (at(pointer + 1) !== 0x3a) return null;
280
+ pointer += 2;
281
+ compress = ++pieceIndex;
282
+ }
283
+ while (at(pointer) !== EOF) {
284
+ if (pieceIndex === 8) return null;
285
+ if (at(pointer) === 0x3a) {
286
+ if (compress !== null) return null;
287
+ pointer++;
288
+ compress = ++pieceIndex;
289
+ continue;
290
+ }
291
+ let value = 0;
292
+ let length = 0;
293
+ while (length < 4 && isASCIIHex(at(pointer))) {
294
+ value = value * 0x10 + parseInt(String.fromCharCode(at(pointer)), 16);
295
+ pointer++;
296
+ length++;
297
+ }
298
+ if (at(pointer) === 0x2e) {
299
+ // Embedded IPv4 address
300
+ if (length === 0) return null;
301
+ pointer -= length;
302
+ if (pieceIndex > 6) return null;
303
+ let numbersSeen = 0;
304
+ while (at(pointer) !== EOF) {
305
+ let ipv4Piece: number | null = null;
306
+ if (numbersSeen > 0) {
307
+ if (at(pointer) === 0x2e && numbersSeen < 4) pointer++;
308
+ else return null;
309
+ }
310
+ if (!isASCIIDigit(at(pointer))) return null;
311
+ while (isASCIIDigit(at(pointer))) {
312
+ const n = at(pointer) - 0x30;
313
+ if (ipv4Piece === null) ipv4Piece = n;
314
+ else if (ipv4Piece === 0) return null;
315
+ else ipv4Piece = ipv4Piece * 10 + n;
316
+ if (ipv4Piece > 255) return null;
317
+ pointer++;
70
318
  }
319
+ address[pieceIndex] = address[pieceIndex]! * 0x100 + ipv4Piece!;
320
+ numbersSeen++;
321
+ if (numbersSeen === 2 || numbersSeen === 4) pieceIndex++;
71
322
  }
72
- bytes.push(str.charCodeAt(i));
73
- i++;
323
+ if (numbersSeen !== 4) return null;
324
+ break;
325
+ } else if (at(pointer) === 0x3a) {
326
+ pointer++;
327
+ if (at(pointer) === EOF) return null;
328
+ } else if (at(pointer) !== EOF) {
329
+ return null;
74
330
  }
75
- // decode UTF-8 bytes
76
- let res = '';
77
- for (let i = 0; i < bytes.length; ) {
78
- const b = bytes[i]!;
79
- if (b < 0x80) {
80
- res += String.fromCharCode(b);
81
- i++;
82
- } else if (b >= 0xc0 && b < 0xe0) {
83
- const b2 = bytes[i + 1] ?? 0x80;
84
- const code = ((b & 0x1f) << 6) | (b2 & 0x3f);
85
- res += String.fromCharCode(code);
86
- i += 2;
87
- } else if (b >= 0xe0 && b < 0xf0) {
88
- const b2 = bytes[i + 1] ?? 0x80;
89
- const b3 = bytes[i + 2] ?? 0x80;
90
- const code = ((b & 0x0f) << 12) | ((b2 & 0x3f) << 6) | (b3 & 0x3f);
91
- res += String.fromCharCode(code);
92
- i += 3;
93
- } else if (b >= 0xf0) {
94
- const b2 = bytes[i + 1] ?? 0x80,
95
- b3 = bytes[i + 2] ?? 0x80,
96
- b4 = bytes[i + 3] ?? 0x80;
97
- const codePoint = ((b & 7) << 18) | ((b2 & 0x3f) << 12) | ((b3 & 0x3f) << 6) | (b4 & 0x3f);
98
- const cp = codePoint - 0x10000;
99
- res += String.fromCharCode(0xd800 + (cp >> 10), 0xdc00 + (cp & 0x3ff));
100
- i += 4;
101
- } else {
102
- i++;
103
- }
331
+ address[pieceIndex] = value;
332
+ pieceIndex++;
333
+ }
334
+ if (compress !== null) {
335
+ let swaps = pieceIndex - compress;
336
+ pieceIndex = 7;
337
+ while (pieceIndex !== 0 && swaps > 0) {
338
+ const other = compress + swaps - 1;
339
+ const tmp = address[other]!;
340
+ address[other] = address[pieceIndex]!;
341
+ address[pieceIndex] = tmp;
342
+ pieceIndex--;
343
+ swaps--;
104
344
  }
105
- return res;
345
+ } else if (pieceIndex !== 8) {
346
+ return null;
106
347
  }
348
+ return address;
107
349
  }
108
350
 
109
- function isWindowsDrivePath(input: string) {
110
- return /^[a-zA-Z]:[\\/]/.test(input);
351
+ function serializeIPv6(address: number[]): string {
352
+ // Compress the first longest run of two or more zero pieces.
353
+ let compress: number | null = null;
354
+ let longest = 1;
355
+ for (let i = 0; i < 8; ) {
356
+ if (address[i] !== 0) {
357
+ i++;
358
+ continue;
359
+ }
360
+ let end = i;
361
+ while (end < 8 && address[end] === 0) end++;
362
+ if (end - i > longest) {
363
+ longest = end - i;
364
+ compress = i;
365
+ }
366
+ i = end;
367
+ }
368
+ let out = '';
369
+ let ignore0 = false;
370
+ for (let i = 0; i < 8; i++) {
371
+ if (ignore0 && address[i] === 0) continue;
372
+ ignore0 = false;
373
+ if (compress === i) {
374
+ out += i === 0 ? '::' : ':';
375
+ ignore0 = true;
376
+ continue;
377
+ }
378
+ out += address[i]!.toString(16);
379
+ if (i !== 7) out += ':';
380
+ }
381
+ return out;
111
382
  }
112
383
 
113
- // Path normalization utility
114
- function normalizePath(path: string): string {
115
- if (!path || path === '/') return '/';
384
+ // Code points UTS #46 maps to nothing (soft hyphen, zero-width space and joiners, variation selectors, BOM).
385
+ const IGNORED_IN_DOMAINS = /[\u00AD\u034F\u180B-\u180F\u200B\u2060\u2064\uFE00-\uFE0F\uFEFF]/g;
386
+
387
+ function normalizeUnicode(input: string, form: 'NFC' | 'NFKC'): string {
388
+ try {
389
+ return typeof input.normalize === 'function' ? input.normalize(form) : input;
390
+ } catch {
391
+ return input;
392
+ }
393
+ }
116
394
 
117
- const segments = path.split('/');
118
- const normalized: string[] = [];
395
+ function punycodeEncode(input: number[]): string {
396
+ const base = 36;
397
+ const tMin = 1;
398
+ const tMax = 26;
399
+ const digit = (d: number) => String.fromCharCode(d < 26 ? 0x61 + d : 0x16 + d);
400
+ const adapt = (delta: number, numPoints: number, firstTime: boolean) => {
401
+ delta = firstTime ? Math.floor(delta / 700) : delta >> 1;
402
+ delta += Math.floor(delta / numPoints);
403
+ let k = 0;
404
+ while (delta > ((base - tMin) * tMax) >> 1) {
405
+ delta = Math.floor(delta / (base - tMin));
406
+ k += base;
407
+ }
408
+ return k + Math.floor(((base - tMin + 1) * delta) / (delta + 38));
409
+ };
119
410
 
120
- for (const segment of segments) {
121
- if (segment === '' || segment === '.') {
122
- continue; // skip empty and current directory
123
- } else if (segment === '..') {
124
- if (normalized.length > 0 && normalized[normalized.length - 1] !== '..') {
125
- normalized.pop(); // go up one directory
126
- } else if (!path.startsWith('/')) {
127
- normalized.push('..'); // relative path, keep ..
411
+ let out = '';
412
+ for (const cp of input) if (cp < 0x80) out += String.fromCharCode(cp);
413
+ const basicLength = out.length;
414
+ let handled = basicLength;
415
+ if (basicLength > 0) out += '-';
416
+ let n = 0x80;
417
+ let delta = 0;
418
+ let bias = 72;
419
+ while (handled < input.length) {
420
+ let m = Infinity;
421
+ for (const cp of input) if (cp >= n && cp < m) m = cp;
422
+ delta += (m - n) * (handled + 1);
423
+ n = m;
424
+ for (const cp of input) {
425
+ if (cp < n) delta++;
426
+ if (cp === n) {
427
+ let q = delta;
428
+ for (let k = base; ; k += base) {
429
+ const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
430
+ if (q < t) break;
431
+ out += digit(t + ((q - t) % (base - t)));
432
+ q = Math.floor((q - t) / (base - t));
433
+ }
434
+ out += digit(q);
435
+ bias = adapt(delta, handled + 1, handled === basicLength);
436
+ delta = 0;
437
+ handled++;
128
438
  }
129
- } else {
130
- normalized.push(segment);
131
439
  }
440
+ delta++;
441
+ n++;
132
442
  }
443
+ return out;
444
+ }
445
+
446
+ // Domain to ASCII. ASCII input is lower-cased; other input gets an approximation of UTS #46 mapping
447
+ // (ignored code points removed, NFKC, per-code-point lower case, NFC) and punycode per label.
448
+ function domainToASCII(domain: string): string | null {
449
+ let result: string;
450
+ if (isASCII(domain)) {
451
+ result = domain.replace(/[A-Z]+/g, (m) => m.toLowerCase());
452
+ } else {
453
+ let mapped = normalizeUnicode(domain.replace(IGNORED_IN_DOMAINS, ''), 'NFKC');
454
+ mapped = normalizeUnicode(toCodePoints(mapped).map(toLowerCodePoint).join(''), 'NFC');
455
+ mapped = mapped.replace(/[\u3002\uFF0E\uFF61]/g, '.');
456
+ // U+FFFD comes from invalid percent-encoded UTF-8; C1 controls are disallowed too.
457
+ if (/[\u0080-\u009f\uFFFD]/.test(mapped)) return null;
458
+ result = mapped
459
+ .split('.')
460
+ .map((label) => (isASCII(label) ? label : 'xn--' + punycodeEncode(toCodePoints(label))))
461
+ .join('.');
462
+ }
463
+ if (result === '') return null;
464
+ for (let i = 0; i < result.length; i++) if (isForbiddenDomainCodePoint(result.charCodeAt(i))) return null;
465
+ return result;
466
+ }
467
+
468
+ function toLowerCodePoint(cp: number): string {
469
+ return String.fromCodePoint(cp).toLowerCase();
470
+ }
471
+
472
+ // Parse a host; returns the serialized host or null on failure.
473
+ function parseHost(input: string, isOpaque: boolean): string | null {
474
+ if (input.startsWith('[')) {
475
+ if (!input.endsWith(']')) return null;
476
+ const address = parseIPv6(input.slice(1, -1));
477
+ return address ? `[${serializeIPv6(address)}]` : null;
478
+ }
479
+ if (isOpaque) {
480
+ for (const cp of toCodePoints(input)) if (isForbiddenHostCodePoint(cp)) return null;
481
+ return percentEncodeString(input, inC0ControlSet);
482
+ }
483
+ const asciiDomain = domainToASCII(utf8Decode(percentDecode(input)));
484
+ if (asciiDomain === null) return null;
485
+ if (endsInANumber(asciiDomain)) return parseIPv4(asciiDomain);
486
+ return asciiDomain;
487
+ }
488
+
489
+ /* -----------------------------
490
+ URL records and the basic URL parser
491
+ ----------------------------- */
133
492
 
134
- let result = normalized.join('/');
135
- if (path.startsWith('/')) result = '/' + result;
136
- if (path.endsWith('/') && result !== '/') result += '/';
493
+ interface URLRecord {
494
+ scheme: string;
495
+ username: string;
496
+ password: string;
497
+ host: string | null; // serialized host
498
+ port: number | null;
499
+ path: string[] | string; // a string is an opaque path (e.g. mailto:, data:)
500
+ query: string | null;
501
+ fragment: string | null;
502
+ }
137
503
 
138
- return result || '/';
504
+ // Special schemes and their default ports (file has none).
505
+ function specialSchemePort(scheme: string): number | null | undefined {
506
+ switch (scheme) {
507
+ case 'ftp':
508
+ return 21;
509
+ case 'http':
510
+ case 'ws':
511
+ return 80;
512
+ case 'https':
513
+ case 'wss':
514
+ return 443;
515
+ case 'file':
516
+ return null;
517
+ default:
518
+ return undefined;
519
+ }
139
520
  }
140
521
 
141
- // Default ports for common protocols
142
- const DEFAULT_PORTS: Record<string, string> = {
143
- 'http:': '80',
144
- 'https:': '443',
145
- 'ftp:': '21',
146
- 'ftps:': '990',
147
- 'ssh:': '22',
148
- 'ws:': '80',
149
- 'wss:': '443',
522
+ const isSpecialScheme = (scheme: string) => specialSchemePort(scheme) !== undefined;
523
+ const includesCredentials = (url: URLRecord) => url.username !== '' || url.password !== '';
524
+ const cannotHaveCredentialsOrPort = (url: URLRecord) => url.host === null || url.host === '' || url.scheme === 'file';
525
+
526
+ const isWindowsDriveLetter = (s: string) => /^[A-Za-z][:|]$/.test(s);
527
+ const isNormalizedWindowsDriveLetter = (s: string) => /^[A-Za-z]:$/.test(s);
528
+ const isSingleDotSegment = (s: string) => s === '.' || s.toLowerCase() === '%2e';
529
+ const isDoubleDotSegment = (s: string) => {
530
+ const lower = s.toLowerCase();
531
+ return lower === '..' || lower === '.%2e' || lower === '%2e.' || lower === '%2e%2e';
150
532
  };
151
533
 
534
+ function startsWithWindowsDriveLetter(cps: number[], pointer: number): boolean {
535
+ if (cps.length - pointer < 2) return false;
536
+ const first = cps[pointer]!;
537
+ const second = cps[pointer + 1]!;
538
+ if (!isASCIIAlpha(first) || (second !== 0x3a && second !== 0x7c)) return false;
539
+ if (cps.length - pointer === 2) return true;
540
+ const third = cps[pointer + 2]!;
541
+ return third === 0x2f || third === 0x5c || third === 0x3f || third === 0x23;
542
+ }
543
+
544
+ function pathList(url: URLRecord): string[] {
545
+ if (typeof url.path === 'string') url.path = [];
546
+ return url.path;
547
+ }
548
+
549
+ function shortenPath(url: URLRecord) {
550
+ const path = pathList(url);
551
+ if (url.scheme === 'file' && path.length === 1 && isNormalizedWindowsDriveLetter(path[0]!)) return;
552
+ path.pop();
553
+ }
554
+
555
+ // Parser states
556
+ const SCHEME_START = 1;
557
+ const SCHEME = 2;
558
+ const NO_SCHEME = 3;
559
+ const SPECIAL_RELATIVE_OR_AUTHORITY = 4;
560
+ const PATH_OR_AUTHORITY = 5;
561
+ const RELATIVE = 6;
562
+ const RELATIVE_SLASH = 7;
563
+ const SPECIAL_AUTHORITY_SLASHES = 8;
564
+ const SPECIAL_AUTHORITY_IGNORE_SLASHES = 9;
565
+ const AUTHORITY = 10;
566
+ const HOST = 11;
567
+ const HOSTNAME = 12;
568
+ const PORT = 13;
569
+ const FILE = 14;
570
+ const FILE_SLASH = 15;
571
+ const FILE_HOST = 16;
572
+ const PATH_START = 17;
573
+ const PATH = 18;
574
+ const OPAQUE_PATH = 19;
575
+ const QUERY = 20;
576
+ const FRAGMENT = 21;
577
+
578
+ /**
579
+ * The URL Standard's basic URL parser. Returns the URL record, or null on failure. With `url` and
580
+ * `stateOverride` (used by the setters) it modifies `url` in place.
581
+ */
582
+ function basicURLParse(
583
+ input: string,
584
+ base: URLRecord | null,
585
+ url?: URLRecord,
586
+ stateOverride?: number
587
+ ): URLRecord | null {
588
+ let record: URLRecord;
589
+ if (url) {
590
+ record = url;
591
+ } else {
592
+ record = { scheme: '', username: '', password: '', host: null, port: null, path: [], query: null, fragment: null };
593
+ input = trimC0ControlOrSpace(input);
594
+ }
595
+ input = input.replace(/[\t\n\r]/g, '');
596
+
597
+ const cps = toCodePoints(input);
598
+ const special = () => isSpecialScheme(record.scheme);
599
+ let state = stateOverride || SCHEME_START;
600
+ let buffer = '';
601
+ let atSignSeen = false;
602
+ let insideBrackets = false;
603
+ let passwordTokenSeen = false;
604
+
605
+ for (let pointer = 0; pointer <= cps.length; pointer++) {
606
+ const c = pointer < cps.length ? cps[pointer]! : EOF;
607
+ const next = pointer + 1 < cps.length ? cps[pointer + 1]! : EOF;
608
+
609
+ switch (state) {
610
+ case SCHEME_START:
611
+ if (isASCIIAlpha(c)) {
612
+ buffer += String.fromCharCode(lowerASCII(c));
613
+ state = SCHEME;
614
+ } else if (!stateOverride) {
615
+ state = NO_SCHEME;
616
+ pointer--;
617
+ } else {
618
+ return null;
619
+ }
620
+ break;
621
+
622
+ case SCHEME:
623
+ if (isASCIIAlphanumeric(c) || c === 0x2b || c === 0x2d || c === 0x2e) {
624
+ buffer += String.fromCharCode(lowerASCII(c));
625
+ } else if (c === 0x3a) {
626
+ if (stateOverride) {
627
+ if (isSpecialScheme(record.scheme) !== isSpecialScheme(buffer)) return record;
628
+ if ((includesCredentials(record) || record.port !== null) && buffer === 'file') return record;
629
+ if (record.scheme === 'file' && record.host === '') return record;
630
+ }
631
+ record.scheme = buffer;
632
+ if (stateOverride) {
633
+ if (record.port === specialSchemePort(record.scheme)) record.port = null;
634
+ return record;
635
+ }
636
+ buffer = '';
637
+ if (record.scheme === 'file') {
638
+ state = FILE;
639
+ } else if (special() && base && base.scheme === record.scheme) {
640
+ state = SPECIAL_RELATIVE_OR_AUTHORITY;
641
+ } else if (special()) {
642
+ state = SPECIAL_AUTHORITY_SLASHES;
643
+ } else if (next === 0x2f) {
644
+ state = PATH_OR_AUTHORITY;
645
+ pointer++;
646
+ } else {
647
+ record.path = '';
648
+ state = OPAQUE_PATH;
649
+ }
650
+ } else if (!stateOverride) {
651
+ buffer = '';
652
+ state = NO_SCHEME;
653
+ pointer = -1; // start over
654
+ } else {
655
+ return null;
656
+ }
657
+ break;
658
+
659
+ case NO_SCHEME:
660
+ if (!base || (typeof base.path === 'string' && c !== 0x23)) {
661
+ return null;
662
+ } else if (typeof base.path === 'string' && c === 0x23) {
663
+ record.scheme = base.scheme;
664
+ record.path = base.path;
665
+ record.query = base.query;
666
+ record.fragment = '';
667
+ state = FRAGMENT;
668
+ } else if (base.scheme !== 'file') {
669
+ state = RELATIVE;
670
+ pointer--;
671
+ } else {
672
+ state = FILE;
673
+ pointer--;
674
+ }
675
+ break;
676
+
677
+ case SPECIAL_RELATIVE_OR_AUTHORITY:
678
+ if (c === 0x2f && next === 0x2f) {
679
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
680
+ pointer++;
681
+ } else {
682
+ state = RELATIVE;
683
+ pointer--;
684
+ }
685
+ break;
686
+
687
+ case PATH_OR_AUTHORITY:
688
+ if (c === 0x2f) {
689
+ state = AUTHORITY;
690
+ } else {
691
+ state = PATH;
692
+ pointer--;
693
+ }
694
+ break;
695
+
696
+ case RELATIVE:
697
+ record.scheme = base!.scheme;
698
+ if (c === 0x2f || (special() && c === 0x5c)) {
699
+ state = RELATIVE_SLASH;
700
+ } else {
701
+ record.username = base!.username;
702
+ record.password = base!.password;
703
+ record.host = base!.host;
704
+ record.port = base!.port;
705
+ record.path = typeof base!.path === 'string' ? base!.path : base!.path.slice();
706
+ record.query = base!.query;
707
+ if (c === 0x3f) {
708
+ record.query = '';
709
+ state = QUERY;
710
+ } else if (c === 0x23) {
711
+ record.fragment = '';
712
+ state = FRAGMENT;
713
+ } else if (c !== EOF) {
714
+ record.query = null;
715
+ shortenPath(record);
716
+ state = PATH;
717
+ pointer--;
718
+ }
719
+ }
720
+ break;
721
+
722
+ case RELATIVE_SLASH:
723
+ if (special() && (c === 0x2f || c === 0x5c)) {
724
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
725
+ } else if (c === 0x2f) {
726
+ state = AUTHORITY;
727
+ } else {
728
+ record.username = base!.username;
729
+ record.password = base!.password;
730
+ record.host = base!.host;
731
+ record.port = base!.port;
732
+ state = PATH;
733
+ pointer--;
734
+ }
735
+ break;
736
+
737
+ case SPECIAL_AUTHORITY_SLASHES:
738
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
739
+ if (c === 0x2f && next === 0x2f) pointer++;
740
+ else pointer--;
741
+ break;
742
+
743
+ case SPECIAL_AUTHORITY_IGNORE_SLASHES:
744
+ if (c !== 0x2f && c !== 0x5c) {
745
+ state = AUTHORITY;
746
+ pointer--;
747
+ }
748
+ break;
749
+
750
+ case AUTHORITY:
751
+ if (c === 0x40) {
752
+ if (atSignSeen) buffer = '%40' + buffer;
753
+ atSignSeen = true;
754
+ for (const bc of toCodePoints(buffer)) {
755
+ if (bc === 0x3a && !passwordTokenSeen) {
756
+ passwordTokenSeen = true;
757
+ continue;
758
+ }
759
+ const encoded = percentEncodeCodePoint(bc, inUserinfoSet);
760
+ if (passwordTokenSeen) record.password += encoded;
761
+ else record.username += encoded;
762
+ }
763
+ buffer = '';
764
+ } else if (c === EOF || c === 0x2f || c === 0x3f || c === 0x23 || (special() && c === 0x5c)) {
765
+ if (atSignSeen && buffer === '') return null;
766
+ pointer -= toCodePoints(buffer).length + 1;
767
+ buffer = '';
768
+ state = HOST;
769
+ } else {
770
+ buffer += String.fromCodePoint(c);
771
+ }
772
+ break;
773
+
774
+ case HOST:
775
+ case HOSTNAME:
776
+ if (stateOverride && record.scheme === 'file') {
777
+ pointer--;
778
+ state = FILE_HOST;
779
+ } else if (c === 0x3a && !insideBrackets) {
780
+ if (buffer === '') return null;
781
+ if (stateOverride === HOSTNAME) return null;
782
+ const host = parseHost(buffer, !special());
783
+ if (host === null) return null;
784
+ record.host = host;
785
+ buffer = '';
786
+ state = PORT;
787
+ } else if (c === EOF || c === 0x2f || c === 0x3f || c === 0x23 || (special() && c === 0x5c)) {
788
+ pointer--;
789
+ if (special() && buffer === '') return null;
790
+ if (stateOverride && buffer === '' && (includesCredentials(record) || record.port !== null)) return null;
791
+ const host = parseHost(buffer, !special());
792
+ if (host === null) return null;
793
+ record.host = host;
794
+ buffer = '';
795
+ state = PATH_START;
796
+ if (stateOverride) return record;
797
+ } else {
798
+ if (c === 0x5b) insideBrackets = true;
799
+ if (c === 0x5d) insideBrackets = false;
800
+ buffer += String.fromCodePoint(c);
801
+ }
802
+ break;
803
+
804
+ case PORT:
805
+ if (isASCIIDigit(c)) {
806
+ buffer += String.fromCharCode(c);
807
+ } else if (c === EOF || c === 0x2f || c === 0x3f || c === 0x23 || (special() && c === 0x5c) || stateOverride) {
808
+ if (buffer !== '') {
809
+ const port = parseInt(buffer, 10);
810
+ if (port > 65535) return null;
811
+ record.port = port === specialSchemePort(record.scheme) ? null : port;
812
+ buffer = '';
813
+ if (stateOverride) return record;
814
+ }
815
+ if (stateOverride) return null;
816
+ state = PATH_START;
817
+ pointer--;
818
+ } else {
819
+ return null;
820
+ }
821
+ break;
822
+
823
+ case FILE:
824
+ record.scheme = 'file';
825
+ record.host = '';
826
+ if (c === 0x2f || c === 0x5c) {
827
+ state = FILE_SLASH;
828
+ } else if (base && base.scheme === 'file') {
829
+ record.host = base.host;
830
+ record.path = typeof base.path === 'string' ? base.path : base.path.slice();
831
+ record.query = base.query;
832
+ if (c === 0x3f) {
833
+ record.query = '';
834
+ state = QUERY;
835
+ } else if (c === 0x23) {
836
+ record.fragment = '';
837
+ state = FRAGMENT;
838
+ } else if (c !== EOF) {
839
+ record.query = null;
840
+ if (!startsWithWindowsDriveLetter(cps, pointer)) shortenPath(record);
841
+ else record.path = [];
842
+ state = PATH;
843
+ pointer--;
844
+ }
845
+ } else {
846
+ state = PATH;
847
+ pointer--;
848
+ }
849
+ break;
850
+
851
+ case FILE_SLASH:
852
+ if (c === 0x2f || c === 0x5c) {
853
+ state = FILE_HOST;
854
+ } else {
855
+ if (base && base.scheme === 'file') {
856
+ record.host = base.host;
857
+ const basePath = base.path;
858
+ if (
859
+ !startsWithWindowsDriveLetter(cps, pointer) &&
860
+ typeof basePath !== 'string' &&
861
+ basePath.length > 0 &&
862
+ isNormalizedWindowsDriveLetter(basePath[0]!)
863
+ ) {
864
+ pathList(record).push(basePath[0]!);
865
+ }
866
+ }
867
+ state = PATH;
868
+ pointer--;
869
+ }
870
+ break;
871
+
872
+ case FILE_HOST:
873
+ if (c === EOF || c === 0x2f || c === 0x5c || c === 0x3f || c === 0x23) {
874
+ pointer--;
875
+ if (!stateOverride && isWindowsDriveLetter(buffer)) {
876
+ state = PATH; // the buffer is kept and becomes the first path segment
877
+ } else if (buffer === '') {
878
+ record.host = '';
879
+ if (stateOverride) return record;
880
+ state = PATH_START;
881
+ } else {
882
+ let host = parseHost(buffer, !special());
883
+ if (host === null) return null;
884
+ if (host === 'localhost') host = '';
885
+ record.host = host;
886
+ if (stateOverride) return record;
887
+ buffer = '';
888
+ state = PATH_START;
889
+ }
890
+ } else {
891
+ buffer += String.fromCodePoint(c);
892
+ }
893
+ break;
894
+
895
+ case PATH_START:
896
+ if (special()) {
897
+ state = PATH;
898
+ if (c !== 0x2f && c !== 0x5c) pointer--;
899
+ } else if (!stateOverride && c === 0x3f) {
900
+ record.query = '';
901
+ state = QUERY;
902
+ } else if (!stateOverride && c === 0x23) {
903
+ record.fragment = '';
904
+ state = FRAGMENT;
905
+ } else if (c !== EOF) {
906
+ state = PATH;
907
+ if (c !== 0x2f) pointer--;
908
+ } else if (stateOverride && record.host === null) {
909
+ pathList(record).push('');
910
+ }
911
+ break;
912
+
913
+ case PATH:
914
+ if (c === EOF || c === 0x2f || (special() && c === 0x5c) || (!stateOverride && (c === 0x3f || c === 0x23))) {
915
+ const slash = c === 0x2f || (special() && c === 0x5c);
916
+ const path = pathList(record);
917
+ if (isDoubleDotSegment(buffer)) {
918
+ shortenPath(record);
919
+ if (!slash) path.push('');
920
+ } else if (isSingleDotSegment(buffer)) {
921
+ if (!slash) path.push('');
922
+ } else {
923
+ if (record.scheme === 'file' && path.length === 0 && isWindowsDriveLetter(buffer)) {
924
+ buffer = buffer[0] + ':';
925
+ }
926
+ path.push(buffer);
927
+ }
928
+ buffer = '';
929
+ if (c === 0x3f) {
930
+ record.query = '';
931
+ state = QUERY;
932
+ } else if (c === 0x23) {
933
+ record.fragment = '';
934
+ state = FRAGMENT;
935
+ }
936
+ } else {
937
+ buffer += percentEncodeCodePoint(c, inPathSet);
938
+ }
939
+ break;
940
+
941
+ case OPAQUE_PATH:
942
+ if (c === 0x3f) {
943
+ record.query = '';
944
+ state = QUERY;
945
+ } else if (c === 0x23) {
946
+ record.fragment = '';
947
+ state = FRAGMENT;
948
+ } else if (c === 0x20) {
949
+ record.path += next === 0x3f || next === 0x23 ? '%20' : ' ';
950
+ } else if (c !== EOF) {
951
+ record.path += percentEncodeCodePoint(c, inC0ControlSet);
952
+ }
953
+ break;
954
+
955
+ case QUERY:
956
+ if ((!stateOverride && c === 0x23) || c === EOF) {
957
+ record.query = (record.query ?? '') + percentEncodeString(buffer, special() ? inSpecialQuerySet : inQuerySet);
958
+ buffer = '';
959
+ if (c === 0x23) {
960
+ record.fragment = '';
961
+ state = FRAGMENT;
962
+ }
963
+ } else {
964
+ buffer += String.fromCodePoint(c);
965
+ }
966
+ break;
967
+
968
+ case FRAGMENT:
969
+ if (c !== EOF) record.fragment = (record.fragment ?? '') + percentEncodeCodePoint(c, inFragmentSet);
970
+ break;
971
+ }
972
+ }
973
+ return record;
974
+ }
975
+
976
+ function serializePath(url: URLRecord): string {
977
+ if (typeof url.path === 'string') return url.path;
978
+ let out = '';
979
+ for (const segment of url.path) out += '/' + segment;
980
+ return out;
981
+ }
982
+
983
+ function serializeURL(url: URLRecord): string {
984
+ let out = url.scheme + ':';
985
+ if (url.host !== null) {
986
+ out += '//';
987
+ if (includesCredentials(url)) {
988
+ out += url.username;
989
+ if (url.password !== '') out += ':' + url.password;
990
+ out += '@';
991
+ }
992
+ out += url.host;
993
+ if (url.port !== null) out += ':' + url.port;
994
+ } else if (typeof url.path !== 'string' && url.path.length > 1 && url.path[0] === '') {
995
+ out += '/.';
996
+ }
997
+ out += serializePath(url);
998
+ if (url.query !== null) out += '?' + url.query;
999
+ if (url.fragment !== null) out += '#' + url.fragment;
1000
+ return out;
1001
+ }
1002
+
1003
+ function serializeOrigin(url: URLRecord): string {
1004
+ switch (url.scheme) {
1005
+ case 'blob': {
1006
+ const inner = basicURLParse(serializePath(url), null);
1007
+ return inner && (inner.scheme === 'http' || inner.scheme === 'https') ? serializeOrigin(inner) : 'null';
1008
+ }
1009
+ case 'ftp':
1010
+ case 'http':
1011
+ case 'https':
1012
+ case 'ws':
1013
+ case 'wss':
1014
+ return `${url.scheme}://${url.host}${url.port !== null ? ':' + url.port : ''}`;
1015
+ default:
1016
+ return 'null';
1017
+ }
1018
+ }
1019
+
152
1020
  /* -----------------------------
153
1021
  URLSearchParams Implementation
154
1022
  ----------------------------- */
155
1023
 
1024
+ // What the owning URL needs to reach inside its URLSearchParams.
1025
+ interface SearchParamsInternals {
1026
+ _list: Array<[string, string]>;
1027
+ _url: URLRecord | null;
1028
+ }
1029
+
1030
+ const internals = (params: URLSearchParams) => params as unknown as SearchParamsInternals;
1031
+
156
1032
  export class URLSearchParams implements Iterable<[string, string]> {
157
- private _map: Map<string, string[]>;
1033
+ private _list: Array<[string, string]> = [];
1034
+ // The record of the URL whose `searchParams` this is; mutations rewrite its query.
1035
+ private _url: URLRecord | null = null;
158
1036
 
159
1037
  constructor(init?: string | Record<string, string> | Array<[string, string]> | URLSearchParams) {
160
- this._map = new Map();
161
- if (!init) return;
162
- if (typeof init === 'string') {
163
- const s = init.startsWith('?') ? init.slice(1) : init;
164
- if (s.length === 0) return;
165
- s.split('&').forEach((pair) => {
166
- if (pair.length === 0) return;
167
- const [k, ...rest] = pair.split('=');
168
- const key = decodePercentEncoded(k!.replace(/\+/g, '%20'))!;
169
- const val = decodePercentEncoded((rest.join('=') || '').replace(/\+/g, '%20'));
170
- this.append(key, val);
171
- });
172
- } else if (Array.isArray(init)) {
173
- init.forEach(([k, v]) => this.append(String(k), String(v)));
174
- } else if (init instanceof URLSearchParams) {
175
- init.forEach((val, key) => this.append(key, val));
176
- } else if (typeof init === 'object') {
177
- Object.keys(init).forEach((k) => this.set(k, init[k]!));
1038
+ if (init === undefined) return;
1039
+ if (init !== null && (typeof init === 'object' || typeof init === 'function')) {
1040
+ const iterable = init as Partial<Iterable<unknown>>;
1041
+ if (typeof iterable[Symbol.iterator] === 'function') {
1042
+ for (const pair of iterable as Iterable<unknown>) {
1043
+ const items = pair !== null && typeof pair === 'object' ? Array.from(pair as Iterable<unknown>) : null;
1044
+ if (!items || items.length !== 2) {
1045
+ throw new TypeError('Each query pair must be an iterable [name, value] tuple');
1046
+ }
1047
+ this._list.push([toUSVString(items[0]), toUSVString(items[1])]);
1048
+ }
1049
+ } else {
1050
+ const record = init as Record<string, unknown>;
1051
+ for (const key of Object.keys(record)) this._list.push([toUSVString(key), toUSVString(record[key])]);
1052
+ }
1053
+ return;
178
1054
  }
1055
+ const query = String(init);
1056
+ this._list = parseFormUrlencoded(query.startsWith('?') ? query.slice(1) : query);
1057
+ }
1058
+
1059
+ private _update() {
1060
+ if (!this._url) return;
1061
+ const serialized = serializeFormUrlencoded(this._list);
1062
+ this._url.query = serialized === '' ? null : serialized;
179
1063
  }
180
1064
 
181
1065
  append(name: string, value: string) {
182
- const key = String(name);
183
- const val = String(value);
184
- const arr = this._map.get(key) || [];
185
- arr.push(val);
186
- this._map.set(key, arr);
1066
+ this._list.push([toUSVString(name), toUSVString(value)]);
1067
+ this._update();
187
1068
  }
188
1069
 
189
1070
  set(name: string, value: string) {
190
- this._map.set(String(name), [String(value)]);
1071
+ const key = toUSVString(name);
1072
+ const val = toUSVString(value);
1073
+ const index = this._list.findIndex(([k]) => k === key);
1074
+ if (index === -1) {
1075
+ this._list.push([key, val]);
1076
+ } else {
1077
+ this._list[index] = [key, val];
1078
+ this._list = this._list.filter(([k], i) => i <= index || k !== key);
1079
+ }
1080
+ this._update();
191
1081
  }
192
1082
 
193
1083
  get(name: string): Nullable<string> {
194
- const arr = this._map.get(String(name));
195
- return arr ? arr[0]! : null;
1084
+ const key = toUSVString(name);
1085
+ const pair = this._list.find(([k]) => k === key);
1086
+ return pair ? pair[1] : null;
196
1087
  }
197
1088
 
198
1089
  getAll(name: string): string[] {
199
- return (this._map.get(String(name)) || []).slice();
1090
+ const key = toUSVString(name);
1091
+ return this._list.filter(([k]) => k === key).map(([, v]) => v);
200
1092
  }
201
1093
 
202
- has(name: string): boolean {
203
- return this._map.has(String(name));
1094
+ has(name: string, value?: string): boolean {
1095
+ const key = toUSVString(name);
1096
+ const val = value === undefined ? undefined : toUSVString(value);
1097
+ return this._list.some(([k, v]) => k === key && (val === undefined || v === val));
204
1098
  }
205
1099
 
206
- delete(name: string) {
207
- this._map.delete(String(name));
1100
+ delete(name: string, value?: string) {
1101
+ const key = toUSVString(name);
1102
+ const val = value === undefined ? undefined : toUSVString(value);
1103
+ this._list = this._list.filter(([k, v]) => !(k === key && (val === undefined || v === val)));
1104
+ this._update();
208
1105
  }
209
1106
 
210
1107
  forEach(cb: (value: string, name: string, self: URLSearchParams) => void, thisArg?: any) {
211
- for (const [k, vals] of this._map) {
212
- for (const v of vals) cb.call(thisArg, v, k, this);
1108
+ for (let i = 0; i < this._list.length; i++) {
1109
+ const [k, v] = this._list[i]!;
1110
+ cb.call(thisArg, v, k, this);
213
1111
  }
214
1112
  }
215
1113
 
216
1114
  toString(): string {
217
- const out: string[] = [];
218
- for (const [k, vals] of this._map) {
219
- for (const v of vals) {
220
- out.push(`${encodeComponent(k)}=${encodeComponent(v)}`);
221
- }
222
- }
223
- return out.join('&');
1115
+ return serializeFormUrlencoded(this._list);
224
1116
  }
225
1117
 
226
1118
  sort() {
227
- // Stable sort by key (and preserve values order per key)
228
- const entries = Array.from(this._map.entries()).sort((a, b) => (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0));
229
- this._map = new Map(entries);
1119
+ // Stable sort by name, comparing code units.
1120
+ this._list = this._list
1121
+ .map((pair, index) => ({ pair, index }))
1122
+ .sort((a, b) => (a.pair[0] < b.pair[0] ? -1 : a.pair[0] > b.pair[0] ? 1 : a.index - b.index))
1123
+ .map(({ pair }) => pair);
1124
+ this._update();
230
1125
  }
231
1126
 
232
1127
  toJSON() {
@@ -239,27 +1134,27 @@ export class URLSearchParams implements Iterable<[string, string]> {
239
1134
 
240
1135
  // Additional utility methods
241
1136
  get size(): number {
242
- let count = 0;
243
- for (const [, vals] of this._map) {
244
- count += vals.length;
245
- }
246
- return count;
1137
+ return this._list.length;
247
1138
  }
248
1139
 
249
1140
  clear(): void {
250
- this._map.clear();
1141
+ this._list = [];
1142
+ this._update();
251
1143
  }
252
1144
 
253
1145
  *entries(): IterableIterator<[string, string]> {
254
- for (const [k, vals] of this._map) for (const v of vals) yield [k, v];
1146
+ for (let i = 0; i < this._list.length; i++) {
1147
+ const [k, v] = this._list[i]!;
1148
+ yield [k, v];
1149
+ }
255
1150
  }
256
1151
 
257
1152
  *keys(): IterableIterator<string> {
258
- for (const [k] of this._map) yield k;
1153
+ for (let i = 0; i < this._list.length; i++) yield this._list[i]![0];
259
1154
  }
260
1155
 
261
1156
  *values(): IterableIterator<string> {
262
- for (const [, vals] of this._map) for (const v of vals) yield v;
1157
+ for (let i = 0; i < this._list.length; i++) yield this._list[i]![1];
263
1158
  }
264
1159
 
265
1160
  [Symbol.iterator]() {
@@ -267,376 +1162,167 @@ export class URLSearchParams implements Iterable<[string, string]> {
267
1162
  }
268
1163
  }
269
1164
 
1165
+ function toUSVString(value: unknown): string {
1166
+ const s = String(value);
1167
+ return /[\ud800-\udfff]/.test(s) ? fromCodePoints(toCodePoints(s)) : s;
1168
+ }
1169
+
270
1170
  /* -----------------------------
271
1171
  URL Implementation
272
1172
  ----------------------------- */
273
1173
 
274
- interface ParsedURL {
275
- protocol: string;
276
- username: string;
277
- password: string;
278
- host: string; // host:port
279
- hostname: string;
280
- port: string;
281
- pathname: string;
282
- search: string;
283
- hash: string;
284
- origin: string;
285
- }
286
-
287
- const SCHEME_RE = /^([A-Za-z][A-Za-z0-9+.-]*):/;
288
-
289
- function splitBeforeFirst(haystack: string, needle: string) {
290
- const idx = haystack.indexOf(needle);
291
- if (idx === -1) return [haystack, ''];
292
- return [haystack.slice(0, idx), haystack.slice(idx + needle.length)];
293
- }
294
-
295
- function parseURLString(input: string, base?: ParsedURL): ParsedURL {
296
- let url = input.trim();
297
-
298
- // Handle data URLs and other special schemes
299
- if (url.match(/^(data|mailto|tel|sms):/i)) {
300
- const [scheme, rest] = splitBeforeFirst(url, ':');
301
- return {
302
- protocol: scheme!.toLowerCase() + ':',
303
- username: '',
304
- password: '',
305
- host: '',
306
- hostname: '',
307
- port: '',
308
- pathname: rest || '',
309
- search: '',
310
- hash: '',
311
- origin: 'null',
312
- };
313
- }
314
-
315
- // If base is provided and url is relative, resolve
316
- if (base) {
317
- // handle scheme-relative: //host/path
318
- if (url.startsWith('//')) {
319
- url = base.protocol + url;
320
- } else if (!SCHEME_RE.test(url)) {
321
- // relative path
322
- // join base.pathname directory with url
323
- const basePath = base.pathname;
324
- let dir = basePath.slice(0, basePath.lastIndexOf('/') + 1);
325
- if (!dir.endsWith('/')) dir += '/';
326
- url = `${base.protocol}//${base.host}${dir}${url}`;
327
- }
328
- }
329
-
330
- const protocolMatch = url.match(SCHEME_RE);
331
- const protocol = protocolMatch ? protocolMatch[1]!.toLowerCase() + ':' : '';
332
-
333
- let rest = protocol ? url.slice(protocol.length) : url;
334
-
335
- // If protocol present, remove single leading slashes
336
- if (protocol) {
337
- if (rest.startsWith('///')) {
338
- // weird but handle
339
- rest = '//' + rest.slice(3);
340
- }
341
- }
342
-
343
- // Extract hash
344
- let [withoutHash, hash] = splitBeforeFirst(rest, '#');
345
- if (hash) hash = '#' + hash;
346
-
347
- // Extract search
348
- let [beforeSearch, search] = splitBeforeFirst(withoutHash!, '?');
349
- if (search) search = '?' + search;
350
-
351
- // authority and path
352
- let authority = '';
353
- let pathname = '';
354
- if (beforeSearch!.startsWith('//')) {
355
- const afterSlashes = beforeSearch!.slice(2);
356
- const idx = afterSlashes.indexOf('/');
357
- if (idx === -1) {
358
- authority = afterSlashes;
359
- pathname = '/';
360
- } else {
361
- authority = afterSlashes.slice(0, idx);
362
- pathname = afterSlashes.slice(idx) || '/';
363
- }
364
- } else {
365
- pathname = beforeSearch || '';
366
- }
367
-
368
- // parse username/password and host/port
369
- let username = '';
370
- let password = '';
371
- let host = '';
372
- let hostname = '';
373
- let port = '';
374
-
375
- if (authority) {
376
- // userinfo@host:port
377
- const atIdx = authority.lastIndexOf('@');
378
- let hostport = authority;
379
- if (atIdx !== -1) {
380
- const userinfo = authority.slice(0, atIdx);
381
- hostport = authority.slice(atIdx + 1);
382
- const [u, p] = splitBeforeFirst(userinfo, ':');
383
- username = decodePercentEncoded(u!);
384
- password = p ? decodePercentEncoded(p) : '';
385
- }
386
- // IPv6 in [..]:port
387
- if (hostport.startsWith('[')) {
388
- const closeIdx = hostport.indexOf(']');
389
- if (closeIdx !== -1) {
390
- hostname = hostport.slice(0, closeIdx + 1);
391
- port = hostport.slice(closeIdx + 1);
392
- if (port.startsWith(':')) port = port.slice(1);
393
- } else {
394
- hostname = hostport; // malformed, but take as hostname
395
- }
396
- } else {
397
- const colonIdx = hostport.lastIndexOf(':');
398
- if (colonIdx > hostport.indexOf(']')) {
399
- // normal
400
- }
401
- if (colonIdx !== -1 && hostport.indexOf(':') === colonIdx) {
402
- hostname = hostport.slice(0, colonIdx);
403
- port = hostport.slice(colonIdx + 1);
404
- } else {
405
- hostname = hostport;
406
- }
407
- }
408
- hostname = hostname || '';
409
- host = port ? `${hostname}:${port}` : hostname;
410
- host = host.trim();
411
- }
412
-
413
- // Normalization
414
- if (!pathname) pathname = '/';
415
- pathname = normalizePath(decodePercentEncoded(pathname));
416
-
417
- // If hostname present but protocol empty (like relative), try to use base
418
- let origin = '';
419
- if (protocol && host) {
420
- origin = protocol + '//' + host;
421
- } else if (base && !protocol) {
422
- origin = base.origin;
423
- } else if (protocol && !host) {
424
- origin = protocol + '//';
425
- }
426
-
427
- return {
428
- protocol: protocol,
429
- username,
430
- password,
431
- host,
432
- hostname,
433
- port,
434
- pathname,
435
- search: search || '',
436
- hash: hash || '',
437
- origin,
438
- };
439
- }
440
-
441
1174
  export class URL {
442
- private _p: ParsedURL;
1175
+ private _r: URLRecord;
443
1176
  public searchParams: URLSearchParams;
444
1177
 
1178
+ /** @throws {TypeError} if `input` (resolved against `base`) or `base` is not a valid URL. */
445
1179
  constructor(input: string, base?: string | URL) {
446
- let baseParsed: ParsedURL | undefined;
447
- if (base instanceof URL) baseParsed = base._p;
448
- else if (typeof base === 'string' && base.length > 0) baseParsed = parseURLString(base);
449
-
450
- this._p = parseURLString(String(input), baseParsed);
451
- this.searchParams = new URLSearchParams(this._p.search || '');
452
-
453
- // Bind searchParams changes to update the URL's search property
454
- this._bindSearchParamsUpdates();
455
- }
456
-
457
- private _bindSearchParamsUpdates() {
458
- const origToString = this.searchParams.toString.bind(this.searchParams);
459
- const self = this;
460
-
461
- // Override methods that change params to update search string
462
- const mutators = ['append', 'set', 'delete', 'sort', 'clear'];
463
- for (const m of mutators) {
464
- const fn = (this.searchParams as any)[m];
465
- if (typeof fn === 'function') {
466
- (this.searchParams as any)[m] = function (...args: any[]) {
467
- const res = fn.apply(this, args);
468
- const newSearch = origToString();
469
- self._p.search = newSearch ? '?' + newSearch : '';
470
- return res;
471
- };
472
- }
1180
+ let baseRecord: URLRecord | null = null;
1181
+ if (base !== undefined) {
1182
+ baseRecord = base instanceof URL ? base._r : basicURLParse(String(base), null);
1183
+ if (baseRecord === null) throw new TypeError(`Invalid base URL: ${String(base)}`);
473
1184
  }
1185
+ const record = basicURLParse(String(input), baseRecord);
1186
+ if (record === null) throw new TypeError(`Invalid URL: ${String(input)}`);
1187
+ this._r = record;
1188
+ this.searchParams = new URLSearchParams();
1189
+ internals(this.searchParams)._url = record;
1190
+ this._resetSearchParams();
1191
+ }
1192
+
1193
+ // Refill searchParams from the query, keeping the same object (as the standard requires).
1194
+ private _resetSearchParams() {
1195
+ internals(this.searchParams)._list = this._r.query !== null ? parseFormUrlencoded(this._r.query) : [];
474
1196
  }
475
1197
 
476
1198
  // Static helper methods
477
- static canParse(url: string, base?: string): boolean {
478
- try {
479
- new URL(url, base);
480
- return true;
481
- } catch {
482
- return false;
1199
+ static canParse(url: string, base?: string | URL): boolean {
1200
+ let baseRecord: URLRecord | null = null;
1201
+ if (base !== undefined) {
1202
+ baseRecord = base instanceof URL ? base._r : basicURLParse(String(base), null);
1203
+ if (baseRecord === null) return false;
483
1204
  }
1205
+ return basicURLParse(String(url), baseRecord) !== null;
484
1206
  }
485
1207
 
486
- static parse(url: string, base?: string): URL | null {
487
- try {
488
- return new URL(url, base);
489
- } catch {
490
- return null;
491
- }
1208
+ static parse(url: string, base?: string | URL): URL | null {
1209
+ return URL.canParse(url, base) ? new URL(url, base) : null;
492
1210
  }
493
1211
 
494
1212
  get href() {
495
- return this.toString();
1213
+ return serializeURL(this._r);
496
1214
  }
497
1215
 
498
1216
  set href(val: string) {
499
- const parsed = parseURLString(String(val));
500
- this._p = parsed;
501
- this.searchParams = new URLSearchParams(this._p.search || '');
502
- this._bindSearchParamsUpdates();
1217
+ const parsed = basicURLParse(String(val), null);
1218
+ if (parsed === null) throw new TypeError(`Invalid URL: ${String(val)}`);
1219
+ // Update in place: searchParams holds a reference to this record.
1220
+ Object.assign(this._r, parsed);
1221
+ this._resetSearchParams();
503
1222
  }
504
1223
 
505
1224
  get protocol() {
506
- return this._p.protocol;
1225
+ return this._r.scheme + ':';
507
1226
  }
508
1227
  set protocol(val: string) {
509
- const m = String(val).replace(/:$/, '');
510
- this._p.protocol = m + ':';
511
- this._updateOrigin();
1228
+ basicURLParse(String(val) + ':', null, this._r, SCHEME_START);
512
1229
  }
513
1230
 
514
1231
  get username() {
515
- return this._p.username;
1232
+ return this._r.username;
516
1233
  }
517
1234
  set username(v: string) {
518
- this._p.username = String(v);
1235
+ if (cannotHaveCredentialsOrPort(this._r)) return;
1236
+ this._r.username = percentEncodeString(String(v), inUserinfoSet);
519
1237
  }
520
1238
 
521
1239
  get password() {
522
- return this._p.password;
1240
+ return this._r.password;
523
1241
  }
524
1242
  set password(v: string) {
525
- this._p.password = String(v);
1243
+ if (cannotHaveCredentialsOrPort(this._r)) return;
1244
+ this._r.password = percentEncodeString(String(v), inUserinfoSet);
526
1245
  }
527
1246
 
528
1247
  get host() {
529
- return this._p.host;
1248
+ const { host, port } = this._r;
1249
+ if (host === null) return '';
1250
+ return port === null ? host : `${host}:${port}`;
530
1251
  }
531
1252
  set host(v: string) {
532
- const [hostname, port] = splitBeforeFirst(String(v), ':');
533
- this._p.hostname = hostname!;
534
- this._p.port = port!;
535
- this._p.host = port ? `${hostname}:${port}` : hostname!;
536
- this._updateOrigin();
1253
+ if (typeof this._r.path === 'string') return;
1254
+ basicURLParse(String(v), null, this._r, HOST);
537
1255
  }
538
1256
 
539
1257
  get hostname() {
540
- return this._p.hostname;
1258
+ return this._r.host ?? '';
541
1259
  }
542
1260
  set hostname(v: string) {
543
- this._p.hostname = String(v);
544
- this._p.host = this._p.port ? `${this._p.hostname}:${this._p.port}` : this._p.hostname;
545
- this._updateOrigin();
1261
+ if (typeof this._r.path === 'string') return;
1262
+ basicURLParse(String(v), null, this._r, HOSTNAME);
546
1263
  }
547
1264
 
548
1265
  get port() {
549
- return this._p.port;
1266
+ return this._r.port === null ? '' : String(this._r.port);
550
1267
  }
551
1268
  set port(v: string) {
552
- const portStr = String(v);
553
- // Remove default ports to match browser behavior
554
- if (DEFAULT_PORTS[this._p.protocol] === portStr) {
555
- this._p.port = '';
556
- } else {
557
- this._p.port = portStr;
558
- }
559
- this._p.host = this._p.port ? `${this._p.hostname}:${this._p.port}` : this._p.hostname;
560
- this._updateOrigin();
1269
+ if (cannotHaveCredentialsOrPort(this._r)) return;
1270
+ const port = String(v);
1271
+ if (port === '') this._r.port = null;
1272
+ else basicURLParse(port, null, this._r, PORT);
561
1273
  }
562
1274
 
563
1275
  get pathname() {
564
- return this._p.pathname;
1276
+ return serializePath(this._r);
565
1277
  }
566
1278
  set pathname(v: string) {
567
- let path = String(v);
568
- if (!path.startsWith('/')) path = '/' + path;
569
- this._p.pathname = normalizePath(path);
1279
+ if (typeof this._r.path === 'string') return;
1280
+ this._r.path = [];
1281
+ basicURLParse(String(v), null, this._r, PATH_START);
570
1282
  }
571
1283
 
572
1284
  get search() {
573
- return this._p.search;
1285
+ return this._r.query ? '?' + this._r.query : '';
574
1286
  }
575
1287
  set search(v: string) {
576
- let search = String(v);
577
- if (search && !search.startsWith('?')) search = '?' + search;
578
- this._p.search = search;
579
- this.searchParams = new URLSearchParams(search || '');
580
- this._bindSearchParamsUpdates();
1288
+ const value = String(v);
1289
+ if (value === '') {
1290
+ this._r.query = null;
1291
+ internals(this.searchParams)._list = [];
1292
+ return;
1293
+ }
1294
+ const input = value.startsWith('?') ? value.slice(1) : value;
1295
+ this._r.query = '';
1296
+ basicURLParse(input, null, this._r, QUERY);
1297
+ // Like Node, read the list back from the stored query (tabs and newlines already removed).
1298
+ this._resetSearchParams();
581
1299
  }
582
1300
 
583
1301
  get hash() {
584
- return this._p.hash;
1302
+ return this._r.fragment ? '#' + this._r.fragment : '';
585
1303
  }
586
1304
  set hash(v: string) {
587
- let hash = String(v);
588
- if (hash && !hash.startsWith('#')) hash = '#' + hash;
589
- this._p.hash = hash;
1305
+ const value = String(v);
1306
+ if (value === '') {
1307
+ this._r.fragment = null;
1308
+ return;
1309
+ }
1310
+ this._r.fragment = '';
1311
+ basicURLParse(value.startsWith('#') ? value.slice(1) : value, null, this._r, FRAGMENT);
590
1312
  }
591
1313
 
592
1314
  get origin() {
593
- return this._p.origin;
594
- }
595
-
596
- private _updateOrigin() {
597
- if (this._p.protocol && this._p.hostname) {
598
- this._p.origin = this._p.protocol + '//' + this._p.host;
599
- }
1315
+ return serializeOrigin(this._r);
600
1316
  }
601
1317
 
602
1318
  toString() {
603
- const p = this._p;
604
- let auth = '';
605
- if (p.username || p.password) {
606
- auth = encodeComponent(p.username) + (p.password ? ':' + encodeComponent(p.password) : '') + '@';
607
- }
608
- const hostPart = p.host || '';
609
- const path = p.pathname ? encodeComponentPath(p.pathname) : '/';
610
- const search =
611
- p.search || (this.searchParams ? (this.searchParams.toString() ? '?' + this.searchParams.toString() : '') : '');
612
- const hash = p.hash || '';
613
- const proto = p.protocol || '';
614
-
615
- // Handle special schemes
616
- if (proto.match(/^(data|mailto|tel|sms):/i)) {
617
- return proto + path + search + hash;
618
- }
619
-
620
- // If protocol uses scheme with no host (like mailto), handle simply
621
- if (!hostPart && proto && (path === '/' || path === '')) {
622
- return proto + path + search + hash;
623
- }
624
- return proto + '//' + auth + hostPart + path + search + hash;
1319
+ return this.href;
625
1320
  }
626
1321
 
627
1322
  toJSON() {
628
- return this.toString();
1323
+ return this.href;
629
1324
  }
630
1325
  }
631
1326
 
632
- /* Helper: escape path preserving slashes */
633
- function encodeComponentPath(path: string) {
634
- // Split on / and encode segments, preserving empty segments for proper // handling
635
- return path
636
- .split('/')
637
- .map((seg) => encodeComponent(seg))
638
- .join('/');
639
- }
640
-
641
1327
  // Export for Node.js environments that might not have these globals
642
1328
  export { URL as PolyURL, URLSearchParams as PolyURLSearchParams };