function b(e){window.enmity.plugins.registerPlugin(e)}var L="Unfurl",x="1.1.0",B="Shorten or lengthen your URLs!",N=[{name:"Niko",id:"341377368075796483"}],D={name:L,version:x,description:B,authors:N},v;(function(e){e[e.BuiltIn=0]="BuiltIn",e[e.Guild=1]="Guild",e[e.DM=2]="DM"})(v||(v={}));var h;(function(e){e[e.Chat=1]="Chat",e[e.User=2]="User",e[e.Message=3]="Message"})(h||(h={}));var c;(function(e){e[e.BuiltIn=0]="BuiltIn",e[e.BuiltInText=1]="BuiltInText",e[e.BuiltInIntegration=2]="BuiltInIntegration",e[e.Bot=3]="Bot",e[e.Placeholder=4]="Placeholder"})(c||(c={}));var f;(function(e){e[e.Role=1]="Role",e[e.User=2]="User"})(f||(f={}));var i;(function(e){e[e.SubCommand=1]="SubCommand",e[e.SubCommandGroup=2]="SubCommandGroup",e[e.String=3]="String",e[e.Integer=4]="Integer",e[e.Boolean=5]="Boolean",e[e.User=6]="User",e[e.Channel=7]="Channel",e[e.Role=8]="Role",e[e.Mentionnable=9]="Mentionnable",e[e.Number=10]="Number",e[e.Attachment=11]="Attachment"})(i||(i={}));var k;(function(e){e[e.ApplicationCommand=2]="ApplicationCommand",e[e.MessageComponent=3]="MessageComponent"})(k||(k={})),window.enmity.modules.common.Constants,window.enmity.modules.common.Clipboard,window.enmity.modules.common.Assets,window.enmity.modules.common.Messages,window.enmity.modules.common.Clyde,window.enmity.modules.common.Avatars,window.enmity.modules.common.Native,window.enmity.modules.common.React,window.enmity.modules.common.Dispatcher,window.enmity.modules.common.Storage,window.enmity.modules.common.Toasts,window.enmity.modules.common.Dialog,window.enmity.modules.common.Token;const R=window.enmity.modules.common.REST;window.enmity.modules.common.Settings,window.enmity.modules.common.Users,window.enmity.modules.common.Navigation,window.enmity.modules.common.NavigationNative,window.enmity.modules.common.NavigationStack,window.enmity.modules.common.Theme,window.enmity.modules.common.Linking,window.enmity.modules.common.StyleSheet,window.enmity.modules.common.ColorMap,window.enmity.modules.common.Components,window.enmity.modules.common.Locale,window.enmity.modules.common.Profiles,window.enmity.modules.common.Lodash,window.enmity.modules.common.Logger,window.enmity.modules.common.Flux,window.enmity.modules.common.SVG,window.enmity.modules.common.Scenes,window.enmity.modules.common.Moment;function o(e,n,l,r){window.enmity.clyde.sendReply(e,n,l,r)}const M={id:"lengthen-command",name:"unfurl",displayName:"unfurl",description:"Annoy people by unfurling your link",displayDescription:"Annoy people by unfurling your link",type:h.Chat,inputType:c.BuiltInText,options:[{name:"url",displayName:"url",description:"URL to lengthen",displayDescription:"URL to lengthen",type:i.String,required:!0},{name:"whisper",displayName:"whisper",description:"Whisper the URL to you",displayDescription:"Whisper the URL to you",type:i.Boolean,required:!1}],execute:async function(e,n){var l,r,u,d,t=e[0].value;t.includes("://")||(t="https://"+t);try{o((l=n==null?void 0:n.channel.id)!=null?l:"0","Generating Longlink..");var a=await R.get(`https://api.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.com/a?url=${t}`)}catch{o((r=n==null?void 0:n.channel.id)!=null?r:"0","Something went really wrong creating your longlink.")}if(a.text!="INVALID_URL")if(e[1]&&e[1].value){o((u=n==null?void 0:n.channel.id)!=null?u:"0",`<${a.text}>`);return}else return{content:`<${a.text}>`};else{o((d=n==null?void 0:n.channel.id)!=null?d:"0","Your URL was invalid!");return}}},I={id:"shorten-command",name:"furl",displayName:"furl",description:"Furl your link into a snail",displayDescription:"Furl your link into a snail",type:h.Chat,inputType:c.BuiltInText,options:[{name:"url",displayName:"url",description:"URL to shorten",displayDescription:"URL to shorten",type:i.String,required:!0},{name:"whisper",displayName:"whisper",description:"Whisper the URL to you",displayDescription:"Whisper the URL to you",type:i.Boolean,required:!1},{name:"alias",displayName:"alias",description:"Alias for your shortlink",displayDescription:"Alias for your shortlink",type:i.String,required:!1}],execute:async function(e,n){var l,r,u,d,t,a,w=e[0].value,m,y=e[e.findIndex(s=>s.name==="whisper")];if(w.startsWith("http")||(w="https://"+w),e[e.findIndex(s=>s.name==="alias")]?m=e[e.findIndex(s=>s.name==="alias")].value:m=null,m!=null&&m.match(/^fag(g|got|tard)?|cocks?sucker(s|ing)?|ni((g{2,}|q)+|[gq]{2,})[e3r]+(s|z)?|mudslime?s?|kikes?|spi(c|k)s?|chinks?|gooks?|bitch(es|ing|y)?|whor(es?|ing)|tr(a|@)nn?(y|ies?)|(b|re|r)tard(ed)?s?/)){o((l=n==null?void 0:n.channel.id)!=null?l:"0","Couldn't create your shortlink. That alias contains blocked words.");return}const S={url:"https://tny-snls.xyz/api/snails",body:{url:w,slug:m}};try{o((r=n==null?void 0:n.channel.id)!=null?r:"0","Generating Shortlink..");var U=await R.post(S)}catch(s){s.body.error=="invalid data"?o((u=n==null?void 0:n.channel.id)!=null?u:"0","Couldn't create your shortlink. Invalid URL."):s.body.error=="alias already exists"?o((d=n==null?void 0:n.channel.id)!=null?d:"0","Couldn't create your shortlink. That alias is already taken."):o((t=n==null?void 0:n.channel.id)!=null?t:"0","Something went really wrong creating your shortlink.");return}const g="https://tny-snls.xyz/s/"+U.body.alias;if(y&&y.value){o((a=n==null?void 0:n.channel.id)!=null?a:"0",`<${g}>`);return}else return{content:`<${g}>`}}},q=[I,M],G={...D,onStart(){this.commands=q},onStop(){this.commands=[]}};b(G);