Build 574548stable
Module 998218
2,987 characters · in no known chunkDependencies
Required by (55)
271617389195753300635903361674694890924123917154872156867168393175671190930202803209086235393237218256265259407266620271866285961311043370480380610417964432000459789464792483883490714497685570314573648595244617986627669694403731068738533742424776231797489803316803977844789871123887909892768925435943775963179978263998218
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{A:()=>O}),n(323874),n(14289),n(35956);var i=n(477450),r=n.n(i),s=n(735438),a=n.n(s),o=n(567243),l=n(403362),u=n(998218),c=n(652215);let d=/(?:^|\.)(?:discordapp|discord|discordmerch)\.com$/i,_=/^.*\.discordapp\.net$/,h=/^.*\.media\.discordapp\.net$/,f=new Set(["media.tenor.com","media.tenor.co","c.tenor.com","static.klipy.com","media.giphy.com","i.giphy.com"]),E=r().v4().source,p=RegExp(`(?:(?:(?:[a-z]+:)?//)|www\\.)(?:[^\\s:@]+(?::[^\\s@]*)?@)?(?:localhost|${E}|(?:[a-z\\u00a1-\\uffff0-9-_]+\\.)+(?:(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:[/?#][^\\s"]*)?`,"ig"),m=new Set([window.GLOBAL_ENV.CDN_HOST,window.GLOBAL_ENV.INVITE_HOST,window.GLOBAL_ENV.GIFT_CODE_HOST,window.GLOBAL_ENV.GUILD_TEMPLATE_HOST]);function g(e,t){return null!=e&&null!=t&&e!==t}function A(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return null!=e&&(d.test(e)||t&&m.has(e.toLowerCase()))}function I(e){return null!=e&&"discord:"===e}function T(e){if(null==e)return!1;let t=u.A.toURLSafe(e);return null!=t&&(!!(0,l.iT)()&&("localhost"===t.hostname||"127.0.0.1"===t.hostname)||t.hostname===window.GLOBAL_ENV.CDN_HOST||_.test(t.hostname))}function S(e,t,n){if(!g(t,n)||null==e)return!1;let i=u.A.toURLSafe(e);return null!=i&&(!!(0,l.iT)()&&("localhost"===i.hostname||"127.0.0.1"===i.hostname)&&"4000"===i.port||h.test(i.hostname))}function N(e){if(null==e)return!1;let t=u.A.toURLSafe(e);return null!=t&&f.has(t.hostname)}function C(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null!=e){let n=u.A.toURLSafe(e)?.hostname;if(null!=n&&A(n,t))return!0}return!1}function y(e){return null!=e&&I(o.parse(e).protocol)}let O={URL_REGEX:p,makeUrl:function(e,t){let n=t??(0,l.m6)()?window.GLOBAL_ENV.INVITE_HOST:location.host;return`${location.protocol}//${n}${e}`},isOriginalContentTypeDifferent:g,isDiscordHostname:A,isDiscordLocalhost:function(e,t){return null!=e&&null!=t&&window.location.host===e},isDiscordProtocol:I,isDiscordUrl:C,isDiscordUri:y,isDiscordCdnUrl:function(e){return null!=e&&o.parse(e).hostname===window.GLOBAL_ENV.CDN_HOST},isDiscordDirectAssetUrl:T,isDiscordProxiedAssetUrl:S,isAllowedGifProviderUrl:N,isDiscordAssetUrl:function(e,t,n){return!!(T(e)||S(e,t,n)||N(e))},isDiscordUrlOrUri:e=>C(e)||y(e),isAppRoute:e=>{let t=e.toLowerCase();return t.startsWith("/channels/")||t.startsWith(c.BVt.APPLICATION_STORE)||t.startsWith(c.BVt.APPLICATION_LIBRARY)||t.startsWith(c.BVt.MESSAGE_REQUESTS)||t.startsWith(c.BVt.FAMILY_CENTER)||t.startsWith(c.BVt.ACTIVITIES)||t.startsWith(c.BVt.COLLECTIBLES_SHOP)||t.startsWith("/feature/boost")||t.startsWith(c.BVt.ACTIVITY)},format:e=>o.format(e),formatPathWithQuery:(e,t)=>o.format({pathname:e,query:a().pickBy(t)}),formatSearch:e=>o.format({query:a().pickBy(e)}),safeParseWithQuery(e){try{return o.parse(e,!0)}catch(e){return null}},toURLSafe(e,t){try{return new URL(e,t)}catch(e){return null}},safeDecodeURIComponent(e){try{return decodeURIComponent(e)}catch(e){return null}}}}