Build 542549stable
Module 998218
2,978 characters · in no known chunkDependencies
Required by (57)
19575295993300635903361677684390924154872168393175671189996190930202803209086235393237218256265259407266620271866285961311043370480380610398817417964432000464792474463497685521337527214570314573648580763595244617986731068738533742424769299776231803316803977833291849380859387871123887909909338922068925435943775963179976526978263998218
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{A:()=>v}),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$/,f=/^.*\.media\.discordapp\.net$/,h=new Set(["media.tenor.com","media.tenor.co","c.tenor.com","static.klipy.com","media.giphy.com","i.giphy.com"]),p=r().v4().source,E=RegExp(`(?:(?:(?:[a-z]+:)?//)|www\\.)(?:\\S+(?::\\S*)?@)?(?:localhost|${p}|(?:[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||f.test(i.hostname))}function N(e){if(null==e)return!1;let t=u.A.toURLSafe(e);return null!=t&&h.has(t.hostname)}function y(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 C(e){return null!=e&&I(o.parse(e).protocol)}let v={URL_REGEX:E,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:y,isDiscordUri:C,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=>y(e)||C(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}}}}