Module 323350

3,327 characters · in 381faf2c40dd0284.js
Dependencies
Required by (3)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{IQ:()=>x,WO:()=>f}),n(321073);var l=n(284009),i=n.n(l),s=n(47167),r=n(379418),a=n(209932),o=n(734057),c=n(317525),u=n(994500),d=n(967198),h=n(287809),m=n(427262),p=n(820066);function f(e,t){let{mode:n,ignoreTrailingEmptyNodes:l,preventEmojiSurrogates:i}=t??{},[s,r]=t?.range!=null?p.ZF.edges(t.range):[void 0,void 0];return g(e,{mode:n,start:s,end:r,ignoreTrailingEmptyNodes:l,preventEmojiSurrogates:i})}function g(e,t){let{mode:n,start:l,end:i,separator:s,ignoreEmptyNodes:r,ignoreTrailingEmptyNodes:a,preventEmojiSurrogates:o}=t??{},c=e.length>0&&!p.l5.isText(e[0]);null==s&&(s=c?"\n":"");let u=l?.path[0]??0,d=i?.path[0]??e.length-1;if(a)for(let t=d;t>=u;t--){let n=e[t];if(p.l5.isText(n)){if(n.text.length>0){d=t;break}}else if(!p.cv.isEmpty(n)){d=t;break}if(t===u)return""}let h=u>0&&p.AS.isType(e[u-1],"blockQuote"),m=p.AS.isType(e[u],"blockQuote"),f=p.AS.isType(e[d],"blockQuote"),g=[];for(let t=u;t<=d;t++){let s=e[t];if(r&&p.l5.isText(s)&&0===s.text.length)continue;let a=x(s,{mode:n,start:null!=l&&t===u?{path:l.path.slice(1),offset:l.offset}:void 0,end:null!=i&&t===d?{path:i.path.slice(1),offset:i.offset}:void 0,allowBlockQuotePrefix:null==l||null==i||!h&&(!m||f),preventEmojiSurrogates:o});(!r||a.length>0)&&g.push(a)}return g.join(s)}function x(e,t){let{mode:n,start:l,allowBlockQuotePrefix:f=!1,preventEmojiSurrogates:x=!1}=t??{};if(p.l5.isText(e))return function(e,t){let{start:n,end:l}=t??{};return i()(null==n||0===n.path.length,"Invalid start provided to serializeText"),i()(null==l||0===l.path.length,"Invalid end provided to serializeText"),e.substring(n?.offset??0,l?.offset??e.length)}(e.text,t);switch(e.type){case"line":case"testInline":return g(e.children,t);case"testInlineVoid":return"";case"blockQuote":{let n=g(e.children,t),i=null!=l&&1===l.path.length&&0===l.path[0]&&0===l.offset;if(f&&(null==l||i))return`> ${n}`;return n}case"emoji":{let t=e.emoji;if(!x&&null!=t.surrogate)return t.surrogate;return t.name}case"customEmoji":{let t=e.emoji;if("raw"===n){let e=t.animated?"a":"",n=t.name.replace(/:/g,"").split("~")[0];return`<${e}:${n}:${t.emojiId}>`}return t.name}case"textMention":return e.name;case"channelMention":{let t=`<#${e.channelId}>`;if("raw"===n)return t;let l=o.A.getChannel(e.channelId);if(null==l)return t;return(0,s.m1)(l,h.default,u.A,!0,!0)}case"soundboard":{let t=`<sound:${e.guildId}:${e.soundId}>`;if("raw"===n)return t;let l=a.A.getSoundById(e.soundId);if(null==l)return t;return l.name}case"staticRouteLink":return null!=e.itemId?`<id:${e.id}:${e.itemId}>`:`<id:${e.id}>`;case"roleMention":{let t=`<@&${e.roleId}>`;if("raw"===n)return t;let l=d.A.getGuildId(),i=null!=l?c.A.getRole(l,e.roleId):void 0;if(null==i)return t;return`@${i.name}`}case"userMention":{let t=`<@${e.userId}>`;if("raw"===n)return t;let l=h.default.getUser(e.userId);if(null==l)return t;return`@${m.Ay.getUserTag(l,{decoration:"never"})}`}case"commandMention":return`</${e.commandName}:${e.commandId}>`;case"timestamp":return(0,r.tf)(e.parsed.timestamp,e.parsed.format);case"timestampMentionInput":{let n=g(e.children,t);if(null==l)return`<@time:${n}>`;return n}case"applicationCommand":return g(e.children,{...t,separator:" ",ignoreEmptyNodes:!0});case"applicationCommandOption":{let n=g(e.children,t);if(null==l)return`${e.optionDisplayName}:${n}`;return n}}}}