urlpurify 2.2.1 → 2.3.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 (370) hide show
  1. package/README.md +96 -45
  2. package/dist/clean.d.mts +1 -0
  3. package/dist/clean.mjs +56 -19
  4. package/dist/defaults.d.mts +7 -1
  5. package/dist/defaults.mjs +160 -3
  6. package/dist/index.d.mts +79 -4
  7. package/dist/index.mjs +79 -4
  8. package/dist/node_modules/entities/dist/decode-codepoint.mjs +2 -2
  9. package/dist/node_modules/entities/dist/decode.mjs +262 -247
  10. package/dist/node_modules/entities/dist/generated/decode-data-html.mjs +8 -4
  11. package/dist/node_modules/entities/dist/internal/decode-data-format.mjs +116 -0
  12. package/dist/node_modules/trousse/dist/is.mjs +7 -1
  13. package/dist/node_modules/trousse/dist/locales.mjs +21 -0
  14. package/dist/node_modules/trousse/dist/matching.mjs +22 -20
  15. package/dist/node_modules/trousse/dist/urls.mjs +186 -53
  16. package/dist/pathTarget.mjs +2 -2
  17. package/dist/tracking/clickAttribution.mjs +26 -1
  18. package/dist/tracking/housekeeping.mjs +13 -1
  19. package/dist/tracking/session.d.mts +2 -0
  20. package/dist/tracking/session.mjs +12 -0
  21. package/dist/types.d.mts +7 -1
  22. package/dist/unwraps/a8Net.mjs +1 -1
  23. package/dist/unwraps/acast.mjs +1 -1
  24. package/dist/unwraps/accesstrade.mjs +1 -1
  25. package/dist/unwraps/aceml.mjs +2 -2
  26. package/dist/unwraps/adcell.mjs +1 -1
  27. package/dist/unwraps/addThis.d.mts +2 -0
  28. package/dist/unwraps/addThis.mjs +17 -0
  29. package/dist/unwraps/addToAny.d.mts +2 -0
  30. package/dist/unwraps/addToAny.mjs +21 -0
  31. package/dist/unwraps/addToAnySubscribe.d.mts +2 -0
  32. package/dist/unwraps/addToAnySubscribe.mjs +8 -0
  33. package/dist/unwraps/addToMyYahoo.d.mts +2 -0
  34. package/dist/unwraps/addToMyYahoo.mjs +29 -0
  35. package/dist/unwraps/adfly.mjs +1 -1
  36. package/dist/unwraps/admitad.mjs +1 -1
  37. package/dist/unwraps/affilae.mjs +2 -1
  38. package/dist/unwraps/affiliatesOne.mjs +1 -1
  39. package/dist/unwraps/allblog.mjs +1 -1
  40. package/dist/unwraps/amazonAffiliate.mjs +5 -4
  41. package/dist/unwraps/amazonSes.mjs +2 -2
  42. package/dist/unwraps/ampCache.mjs +4 -3
  43. package/dist/unwraps/ampCacheImage.mjs +1 -1
  44. package/dist/unwraps/anchor.mjs +1 -1
  45. package/dist/unwraps/anonymouse.mjs +1 -1
  46. package/dist/unwraps/antennaPod.d.mts +2 -0
  47. package/dist/unwraps/antennaPod.mjs +15 -0
  48. package/dist/unwraps/anytimePlayer.d.mts +2 -0
  49. package/dist/unwraps/anytimePlayer.mjs +17 -0
  50. package/dist/unwraps/apptrkr.mjs +2 -1
  51. package/dist/unwraps/archiveToday.mjs +2 -2
  52. package/dist/unwraps/arquivo.mjs +1 -1
  53. package/dist/unwraps/arttrack.mjs +1 -1
  54. package/dist/unwraps/augure.mjs +3 -3
  55. package/dist/unwraps/awesound.mjs +1 -1
  56. package/dist/unwraps/axigen.mjs +2 -1
  57. package/dist/unwraps/bacLacWebArchive.mjs +1 -1
  58. package/dist/unwraps/bananatag.mjs +1 -1
  59. package/dist/unwraps/big5Gate.mjs +1 -1
  60. package/dist/unwraps/bing.mjs +7 -7
  61. package/dist/unwraps/bingAds.mjs +4 -4
  62. package/dist/unwraps/bitrix.mjs +2 -1
  63. package/dist/unwraps/bitrixBanner.mjs +2 -1
  64. package/dist/unwraps/blinkList.d.mts +2 -0
  65. package/dist/unwraps/blinkList.mjs +8 -0
  66. package/dist/unwraps/bloggerBlogThis.d.mts +2 -0
  67. package/dist/unwraps/bloggerBlogThis.mjs +16 -0
  68. package/dist/unwraps/bloggerImageProxy.mjs +2 -1
  69. package/dist/unwraps/bloglines.d.mts +2 -0
  70. package/dist/unwraps/bloglines.mjs +21 -0
  71. package/dist/unwraps/bridgyFed.mjs +1 -1
  72. package/dist/unwraps/buffer.d.mts +2 -0
  73. package/dist/unwraps/buffer.mjs +23 -0
  74. package/dist/unwraps/buybox.mjs +1 -1
  75. package/dist/unwraps/buzzstream.mjs +1 -1
  76. package/dist/unwraps/checkPointHarmony.mjs +2 -2
  77. package/dist/unwraps/cjNetwork.mjs +3 -3
  78. package/dist/unwraps/claritas.mjs +2 -2
  79. package/dist/unwraps/cleverbridge.mjs +1 -1
  80. package/dist/unwraps/cloudhq.mjs +1 -1
  81. package/dist/unwraps/cloze.mjs +1 -1
  82. package/dist/unwraps/cohst.mjs +1 -1
  83. package/dist/unwraps/contactMonkey.mjs +3 -2
  84. package/dist/unwraps/convertiser.mjs +1 -1
  85. package/dist/unwraps/cse360.mjs +1 -1
  86. package/dist/unwraps/dasBlog.mjs +1 -1
  87. package/dist/unwraps/datalifeEngine.mjs +5 -4
  88. package/dist/unwraps/delicious.d.mts +2 -0
  89. package/dist/unwraps/delicious.mjs +15 -0
  90. package/dist/unwraps/deployer.mjs +2 -2
  91. package/dist/unwraps/derefMail.mjs +4 -3
  92. package/dist/unwraps/deviantartOutgoing.mjs +1 -1
  93. package/dist/unwraps/diasporaShare.d.mts +2 -0
  94. package/dist/unwraps/diasporaShare.mjs +16 -0
  95. package/dist/unwraps/diggSubmit.d.mts +2 -0
  96. package/dist/unwraps/diggSubmit.mjs +11 -0
  97. package/dist/unwraps/digikala.mjs +3 -3
  98. package/dist/unwraps/diigoPost.d.mts +2 -0
  99. package/dist/unwraps/diigoPost.mjs +12 -0
  100. package/dist/unwraps/disqus.mjs +2 -1
  101. package/dist/unwraps/dstats.mjs +2 -2
  102. package/dist/unwraps/eClick.mjs +1 -1
  103. package/dist/unwraps/easyMarketing.mjs +3 -3
  104. package/dist/unwraps/ebayRover.mjs +1 -1
  105. package/dist/unwraps/ebuzzing.mjs +1 -1
  106. package/dist/unwraps/edgepilot.mjs +1 -1
  107. package/dist/unwraps/effiliation.mjs +1 -1
  108. package/dist/unwraps/elasticEmail.mjs +2 -1
  109. package/dist/unwraps/epn.mjs +1 -1
  110. package/dist/unwraps/eulerian.mjs +1 -1
  111. package/dist/unwraps/evernoteClip.d.mts +2 -0
  112. package/dist/unwraps/evernoteClip.mjs +8 -0
  113. package/dist/unwraps/exciteTranslate.mjs +1 -1
  114. package/dist/unwraps/facebook.mjs +1 -1
  115. package/dist/unwraps/facebookShare.d.mts +2 -0
  116. package/dist/unwraps/facebookShare.mjs +25 -0
  117. package/dist/unwraps/feed2js.d.mts +2 -0
  118. package/dist/unwraps/feed2js.mjs +16 -0
  119. package/dist/unwraps/feedStatistics.mjs +2 -2
  120. package/dist/unwraps/feedValidator.d.mts +2 -0
  121. package/dist/unwraps/feedValidator.mjs +12 -0
  122. package/dist/unwraps/feedblitz.mjs +1 -1
  123. package/dist/unwraps/feedland.d.mts +2 -0
  124. package/dist/unwraps/feedland.mjs +12 -0
  125. package/dist/unwraps/feedly.d.mts +2 -0
  126. package/dist/unwraps/feedly.mjs +28 -0
  127. package/dist/unwraps/feedsportal.mjs +1 -1
  128. package/dist/unwraps/firebaseDynamicLinks.mjs +1 -1
  129. package/dist/unwraps/firstory.mjs +3 -3
  130. package/dist/unwraps/fiveByFive.mjs +2 -2
  131. package/dist/unwraps/flattrSubmit.d.mts +2 -0
  132. package/dist/unwraps/flattrSubmit.mjs +8 -0
  133. package/dist/unwraps/flipboardShare.d.mts +2 -0
  134. package/dist/unwraps/flipboardShare.mjs +15 -0
  135. package/dist/unwraps/fortimail.mjs +2 -1
  136. package/dist/unwraps/friendFeed.d.mts +2 -0
  137. package/dist/unwraps/friendFeed.mjs +18 -0
  138. package/dist/unwraps/gabCompose.d.mts +2 -0
  139. package/dist/unwraps/gabCompose.mjs +8 -0
  140. package/dist/unwraps/genericCarrier.d.mts +2 -0
  141. package/dist/unwraps/genericCarrier.mjs +31 -0
  142. package/dist/unwraps/gfnLinkProxy.mjs +3 -3
  143. package/dist/unwraps/godcaster.mjs +2 -2
  144. package/dist/unwraps/googleAmpViewer.mjs +2 -2
  145. package/dist/unwraps/googleBookmarks.d.mts +2 -0
  146. package/dist/unwraps/googleBookmarks.mjs +8 -0
  147. package/dist/unwraps/googleBuzz.d.mts +2 -0
  148. package/dist/unwraps/googleBuzz.mjs +8 -0
  149. package/dist/unwraps/googleNewsModern.mjs +2 -3
  150. package/dist/unwraps/googlePlusShare.d.mts +2 -0
  151. package/dist/unwraps/googlePlusShare.mjs +11 -0
  152. package/dist/unwraps/googlePodcasts.d.mts +2 -0
  153. package/dist/unwraps/googlePodcasts.mjs +27 -0
  154. package/dist/unwraps/googleReader.d.mts +2 -0
  155. package/dist/unwraps/googleReader.mjs +20 -0
  156. package/dist/unwraps/googleTranslate.mjs +5 -5
  157. package/dist/unwraps/govdelivery.mjs +3 -2
  158. package/dist/unwraps/hackerNewsSubmit.d.mts +2 -0
  159. package/dist/unwraps/hackerNewsSubmit.mjs +8 -0
  160. package/dist/unwraps/hasoffers.mjs +2 -1
  161. package/dist/unwraps/hatenaBookmark.d.mts +2 -0
  162. package/dist/unwraps/hatenaBookmark.mjs +22 -0
  163. package/dist/unwraps/hirkereso.mjs +1 -1
  164. package/dist/unwraps/horde.mjs +1 -1
  165. package/dist/unwraps/hubspotSidekick.mjs +1 -1
  166. package/dist/unwraps/impact.mjs +2 -2
  167. package/dist/unwraps/indexHu.mjs +2 -1
  168. package/dist/unwraps/inoreader.d.mts +2 -0
  169. package/dist/unwraps/inoreader.mjs +22 -0
  170. package/dist/unwraps/instapaperSave.d.mts +2 -0
  171. package/dist/unwraps/instapaperSave.mjs +11 -0
  172. package/dist/unwraps/invisionNoExternalLinks.mjs +1 -1
  173. package/dist/unwraps/involveAsia.mjs +1 -1
  174. package/dist/unwraps/jive.mjs +2 -1
  175. package/dist/unwraps/klook.mjs +2 -1
  176. package/dist/unwraps/lazada.mjs +1 -1
  177. package/dist/unwraps/letscast.mjs +1 -1
  178. package/dist/unwraps/lineShare.d.mts +2 -0
  179. package/dist/unwraps/lineShare.mjs +25 -0
  180. package/dist/unwraps/linkA.mjs +1 -1
  181. package/dist/unwraps/linkedin.mjs +1 -1
  182. package/dist/unwraps/linkedinShare.d.mts +2 -0
  183. package/dist/unwraps/linkedinShare.mjs +15 -0
  184. package/dist/unwraps/linksynergy.mjs +2 -2
  185. package/dist/unwraps/linktrust.mjs +3 -3
  186. package/dist/unwraps/linkwise.mjs +1 -1
  187. package/dist/unwraps/livedoorReader.d.mts +2 -0
  188. package/dist/unwraps/livedoorReader.mjs +12 -0
  189. package/dist/unwraps/locWebArchive.mjs +1 -1
  190. package/dist/unwraps/locaweb.mjs +2 -1
  191. package/dist/unwraps/logicboard.mjs +1 -1
  192. package/dist/unwraps/magellan.mjs +1 -1
  193. package/dist/unwraps/mail2easy.mjs +1 -1
  194. package/dist/unwraps/mailchimp.mjs +1 -1
  195. package/dist/unwraps/mailinblack.mjs +6 -4
  196. package/dist/unwraps/mailstat.mjs +1 -1
  197. package/dist/unwraps/mailtrack.mjs +1 -1
  198. package/dist/unwraps/mandrill.mjs +3 -3
  199. package/dist/unwraps/medium.mjs +5 -5
  200. package/dist/unwraps/meneameSubmit.d.mts +2 -0
  201. package/dist/unwraps/meneameSubmit.mjs +11 -0
  202. package/dist/unwraps/meweShare.d.mts +2 -0
  203. package/dist/unwraps/meweShare.mjs +8 -0
  204. package/dist/unwraps/mimecast.mjs +1 -1
  205. package/dist/unwraps/ministryCloud.mjs +1 -1
  206. package/dist/unwraps/mintDownloads.mjs +1 -1
  207. package/dist/unwraps/mintFeeder.mjs +2 -1
  208. package/dist/unwraps/mohtwize.mjs +6 -4
  209. package/dist/unwraps/morss.d.mts +2 -0
  210. package/dist/unwraps/morss.mjs +13 -0
  211. package/dist/unwraps/mozillaOutgoing.mjs +3 -3
  212. package/dist/unwraps/myAolFeeds.d.mts +2 -0
  213. package/dist/unwraps/myAolFeeds.mjs +8 -0
  214. package/dist/unwraps/narrativ.mjs +1 -1
  215. package/dist/unwraps/natlibNz.mjs +1 -1
  216. package/dist/unwraps/ncls.mjs +2 -1
  217. package/dist/unwraps/ndlWarp.mjs +2 -2
  218. package/dist/unwraps/netaffiliation.mjs +1 -1
  219. package/dist/unwraps/netvibes.d.mts +2 -0
  220. package/dist/unwraps/netvibes.mjs +7 -0
  221. package/dist/unwraps/newsGator.d.mts +2 -0
  222. package/dist/unwraps/newsGator.mjs +17 -0
  223. package/dist/unwraps/newswire.mjs +3 -3
  224. package/dist/unwraps/nicoMs.mjs +1 -1
  225. package/dist/unwraps/nimble.mjs +1 -1
  226. package/dist/unwraps/nlaWebarchive.mjs +3 -3
  227. package/dist/unwraps/okShare.d.mts +2 -0
  228. package/dist/unwraps/okShare.mjs +23 -0
  229. package/dist/unwraps/op3.mjs +1 -1
  230. package/dist/unwraps/outlookSafelinks.mjs +1 -1
  231. package/dist/unwraps/pageflakes.d.mts +2 -0
  232. package/dist/unwraps/pageflakes.mjs +8 -0
  233. package/dist/unwraps/pagefreezer.mjs +2 -2
  234. package/dist/unwraps/partnerAds.mjs +2 -2
  235. package/dist/unwraps/pbs.mjs +1 -1
  236. package/dist/unwraps/pinterestPin.d.mts +2 -0
  237. package/dist/unwraps/pinterestPin.mjs +85 -0
  238. package/dist/unwraps/pipedrive.mjs +1 -1
  239. package/dist/unwraps/playerFm.d.mts +2 -0
  240. package/dist/unwraps/playerFm.mjs +16 -0
  241. package/dist/unwraps/pocketSave.d.mts +2 -0
  242. package/dist/unwraps/pocketSave.mjs +15 -0
  243. package/dist/unwraps/podcastAddict.d.mts +2 -0
  244. package/dist/unwraps/podcastAddict.mjs +14 -0
  245. package/dist/unwraps/podcastReady.d.mts +2 -0
  246. package/dist/unwraps/podcastReady.mjs +8 -0
  247. package/dist/unwraps/podcorn.mjs +1 -1
  248. package/dist/unwraps/podkite.mjs +1 -1
  249. package/dist/unwraps/podscribe.mjs +1 -1
  250. package/dist/unwraps/podsights.mjs +1 -1
  251. package/dist/unwraps/podup.mjs +2 -3
  252. package/dist/unwraps/postAffiliatePro.mjs +1 -1
  253. package/dist/unwraps/postmark.mjs +1 -1
  254. package/dist/unwraps/prNewswire.mjs +2 -2
  255. package/dist/unwraps/prezly.mjs +1 -1
  256. package/dist/unwraps/proofpointV3.mjs +3 -3
  257. package/dist/unwraps/prweb.mjs +2 -2
  258. package/dist/unwraps/prxPlayer.d.mts +2 -0
  259. package/dist/unwraps/prxPlayer.mjs +16 -0
  260. package/dist/unwraps/qqMailReader.d.mts +2 -0
  261. package/dist/unwraps/qqMailReader.mjs +8 -0
  262. package/dist/unwraps/qualityClick.mjs +2 -1
  263. package/dist/unwraps/qzoneShare.d.mts +2 -0
  264. package/dist/unwraps/qzoneShare.mjs +8 -0
  265. package/dist/unwraps/rakutenAffiliate.mjs +3 -3
  266. package/dist/unwraps/redditOut.mjs +1 -1
  267. package/dist/unwraps/redditSubmit.d.mts +2 -0
  268. package/dist/unwraps/redditSubmit.mjs +19 -0
  269. package/dist/unwraps/researchgate.mjs +1 -1
  270. package/dist/unwraps/reviveAdserver.mjs +2 -2
  271. package/dist/unwraps/rssBoardValidator.d.mts +2 -0
  272. package/dist/unwraps/rssBoardValidator.mjs +8 -0
  273. package/dist/unwraps/salesdoubler.mjs +1 -1
  274. package/dist/unwraps/saleshandy.mjs +1 -1
  275. package/dist/unwraps/segmentfault.mjs +2 -2
  276. package/dist/unwraps/serendipity.mjs +3 -3
  277. package/dist/unwraps/shareaholic.d.mts +2 -0
  278. package/dist/unwraps/shareaholic.mjs +12 -0
  279. package/dist/unwraps/slashdotBookmark.d.mts +2 -0
  280. package/dist/unwraps/slashdotBookmark.mjs +11 -0
  281. package/dist/unwraps/smartredirect.mjs +1 -1
  282. package/dist/unwraps/sophos.mjs +2 -2
  283. package/dist/unwraps/soundOn.mjs +1 -1
  284. package/dist/unwraps/stay22.mjs +1 -1
  285. package/dist/unwraps/streamsend.mjs +1 -1
  286. package/dist/unwraps/stumbleuponSubmit.d.mts +2 -0
  287. package/dist/unwraps/stumbleuponSubmit.mjs +14 -0
  288. package/dist/unwraps/subscribeByEmail.d.mts +2 -0
  289. package/dist/unwraps/subscribeByEmail.mjs +10 -0
  290. package/dist/unwraps/subscribeOnAndroid.d.mts +2 -0
  291. package/dist/unwraps/subscribeOnAndroid.mjs +10 -0
  292. package/dist/unwraps/subscribeRu.mjs +1 -1
  293. package/dist/unwraps/substack.mjs +2 -3
  294. package/dist/unwraps/surly.mjs +1 -1
  295. package/dist/unwraps/swap.mjs +1 -1
  296. package/dist/unwraps/symantecClicktime.mjs +1 -1
  297. package/dist/unwraps/symplicity.mjs +1 -1
  298. package/dist/unwraps/teacup.mjs +1 -1
  299. package/dist/unwraps/technoratiFaves.d.mts +2 -0
  300. package/dist/unwraps/technoratiFaves.mjs +10 -0
  301. package/dist/unwraps/telegramShare.d.mts +2 -0
  302. package/dist/unwraps/telegramShare.mjs +18 -0
  303. package/dist/unwraps/theRegister.mjs +1 -1
  304. package/dist/unwraps/threadsIntent.d.mts +2 -0
  305. package/dist/unwraps/threadsIntent.mjs +16 -0
  306. package/dist/unwraps/toucharcade.mjs +1 -1
  307. package/dist/unwraps/tracdelight.mjs +1 -1
  308. package/dist/unwraps/trxHub.mjs +1 -1
  309. package/dist/unwraps/tumblrShare.d.mts +2 -0
  310. package/dist/unwraps/tumblrShare.mjs +13 -0
  311. package/dist/unwraps/twitterIntent.d.mts +2 -0
  312. package/dist/unwraps/twitterIntent.mjs +17 -0
  313. package/dist/unwraps/twoCheckout.mjs +2 -1
  314. package/dist/unwraps/ukWebArchive.mjs +1 -1
  315. package/dist/unwraps/ukgwa.mjs +1 -1
  316. package/dist/unwraps/unescoWebArchive.mjs +1 -1
  317. package/dist/unwraps/unisender.mjs +3 -3
  318. package/dist/unwraps/upAudio.mjs +1 -1
  319. package/dist/unwraps/vadeSecure.mjs +1 -1
  320. package/dist/unwraps/valuePress.mjs +2 -2
  321. package/dist/unwraps/vanilla.mjs +1 -1
  322. package/dist/unwraps/vbulletin.mjs +1 -1
  323. package/dist/unwraps/vefsafn.mjs +2 -2
  324. package/dist/unwraps/vgWort.mjs +1 -1
  325. package/dist/unwraps/vkShare.d.mts +2 -0
  326. package/dist/unwraps/vkShare.mjs +16 -0
  327. package/dist/unwraps/vocus.mjs +1 -1
  328. package/dist/unwraps/voxnest.mjs +1 -1
  329. package/dist/unwraps/w3cFeedValidator.d.mts +2 -0
  330. package/dist/unwraps/w3cFeedValidator.mjs +8 -0
  331. package/dist/unwraps/webArchive.mjs +5 -5
  332. package/dist/unwraps/webcitation.mjs +1 -1
  333. package/dist/unwraps/webharvest.mjs +1 -1
  334. package/dist/unwraps/weiboShare.d.mts +2 -0
  335. package/dist/unwraps/weiboShare.mjs +8 -0
  336. package/dist/unwraps/weserv.mjs +2 -2
  337. package/dist/unwraps/wikizero.mjs +2 -2
  338. package/dist/unwraps/windowsLive.d.mts +2 -0
  339. package/dist/unwraps/windowsLive.mjs +13 -0
  340. package/dist/unwraps/windowsLiveFavorites.d.mts +2 -0
  341. package/dist/unwraps/windowsLiveFavorites.mjs +8 -0
  342. package/dist/unwraps/wpPoczta.mjs +2 -2
  343. package/dist/unwraps/wykop.d.mts +2 -0
  344. package/dist/unwraps/wykop.mjs +11 -0
  345. package/dist/unwraps/xengentr.mjs +4 -3
  346. package/dist/unwraps/xianguo.d.mts +2 -0
  347. package/dist/unwraps/xianguo.mjs +8 -0
  348. package/dist/unwraps/xiaoyuzhou.mjs +1 -1
  349. package/dist/unwraps/ximalaya.mjs +3 -3
  350. package/dist/unwraps/xingShare.d.mts +2 -0
  351. package/dist/unwraps/xingShare.mjs +16 -0
  352. package/dist/unwraps/yahooBookmarks.d.mts +2 -0
  353. package/dist/unwraps/yahooBookmarks.mjs +38 -0
  354. package/dist/unwraps/yahooJapan.mjs +2 -3
  355. package/dist/unwraps/yahooJapanAmpViewer.mjs +2 -2
  356. package/dist/unwraps/yahooMailImage.mjs +2 -1
  357. package/dist/unwraps/yahooSearch.mjs +2 -2
  358. package/dist/unwraps/yamm.mjs +2 -1
  359. package/dist/unwraps/yandexMail.mjs +4 -3
  360. package/dist/unwraps/yandexTranslate.mjs +1 -1
  361. package/dist/unwraps/yandexTurbo.mjs +4 -4
  362. package/dist/unwraps/yesware.mjs +2 -2
  363. package/dist/unwraps/yourMembership.mjs +2 -1
  364. package/dist/unwraps/zencastr.mjs +1 -1
  365. package/dist/unwraps/zix.mjs +1 -1
  366. package/dist/unwraps/zscalerIsolation.mjs +1 -1
  367. package/dist/utils.mjs +9 -42
  368. package/package.json +4 -4
  369. package/dist/node_modules/entities/dist/internal/bin-trie-flags.mjs +0 -50
  370. package/dist/node_modules/entities/dist/internal/decode-shared.mjs +0 -143
@@ -1,58 +1,27 @@
1
1
  import { codePointToString } from "./decode-codepoint.mjs";
2
- import { htmlDecodeTree } from "./generated/decode-data-html.mjs";
3
- import { BinTrieFlags } from "./internal/bin-trie-flags.mjs";
2
+ import { htmlDecodeData } from "./generated/decode-data-html.mjs";
3
+ import { BUCKET_HASH_1, BUCKET_HASH_2, CHAR_REMAP, initDecodeData, pairIndex } from "./internal/decode-data-format.mjs";
4
4
  // node_modules/entities/dist/decode.js
5
- var CharCodes;
6
- (function(CharCodes) {
7
- CharCodes[CharCodes["AMP"] = 38] = "AMP";
8
- CharCodes[CharCodes["NUM"] = 35] = "NUM";
9
- CharCodes[CharCodes["SEMI"] = 59] = "SEMI";
10
- CharCodes[CharCodes["EQUALS"] = 61] = "EQUALS";
11
- CharCodes[CharCodes["ZERO"] = 48] = "ZERO";
12
- CharCodes[CharCodes["NINE"] = 57] = "NINE";
13
- CharCodes[CharCodes["LOWER_A"] = 97] = "LOWER_A";
14
- CharCodes[CharCodes["LOWER_X"] = 120] = "LOWER_X";
15
- })(CharCodes || (CharCodes = {}));
5
+ const CHAR_AMP = 38;
6
+ const CHAR_NUM = 35;
7
+ const CHAR_SEMI = 59;
8
+ const CHAR_EQUALS = 61;
9
+ const CHAR_ZERO = 48;
10
+ const CHAR_LOWER_A = 97;
11
+ const CHAR_LOWER_X = 120;
12
+ const CHAR_UPPER_A = 65;
16
13
  /** Bit that needs to be set to convert an upper case ASCII character to lower case */
17
14
  const TO_LOWER_BIT = 32;
18
- const CONSUMED_SHIFT = 21;
19
- const CODE_POINT_MASK = 2097151;
20
- /**
21
- * Reserved consumed field for counts of at least 2047 characters after `&`.
22
- * The true count is in `longNumericConsumed`.
23
- */
24
- const CONSUMED_OVERFLOW = 2047;
25
- /**
26
- * Side channel for numeric entities of at least 2048 characters including
27
- * `&`. Set by `parseNumericEntity` when its consumed count reaches the
28
- * reserved value `CONSUMED_OVERFLOW`; callers read the true count from here.
29
- * A module-level slot avoids a tuple allocation on the hot path.
30
- */
31
- let longNumericConsumed = 0;
32
- /**
33
- * Extract the consumed count from a `parseNumericEntity` packed result,
34
- * recovering the true length from `longNumericConsumed` when the packed
35
- * field contains the sentinel. Read it before the next `parseNumericEntity`
36
- * call, which may overwrite the side channel. This helper owns that protocol.
37
- * @param packed Packed result of `parseNumericEntity`.
38
- */
39
- function unpackConsumed(packed) {
40
- const consumed = packed >>> CONSUMED_SHIFT;
41
- return consumed === CONSUMED_OVERFLOW ? longNumericConsumed : consumed;
42
- }
43
15
  /**
44
16
  * Unsigned subtraction trick: (code - lo) >>> 0 wraps negatives to large
45
17
  * values, so a single `<=` covers the entire [lo..hi] range check.
46
18
  * @param code Code point to check.
47
19
  */
48
20
  function isNumber(code) {
49
- return code - CharCodes.ZERO >>> 0 <= 9;
21
+ return code - CHAR_ZERO >>> 0 <= 9;
50
22
  }
51
- function isHexadecimalCharacter(code) {
52
- return (code | TO_LOWER_BIT) - CharCodes.LOWER_A >>> 0 <= 5;
53
- }
54
- function isAlpha(code) {
55
- return (code | TO_LOWER_BIT) - CharCodes.LOWER_A >>> 0 <= 25;
23
+ function isAlphaNumeric(code) {
24
+ return isNumber(code) || (code | TO_LOWER_BIT) - CHAR_LOWER_A >>> 0 <= 25;
56
25
  }
57
26
  /**
58
27
  * Checks if the given character is a valid end character for an entity in an attribute.
@@ -62,16 +31,8 @@ function isAlpha(code) {
62
31
  * @param code Code point to check.
63
32
  */
64
33
  function isEntityInAttributeInvalidEnd(code) {
65
- return code === CharCodes.EQUALS || isAlpha(code) || isNumber(code);
34
+ return code === CHAR_EQUALS || isAlphaNumeric(code);
66
35
  }
67
- var EntityDecoderState;
68
- (function(EntityDecoderState) {
69
- EntityDecoderState[EntityDecoderState["EntityStart"] = 0] = "EntityStart";
70
- EntityDecoderState[EntityDecoderState["NumericStart"] = 1] = "NumericStart";
71
- EntityDecoderState[EntityDecoderState["NumericDecimal"] = 2] = "NumericDecimal";
72
- EntityDecoderState[EntityDecoderState["NumericHex"] = 3] = "NumericHex";
73
- EntityDecoderState[EntityDecoderState["NamedEntity"] = 4] = "NamedEntity";
74
- })(EntityDecoderState || (EntityDecoderState = {}));
75
36
  /**
76
37
  * Decoding mode for named entities.
77
38
  */
@@ -84,231 +45,285 @@ var DecodingMode;
84
45
  /** Entities in attributes have limitations on ending characters. */
85
46
  DecodingMode[DecodingMode["Attribute"] = 2] = "Attribute";
86
47
  })(DecodingMode || (DecodingMode = {}));
48
+ /** Decode data for HTML entities. */
49
+ const htmlDecode = /* #__PURE__ */ initDecodeData(htmlDecodeData);
50
+ const htmlKeys = /* #__PURE__ */ (() => htmlDecode.keys)();
51
+ const htmlBuckets = /* #__PURE__ */ (() => htmlDecode.buckets)();
52
+ const htmlSlotMidOff = /* #__PURE__ */ (() => htmlDecode.slotMidOff)();
53
+ const htmlLengthBits = /* #__PURE__ */ (() => htmlDecode.lengthBits)();
54
+ const htmlMiddles = /* #__PURE__ */ (() => htmlDecode.middles)();
55
+ /** Hoisted for the specialized HTML cores; see `emitHtmlValue`. */
56
+ const htmlSlotValue = /* #__PURE__ */ (() => htmlDecode.slotValue)();
57
+ const htmlValues = /* #__PURE__ */ (() => htmlDecode.values)();
87
58
  /**
88
- * Determines the branch of the current node that is taken given the current
89
- * character. This function is used to traverse the trie.
90
- *
91
- * See `BinTrieFlags` for the branch-data layouts handled here.
92
- * @param decodeTree The trie.
93
- * @param current The current node's header word.
94
- * @param nodeIndex Index of the node's first branch-data word (the header
95
- * plus any value words have been skipped by the caller).
96
- * @param char The current character.
97
- * @returns The index of the next node, or -1 if no branch is taken.
59
+ * The replacement string for a packed `slotValue` entry. Most values need
60
+ * just one UTF-16 code unit.
61
+ * @param packed Replacement offset, legacy flag, and length from `htmlSlotValue`.
62
+ */
63
+ function emitHtmlValue(packed) {
64
+ const off = packed >> 2;
65
+ return (packed & 1) === 0 ? htmlValues.charAt(off) : htmlValues.slice(off, off + (packed & 1) + 1);
66
+ }
67
+ /**
68
+ * Find the slot matching `text[start..start+length)`, or -1. A match proves
69
+ * every character of the span (exact key + middle comparison).
70
+ * @param text Input text.
71
+ * @param start Start of the span in `text`.
72
+ * @param length Length of the span.
98
73
  */
99
- function determineBranch(decodeTree, current, nodeIndex, char) {
100
- const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
101
- const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
102
- if (jumpOffset) {
103
- if (branchCount === 0) return char === jumpOffset ? nodeIndex : -1;
104
- const slot = char - jumpOffset;
105
- if (slot >>> 0 >= branchCount) return -1;
106
- const stored = decodeTree[nodeIndex + slot];
107
- return stored === 0 ? -1 : nodeIndex + branchCount + stored - 1 & 65535;
74
+ function findSlotHtml(text, start, length) {
75
+ const c0 = text.charCodeAt(start);
76
+ const c1 = text.charCodeAt(start + 1);
77
+ const c2 = text.charCodeAt(start + length - 2);
78
+ const c3 = text.charCodeAt(start + length - 1);
79
+ if ((c0 | c1 | c2 | c3) > 127) return -1;
80
+ const key = c0 << 25 | c1 << 18 | c2 << 11 | CHAR_REMAP[c3] << 5 | length;
81
+ let slot = 2 * ((Math.imul(key, BUCKET_HASH_1) >>> 16) * htmlBuckets >>> 16);
82
+ for (let attempt = 0;; attempt++) {
83
+ if (htmlKeys[slot] === key && (length <= 4 || isMidMatchHtml(slot, text, start, length))) return slot;
84
+ if (htmlKeys[slot + 1] === key && (length <= 4 || isMidMatchHtml(slot + 1, text, start, length))) return slot + 1;
85
+ if (attempt === 1) return -1;
86
+ slot = 2 * ((Math.imul(key, BUCKET_HASH_2) >>> 16) * htmlBuckets >>> 16);
108
87
  }
109
- if (branchCount === 0) return -1;
110
- const packedKeySlots = branchCount + 1 >> 1;
111
- const branchEnd = nodeIndex + packedKeySlots + branchCount;
112
- for (let index = 0; index < branchCount; index++) {
113
- const key = decodeTree[nodeIndex + (index >> 1)] >> ((index & 1) << 3) & 255;
114
- if (key === char) return branchEnd + decodeTree[nodeIndex + packedKeySlots + index] & 65535;
115
- if (key > char) return -1;
88
+ }
89
+ /**
90
+ * Compare the middle characters (positions 2..length-3) of the candidate at
91
+ * `slot` against the input. The key already proves the outer characters and
92
+ * the length. Names of length at most four are accepted by the caller.
93
+ * @param slot Slot of the candidate.
94
+ * @param text Input text.
95
+ * @param start Start of the span in `text`.
96
+ * @param length Length of the span.
97
+ */
98
+ function isMidMatchHtml(slot, text, start, length) {
99
+ let wordIndex = htmlSlotMidOff[slot];
100
+ let index = start + 2;
101
+ const end = start + length - 2;
102
+ while (index + 1 < end) {
103
+ if ((text.charCodeAt(index) | text.charCodeAt(index + 1) << 16) !== htmlMiddles[wordIndex++]) return false;
104
+ index += 2;
116
105
  }
117
- return -1;
106
+ return index === end || text.charCodeAt(index) === (htmlMiddles[wordIndex] & 65535);
118
107
  }
119
108
  /**
120
- * Read the decoded value from a trie node.
121
- * @param decodeTree The trie.
122
- * @param nodeIndex The index of the node.
123
- * @param valueLength The length of the value (1, 2, or 3).
124
- * @returns The decoded string.
109
+ * `parseNumericEntity` packs its two results into one integer:
110
+ * `(consumed << CONSUMED_SHIFT) | codePoint`. The code point occupies the low
111
+ * 21 bits (max 0x110000, clamped before packing); `consumed` takes the upper
112
+ * 11 bits and is read back with `>>> CONSUMED_SHIFT`, so the sign bit set by a
113
+ * large `consumed` is harmless. The maximum consumed field is reserved for
114
+ * long references, whose full length is stored in `longNumericConsumed`.
115
+ * A zero return means "no numeric entity".
125
116
  */
126
- function readTrieValue(decodeTree, nodeIndex, valueLength) {
127
- if (valueLength === 1) return String.fromCharCode(decodeTree[nodeIndex] & BinTrieFlags.VALUE_MASK);
128
- if (valueLength === 2) return String.fromCharCode(decodeTree[nodeIndex + 1]);
129
- return String.fromCharCode(decodeTree[nodeIndex + 1], decodeTree[nodeIndex + 2]);
117
+ const NUMERIC_CONSUMED_SHIFT = 21;
118
+ const NUMERIC_CODE_POINT_MASK = 2097151;
119
+ const NUMERIC_CONSUMED_OVERFLOW = 2047;
120
+ /** Full length, including `&`, when the packed consumed field overflows. */
121
+ let longNumericConsumed = 0;
122
+ /**
123
+ * Recover the consumed count before the next numeric parse can overwrite
124
+ * `longNumericConsumed`. This avoids allocating a tuple for each reference.
125
+ * @param packed Packed result of `parseNumericEntity`.
126
+ */
127
+ function unpackConsumed(packed) {
128
+ const consumed = packed >>> NUMERIC_CONSUMED_SHIFT;
129
+ return consumed === NUMERIC_CONSUMED_OVERFLOW ? longNumericConsumed : consumed;
130
130
  }
131
+ /** ASCII digit values; 0xff marks characters outside the hexadecimal range. */
132
+ const numericDigits = /* #__PURE__ */ (() => {
133
+ const digits = (/* @__PURE__ */ new Uint8Array(128)).fill(255);
134
+ for (let digit = 0; digit < 10; digit++) digits[CHAR_ZERO + digit] = digit;
135
+ for (let digit = 0; digit < 6; digit++) {
136
+ digits[CHAR_UPPER_A + digit] = digit + 10;
137
+ digits[CHAR_LOWER_A + digit] = digit + 10;
138
+ }
139
+ return digits;
140
+ })();
131
141
  /**
132
- * Parse a numeric entity (`&#DDD;` or `&#xHHH;`).
133
- *
134
- * Encodes the result as `(consumed << CONSUMED_SHIFT) | codepoint` (see
135
- * the packing comment at the top of the file; overlong entities spill
136
- * their length into `longNumericConsumed`). Returns 0 when no digits were
137
- * found.
138
- *
139
- * This is the sync counterpart of the streaming
140
- * `EntityDecoder#stateNumericDecimal` / `#stateNumericHex`. Digit parsing
141
- * matches those methods; only this packed result needs a value clamp.
142
- * @param input The input string.
143
- * @param numberStart Index of the `#` character.
144
- * @param inputLength Cached `input.length`.
142
+ * Parse a numeric entity starting right after the `#`. In legacy mode the
143
+ * terminating semicolon is optional. Returns the number of characters
144
+ * consumed (counting the `&` and `#`) packed with the code point (see
145
+ * the packing constants above), or 0 if there is no valid numeric entity at this
146
+ * position.
147
+ * @param input Input string.
148
+ * @param offset Index right after the `#`.
149
+ * @param isStrict Whether a terminating semicolon is required.
145
150
  */
146
- function parseNumericEntity(input, numberStart, inputLength) {
147
- let offset = numberStart + 1;
148
- let cp = 0;
149
- let digitStart = offset;
150
- if (offset < inputLength && (input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes.LOWER_X) {
151
- offset += 1;
152
- digitStart = offset;
153
- while (offset < inputLength) {
154
- const char = input.charCodeAt(offset);
155
- if (isNumber(char)) cp = cp * 16 + (char - CharCodes.ZERO);
156
- else if (isHexadecimalCharacter(char)) cp = cp * 16 + ((char | TO_LOWER_BIT) - CharCodes.LOWER_A + 10);
157
- else break;
158
- offset += 1;
151
+ function parseNumericEntity(input, offset, isStrict) {
152
+ const inputLength = input.length;
153
+ let index = offset;
154
+ let codePoint = 0;
155
+ let digitsStart;
156
+ if ((input.charCodeAt(index) | TO_LOWER_BIT) === CHAR_LOWER_X) {
157
+ index += 1;
158
+ digitsStart = index;
159
+ while (index < inputLength) {
160
+ const char = input.charCodeAt(index);
161
+ if (char >= 128) break;
162
+ const digit = numericDigits[char];
163
+ if (digit <= 15) {
164
+ codePoint = codePoint * 16 + digit;
165
+ index++;
166
+ } else break;
167
+ }
168
+ } else {
169
+ digitsStart = index;
170
+ while (index < inputLength) {
171
+ const char = input.charCodeAt(index);
172
+ if (char >= 128) break;
173
+ const digit = numericDigits[char];
174
+ if (digit <= 9) {
175
+ codePoint = codePoint * 10 + digit;
176
+ index++;
177
+ } else break;
159
178
  }
160
- } else while (offset < inputLength) {
161
- const digit = input.charCodeAt(offset) - CharCodes.ZERO;
162
- if (digit >>> 0 > 9) break;
163
- cp = cp * 10 + digit;
164
- offset += 1;
165
179
  }
166
- if (offset === digitStart) return 0;
167
- if (offset < inputLength && input.charCodeAt(offset) === CharCodes.SEMI) offset += 1;
168
- if (cp > 1114111) cp = 1114112;
169
- let consumed = offset - numberStart;
170
- if (consumed >= CONSUMED_OVERFLOW) {
180
+ if (index === digitsStart) return 0;
181
+ if (codePoint > 1114111) codePoint = 1114112;
182
+ let consumed = index - offset + 2;
183
+ if (index < inputLength && input.charCodeAt(index) === CHAR_SEMI) consumed += 1;
184
+ else if (isStrict) return 0;
185
+ if (consumed >= NUMERIC_CONSUMED_OVERFLOW) {
171
186
  longNumericConsumed = consumed;
172
- consumed = CONSUMED_OVERFLOW;
187
+ consumed = NUMERIC_CONSUMED_OVERFLOW;
173
188
  }
174
- return consumed << CONSUMED_SHIFT | cp;
189
+ return consumed << NUMERIC_CONSUMED_SHIFT | codePoint;
175
190
  }
176
191
  /**
177
- * Decode all entities in `input` using the HTML trie.
178
- *
179
- * Hard-wired to `htmlDecodeTree`: the inline root navigation below assumes
180
- * the HTML root's jump-table shape, so this must not be generalized to
181
- * other tries (the XML trie's dictionary root would silently match no
182
- * entities — `decodeXML` has its own hand-coded fast path instead).
183
- * @param input The string to decode.
184
- * @param isStrict Only match semicolon-terminated entities.
185
- * @param isAttribute Whether to apply attribute-specific parsing rules (disallowing certain non-semicolon terminators).
186
- * @returns The decoded string.
192
+ * Find the longest legacy (semicolon-less) match for the name starting at
193
+ * `start`, using the per-class legacy length bits. Returns
194
+ * `slot << 3 | matchLength`, or -1 if there is no match. Only called after
195
+ * the exact probes failed (the miss path).
196
+ * @param input Input text.
197
+ * @param start Start of the name.
198
+ * @param maxLength Number of available run characters.
187
199
  */
188
- function decodeWithTrie(input, isStrict, isAttribute) {
189
- const decodeTree = htmlDecodeTree;
200
+ function findLegacySlot(input, start, maxLength) {
201
+ let legacy = htmlLengthBits[pairIndex(input.charCodeAt(start), input.charCodeAt(start + 1))] >>> 16 & 31;
202
+ while (legacy !== 0) {
203
+ const top = 31 - Math.clz32(legacy);
204
+ legacy ^= 1 << top;
205
+ if (top + 2 > maxLength) continue;
206
+ const slot = findSlotHtml(input, start, top + 2);
207
+ if (slot >= 0 && (htmlSlotValue[slot] & 2) !== 0) return slot << 3 | top + 2;
208
+ }
209
+ return -1;
210
+ }
211
+ /**
212
+ * Match a class containing long names without probing all its shorter lengths.
213
+ * The 32-character window bounds the scan even for invalid or unterminated runs.
214
+ * Returns `(slot << 6) | consumed`, excluding the `&`, or -1 on a miss.
215
+ * @param input Input containing the candidate name.
216
+ * @param start Start of the name.
217
+ * @param mode Decoding mode, including the rules for legacy matches.
218
+ */
219
+ function findLongClassMatch(input, start, mode) {
220
+ const length = input.slice(start, start + 32).indexOf(";");
221
+ if (length - 2 >>> 0 <= 29) {
222
+ const slot = findSlotHtml(input, start, length);
223
+ if (slot >= 0) return slot << 6 | length + 1;
224
+ }
225
+ if (mode !== DecodingMode.Strict) {
226
+ const packed = findLegacySlot(input, start, Math.min(31, input.length - start));
227
+ if (packed >= 0) {
228
+ const length = packed & 7;
229
+ if (mode !== DecodingMode.Attribute || start + length >= input.length || !isEntityInAttributeInvalidEnd(input.charCodeAt(start + length))) return packed >> 3 << 6 | length;
230
+ }
231
+ }
232
+ return -1;
233
+ }
234
+ /**
235
+ * The next `&` to resume from after emitting a replacement, given the index
236
+ * just past it. A leaf the decoders call after every emit: the common
237
+ * adjacent-entity case (`&amp;&lt;`) skips the `indexOf` C++ call.
238
+ * @param input Input text.
239
+ * @param last Index just past the entity that was emitted.
240
+ */
241
+ function nextOffset(input, last) {
242
+ if (last >= input.length) return -1;
243
+ return input.charCodeAt(last) === CHAR_AMP ? last : input.indexOf("&", last);
244
+ }
245
+ /**
246
+ * Synchronous HTML decoder, shared by all three decoding modes.
247
+ * @param input String to decode.
248
+ * @param mode Decoding mode for named entities.
249
+ */
250
+ function decodeHtmlText(input, mode) {
251
+ const isLegacyAllowed = mode !== DecodingMode.Strict;
190
252
  let offset = input.indexOf("&");
191
253
  if (offset < 0) return input;
192
254
  const inputLength = input.length;
193
- let chunkStart = 0;
194
255
  let result = "";
195
- const root = decodeTree[0];
196
- const rootJumpOffset = root & BinTrieFlags.JUMP_TABLE;
197
- const rootBranchCount = (root & BinTrieFlags.BRANCH_LENGTH) >> 7;
256
+ let last = 0;
198
257
  do {
199
- const entityStart = offset + 1;
200
- const firstChar = input.charCodeAt(entityStart);
201
- let consumed;
202
- let value;
203
- if (firstChar === CharCodes.NUM) {
204
- const packed = parseNumericEntity(input, entityStart, inputLength);
205
- consumed = unpackConsumed(packed);
206
- if (isStrict && consumed > 0 && input.charCodeAt(entityStart + consumed - 1) !== CharCodes.SEMI) consumed = 0;
207
- value = consumed === 0 ? "" : codePointToString(packed & CODE_POINT_MASK);
208
- } else if (isAlpha(firstChar)) {
209
- consumed = 0;
210
- value = "";
211
- const rootSlotIndex = firstChar - rootJumpOffset;
212
- let nodeIndex;
213
- if (rootSlotIndex >>> 0 < rootBranchCount) {
214
- const stored = decodeTree[1 + rootSlotIndex];
215
- nodeIndex = stored === 0 ? -1 : rootBranchCount + stored & 65535;
216
- } else nodeIndex = -1;
217
- let bestNodeIndex = 0;
218
- let bestValueLength = 0;
219
- let current = nodeIndex < 0 ? 0 : decodeTree[nodeIndex];
220
- let index = entityStart + 1;
221
- trie: while (index < inputLength) {
222
- while ((current & (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) === 0 && (current & BinTrieFlags.JUMP_TABLE) !== 0) {
223
- const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
224
- const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
225
- if (branchCount === 0) {
226
- if (input.charCodeAt(index) !== jumpOffset) break trie;
227
- nodeIndex += 1;
228
- } else {
229
- const slot = input.charCodeAt(index) - jumpOffset;
230
- if (slot >>> 0 >= branchCount) break trie;
231
- const stored = decodeTree[nodeIndex + 1 + slot];
232
- if (stored === 0) break trie;
233
- nodeIndex = nodeIndex + branchCount + stored & 65535;
234
- }
235
- current = decodeTree[nodeIndex];
236
- index += 1;
237
- if (index >= inputLength) break trie;
238
- }
239
- if ((current & (BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13)) === BinTrieFlags.FLAG13) {
240
- const runLength = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
241
- if (input.charCodeAt(index) !== (current & BinTrieFlags.JUMP_TABLE)) break;
242
- index += 1;
243
- const remaining = runLength - 1;
244
- let wordIndex = nodeIndex + 1;
245
- let charIndexInPacked = 0;
246
- for (; charIndexInPacked + 1 < remaining; charIndexInPacked += 2) {
247
- const packed = decodeTree[wordIndex];
248
- if (input.charCodeAt(index) !== (packed & 255)) break trie;
249
- index += 1;
250
- if (input.charCodeAt(index) !== (packed >> 8 & 255)) break trie;
251
- index += 1;
252
- wordIndex += 1;
253
- }
254
- if (charIndexInPacked < remaining) {
255
- if (input.charCodeAt(index) !== (decodeTree[wordIndex] & 255)) break;
256
- index += 1;
257
- }
258
- nodeIndex += 1 + (runLength >> 1);
259
- current = decodeTree[nodeIndex];
260
- continue;
261
- }
262
- const valueLength = current >>> 14;
263
- const char = input.charCodeAt(index);
264
- if (valueLength !== 0) {
265
- if (char === CharCodes.SEMI) {
266
- consumed = index - entityStart + 1;
267
- value = valueLength === 1 ? String.fromCharCode(current & BinTrieFlags.VALUE_MASK) : readTrieValue(decodeTree, nodeIndex, valueLength);
268
- break;
269
- }
270
- if (!isStrict && (current & BinTrieFlags.FLAG13) === 0) {
271
- consumed = index - entityStart;
272
- bestNodeIndex = nodeIndex;
273
- bestValueLength = valueLength;
274
- }
275
- if (valueLength === 1) break;
276
- }
277
- const next = determineBranch(decodeTree, current, nodeIndex + (valueLength || 1), char);
278
- if (next < 0) break;
279
- nodeIndex = next;
280
- current = decodeTree[nodeIndex];
281
- index += 1;
258
+ const start = offset + 1;
259
+ if (start + 1 >= inputLength) break;
260
+ const c0 = input.charCodeAt(start);
261
+ if (c0 === CHAR_AMP) {
262
+ offset = start;
263
+ continue;
264
+ }
265
+ if (c0 === CHAR_NUM) {
266
+ const packed = parseNumericEntity(input, start + 1, !isLegacyAllowed);
267
+ const consumed = unpackConsumed(packed);
268
+ if (consumed === 0) offset = input.indexOf("&", start);
269
+ else {
270
+ if (last !== offset) result += input.slice(last, offset);
271
+ result += codePointToString(packed & NUMERIC_CODE_POINT_MASK);
272
+ last = offset + consumed;
273
+ offset = nextOffset(input, last);
282
274
  }
283
- if (value === "") {
284
- const finalVL = current >>> 14;
285
- if (finalVL !== 0 && !isStrict && (current & BinTrieFlags.FLAG13) === 0) {
286
- consumed = index - entityStart;
287
- bestNodeIndex = nodeIndex;
288
- bestValueLength = finalVL;
289
- }
290
- if (consumed > 0) value = readTrieValue(decodeTree, bestNodeIndex, bestValueLength);
275
+ continue;
276
+ }
277
+ const bits = htmlLengthBits[pairIndex(c0, input.charCodeAt(start + 1))];
278
+ if ((bits & 32768) !== 0) {
279
+ const packed = findLongClassMatch(input, start, mode);
280
+ if (packed >= 0) {
281
+ if (last !== offset) result += input.slice(last, offset);
282
+ result += emitHtmlValue(htmlSlotValue[packed >> 6]);
283
+ last = start + (packed & 63);
284
+ offset = nextOffset(input, last);
285
+ } else offset = input.indexOf("&", start);
286
+ continue;
287
+ }
288
+ let probed = bits & 32767;
289
+ let matched = -1;
290
+ while (probed !== 0) {
291
+ const low = probed & -probed;
292
+ probed ^= low;
293
+ const length = 33 - Math.clz32(low);
294
+ const end = start + length;
295
+ if (end > inputLength) break;
296
+ const isTerminated = end < inputLength && input.charCodeAt(end) === CHAR_SEMI;
297
+ if (!(isTerminated || isLegacyAllowed && (bits >>> length + 14 & 1) !== 0)) continue;
298
+ const slot = findSlotHtml(input, start, length);
299
+ if (slot < 0) continue;
300
+ if (isTerminated) {
301
+ matched = slot << 6 | 32 | length + 1;
302
+ break;
291
303
  }
292
- } else {
293
- consumed = 0;
294
- value = "";
304
+ if ((htmlSlotValue[slot] & 2) !== 0) matched = slot << 6 | length;
295
305
  }
296
- if (consumed === 0 || isAttribute && firstChar !== CharCodes.NUM && input.charCodeAt(entityStart + consumed - 1) !== CharCodes.SEMI && entityStart + consumed < inputLength && isEntityInAttributeInvalidEnd(input.charCodeAt(entityStart + consumed))) offset = entityStart;
297
- else {
298
- if (chunkStart < offset) result += input.slice(chunkStart, offset);
299
- result += value;
300
- offset = chunkStart = entityStart + consumed;
306
+ if (matched >= 0) {
307
+ const length = matched & 31;
308
+ if ((matched & 32) !== 0 || mode !== DecodingMode.Attribute || start + length >= inputLength || !isEntityInAttributeInvalidEnd(input.charCodeAt(start + length))) {
309
+ if (last !== offset) result += input.slice(last, offset);
310
+ result += emitHtmlValue(htmlSlotValue[matched >> 6]);
311
+ last = start + length;
312
+ offset = nextOffset(input, last);
313
+ continue;
314
+ }
301
315
  }
302
- if (input.charCodeAt(offset) !== CharCodes.AMP) offset = input.indexOf("&", offset);
316
+ offset = input.indexOf("&", start + 1);
303
317
  } while (offset >= 0);
304
- return result + input.slice(chunkStart);
318
+ return result + input.slice(last);
305
319
  }
306
320
  /**
307
- * Decodes an HTML string, requiring all entities to be terminated by a semicolon.
321
+ * Decodes an HTML string, requiring all entities to be terminated by a
322
+ * semicolon.
308
323
  * @param htmlString The string to decode.
309
324
  * @returns The decoded string.
310
325
  */
311
326
  function decodeHTMLStrict(htmlString) {
312
- return decodeWithTrie(htmlString, true, false);
327
+ return decodeHtmlText(htmlString, DecodingMode.Strict);
313
328
  }
314
- export { DecodingMode, decodeHTMLStrict, determineBranch };
329
+ export { DecodingMode, decodeHTMLStrict };