urlpurify 2.2.0 → 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.
- package/README.md +96 -45
- package/dist/clean.d.mts +1 -0
- package/dist/clean.mjs +56 -20
- package/dist/defaults.d.mts +7 -1
- package/dist/defaults.mjs +160 -3
- package/dist/index.d.mts +79 -4
- package/dist/index.mjs +79 -4
- package/dist/node_modules/entities/dist/decode-codepoint.mjs +2 -2
- package/dist/node_modules/entities/dist/decode.mjs +262 -247
- package/dist/node_modules/entities/dist/generated/decode-data-html.mjs +8 -4
- package/dist/node_modules/entities/dist/internal/decode-data-format.mjs +116 -0
- package/dist/node_modules/trousse/dist/is.mjs +7 -1
- package/dist/node_modules/trousse/dist/locales.mjs +21 -0
- package/dist/node_modules/trousse/dist/matching.mjs +23 -13
- package/dist/node_modules/trousse/dist/urls.mjs +203 -51
- package/dist/pathTarget.mjs +2 -2
- package/dist/tracking/clickAttribution.mjs +26 -1
- package/dist/tracking/housekeeping.mjs +13 -1
- package/dist/tracking/session.d.mts +2 -0
- package/dist/tracking/session.mjs +12 -0
- package/dist/types.d.mts +7 -1
- package/dist/unwraps/a8Net.mjs +1 -1
- package/dist/unwraps/acast.mjs +1 -1
- package/dist/unwraps/accesstrade.mjs +1 -1
- package/dist/unwraps/aceml.mjs +2 -2
- package/dist/unwraps/adcell.mjs +1 -1
- package/dist/unwraps/addThis.d.mts +2 -0
- package/dist/unwraps/addThis.mjs +17 -0
- package/dist/unwraps/addToAny.d.mts +2 -0
- package/dist/unwraps/addToAny.mjs +21 -0
- package/dist/unwraps/addToAnySubscribe.d.mts +2 -0
- package/dist/unwraps/addToAnySubscribe.mjs +8 -0
- package/dist/unwraps/addToMyYahoo.d.mts +2 -0
- package/dist/unwraps/addToMyYahoo.mjs +29 -0
- package/dist/unwraps/adfly.mjs +1 -1
- package/dist/unwraps/admitad.mjs +1 -1
- package/dist/unwraps/affilae.mjs +3 -1
- package/dist/unwraps/affiliatesOne.mjs +1 -1
- package/dist/unwraps/allblog.mjs +1 -1
- package/dist/unwraps/amazonAffiliate.mjs +5 -4
- package/dist/unwraps/amazonSes.mjs +2 -2
- package/dist/unwraps/ampCache.mjs +4 -3
- package/dist/unwraps/ampCacheImage.mjs +1 -1
- package/dist/unwraps/anchor.mjs +1 -1
- package/dist/unwraps/anonymouse.mjs +1 -1
- package/dist/unwraps/antennaPod.d.mts +2 -0
- package/dist/unwraps/antennaPod.mjs +15 -0
- package/dist/unwraps/anytimePlayer.d.mts +2 -0
- package/dist/unwraps/anytimePlayer.mjs +17 -0
- package/dist/unwraps/apptrkr.mjs +3 -2
- package/dist/unwraps/archiveToday.mjs +2 -2
- package/dist/unwraps/arquivo.mjs +1 -1
- package/dist/unwraps/arttrack.mjs +1 -1
- package/dist/unwraps/augure.mjs +3 -3
- package/dist/unwraps/awesound.mjs +1 -1
- package/dist/unwraps/axigen.mjs +2 -1
- package/dist/unwraps/bacLacWebArchive.mjs +1 -1
- package/dist/unwraps/bananatag.mjs +1 -1
- package/dist/unwraps/big5Gate.mjs +1 -1
- package/dist/unwraps/bing.mjs +7 -7
- package/dist/unwraps/bingAds.mjs +4 -4
- package/dist/unwraps/bitrix.mjs +2 -1
- package/dist/unwraps/bitrixBanner.mjs +2 -1
- package/dist/unwraps/blinkList.d.mts +2 -0
- package/dist/unwraps/blinkList.mjs +8 -0
- package/dist/unwraps/bloggerBlogThis.d.mts +2 -0
- package/dist/unwraps/bloggerBlogThis.mjs +16 -0
- package/dist/unwraps/bloggerImageProxy.mjs +2 -1
- package/dist/unwraps/bloglines.d.mts +2 -0
- package/dist/unwraps/bloglines.mjs +21 -0
- package/dist/unwraps/bridgyFed.mjs +1 -1
- package/dist/unwraps/buffer.d.mts +2 -0
- package/dist/unwraps/buffer.mjs +23 -0
- package/dist/unwraps/buybox.mjs +1 -1
- package/dist/unwraps/buzzstream.mjs +1 -1
- package/dist/unwraps/cake.mjs +2 -2
- package/dist/unwraps/checkPointHarmony.mjs +2 -2
- package/dist/unwraps/cjNetwork.mjs +3 -3
- package/dist/unwraps/claritas.mjs +2 -2
- package/dist/unwraps/cleverbridge.mjs +3 -3
- package/dist/unwraps/cloudhq.mjs +1 -1
- package/dist/unwraps/cloze.mjs +1 -1
- package/dist/unwraps/cohst.mjs +1 -1
- package/dist/unwraps/contactMonkey.mjs +3 -2
- package/dist/unwraps/convertiser.mjs +1 -1
- package/dist/unwraps/cse360.mjs +1 -1
- package/dist/unwraps/dasBlog.mjs +1 -1
- package/dist/unwraps/datalifeEngine.mjs +5 -4
- package/dist/unwraps/delicious.d.mts +2 -0
- package/dist/unwraps/delicious.mjs +15 -0
- package/dist/unwraps/deployer.mjs +3 -3
- package/dist/unwraps/derefMail.mjs +4 -3
- package/dist/unwraps/deviantartOutgoing.mjs +1 -1
- package/dist/unwraps/diasporaShare.d.mts +2 -0
- package/dist/unwraps/diasporaShare.mjs +16 -0
- package/dist/unwraps/diggSubmit.d.mts +2 -0
- package/dist/unwraps/diggSubmit.mjs +11 -0
- package/dist/unwraps/digikala.mjs +3 -3
- package/dist/unwraps/diigoPost.d.mts +2 -0
- package/dist/unwraps/diigoPost.mjs +12 -0
- package/dist/unwraps/disqus.mjs +2 -1
- package/dist/unwraps/drupalOembed.mjs +3 -5
- package/dist/unwraps/dstats.mjs +2 -2
- package/dist/unwraps/eClick.mjs +1 -1
- package/dist/unwraps/easyMarketing.mjs +3 -3
- package/dist/unwraps/ebayRover.mjs +1 -1
- package/dist/unwraps/ebuzzing.mjs +1 -1
- package/dist/unwraps/edgepilot.mjs +1 -1
- package/dist/unwraps/effiliation.mjs +1 -1
- package/dist/unwraps/elasticEmail.mjs +3 -2
- package/dist/unwraps/epn.mjs +1 -1
- package/dist/unwraps/eulerian.mjs +1 -1
- package/dist/unwraps/evernoteClip.d.mts +2 -0
- package/dist/unwraps/evernoteClip.mjs +8 -0
- package/dist/unwraps/exciteTranslate.mjs +1 -1
- package/dist/unwraps/facebook.mjs +1 -1
- package/dist/unwraps/facebookShare.d.mts +2 -0
- package/dist/unwraps/facebookShare.mjs +25 -0
- package/dist/unwraps/feed2js.d.mts +2 -0
- package/dist/unwraps/feed2js.mjs +16 -0
- package/dist/unwraps/feedStatistics.mjs +2 -2
- package/dist/unwraps/feedValidator.d.mts +2 -0
- package/dist/unwraps/feedValidator.mjs +12 -0
- package/dist/unwraps/feedblitz.mjs +4 -5
- package/dist/unwraps/feedland.d.mts +2 -0
- package/dist/unwraps/feedland.mjs +12 -0
- package/dist/unwraps/feedly.d.mts +2 -0
- package/dist/unwraps/feedly.mjs +28 -0
- package/dist/unwraps/feedsportal.mjs +1 -1
- package/dist/unwraps/finalsite.mjs +2 -2
- package/dist/unwraps/firebaseDynamicLinks.mjs +3 -2
- package/dist/unwraps/firstory.mjs +3 -3
- package/dist/unwraps/fiveByFive.mjs +2 -2
- package/dist/unwraps/flattrSubmit.d.mts +2 -0
- package/dist/unwraps/flattrSubmit.mjs +8 -0
- package/dist/unwraps/flipboardShare.d.mts +2 -0
- package/dist/unwraps/flipboardShare.mjs +15 -0
- package/dist/unwraps/fortimail.mjs +3 -2
- package/dist/unwraps/friendFeed.d.mts +2 -0
- package/dist/unwraps/friendFeed.mjs +18 -0
- package/dist/unwraps/gabCompose.d.mts +2 -0
- package/dist/unwraps/gabCompose.mjs +8 -0
- package/dist/unwraps/genericCarrier.d.mts +2 -0
- package/dist/unwraps/genericCarrier.mjs +31 -0
- package/dist/unwraps/gfnLinkProxy.mjs +3 -3
- package/dist/unwraps/godcaster.mjs +2 -2
- package/dist/unwraps/googleAmpViewer.mjs +2 -2
- package/dist/unwraps/googleBookmarks.d.mts +2 -0
- package/dist/unwraps/googleBookmarks.mjs +8 -0
- package/dist/unwraps/googleBuzz.d.mts +2 -0
- package/dist/unwraps/googleBuzz.mjs +8 -0
- package/dist/unwraps/googleNewsModern.mjs +2 -3
- package/dist/unwraps/googlePlusShare.d.mts +2 -0
- package/dist/unwraps/googlePlusShare.mjs +11 -0
- package/dist/unwraps/googlePodcasts.d.mts +2 -0
- package/dist/unwraps/googlePodcasts.mjs +27 -0
- package/dist/unwraps/googleReader.d.mts +2 -0
- package/dist/unwraps/googleReader.mjs +20 -0
- package/dist/unwraps/googleTranslate.mjs +13 -13
- package/dist/unwraps/govdelivery.mjs +3 -2
- package/dist/unwraps/hackerNewsSubmit.d.mts +2 -0
- package/dist/unwraps/hackerNewsSubmit.mjs +8 -0
- package/dist/unwraps/hasoffers.mjs +3 -2
- package/dist/unwraps/hatenaBookmark.d.mts +2 -0
- package/dist/unwraps/hatenaBookmark.mjs +22 -0
- package/dist/unwraps/hirkereso.mjs +1 -1
- package/dist/unwraps/horde.mjs +1 -1
- package/dist/unwraps/hubspotSidekick.mjs +1 -1
- package/dist/unwraps/impact.mjs +2 -2
- package/dist/unwraps/indexHu.mjs +2 -1
- package/dist/unwraps/inoreader.d.mts +2 -0
- package/dist/unwraps/inoreader.mjs +22 -0
- package/dist/unwraps/instapaperSave.d.mts +2 -0
- package/dist/unwraps/instapaperSave.mjs +11 -0
- package/dist/unwraps/invisionNoExternalLinks.mjs +1 -1
- package/dist/unwraps/involveAsia.mjs +1 -1
- package/dist/unwraps/jive.mjs +2 -1
- package/dist/unwraps/klook.mjs +2 -1
- package/dist/unwraps/lazada.mjs +1 -1
- package/dist/unwraps/letscast.mjs +1 -1
- package/dist/unwraps/lineShare.d.mts +2 -0
- package/dist/unwraps/lineShare.mjs +25 -0
- package/dist/unwraps/linkA.mjs +1 -1
- package/dist/unwraps/linkedin.mjs +1 -1
- package/dist/unwraps/linkedinShare.d.mts +2 -0
- package/dist/unwraps/linkedinShare.mjs +15 -0
- package/dist/unwraps/linksynergy.mjs +2 -2
- package/dist/unwraps/linktrust.mjs +3 -3
- package/dist/unwraps/linkwise.mjs +1 -1
- package/dist/unwraps/livedoorReader.d.mts +2 -0
- package/dist/unwraps/livedoorReader.mjs +12 -0
- package/dist/unwraps/locWebArchive.mjs +1 -1
- package/dist/unwraps/locaweb.mjs +3 -1
- package/dist/unwraps/logicboard.mjs +1 -1
- package/dist/unwraps/magellan.mjs +1 -1
- package/dist/unwraps/mail2easy.mjs +1 -1
- package/dist/unwraps/mailchimp.mjs +1 -1
- package/dist/unwraps/mailinblack.mjs +6 -4
- package/dist/unwraps/mailstat.mjs +1 -1
- package/dist/unwraps/mailtrack.mjs +1 -1
- package/dist/unwraps/mandrill.mjs +3 -3
- package/dist/unwraps/medium.mjs +5 -5
- package/dist/unwraps/meneameSubmit.d.mts +2 -0
- package/dist/unwraps/meneameSubmit.mjs +11 -0
- package/dist/unwraps/meweShare.d.mts +2 -0
- package/dist/unwraps/meweShare.mjs +8 -0
- package/dist/unwraps/mimecast.mjs +1 -1
- package/dist/unwraps/ministryCloud.mjs +1 -1
- package/dist/unwraps/mintDownloads.mjs +1 -1
- package/dist/unwraps/mintFeeder.mjs +3 -2
- package/dist/unwraps/mohtwize.mjs +6 -4
- package/dist/unwraps/morss.d.mts +2 -0
- package/dist/unwraps/morss.mjs +13 -0
- package/dist/unwraps/mozillaOutgoing.mjs +3 -3
- package/dist/unwraps/myAolFeeds.d.mts +2 -0
- package/dist/unwraps/myAolFeeds.mjs +8 -0
- package/dist/unwraps/narrativ.mjs +1 -1
- package/dist/unwraps/natlibNz.mjs +1 -1
- package/dist/unwraps/ncls.mjs +2 -1
- package/dist/unwraps/ndlWarp.mjs +2 -2
- package/dist/unwraps/netaffiliation.mjs +1 -1
- package/dist/unwraps/netvibes.d.mts +2 -0
- package/dist/unwraps/netvibes.mjs +7 -0
- package/dist/unwraps/newsGator.d.mts +2 -0
- package/dist/unwraps/newsGator.mjs +17 -0
- package/dist/unwraps/newswire.mjs +3 -3
- package/dist/unwraps/nicoMs.mjs +1 -1
- package/dist/unwraps/nimble.mjs +1 -1
- package/dist/unwraps/nlaWebarchive.mjs +3 -3
- package/dist/unwraps/okRu.mjs +3 -2
- package/dist/unwraps/okShare.d.mts +2 -0
- package/dist/unwraps/okShare.mjs +23 -0
- package/dist/unwraps/op3.mjs +1 -1
- package/dist/unwraps/outlookSafelinks.mjs +1 -1
- package/dist/unwraps/pageflakes.d.mts +2 -0
- package/dist/unwraps/pageflakes.mjs +8 -0
- package/dist/unwraps/pagefreezer.mjs +2 -2
- package/dist/unwraps/partnerAds.mjs +2 -2
- package/dist/unwraps/pbs.mjs +1 -1
- package/dist/unwraps/pinterestPin.d.mts +2 -0
- package/dist/unwraps/pinterestPin.mjs +85 -0
- package/dist/unwraps/pipedrive.mjs +1 -1
- package/dist/unwraps/playerFm.d.mts +2 -0
- package/dist/unwraps/playerFm.mjs +16 -0
- package/dist/unwraps/pocketSave.d.mts +2 -0
- package/dist/unwraps/pocketSave.mjs +15 -0
- package/dist/unwraps/podcastAddict.d.mts +2 -0
- package/dist/unwraps/podcastAddict.mjs +14 -0
- package/dist/unwraps/podcastReady.d.mts +2 -0
- package/dist/unwraps/podcastReady.mjs +8 -0
- package/dist/unwraps/podcorn.mjs +1 -1
- package/dist/unwraps/podkite.mjs +1 -1
- package/dist/unwraps/podscribe.mjs +1 -1
- package/dist/unwraps/podsights.mjs +1 -1
- package/dist/unwraps/podup.mjs +2 -3
- package/dist/unwraps/postAffiliatePro.mjs +1 -1
- package/dist/unwraps/postmark.mjs +1 -1
- package/dist/unwraps/prNewswire.mjs +2 -2
- package/dist/unwraps/prezly.mjs +1 -1
- package/dist/unwraps/proofpointV2.mjs +1 -1
- package/dist/unwraps/proofpointV3.mjs +3 -3
- package/dist/unwraps/prweb.mjs +2 -2
- package/dist/unwraps/prxPlayer.d.mts +2 -0
- package/dist/unwraps/prxPlayer.mjs +16 -0
- package/dist/unwraps/qqMailReader.d.mts +2 -0
- package/dist/unwraps/qqMailReader.mjs +8 -0
- package/dist/unwraps/qualityClick.mjs +4 -3
- package/dist/unwraps/qzoneShare.d.mts +2 -0
- package/dist/unwraps/qzoneShare.mjs +8 -0
- package/dist/unwraps/rakutenAffiliate.mjs +3 -3
- package/dist/unwraps/redditOut.mjs +1 -1
- package/dist/unwraps/redditSubmit.d.mts +2 -0
- package/dist/unwraps/redditSubmit.mjs +19 -0
- package/dist/unwraps/researchgate.mjs +1 -1
- package/dist/unwraps/reviveAdserver.mjs +4 -4
- package/dist/unwraps/rssBoardValidator.d.mts +2 -0
- package/dist/unwraps/rssBoardValidator.mjs +8 -0
- package/dist/unwraps/salesdoubler.mjs +1 -1
- package/dist/unwraps/saleshandy.mjs +1 -1
- package/dist/unwraps/segmentfault.mjs +2 -2
- package/dist/unwraps/serendipity.mjs +4 -4
- package/dist/unwraps/shareaholic.d.mts +2 -0
- package/dist/unwraps/shareaholic.mjs +12 -0
- package/dist/unwraps/slashdotBookmark.d.mts +2 -0
- package/dist/unwraps/slashdotBookmark.mjs +11 -0
- package/dist/unwraps/smartredirect.mjs +1 -1
- package/dist/unwraps/sophos.mjs +2 -2
- package/dist/unwraps/soundOn.mjs +1 -1
- package/dist/unwraps/stay22.mjs +1 -1
- package/dist/unwraps/streamsend.mjs +1 -1
- package/dist/unwraps/stumbleuponSubmit.d.mts +2 -0
- package/dist/unwraps/stumbleuponSubmit.mjs +14 -0
- package/dist/unwraps/subscribeByEmail.d.mts +2 -0
- package/dist/unwraps/subscribeByEmail.mjs +10 -0
- package/dist/unwraps/subscribeOnAndroid.d.mts +2 -0
- package/dist/unwraps/subscribeOnAndroid.mjs +10 -0
- package/dist/unwraps/subscribeRu.mjs +1 -1
- package/dist/unwraps/substack.mjs +2 -3
- package/dist/unwraps/surly.mjs +1 -1
- package/dist/unwraps/swap.mjs +1 -1
- package/dist/unwraps/symantecClicktime.mjs +1 -1
- package/dist/unwraps/symplicity.mjs +1 -1
- package/dist/unwraps/teacup.mjs +3 -2
- package/dist/unwraps/technoratiFaves.d.mts +2 -0
- package/dist/unwraps/technoratiFaves.mjs +10 -0
- package/dist/unwraps/telegramShare.d.mts +2 -0
- package/dist/unwraps/telegramShare.mjs +18 -0
- package/dist/unwraps/theRegister.mjs +1 -1
- package/dist/unwraps/threadsIntent.d.mts +2 -0
- package/dist/unwraps/threadsIntent.mjs +16 -0
- package/dist/unwraps/toucharcade.mjs +1 -1
- package/dist/unwraps/tracdelight.mjs +3 -2
- package/dist/unwraps/trxHub.mjs +1 -1
- package/dist/unwraps/tumblrShare.d.mts +2 -0
- package/dist/unwraps/tumblrShare.mjs +13 -0
- package/dist/unwraps/twitterIntent.d.mts +2 -0
- package/dist/unwraps/twitterIntent.mjs +17 -0
- package/dist/unwraps/twoCheckout.mjs +4 -3
- package/dist/unwraps/ukWebArchive.mjs +1 -1
- package/dist/unwraps/ukgwa.mjs +1 -1
- package/dist/unwraps/unescoWebArchive.mjs +1 -1
- package/dist/unwraps/unisender.mjs +4 -4
- package/dist/unwraps/upAudio.mjs +1 -1
- package/dist/unwraps/vadeSecure.mjs +1 -1
- package/dist/unwraps/valuePress.mjs +2 -2
- package/dist/unwraps/vanilla.mjs +1 -1
- package/dist/unwraps/vbulletin.mjs +1 -1
- package/dist/unwraps/vefsafn.mjs +2 -2
- package/dist/unwraps/vgWort.mjs +1 -1
- package/dist/unwraps/vkShare.d.mts +2 -0
- package/dist/unwraps/vkShare.mjs +16 -0
- package/dist/unwraps/vocus.mjs +1 -1
- package/dist/unwraps/voxnest.mjs +1 -1
- package/dist/unwraps/w3cFeedValidator.d.mts +2 -0
- package/dist/unwraps/w3cFeedValidator.mjs +8 -0
- package/dist/unwraps/webArchive.mjs +5 -5
- package/dist/unwraps/webcitation.mjs +1 -1
- package/dist/unwraps/webharvest.mjs +1 -1
- package/dist/unwraps/weiboShare.d.mts +2 -0
- package/dist/unwraps/weiboShare.mjs +8 -0
- package/dist/unwraps/weserv.mjs +2 -2
- package/dist/unwraps/wikizero.mjs +2 -2
- package/dist/unwraps/windowsLive.d.mts +2 -0
- package/dist/unwraps/windowsLive.mjs +13 -0
- package/dist/unwraps/windowsLiveFavorites.d.mts +2 -0
- package/dist/unwraps/windowsLiveFavorites.mjs +8 -0
- package/dist/unwraps/worldNomads.mjs +2 -1
- package/dist/unwraps/wpPoczta.mjs +2 -2
- package/dist/unwraps/wykop.d.mts +2 -0
- package/dist/unwraps/wykop.mjs +11 -0
- package/dist/unwraps/xengentr.mjs +4 -3
- package/dist/unwraps/xianguo.d.mts +2 -0
- package/dist/unwraps/xianguo.mjs +8 -0
- package/dist/unwraps/xiaoyuzhou.mjs +1 -1
- package/dist/unwraps/ximalaya.mjs +3 -3
- package/dist/unwraps/xingShare.d.mts +2 -0
- package/dist/unwraps/xingShare.mjs +16 -0
- package/dist/unwraps/yahooBookmarks.d.mts +2 -0
- package/dist/unwraps/yahooBookmarks.mjs +38 -0
- package/dist/unwraps/yahooJapan.mjs +2 -3
- package/dist/unwraps/yahooJapanAmpViewer.mjs +2 -2
- package/dist/unwraps/yahooMailImage.mjs +2 -1
- package/dist/unwraps/yahooSearch.mjs +2 -2
- package/dist/unwraps/yamm.mjs +2 -1
- package/dist/unwraps/yandexMail.mjs +4 -3
- package/dist/unwraps/yandexTranslate.mjs +1 -1
- package/dist/unwraps/yandexTurbo.mjs +4 -4
- package/dist/unwraps/yesware.mjs +2 -2
- package/dist/unwraps/yourMembership.mjs +3 -2
- package/dist/unwraps/zencastr.mjs +1 -1
- package/dist/unwraps/zix.mjs +1 -1
- package/dist/unwraps/zscalerIsolation.mjs +1 -1
- package/dist/utils.mjs +9 -42
- package/package.json +4 -4
- package/dist/node_modules/entities/dist/internal/bin-trie-flags.mjs +0 -50
- package/dist/node_modules/entities/dist/internal/decode-shared.mjs +0 -143
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isHostOf } from "../node_modules/trousse/dist/urls.mjs";
|
|
2
2
|
import { getPathTarget } from "../pathTarget.mjs";
|
|
3
3
|
// src/unwraps/xiaoyuzhou.ts
|
|
4
|
-
const prefixRegex = /^\/track\/[0-9a-f]{24}\/[0-9a-f]{24}\/(?=media\.xyzcdn\.net\/)
|
|
4
|
+
const prefixRegex = /^\/track\/[0-9a-f]{24}\/[0-9a-f]{24}\/(?=media\.xyzcdn\.net\/)/i;
|
|
5
5
|
const unwrapXiaoyuzhou = (url) => {
|
|
6
6
|
if (!isHostOf(url, "dts-api.xiaoyuzhoufm.com")) return;
|
|
7
7
|
return getPathTarget(url, prefixRegex);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseUrl } from "../node_modules/trousse/dist/urls.mjs";
|
|
1
2
|
import { createParamExtractor } from "../utils.mjs";
|
|
2
3
|
// src/unwraps/ximalaya.ts
|
|
3
4
|
const filePathRegex = /^\/\/[^/]+$/;
|
|
@@ -10,8 +11,7 @@ const unwrapXimalaya = (url) => {
|
|
|
10
11
|
if (!filePathRegex.test(url.pathname)) return;
|
|
11
12
|
const target = extractTarget(url);
|
|
12
13
|
if (!target) return;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} catch {}
|
|
14
|
+
const targetHost = parseUrl(target)?.hostname;
|
|
15
|
+
if (targetHost && targetHostRegex.test(targetHost)) return target;
|
|
16
16
|
};
|
|
17
17
|
export { unwrapXimalaya };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { isAnyOf } from "../node_modules/trousse/dist/matching.mjs";
|
|
2
|
+
import { isHostOf, parseUrl } from "../node_modules/trousse/dist/urls.mjs";
|
|
3
|
+
import { getParamTarget, getParamValues } from "../utils.mjs";
|
|
4
|
+
// src/unwraps/xingShare.ts
|
|
5
|
+
const hosts = ["www.xing.com", "xing.com"];
|
|
6
|
+
const sharePathRegex = /^\/(?:spi\/shares\/new|social_plugins\/share(?:\/new)?|social\/share\/spi)\/?$/i;
|
|
7
|
+
const appPathRegex = /^\/app\/user\/?$/i;
|
|
8
|
+
const unwrapXingShare = (url) => {
|
|
9
|
+
if (!isHostOf(url, hosts)) return;
|
|
10
|
+
if (isAnyOf(url.pathname, sharePathRegex)) return getParamTarget(url, "url");
|
|
11
|
+
if (!isAnyOf(url.pathname, appPathRegex)) return;
|
|
12
|
+
const query = parseUrl(url.href.replace(url.search, () => url.search.replaceAll(";", "&")));
|
|
13
|
+
if (!query || getParamValues(query, "op").at(0) !== "share") return;
|
|
14
|
+
return getParamTarget(query, "url");
|
|
15
|
+
};
|
|
16
|
+
export { unwrapXingShare };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { isAnyOf } from "../node_modules/trousse/dist/matching.mjs";
|
|
2
|
+
import { isHostOf, isHttpUrl } from "../node_modules/trousse/dist/urls.mjs";
|
|
3
|
+
import { createParamExtractor, getParamTarget } from "../utils.mjs";
|
|
4
|
+
// src/unwraps/yahooBookmarks.ts
|
|
5
|
+
const submitPathRegex = /^\/submit\/?$/i;
|
|
6
|
+
const unwrapBookmarklet = createParamExtractor({
|
|
7
|
+
hosts: [
|
|
8
|
+
"bookmarks.yahoo.com",
|
|
9
|
+
"myweb2.search.yahoo.com",
|
|
10
|
+
"myweb.yahoo.com"
|
|
11
|
+
],
|
|
12
|
+
path: "/myresults/bookmarklet",
|
|
13
|
+
params: ["u"]
|
|
14
|
+
});
|
|
15
|
+
const unwrapToolbar = createParamExtractor({
|
|
16
|
+
hosts: "bookmarks.yahoo.com",
|
|
17
|
+
path: "/toolbar/savebm",
|
|
18
|
+
params: ["u"]
|
|
19
|
+
});
|
|
20
|
+
const unwrapBuzz = createParamExtractor({
|
|
21
|
+
hosts: [
|
|
22
|
+
"buzz.yahoo.com",
|
|
23
|
+
"fr.buzz.yahoo.com",
|
|
24
|
+
"uk.buzz.yahoo.com"
|
|
25
|
+
],
|
|
26
|
+
path: "/buzz",
|
|
27
|
+
params: ["targetUrl", "guid"]
|
|
28
|
+
});
|
|
29
|
+
const unwrapBuzzSubmit = (url) => {
|
|
30
|
+
if (!isHostOf(url, "buzz.yahoo.com") || !isAnyOf(url.pathname, submitPathRegex)) return;
|
|
31
|
+
const submitUrl = getParamTarget(url, "submitUrl");
|
|
32
|
+
if (submitUrl && isHttpUrl(submitUrl)) return submitUrl;
|
|
33
|
+
return getParamTarget(url, "u");
|
|
34
|
+
};
|
|
35
|
+
const unwrapYahooBookmarks = (url) => {
|
|
36
|
+
return unwrapBookmarklet(url) ?? unwrapToolbar(url) ?? unwrapBuzz(url) ?? unwrapBuzzSubmit(url);
|
|
37
|
+
};
|
|
38
|
+
export { unwrapYahooBookmarks };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { isHostOf, isHttpUrl } from "../node_modules/trousse/dist/urls.mjs";
|
|
2
|
-
import { decodeBase64Url } from "../utils.mjs";
|
|
1
|
+
import { decodeBase64Url, isHostOf, isHttpUrl } from "../node_modules/trousse/dist/urls.mjs";
|
|
3
2
|
// src/unwraps/yahooJapan.ts
|
|
4
|
-
const pathRegex = /^(?:\/[^/]+)*\/RU=([\w-]+)(?:\/R[A-Z]=[^/]*)*(?:;.*)
|
|
3
|
+
const pathRegex = /^(?:\/[^/]+)*\/RU=([\w-]+)(?:\/R[A-Z]=[^/]*)*(?:;.*)?$/i;
|
|
5
4
|
const paddingRegex = /-+$/;
|
|
6
5
|
const unwrapYahooJapan = (url) => {
|
|
7
6
|
if (!isHostOf(url, "rdsig.yahoo.co.jp")) return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { decodePercent, isHostOf, isHttpUrl } from "../node_modules/trousse/dist/urls.mjs";
|
|
2
2
|
// src/unwraps/yahooJapanAmpViewer.ts
|
|
3
|
-
const httpsPathRegex = /^\/amp\/s\/(.+)
|
|
4
|
-
const httpPathRegex = /^\/amp\/(?!s\/)(.+)
|
|
3
|
+
const httpsPathRegex = /^\/amp\/s\/(.+)$/i;
|
|
4
|
+
const httpPathRegex = /^\/amp\/(?!s\/)(.+)$/i;
|
|
5
5
|
const unwrapYahooJapanAmpViewer = (url) => {
|
|
6
6
|
if (!isHostOf(url, "search.yahoo.co.jp")) return;
|
|
7
7
|
const httpsMatch = httpsPathRegex.exec(url.pathname);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { decodePercent, getQueryParamValues, isHostOf } from "../node_modules/trousse/dist/urls.mjs";
|
|
2
|
+
import { isAnyOf } from "../node_modules/trousse/dist/matching.mjs";
|
|
2
3
|
// src/unwraps/yahooMailImage.ts
|
|
3
4
|
const unwrapYahooMailImage = (url) => {
|
|
4
|
-
if (!isHostOf(url, "ecp.yusercontent.com") || url.pathname
|
|
5
|
+
if (!isHostOf(url, "ecp.yusercontent.com") || !isAnyOf(url.pathname, "/mail")) return;
|
|
5
6
|
const value = getQueryParamValues(url, "url", { decodeValues: false }).at(-1);
|
|
6
7
|
if (!value) return;
|
|
7
8
|
return decodePercent(value);
|
|
@@ -6,8 +6,8 @@ const hosts = [
|
|
|
6
6
|
"ri.search.yahoo.com",
|
|
7
7
|
"chicagotribune.search.yahoo.com"
|
|
8
8
|
];
|
|
9
|
-
const yahooPathRegex = /^(?:\/[^/]+)*\/RU=([^/]+)\/RK
|
|
10
|
-
const unencodedTargetRegex = /^(?:\/[^/]+)*\/RU=(https?:\/\/.+?)\/RK
|
|
9
|
+
const yahooPathRegex = /^(?:\/[^/]+)*\/RU=([^/]+)\/RK=/i;
|
|
10
|
+
const unencodedTargetRegex = /^(?:\/[^/]+)*\/RU=(https?:\/\/.+?)\/RK=/i;
|
|
11
11
|
const unwrapYahooSearch = (url) => {
|
|
12
12
|
if (!isHostOf(url, hosts)) return;
|
|
13
13
|
const match = url.pathname.match(yahooPathRegex);
|
package/dist/unwraps/yamm.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { isAnyOf } from "../node_modules/trousse/dist/matching.mjs";
|
|
1
2
|
import { getParamTarget } from "../utils.mjs";
|
|
2
3
|
// src/unwraps/yamm.ts
|
|
3
4
|
const hostRegex = /^(?:[a-z0-9-]+-dot-)?yamm-track\.appspot\.com$/;
|
|
4
5
|
const unwrapYamm = (url) => {
|
|
5
|
-
if (!hostRegex.test(url.hostname) || url.pathname
|
|
6
|
+
if (!hostRegex.test(url.hostname) || !isAnyOf(url.pathname, "/Redirect")) return;
|
|
6
7
|
return getParamTarget(url, "link", -1);
|
|
7
8
|
};
|
|
8
9
|
export { unwrapYamm };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { isHttpUrl } from "../node_modules/trousse/dist/urls.mjs";
|
|
2
|
-
import {
|
|
1
|
+
import { decodeBase64Url, isHttpUrl } from "../node_modules/trousse/dist/urls.mjs";
|
|
2
|
+
import { isAnyOf } from "../node_modules/trousse/dist/matching.mjs";
|
|
3
|
+
import { getParamValues } from "../utils.mjs";
|
|
3
4
|
// src/unwraps/yandexMail.ts
|
|
4
5
|
const hostRegex = /^mail\.yandex\.(?:com\.tr|[a-z]{2,3})$/;
|
|
5
6
|
const unwrapYandexMail = (url) => {
|
|
6
|
-
if (!hostRegex.test(url.hostname) || url.pathname
|
|
7
|
+
if (!hostRegex.test(url.hostname) || !isAnyOf(url.pathname, "/re.jsx")) return;
|
|
7
8
|
const value = getParamValues(url, "l").at(0);
|
|
8
9
|
if (!value) return;
|
|
9
10
|
const decoded = decodeBase64Url(value);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isHostOf } from "../node_modules/trousse/dist/urls.mjs";
|
|
2
2
|
// src/unwraps/yandexTranslate.ts
|
|
3
|
-
const proxyPathRegex = /^\/proxy_u\/[^/]+\/(?:(?<scheme>https?)\/)?(?<target>.+)
|
|
3
|
+
const proxyPathRegex = /^\/proxy_u\/[^/]+\/(?:(?<scheme>https?)\/)?(?<target>.+)$/i;
|
|
4
4
|
const unwrapYandexTranslate = (url) => {
|
|
5
5
|
if (!isHostOf(url, "translated.turbopages.org")) return;
|
|
6
6
|
const match = url.pathname.match(proxyPathRegex);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createParamExtractor } from "../utils.mjs";
|
|
2
2
|
// src/unwraps/yandexTurbo.ts
|
|
3
3
|
const turbopagesHostRegex = /\.turbopages\.org$/;
|
|
4
|
-
const turbopagesPathRegex = /^\/[^/]+\/s\/(.+)
|
|
5
|
-
const hostInPathRegex = /^\/turbo\/([^/]+)\/s\/(.+)
|
|
6
|
-
const yandexSlashSFirstRegex = /^\/turbo\/s\/([^/]+)\/(.*)
|
|
7
|
-
const turbopagesSlashSFirstRegex = /^\/s\/([^/]+)\/(.*)
|
|
4
|
+
const turbopagesPathRegex = /^\/[^/]+\/s\/(.+)$/i;
|
|
5
|
+
const hostInPathRegex = /^\/turbo\/([^/]+)\/s\/(.+)$/i;
|
|
6
|
+
const yandexSlashSFirstRegex = /^\/turbo\/s\/([^/]+)\/(.*)$/i;
|
|
7
|
+
const turbopagesSlashSFirstRegex = /^\/s\/([^/]+)\/(.*)$/i;
|
|
8
8
|
const dashRegex = /-/g;
|
|
9
9
|
const yandexHostRegex = /^(?:www\.)?yandex\.(?:com\.tr|[a-z]{2,3})$/;
|
|
10
10
|
const extractTurboTarget = createParamExtractor({
|
package/dist/unwraps/yesware.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isHostOf, isHttpUrl } from "../node_modules/trousse/dist/urls.mjs";
|
|
2
2
|
import { createParamExtractor } from "../utils.mjs";
|
|
3
3
|
// src/unwraps/yesware.ts
|
|
4
|
-
const trackPathRegex = /^\/tt\/[\da-f]{40}\/[\da-f]{32}\/[\da-f]{32}\/(.+)
|
|
5
|
-
const linkPathRegex = /^\/tl\/[\da-f]{40}\/[\da-f]{32}\/[\da-f]{32}
|
|
4
|
+
const trackPathRegex = /^\/tt\/[\da-f]{40}\/[\da-f]{32}\/[\da-f]{32}\/(.+)$/i;
|
|
5
|
+
const linkPathRegex = /^\/tl\/[\da-f]{40}\/[\da-f]{32}\/[\da-f]{32}$/i;
|
|
6
6
|
const extractLinkTarget = createParamExtractor({
|
|
7
7
|
hosts: "t.yesware.com",
|
|
8
8
|
params: ["ytl"]
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { decodePercent, isHttpUrl } from "../node_modules/trousse/dist/urls.mjs";
|
|
1
|
+
import { decodePercent, getQueryParam, isHttpUrl } from "../node_modules/trousse/dist/urls.mjs";
|
|
2
|
+
import { isAnyOf } from "../node_modules/trousse/dist/matching.mjs";
|
|
2
3
|
import { getParamValues } from "../utils.mjs";
|
|
3
4
|
// src/unwraps/yourMembership.ts
|
|
4
5
|
const ymlinkRegex = /^\d+$/;
|
|
5
6
|
const encodedSchemeRegex = /^https?%3A/i;
|
|
6
7
|
const unwrapYourMembership = (url) => {
|
|
7
|
-
if (url.pathname
|
|
8
|
+
if (!isAnyOf(url.pathname, "/link.asp") || !ymlinkRegex.test(getQueryParam(url, "ymlink") ?? "")) return;
|
|
8
9
|
let target = getParamValues(url, "finalurl").at(0);
|
|
9
10
|
if (target && encodedSchemeRegex.test(target)) target = decodePercent(target);
|
|
10
11
|
if (target && isHttpUrl(target)) return target;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isHostOf } from "../node_modules/trousse/dist/urls.mjs";
|
|
2
2
|
import { getPathTarget } from "../pathTarget.mjs";
|
|
3
3
|
// src/unwraps/zencastr.ts
|
|
4
|
-
const redirectPrefixRegex = /^\/r
|
|
4
|
+
const redirectPrefixRegex = /^\/r\//i;
|
|
5
5
|
const unwrapZencastr = (url) => {
|
|
6
6
|
if (!isHostOf(url, ["r.zencastr.com", "r.zen.ai"])) return;
|
|
7
7
|
return getPathTarget(url, redirectPrefixRegex);
|
package/dist/unwraps/zix.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createParamExtractor } from "../utils.mjs";
|
|
2
2
|
// src/unwraps/zix.ts
|
|
3
|
-
const linkPathRegex = /^\/u\/[0-9a-f]{8}\/[A-Za-z0-9_-]
|
|
3
|
+
const linkPathRegex = /^\/u\/[0-9a-f]{8}\/[A-Za-z0-9_-]+$/i;
|
|
4
4
|
const extractTarget = createParamExtractor({
|
|
5
5
|
hosts: "link.zixcentral.com",
|
|
6
6
|
params: ["u"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createParamExtractor } from "../utils.mjs";
|
|
2
2
|
// src/unwraps/zscalerIsolation.ts
|
|
3
|
-
const sessionPathRegex = /^\/profile\/[0-9a-f-]{36}\/zia-session
|
|
3
|
+
const sessionPathRegex = /^\/profile\/[0-9a-f-]{36}\/zia-session\/$/i;
|
|
4
4
|
const extractTarget = createParamExtractor({
|
|
5
5
|
hosts: /^[0-9a-f]{8}\.isolation\.zscaler\.com$/,
|
|
6
6
|
params: ["original_url"]
|
package/dist/utils.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isAnyOf } from "./node_modules/trousse/dist/matching.mjs";
|
|
2
1
|
import { decodePercent, getQueryParamValues, isHostOf, isHostOrSubdomainOf } from "./node_modules/trousse/dist/urls.mjs";
|
|
2
|
+
import { isAnyOf } from "./node_modules/trousse/dist/matching.mjs";
|
|
3
3
|
// src/utils.ts
|
|
4
4
|
const encodedSchemeRegex = /^https?%3A/i;
|
|
5
5
|
const decodeEncodedScheme = (value) => {
|
|
@@ -7,20 +7,15 @@ const decodeEncodedScheme = (value) => {
|
|
|
7
7
|
return decodePercent(value);
|
|
8
8
|
};
|
|
9
9
|
const unencodedTargetRegex = /^https?:\/\//i;
|
|
10
|
+
const decodeParamValue = (raw) => {
|
|
11
|
+
if (!unencodedTargetRegex.test(raw)) return decodePercent(raw.replaceAll("+", " "));
|
|
12
|
+
return decodePercent(raw);
|
|
13
|
+
};
|
|
10
14
|
const getParamValues = (url, name) => {
|
|
11
|
-
|
|
12
|
-
const raws = getQueryParamValues(url, name, {
|
|
15
|
+
return getQueryParamValues(url, name, {
|
|
13
16
|
decodeValues: false,
|
|
14
17
|
preserveEmptyValues: true
|
|
15
|
-
});
|
|
16
|
-
for (const raw of raws) {
|
|
17
|
-
if (!unencodedTargetRegex.test(raw)) {
|
|
18
|
-
values.push(decodePercent(raw.replaceAll("+", " ")));
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
values.push(decodePercent(raw));
|
|
22
|
-
}
|
|
23
|
-
return values;
|
|
18
|
+
}).map(decodeParamValue);
|
|
24
19
|
};
|
|
25
20
|
const getParamTarget = (url, name, index = 0) => {
|
|
26
21
|
const value = getParamValues(url, name).at(index);
|
|
@@ -35,43 +30,15 @@ const createParamExtractor = (config) => {
|
|
|
35
30
|
};
|
|
36
31
|
return (url) => {
|
|
37
32
|
if (!isHostMatch(url)) return;
|
|
38
|
-
if (config.path && url.pathname
|
|
33
|
+
if (config.path && !isAnyOf(url.pathname, config.path)) return;
|
|
39
34
|
for (const param of config.params) {
|
|
40
35
|
const value = getParamValues(url, param).at(0);
|
|
41
36
|
if (value) return decodeEncodedScheme(value);
|
|
42
37
|
}
|
|
43
38
|
};
|
|
44
39
|
};
|
|
45
|
-
const decodeBase64Binary = (value) => {
|
|
46
|
-
try {
|
|
47
|
-
return atob(value);
|
|
48
|
-
} catch {}
|
|
49
|
-
};
|
|
50
|
-
const decodeBase64 = (value) => {
|
|
51
|
-
const binary = decodeBase64Binary(value);
|
|
52
|
-
if (binary === void 0) return;
|
|
53
|
-
let encoded = "";
|
|
54
|
-
for (let index = 0; index < binary.length; index++) {
|
|
55
|
-
const byte = binary.charCodeAt(index);
|
|
56
|
-
if (byte < 128 && binary[index] !== "%") {
|
|
57
|
-
encoded += binary[index];
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
encoded += `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
61
|
-
}
|
|
62
|
-
return decodePercent(encoded);
|
|
63
|
-
};
|
|
64
|
-
const toBase64 = (base64Url) => {
|
|
65
|
-
return base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
66
|
-
};
|
|
67
|
-
const decodeBase64Url = (value) => {
|
|
68
|
-
return decodeBase64(toBase64(value));
|
|
69
|
-
};
|
|
70
|
-
const decodeBase64UrlBinary = (value) => {
|
|
71
|
-
return decodeBase64Binary(toBase64(value));
|
|
72
|
-
};
|
|
73
40
|
const utf8Encoder = new TextEncoder();
|
|
74
41
|
const getUtf8ByteLength = (value) => {
|
|
75
42
|
return utf8Encoder.encode(value).length;
|
|
76
43
|
};
|
|
77
|
-
export { createParamExtractor,
|
|
44
|
+
export { createParamExtractor, decodeEncodedScheme, decodeParamValue, getParamTarget, getParamValues, getUtf8ByteLength };
|
package/package.json
CHANGED
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/bun": "^1.4.4",
|
|
44
|
-
"kvalita": "^1.
|
|
45
|
-
"trousse": "^3.
|
|
46
|
-
"tsdown": "0.23.
|
|
44
|
+
"kvalita": "^1.39.0",
|
|
45
|
+
"trousse": "^3.15.0",
|
|
46
|
+
"tsdown": "0.23.7"
|
|
47
47
|
},
|
|
48
|
-
"version": "2.
|
|
48
|
+
"version": "2.3.0"
|
|
49
49
|
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// node_modules/entities/dist/internal/bin-trie-flags.js
|
|
2
|
-
/**
|
|
3
|
-
* Bit flags & masks for the binary trie encoding used for entity decoding.
|
|
4
|
-
*
|
|
5
|
-
* The trie is a flat `Uint16Array`. Every node starts with one header word:
|
|
6
|
-
*
|
|
7
|
-
* 15..14 VALUE_LENGTH Number of words the value occupies, +1.
|
|
8
|
-
* 0 = no value; 1 = value inline in bits 12..0;
|
|
9
|
-
* 2/3 = value in the 1/2 words after the header.
|
|
10
|
-
* 13 FLAG13 If VALUE_LENGTH > 0: semicolon required ("strict"
|
|
11
|
-
* entity; `;` is never stored as a branch).
|
|
12
|
-
* If VALUE_LENGTH == 0: this node is a compact run.
|
|
13
|
-
* 12..7 BRANCH_LENGTH Number of branches (or run length for runs).
|
|
14
|
-
* 6..0 JUMP_TABLE Jump-table offset / single-branch char / first
|
|
15
|
-
* run char (see below).
|
|
16
|
-
*
|
|
17
|
-
* Branch data follows the header and any value words. Its shape is selected
|
|
18
|
-
* by (JUMP_TABLE, BRANCH_LENGTH) in the header:
|
|
19
|
-
*
|
|
20
|
-
* Single branch JUMP_TABLE = the only child's char, BRANCH_LENGTH = 0.
|
|
21
|
-
* No branch words; the child node follows immediately.
|
|
22
|
-
* Jump table JUMP_TABLE = first covered char (> 0), BRANCH_LENGTH =
|
|
23
|
-
* table length. One word per covered char: 0 = no branch,
|
|
24
|
-
* otherwise the child's offset from the END of the table,
|
|
25
|
-
* +1 (so 0 stays the no-branch sentinel).
|
|
26
|
-
* Dictionary JUMP_TABLE = 0, BRANCH_LENGTH = number of branches.
|
|
27
|
-
* ceil(n/2) words of sorted keys packed two per word
|
|
28
|
-
* (low byte first), then n pointer words storing the
|
|
29
|
-
* child's offset from the END of the branch data.
|
|
30
|
-
* Compact run VALUE_LENGTH = 0, FLAG13 set. BRANCH_LENGTH = run
|
|
31
|
-
* length (3..63), JUMP_TABLE = first char; remaining run
|
|
32
|
-
* chars packed two per word after the header. The target
|
|
33
|
-
* node follows the packed words immediately.
|
|
34
|
-
*
|
|
35
|
-
* Pointers are end-relative (rather than relative to the pointer's own
|
|
36
|
-
* position) because that makes the common "child encoded right after the
|
|
37
|
-
* branch data" case a small constant, which compresses far better. Offsets
|
|
38
|
-
* to already-encoded (shared) nodes wrap via uint16 modulo arithmetic; the
|
|
39
|
-
* decoder masks navigation results with `& 0xff_ff` to match.
|
|
40
|
-
*/
|
|
41
|
-
var BinTrieFlags;
|
|
42
|
-
(function(BinTrieFlags) {
|
|
43
|
-
BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
|
|
44
|
-
BinTrieFlags[BinTrieFlags["FLAG13"] = 8192] = "FLAG13";
|
|
45
|
-
BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 8064] = "BRANCH_LENGTH";
|
|
46
|
-
BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE";
|
|
47
|
-
/** Bits 12..0: the inline value of a VALUE_LENGTH = 1 header word. */
|
|
48
|
-
BinTrieFlags[BinTrieFlags["VALUE_MASK"] = 8191] = "VALUE_MASK";
|
|
49
|
-
})(BinTrieFlags || (BinTrieFlags = {}));
|
|
50
|
-
export { BinTrieFlags };
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
// node_modules/entities/dist/internal/decode-shared.js
|
|
2
|
-
const BASE91_INVERSE = /* #__PURE__ */ (() => {
|
|
3
|
-
const table = /* @__PURE__ */ new Uint8Array(127);
|
|
4
|
-
let code = 0;
|
|
5
|
-
for (let char = 33; char <= 126; char++) if (char !== 34 && char !== 36 && char !== 92) table[char] = code++;
|
|
6
|
-
return table;
|
|
7
|
-
})();
|
|
8
|
-
/**
|
|
9
|
-
* Decode a dictionary-encoded trie string back into its Uint16Array.
|
|
10
|
-
*
|
|
11
|
-
* Stream layout (consumed in this order):
|
|
12
|
-
* 1. dict1 atoms — `dict1AtomCount` uint16 values, delta+RLE encoded.
|
|
13
|
-
* 2. dict2 atoms — `atomCount - dict1AtomCount` values, delta+RLE.
|
|
14
|
-
* 3. dict2 ngrams — `ngramCount - (dictSize - dict1AtomCount)` entries,
|
|
15
|
-
* each a pair of slot codes that resolve to earlier slots.
|
|
16
|
-
* 4. dict1 ngrams — `dictSize - dict1AtomCount` entries, same shape.
|
|
17
|
-
* 5. data — slot codes, each expanding to one or more uint16 values.
|
|
18
|
-
*
|
|
19
|
-
* Codes use a 91-char base (printable ASCII minus `"`, `$`, `\`):
|
|
20
|
-
* - char1 < dictSize → 1-char code, slot = char1
|
|
21
|
-
* - char1 ≥ dictSize → 2-char code, slot = dictSize + (char1 - dictSize)*91 + char2
|
|
22
|
-
*
|
|
23
|
-
* Slot index → token kind:
|
|
24
|
-
* [0, A) dict1 atoms (1-char codes)
|
|
25
|
-
* [A, dictSize) dict1 ngrams (1-char codes)
|
|
26
|
-
* [dictSize, dictSize+D) dict2 atoms (2-char codes)
|
|
27
|
-
* [dictSize+D, end) dict2 ngrams (2-char codes)
|
|
28
|
-
*
|
|
29
|
-
* Both atom dicts decode before any ngram, and dict2 ngrams decode before
|
|
30
|
-
* dict1 ngrams. So every ngram entry references slots whose contents are
|
|
31
|
-
* already filled — no forward references to handle.
|
|
32
|
-
*
|
|
33
|
-
* This runs on library import. Flat typed arrays store each slot as either
|
|
34
|
-
* a plain value (`single`, covering every atom) or a range in a shared
|
|
35
|
-
* `pool` (ngrams).
|
|
36
|
-
* @param input Packed trie string.
|
|
37
|
-
* @param resultLength Expected number of uint16 values in the output.
|
|
38
|
-
* @param atomCount Total number of distinct uint16 values in the trie.
|
|
39
|
-
* @param dict1AtomCount Atoms in the 1-char range (`A` above).
|
|
40
|
-
* @param ngramCount Total number of ngram entries (dict1 + dict2).
|
|
41
|
-
* @param dictSize Number of 1-char code slots; the rest of `BASE - dictSize`
|
|
42
|
-
* first-byte values are 2-char codes.
|
|
43
|
-
*/
|
|
44
|
-
function decodeTrieDict(input, resultLength, atomCount, dict1AtomCount, ngramCount, dictSize) {
|
|
45
|
-
const base = 91;
|
|
46
|
-
const inputLength = input.length;
|
|
47
|
-
const twoCharBias = dictSize * 90;
|
|
48
|
-
let pos = 0;
|
|
49
|
-
/** Read one slot code at `pos` and return its slot index, advancing pos. */
|
|
50
|
-
const readSlotCode = () => {
|
|
51
|
-
const c1 = BASE91_INVERSE[input.charCodeAt(pos++)];
|
|
52
|
-
return c1 < dictSize ? c1 : c1 * base - twoCharBias + BASE91_INVERSE[input.charCodeAt(pos++)];
|
|
53
|
-
};
|
|
54
|
-
const dict2AtomCount = atomCount - dict1AtomCount;
|
|
55
|
-
const slotCount = atomCount + ngramCount;
|
|
56
|
-
const single = new Int32Array(slotCount);
|
|
57
|
-
single.fill(-1, dict1AtomCount, dictSize);
|
|
58
|
-
single.fill(-1, dictSize + dict2AtomCount, slotCount);
|
|
59
|
-
const start = new Int32Array(slotCount);
|
|
60
|
-
const length = new Int32Array(slotCount);
|
|
61
|
-
/**
|
|
62
|
-
* Decode `count` ascending uint16 values from a delta+RLE stream into
|
|
63
|
-
* `single[off..off+count)`.
|
|
64
|
-
*
|
|
65
|
-
* code < 89 → delta = code
|
|
66
|
-
* code == 89 → run-length: next char encodes runLength-2; emit `runLength` consecutive +1 values
|
|
67
|
-
* code == 90, next < 90 → escape: delta = 89 + next * BASE + after-next
|
|
68
|
-
* code == 90, next == 90 → double-escape: extra char for very large deltas
|
|
69
|
-
* @param count
|
|
70
|
-
* @param off
|
|
71
|
-
*/
|
|
72
|
-
function decodeDelta(count, off) {
|
|
73
|
-
let previous = 0;
|
|
74
|
-
let slot = off;
|
|
75
|
-
const end = off + count;
|
|
76
|
-
while (slot < end) {
|
|
77
|
-
const code = BASE91_INVERSE[input.charCodeAt(pos++)];
|
|
78
|
-
if (code < 89) {
|
|
79
|
-
previous += code;
|
|
80
|
-
single[slot++] = previous;
|
|
81
|
-
} else if (code === 89) {
|
|
82
|
-
let runLength = BASE91_INVERSE[input.charCodeAt(pos++)] + 2;
|
|
83
|
-
while (runLength--) single[slot++] = ++previous;
|
|
84
|
-
} else {
|
|
85
|
-
const next = BASE91_INVERSE[input.charCodeAt(pos++)];
|
|
86
|
-
previous += 89 + (next < 90 ? next * base + BASE91_INVERSE[input.charCodeAt(pos++)] : BASE91_INVERSE[input.charCodeAt(pos++)] * 8281 + BASE91_INVERSE[input.charCodeAt(pos++)] * base + BASE91_INVERSE[input.charCodeAt(pos++)]);
|
|
87
|
-
single[slot++] = previous;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
decodeDelta(dict1AtomCount, 0);
|
|
92
|
-
decodeDelta(dict2AtomCount, dictSize);
|
|
93
|
-
const references = new Int32Array(ngramCount * 2);
|
|
94
|
-
let poolSize = 0;
|
|
95
|
-
let ngramIndex = 0;
|
|
96
|
-
/**
|
|
97
|
-
* Read `count` ngram entries (each = 2 slot-code references) for the slots
|
|
98
|
-
* starting at `startSlot`, recording references and assigning pool ranges.
|
|
99
|
-
* @param count
|
|
100
|
-
* @param startSlot
|
|
101
|
-
*/
|
|
102
|
-
function readNgramReferences(count, startSlot) {
|
|
103
|
-
for (let index = 0; index < count; index++) {
|
|
104
|
-
const slot = startSlot + index;
|
|
105
|
-
const a = readSlotCode();
|
|
106
|
-
const b = readSlotCode();
|
|
107
|
-
references[ngramIndex * 2] = a;
|
|
108
|
-
references[ngramIndex * 2 + 1] = b;
|
|
109
|
-
ngramIndex += 1;
|
|
110
|
-
start[slot] = poolSize;
|
|
111
|
-
const entryLength = (single[a] < 0 ? length[a] : 1) + (single[b] < 0 ? length[b] : 1);
|
|
112
|
-
length[slot] = entryLength;
|
|
113
|
-
poolSize += entryLength;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
readNgramReferences(ngramCount - dictSize + dict1AtomCount, dictSize + dict2AtomCount);
|
|
117
|
-
readNgramReferences(dictSize - dict1AtomCount, dict1AtomCount);
|
|
118
|
-
const pool = new Uint16Array(poolSize);
|
|
119
|
-
let write = 0;
|
|
120
|
-
for (let index = 0; index < ngramIndex; index++) for (let half = 0; half < 2; half++) {
|
|
121
|
-
const source = references[index * 2 + half];
|
|
122
|
-
const value = single[source];
|
|
123
|
-
if (value < 0) {
|
|
124
|
-
let read = start[source];
|
|
125
|
-
const readEnd = read + length[source];
|
|
126
|
-
while (read < readEnd) pool[write++] = pool[read++];
|
|
127
|
-
} else pool[write++] = value;
|
|
128
|
-
}
|
|
129
|
-
const out = new Uint16Array(resultLength);
|
|
130
|
-
let outIndex = 0;
|
|
131
|
-
while (pos < inputLength) {
|
|
132
|
-
let slot = BASE91_INVERSE[input.charCodeAt(pos++)];
|
|
133
|
-
if (slot >= dictSize) slot = slot * base - twoCharBias + BASE91_INVERSE[input.charCodeAt(pos++)];
|
|
134
|
-
const value = single[slot];
|
|
135
|
-
if (value < 0) {
|
|
136
|
-
let read = start[slot];
|
|
137
|
-
const readEnd = read + length[slot];
|
|
138
|
-
while (read < readEnd) out[outIndex++] = pool[read++];
|
|
139
|
-
} else out[outIndex++] = value;
|
|
140
|
-
}
|
|
141
|
-
return out;
|
|
142
|
-
}
|
|
143
|
-
export { decodeTrieDict };
|