Loading
function(t,e,n){n.d(e,{FV:()=>C,M3:()=>d,O7:()=>m,SQ:()=>y,cd:()=>x,ke:()=>v,n$:()=>g,pY:()=>A}),n(321073);var l=n(155718),i=n(721768),r=n(861382),a=n(203779),o=n(31717),s=n(522602),u=n(408018),p=n(323350),c=n(820066),h=n(551483);let f=/([\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}_-]+):/gu;function g(t){let e=c.VW.richValue(t)[0];return null==e||"applicationCommand"!==e.type?null:[e,h.Xg]}function d(t){if(null==t.selection)return null;let e=c.VW.above(t,{at:t.selection.focus,match:t=>c.AS.isType(t,"applicationCommandOption")})??null;return null!=e||c.ZF.isCollapsed(t.selection)?e:c.VW.above(t,{at:t.selection.anchor,match:t=>c.AS.isType(t,"applicationCommandOption")})??null}function m(t){let e=g(t),n=[],l=e?.[0].children;if(null!=l)for(let t of l)c.AS.isType(t,"applicationCommandOption")&&n.push(t.optionName);return n}function y(t,e,n){let l={};if(null==e.options)return{};let i=g(t),r=Object.fromEntries(e.options.map(t=>[t.name,t])),a=i?.[0].children;if(null!=a){for(let e of a)if(c.AS.isType(e,"applicationCommandOption")){let i=r[e.optionName];null!=i&&(l[e.optionName]=C(t,i,e,n))}}return l}function C(t,e,n,i){let r=n.children.map(n=>{if(e.type===l.n4.ATTACHMENT){let t=s.A.getUpload(i,e.name,o.C.SlashCommand);if(null!=t)return{type:"text",text:t.filename??""}}if(c.l5.isText(n))return{type:"text",text:n.text};if(c.VW.isVoid(t,n)){let t=(0,u.QR)(n);if(null!=t)return t}return{type:"text",text:(0,p.IQ)(n,{mode:"raw"})}});if(e.type!==l.n4.STRING){for(;r.length>0&&"text"===r[0].type&&""===r[0].text.trim();)r.shift();for(;r.length>0&&"text"===r[r.length-1].type&&""===r[r.length-1].text.trim();)r.pop()}return r}function x(t,e,n,l,r){if(null==t.options)return{};let o=Object.fromEntries(t.options.map(t=>[t.name,a.J({option:t,content:l[t.name]??null,guildId:e,channelId:n,allowEmptyValues:r})]));return i._y(n,o),o}function v(t,e,n,l,o){let[s]=l,u=r.A.getActiveCommand(n),p=u?.options?.find(t=>t.name===s.optionName);if(null==p)return;let c=C(t,p,s,n),h=a.J({option:p,content:c,guildId:e,channelId:n,allowEmptyValues:o});return i.H2(n,{[s.optionName]:{lastValidationResult:h}}),h}function A(t,e){if(null==e.options||0===e.options.length)return[];let n=c.VW.richValue(t),l=[],i=new Set(m(t)),r={},a=new Set;for(let t of e.options)r[t.displayName]=t,i.has(t.name)||a.add(t.displayName);let o=null;for(let e=0;e<n.length;e++){let i=n[e];if("line"===i.type||"applicationCommand"===i.type)for(let s=0;s<i.children.length;s++){let u,h=i.children[s],g=[e,s];if(c.AS.isType(h,"applicationCommandOption")){null!=o&&(o.valueRange.focus=c.VW.before(t,g)??c.VW.start(t,[]),o.text=(0,p.WO)(n,{mode:"raw",range:o.valueRange}).trim(),l.push(o),o=null);continue}if(c.l5.isText(h))for(f.lastIndex=0;null!=(u=f.exec(h.text));){if(0!==u.index&&null==h.text.charAt(u.index-1).match(/(\t|\s)/))continue;let t=u[1];if(!a.has(t))continue;a.delete(t);let e=r[t];if(null==e)continue;let i={path:g,offset:u.index},s={path:g,offset:i.offset+u[0].length},c={path:g,offset:s.offset},f={name:e.name,displayName:e.displayName,type:e.type,keyRange:{anchor:i,focus:s},valueRange:{anchor:c,focus:c},text:""};null!=o&&(o.valueRange.focus=f.keyRange.anchor,o.text=(0,p.WO)(n,{mode:"raw",range:o.valueRange}).trim(),l.push(o)),o=f}}}return null!=o&&(o.valueRange.focus=c.VW.end(t,[]),o.text=(0,p.WO)(n,{mode:"raw",range:o.valueRange}).trim(),l.push(o)),l}}