From 3b0c2047f71ef409ed1a34686d5c45258f86d48b Mon Sep 17 00:00:00 2001 From: HCLonely Date: Sat, 2 Nov 2024 15:14:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=E9=83=A8=E5=88=86=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E9=94=99=E8=AF=AF(#31);=20=E4=BF=AE=E5=A4=8D:Gleam?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=AE=8C=E6=88=90=E5=BC=B9=E7=AA=97=E8=AE=A1?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1(#32)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.json | 2 +- .github/workflows/Release.yml | 8 +++--- dist/auto-task-v4-for-giveawaysu.all.user.js | 4 +-- dist/auto-task-v4-for-giveawaysu.user.js | 4 +-- dist/auto-task-v4.all.user.js | 24 +++++++++++++++--- dist/auto-task-v4.compatibility.all.user.js | 6 ++--- dist/auto-task-v4.compatibility.user.js | 6 ++--- dist/auto-task-v4.user.js | 24 +++++++++++++++--- doc/docs/.vuepress/public/report.html | 11 ++++---- doc/docs/logs/README.md | 7 ++++++ package.json | 5 ++-- .../auto-task-v4-for-giveawaysu.all.user.js | 4 +-- page/dist/auto-task-v4-for-giveawaysu.user.js | 4 +-- page/dist/auto-task-v4.all.user.js | 24 +++++++++++++++--- .../auto-task-v4.compatibility.all.user.js | 6 ++--- page/dist/auto-task-v4.compatibility.user.js | 6 ++--- page/dist/auto-task-v4.user.js | 24 +++++++++++++++--- page/package.json | 5 ++-- src/locales/zh-CN.js | 4 +-- src/scripts/website/Gleam.ts | 25 +++++++++++++++++-- 20 files changed, 150 insertions(+), 53 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index f65faf4..259d82a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -201,7 +201,7 @@ "max-len": [ "error", { - "code": 150 + "code": 200 } ], "block-spacing": "error", diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 5046e42..6812853 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -21,9 +21,11 @@ jobs: uses: softprops/action-gh-release@v1 with: prerelease: false - tag_name: v4.4.12 - name: 4.4.12 - body: '- 修复:Steam社区凭证更新错误(#26)' + tag_name: v4.4.13 + name: 4.4.13 + body: |- + - 修复:部分文本错误(#31) + - 修复:Gleam无法完成弹窗计时任务(#32) files: |- dist/auto-task-v4-for-giveawaysu.user.js dist/auto-task-v4.compatibility.user.js diff --git a/dist/auto-task-v4-for-giveawaysu.all.user.js b/dist/auto-task-v4-for-giveawaysu.all.user.js index 8369ad7..9f4da40 100644 --- a/dist/auto-task-v4-for-giveawaysu.all.user.js +++ b/dist/auto-task-v4-for-giveawaysu.all.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name auto-task-v4-for-giveawaysu // @namespace auto-task-v4-for-giveawaysu -// @version 4.4.12 +// @version 4.4.13 // @description 赠Key站自动任务 // @author HCLonely // @license MIT @@ -112,4 +112,4 @@ console.log('%c%s', 'color:blue', 'Auto Task GS特供脚本开始加载'); `+error.stack)}let httpRequest_httpRequest=async(options,times=0)=>{window.TRACE&&console.trace("%cAuto-Task[Debug]:","color:blue");try{var result=await new Promise(resolve=>{options.dataType&&(options.responseType=options.dataType);var requestObj={timeout:3e4,ontimeout(data){resolve({result:"Error",statusText:"Timeout",status:601,data:data,options:options})},onabort(data){resolve({result:"Error",statusText:"Aborted",status:602,data:data,options:options})},onerror(data){resolve({result:"Error",statusText:"Error",status:603,data:data,options:options})},onload(data){if("json"===options.responseType&&data?.response&&"object"!=typeof data.response)try{data.response=JSON.parse(data.responseText)}catch(error){}resolve({result:"Success",statusText:"Load",status:600,data:data,options:options})},...options};GM_xmlhttpRequest(requestObj)});return window.DEBUG&&console.log("%cAuto-Task[httpRequest]:","color:blue",JSON.stringify(result)),600!==result.status&×<2?await httpRequest_httpRequest(options,times+1):result}catch(error){return console.log("%cAuto-Task[httpRequest]:","color:red",JSON.stringify({errorMsg:error,options:options})),throwError_throwError(error,"httpRequest"),{result:"JsError",statusText:"Error",status:604,error:error,options:options}}},tools_httpRequest=httpRequest_httpRequest,scripts_echoLog=({type,text,html,id})=>{let emptyStatus={success:()=>emptyStatus,error:()=>emptyStatus,warning:()=>emptyStatus,info:()=>emptyStatus,view:()=>emptyStatus};try{let ele;if(type)switch(type){case"joiningSteamGroup":case"leavingSteamGroup":case"gettingSteamGroupId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"joiningSteamOfficialGroup":case"leavingSteamOfficialGroup":case"gettingSteamOfficialGroupId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"subscribingForum":case"unsubscribingForum":case"gettingForumId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"followingCurator":case"unfollowingCurator":case"gettingCuratorId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"addingToWishlist":case"removingFromWishlist":case"followingGame":case"unfollowingGame":case"gettingSubid":case"addingFreeLicense":case"requestingPlayTestAccess":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"addingFreeLicenseSubid":ele=$(`
  • ${i18n("addingFreeLicense")}[${text}]...
  • `);break;case"favoritingWorkshop":case"unfavoritingWorkshop":case"gettingWorkshopAppId":case"votingUpWorkshop":ele=$(`
  • ${i18n(type)}[ ${text}]...
  • `);break;case"gettingAnnouncementParams":case"likingAnnouncement":ele=$(`
  • ${i18n(type)}[ ${id}]...
  • `);break;case"joiningDiscordServer":case"gettingDiscordGuild":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"leavingDiscordServer":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"updateDiscordAuth":ele=$(`
  • ${i18n("updateDiscordAuth")}
  • `);break;case"followingTwitchChannel":case"unfollowingTwitchChannel":case"gettingTwitchChannelId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingInsUserId":case"followingIns":case"unfollowingIns":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingTwitterUserId":case"followingTwitterUser":case"unfollowingTwitterUser":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"retweetting":case"unretweetting":ele=$(`
  • ${i18n(type)}${text}...
  • `);break;case"joiningReddit":case"leavingReddit":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"followingRedditUser":case"unfollowingRedditUser":ele=$(`
  • ${i18n(type)}[ - ${text?.replace("u_","")}]...
  • `);break;case"followingYtbChannel":case"unfollowingYtbChannel":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"likingYtbVideo":case"unlikingYtbVideo":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingVkId":case"joiningVkGroup":case"leavingVkGroup":case"joiningVkPublic":case"leavingVkPublic":case"sendingVkWall":case"deletingVkWall":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"visitingLink":ele=$(`
  • ${i18n("visitingLink")}[${text}]...
  • `);break;case"verifyingInsAuth":case"text":ele=$(`
  • ${i18n(text)}
  • `);break;case"html":ele=$(text||html);break;case"whiteList":ele=$(`
  • ${i18n("skipTask")}[${text}(${id})](${i18n("whiteList")})
  • `);break;case"globalOptionsSkip":ele=$(`
  • ${i18n("skipTaskOption")}${text}
  • `);break;default:ele=$(`
  • ${i18n("unKnown")}:${type}(${text})...
  • `)}else ele=text?$(`
  • ${i18n(text)}
  • `):html?$(html):$("
  • ");return ele.addClass("card-text"),$("#auto-task-info").append(ele),ele[0]?.scrollIntoView(),{font:ele.find("font"),success(text="Success",html=!1){return this.font?.attr("class","").addClass("success"),html?this.font?.html(text):this.font?.text(text),this},error(text="Error",html=!1){return this.font?.attr("class","").addClass("error"),html?this.font?.html(text):this.font?.text(text),this},warning(text="Warning",html=!1){return this.font?.attr("class","").addClass("warning"),html?this.font?.html(text):this.font?.text(text),this},info(text="Info",html=!1){return this.font?.attr("class","").addClass("info"),html?this.font?.html(text):this.font?.text(text),this},view(){return this.font?.[0].scrollIntoView(),this}}}catch(error){return throwError_throwError(error,"echoLog"),emptyStatus}},unique=array=>{try{return[...new Set(array)]}catch(error){return throwError_throwError(error,"unique"),[]}},delay=(time=1e3)=>new Promise(resolve=>{setTimeout(()=>{resolve(!0)},time)}),defaultGlobalOptions={doTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0,workshopVotes:!0,announcements:!0,licenses:!0,playtests:!0}},undoTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0}},ASF:{AsfEnabled:!1,AsfIpcUrl:"",AsfIpcPassword:"",AsfBotname:"asf"},position:{buttonSideX:"right",buttonSideY:"top",buttonDistance:"15,30",showButtonSideX:"right",showButtonSideY:"top",showButtonDistance:"15,30",logSideX:"right",logSideY:"bottom",logDistance:"10,10"},hotKey:{doTaskKey:"alt + d",undoTaskKey:"alt + u",toggleLogKey:"alt + l"},other:{twitterVerifyId:"783214",youtubeVerifyChannel:"UCrXUsMBcfTVqwAS7DKg9C0Q",autoUpdateSource:"jsdelivr",language:"zh",checkLogin:!0,checkLeftKey:!0,defaultShowButton:!0,defaultShowLog:!0,debug:!1,receivePreview:!0}},assignObject=(external_Swal_namespaceObject=GM_getValue("globalOptions")||{},(obj1,obj2)=>{try{var key,value,newObj={};for([key,value]of Object.entries(obj1))"[object Object]"===Object.prototype.toString.call(value)&&"[object Object]"===Object.prototype.toString.call(obj2[key])?newObj[key]=assignObject(value,obj2[key]):newObj[key]=obj2[key]??value;return newObj}catch(error){return throwError_throwError(error,"assignObject"),defaultGlobalOptions}}),globalOptions=assignObject(defaultGlobalOptions,external_Swal_namespaceObject),languages={zh:{website:"网站",type:"类型",edit:"编辑",whiteList:"白名单",skipTask:"跳过撤销任务",whiteListOptions:"白名单设置",changeWhiteListOption:"设置白名单(%0)",whiteListNotFound:"找不到此项白名单: %0",changeWhiteListSuccess:"白名单修改成功,刷新生效!",changeWebsiteOptions:"网站设置",changeGlobalOptions:"全局设置",ok:"是",save:"保存",close:"关闭",return:"返回",option:"选项",value:"值",websiteOptions:"当前网站设置",changeWebsiteOptionsSuccess:"更改当前网站设置成功,刷新生效!",changeGlobalOptionsSuccess:"更改全局设置成功,刷新生效!",needLogin:"请先登录!",getTasksInfo:"正在获取并处理任务信息...",gettingKey:"正在获取Key...",verifyingTask:"正在验证任务",notice:"自动任务脚本提醒",noKeysLeft:"此页面已经没有剩余key了,是否关闭?",giveawayEnded:"此活动已结束,是否关闭?",giveawayNotWork:"此活动因某些原因(已结束/暂停/未开始...)不可用(如果是脚本误判请及时反馈),是否关闭?",confirm:"确定",cancel:"取消",unKnown:"未知",unKnownTaskType:"未识别的任务",doing:"正在做任务",allTasksComplete:"所有任务已完成!",getTaskIdFailed:"获取任务Id失败!",initSuccess:"%0 初始化成功!",initFailed:"%0 初始化失败!",errorLink:"链接错误: %0",needInit:"请先初始化",verifyingAuth:"正在验证%0凭证...",updatingAuth:"正在更新%0凭证...",refreshingToken:"正在刷新%0凭证...",settingToken:"正在设置%0凭证...",initing:"正在初始化...",getFailed:"获取%0失败!",checkLoginFailed:"检测登录状态失败!",checkLeftKeyFailed:"检测剩余Key失败!",userId:"用户Id",joiningGiveaway:"正在加入赠Key",needJoinGiveaway:"需要先加入赠Key",cannotUndo:"此网站不支持取消任务",verifyAuth:"正在验证 %0 凭证...",closePageNotice:"如果此页面没有自动关闭,请自行关闭本页面。",errorReport:"检测到脚本报错,是否前往反馈BUG?",visitingLink:"正在访问链接: ",doTask:"做任务",undoTask:"撤销任务",verifyTask:"验证任务",getKey:"获取Key",selectAll:"全选",selectNone:"全不选",invertSelect:"反选",doFreeTask:"加入免费赠品",doPointTask:"加入点数赠品",skipTaskOption:"设置中已配置跳过任务",other:"其他",globalOptions:"全局设置",checkLogin:"登录检测
    需要登录的网站自动登录,部分本网站支持",checkLeftKey:"剩余Key检测
    赠Key活动结束提示是否关闭,部分本网站支持",twitterVerifyId:"通过尝试关注该账号验证Twitter凭证
    默认为Twitter官方帐号 783214
    不想关注官方账号可以改为自己的帐号",youtubeVerifyChannel:"通过尝试订阅该频道验证YouTube凭证
    默认为YouTube官方频道 UCrXUsMBcfTVqwAS7DKg9C0Q
    不想关注官方频道可以改为自己的频道",autoUpdateSource:"更新源
    github: 需代理,实时更新
    jsdelivr: 可不用代理,更新有延迟
    standby: 备用
    auto: 依次使用github, jsdelivr, standby源进行尝试更新",saveGlobalOptions:"保存全局设置",settingPage:"设置页面",name:"名称",version:"版本",scriptManager:"脚本管理器",script:"脚本",environment:"环境",os:"系统",browser:"浏览器",getId:"获取 %0 id",getTwitterUserId:"获取Twitter用户id(获取id功能仅在设置页面可用)",getYoutubeChannelId:"获取Youtube频道id(获取id功能仅在设置页面可用)",showButton:"显示按钮",hideButton:"隐藏按钮",showLog:"显示日志",hideLog:"隐藏日志",defaultShowButton:"默认显示按钮",defaultShowLog:"默认显示日志",debug:"输出调试日志,不要开启此选项!",receivePreview:"接收预览版更新",position:"组件位置",buttonSideX:"按钮区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",buttonSideY:"按钮区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",buttonDistance:"按钮区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",showButtonSideX:"显示按钮水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",showButtonSideY:"显示按钮垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",showButtonDistance:"显示按钮距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",logSideX:"日志区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",logSideY:"日志区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",logDistance:"日志区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",hotKey:"快捷键",doTaskKey:"做任务快捷键
    (实时预览功能仅在设置页面可用)",undoTaskKey:"撤销任务快捷键
    (实时预览功能仅在设置页面可用)",toggleLogKey:"显示/隐藏日志快捷键
    (实时预览功能仅在设置页面可用)",tasksHistory:"任务历史",clearHistory:"清空历史",clearHistoryFinished:"已清空任务历史!",deleteTask:"删除任务",lastChangeTime:"最后一次修改时间",clearTaskFinished:"删除以下任务完成!",clearTaskFailed:"删除任务失败,没有找到任务名!",syncData:"数据同步",settingData:"正在上传数据...",gettingData:"正在获取数据...",help:"帮助",fileName:"文件名",upload2gist:"同步到Gist",downloadFromGist:"从Gist同步",saveAndTest:"保存配置并测试",testSuccess:"测试成功!",testFailed:"测试失败!",saveAndTestNotice:"请先保存配置并测试!",processingData:"正在处理数据...",updatingData:"正在上传数据...",syncDataSuccess:"同步数据成功!",syncDataFailed:"同步数据失败,请在控制台查看错误信息!",downloadingData:"正在下载数据...",checkedNoData:"没有检测到远程数据,请确认配置是否正确!",savingData:"正在保存数据...",syncHistory:"同步任务历史",checkUpdateFailed:"检测更新失败",newVersionNotice:'检测到新版本V%0, 点此更新',language:"语言
    目前仅支持zh: 中文, en: 英文",gistOptions:"Gist 设置",swalNotice:"检测到您第一次安装V4版本脚本,请前往阅读用前必读内容!",echoNotice:'检测到您第一次安装V4版本脚本,请点此前往阅读用前必读内容!',noticeLink:"https://auto-task-doc.js.org/guide/#用前必读",toGithub:"前往Github反馈",toKeylol:"前往其乐论坛反馈",copySuccess:"错误信息已复制到剪切板,是否前往其乐论坛反馈?",copyFailed:"请复制下方错误信息后前往Keylol论坛反馈!",updateText:"%0 版本更新内容:",Active:"进行中",Ended:"已结束",Banned:"已封禁",Paused:"已暂停",notStart:"未开始",noRemoteData:"检测到远程无数据",errorRemoteDataFormat:"远程数据格式错误",updateHistory:'历史更新记录点此查看',AsfEnabled:'使用ASF做Steam相关任务(需ASFEnhance插件)',AsfIpcUrl:"ASF IPC 地址",AsfIpcPassword:"ASF IPC 密码",versionNotMatched:"脚本管理器版本过低,需TamperMonkey >= 5.2.0或TamperMonkey Beta >= 5.2.6196",groups:"组",officialGroups:"官方组",wishlists:"愿望单",follows:"游戏关注",forums:"论坛",workshops:"创意工坊收藏",curators:"鉴赏家",workshopVotes:"创意工坊点赞",announcements:"社区通知",steamCommunity:"Steam社区",steamStore:"Steam商店",licenses:"入库免费游戏",playtests:"请求访问权限",needLoginSteamStore:'请先登录Steam商店',needLoginSteamCommunity:'请先登录Steam社区',joiningSteamGroup:"正在加入Steam组",leavingSteamGroup:"正在退出Steam组",gettingSteamGroupId:"正在获取Steam组Id",joiningSteamOfficialGroup:"正在加入Steam官方组",leavingSteamOfficialGroup:"正在退出Steam官方组",gettingSteamOfficialGroupId:"正在获取Steam官方组Id",subscribingForum:"正在订阅Steam论坛",unsubscribingForum:"正在取消订阅Steam论坛",gettingForumId:"正在获取Steam论坛Id",followingCurator:"正在关注Steam鉴赏家",unfollowingCurator:"正在取关Steam鉴赏家",gettingCuratorId:"正在获取Steam鉴赏家Id",addingToWishlist:"正在添加游戏到Steam愿望单",removingFromWishlist:"正在从Steam愿望单移除游戏",followingGame:"正在关注Steam游戏",unfollowingGame:"正在取关Steam游戏",favoritingWorkshop:"正在收藏Steam创意工坊物品",unfavoritingWorkshop:"正在取消收藏Steam创意工坊物品",gettingWorkshopAppId:"正在获取Steam创意工坊物品Id",votingUpWorkshop:"正在点赞Steam创意工坊物品",gettingAnnouncementParams:"正在获取Steam通知信息",likingAnnouncement:"正在点赞Steam通知",changingArea:"正在更换Steam地区: %0...",notNeededChangeArea:"当前地区不需要更换",noAnotherArea:"请检测是否开启正确开启代理",gettingAreaInfo:"正在获取Steam地区信息...",changeAreaNotice:"疑似锁区游戏,尝试换区执行",steamFinishNotice:"Steam任务完成,尝试将购物车地区换回CN",gettingSubid:"正在获取游戏subid",addingFreeLicense:"正在入库",missParams:"缺少参数",gettingLicenses:"正在获取Licenses...",requestingPlayTestAccess:"正在请求访问权限",tryChangeAreaNotice:"此功能无法检测游戏是否限区,因此会尝试换区后再入库,换区失败也不影响后续入库",gettingUserLink:"正在获取Steam用户社区链接...",retry:"重试",initingASF:"正在初始化ASF...",servers:"服务器",joiningDiscordServer:"正在加入Discord服务器",leavingDiscordServer:"正在退出Discord服务器",gettingDiscordGuild:"正在获取Discord服务器Id",getDiscordAuthFailed:"获取Discord凭证失败,请检测Discord帐号是否已登录",discordImportantNotice:"重要提醒!!!",discordImportantNoticeText:"由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!",continue:"继续",skipDiscordTask:"跳过Discord任务",continueAndDontRemindAgain:"继续且不再提醒",users:"用户",loginIns:'请先登录Instagram',insBanned:"您的Instagram账户已被封禁",verifyingInsAuth:"正在验证Instagram凭证...",gettingInsUserId:"正在获取Instagram用户Id",followingIns:"正在关注Instagram用户",unfollowingIns:"正在取关Instagram用户",reddits:"社区/用户",loginReddit:'请先登录Reddit',changingRedditVersion:"正在切换Reddit为新版页面...",joiningReddit:"正在加入Reddit社区",leavingReddit:"正在退出Reddit社区",followingRedditUser:"正在关注Reddit用户",unfollowingRedditUser:"正在取关Reddit用户",channels:"频道",followingTwitchChannel:"正在关注Twitch频道",unfollowingTwitchChannel:"正在取关Twitch频道",gettingTwitchChannelId:"正在获取Twitch频道Id",checkingTwitchIntegrity:"正在检查Twitch完整性...",twitterUser:"推特用户",retweets:"转推",gettingTwitterUserId:"正在获取推特用户Id",followingTwitterUser:"正在关注推特用户",unfollowingTwitterUser:"正在取关推特用户",retweetting:"正在转推",unretweetting:"正在撤销转推",names:"组/社区/动态",loginVk:'请先登录Vk',gettingVkId:"正在获取Vk任务Id",joiningVkGroup:"正在加入Vk组",leavingVkGroup:"正在退出Vk组",joiningVkPublic:"正在加入Vk社区",leavingVkPublic:"正在退出Vk社区",sendingVkWall:"正在转发Vk动态",deletingVkWall:"正在撤销转发Vk动态",youtubeChannel:"YouTube频道",likes:"点赞",loginYtb:'请先登录YouTube',tryUpdateYtbAuth:'请尝试更新YouTube凭证',gettingYtbToken:"正在获取YouTube Token...",followingYtbChannel:"正在订阅YouTube频道",unfollowingYtbChannel:"正在退订YouTube频道",likingYtbVideo:"正在点赞YouTube视频",unlikingYtbVideo:"正在取消点赞YouTube视频",giveKeyNoticeBefore:"每次验证间隔15s",giveKeyNoticeAfter:'如果没有key, 请在https://givekey.ru/profile查看',noPoints:"点数不够,跳过抽奖",getNeedPointsFailed:"获取所需点数失败,跳过抽奖",joiningLottery:"正在加入抽奖",doingGleamTask:"正在做Gleam任务...",gettingGleamLink:"正在获取Gleam任务链接...",gleamTaskNotice:"如果此页面长时间未关闭,请完成任一任务后自行关闭!",verifiedGleamTasks:"已尝试验证所有任务,验证失败的任务请尝试手动验证或完成!",campaign:"检测到人机验证,请完成验证后重新验证任务!",gsNotice:'为避免得到"0000-0000-0000"key, 已自动屏蔽"Grab Key"按钮,获取key时请关闭脚本!',giveeClubVerifyNotice:"正在验证任务...",giveeClubVerifyFinished:"请等待验证完成后自行加入赠Key",doingKeyhubTask:"正在做Keyhub任务...",SweepWidgetNotice:"正在处理并验证任务,每次验证任务有1~3s间隔防止触发验证过快警告...",tasksNotCompleted:"任务未完成",confirmingTask:"正在跳过警告页面..."},en:{website:"Website",type:"Type",edit:"Edit",whiteList:"Whitelist",skipTask:"Skip undo task",whiteListOptions:"Whitelist options",changeWhiteListOption:"Whitelist option(%0)",whiteListNotFound:"Cannot find this whitelist: %0",changeWhiteListSuccess:"The whitelist is successfully modified, and the page refresh will take effect!",changeWebsiteOptions:"Website options",changeGlobalOptions:"Global options",ok:"OK",save:"Save",close:"Close",return:"Return",option:"Option",value:"Value",websiteOptions:"Current website settings",changeWebsiteOptionsSuccess:"The current website setting is changed successfully, and the page refresh will take effect!",changeGlobalOptionsSuccess:"The global setting is changed successfully, and the refresh will take effect!",needLogin:"Please log in first!",getTasksInfo:"Obtaining and processing task information...",gettingKey:"Getting Key...",verifyingTask:"Verifying task",notice:"Automatic task script notice",noKeysLeft:"There are no more keys left on this page. Do you want to close it?",giveawayEnded:"This event has ended, do you want to close it?",giveawayNotWork:"This activity is unavailable for some reasons (banned/ended/paused/not started...) (if it is a script misjudgment, please give us feedback in time), is it closed?",confirm:"Confirm",cancel:"Cancel",unKnown:"Unknown",unKnownTaskType:"Unrecognized task",doing:"Doing a task",allTasksComplete:"All tasks have been completed!",getTaskIdFailed:"Failed to obtain task Id!",initSuccess:"%0 was initialized successfully!",initFailed:"%0 initialization failed!",errorLink:"Link error: %0",needInit:"Please initialize first",verifyingAuth:"Verifying %0 token...",updatingAuth:"Update %0 token...",initing:"Initializing...",getFailed:"Failed to get %0!",checkLoginFailed:"Failed to detect login status!",checkLeftKeyFailed:"Failed to detect the remaining keys!",userId:"User Id",joiningGiveaway:"Joining giveaway",needJoinGiveaway:"Need to join the giveaway first",cannotUndo:"This website does not support canceling tasks",verifyAuth:"Verifying %0 token...",closePageNotice:"f this page does not close automatically, please close this page yourself.",errorReport:"A script error is detected, do you want to report the BUG?",visitingLink:"Visiting link: ",doTask:"DoTask",undoTask:"UndoTask",verifyTask:"Verify",getKey:"GetKey",selectAll:"SelectAll",selectNone:"SelectNone",invertSelect:"InvertSelect",doFreeTask:"FreeTask",doPointTask:"PointTask",skipTaskOption:"Skip task has been configured in the settings",other:"Other",globalOptions:"Global Options",checkLogin:"Login detection
    Need to log in to the website automatically log in, part of this website supports.",checkLeftKey:"Key remaining detection
    The end of the giveaway event prompts whether to close or not, part of this website supports.",twitterVerifyId:"Verify Twitter token by trying to follow the account.
    The default is the official Twitter account 783214.
    If you don't want to follow the official account, you can change it to your own account.",youtubeVerifyChannel:"Verify YouTube token by trying to subscribe to the channel.
    The default is the official YouTube channel UCrXUsMBcfTVqwAS7DKg9C0Q.
    If you don't want to follow the official channel, you can change it to your own channel.",autoUpdateSource:"The source to update
    github: Fast update.
    jsdelivr: Update is delayed.
    standby: Standby source.
    auto: Try to update using github, jsdelivr, standby sources in turn.",saveGlobalOptions:"SaveSettings",settingPage:"Setting Page",name:"Name",version:"Version",scriptManager:"Script Manager",script:"Script",environment:"Environment",os:"OS",browser:"Browser",getId:"Get %0 id",getTwitterUserId:"Get Twitter user id (Get id function is only available on the settings page).",getYoutubeChannelId:"Get Youtube channel id (Get id function is only available on the settings page).",showButton:"ShowButton",hideButton:"HideButton",showLog:"ShowLog",hideLog:"HideLog",defaultShowButton:"Default display button",defaultShowLog:"Display log by default",debug:"Output debug log, do not enable this option!",receivePreview:"Receive preview updates",position:"Component position",buttonSideX:"Horizontal positioning of the button area (real-time preview function is only available on the setting page).
    left: left | right: right",buttonSideY:"The button area is positioned in the vertical direction (real-time preview function is only available on the settings page).
    top: top | bottom: bottom",buttonDistance:"The distance between the button area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",showButtonSideX:"ShowButton horizontal positioning (real-time preview function is only available on the setting page).
    left: left | right: right",showButtonSideY:"ShowButton vertical positioning (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",showButtonDistance:"The distance between the ShowButton and the edge (real-time preview function is only available on the setting page).
    Format: X distance, Y distance",logSideX:"Horizontal positioning of the log area (real-time preview function is only available on the setting page).
    left: left | right: right",logSideY:"Vertical positioning of the log area (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",logDistance:"The distance between the log area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",hotKey:"Shortcut key",doTaskKey:"DoTask shortcut keys
    (real-time preview function is only available on the settings page).",undoTaskKey:"UndoTask shortcut keys
    (real-time preview function is only available on the settings page).",toggleLogKey:"ShowLog/HideLog shortcut keys
    (real-time preview function is only available on the settings page).",tasksHistory:"TasksHistory",clearHistory:"Clear history",clearHistoryFinished:"The mission history has been cleared!",deleteTask:"Delete task",lastChangeTime:"Last Change Time",clearTaskFinished:"Delete the following tasks completed!",clearTaskFailed:"Failed to delete the task, the task name was not found!",syncData:"DataSync",settingData:"Uploading data...",gettingData:"Getting data...",help:"Help",fileName:"Filename",upload2gist:"Sync to Gist",downloadFromGist:"Sync from Gist",saveAndTest:"Save configuration and test",testSuccess:"Test success!",testFailed:"Test failed!",saveAndTestNotice:"Please save the configuration and test first!",processingData:"Processing data...",updatingData:"Uploading data...",syncDataSuccess:"Synchronized data successfully!",syncDataFailed:"Failed to synchronize data, please check the error message on the console!",downloadingData:"Downloading data...",checkedNoData:"No remote data is detected, please confirm whether the configuration is correct!",savingData:"Saving data...",syncHistory:"Synchronize tasks history",checkUpdateFailed:"Check update failed",newVersionNotice:'Checked a new version V%0, click to update',language:"Language
    Currently only supports zh: Chinese, en: English",gistOptions:"Gist Settings",swalNotice:"It is detected that you are installing the V4 version script for the first time, please go to read the READ ME FIRST content before use!",echoNotice:'It is detected that you are installing the V4 version script for the first time, please click here to read the READ ME FIRST content before use!',noticeLink:"https://auto-task-doc.js.org/en/guide/#read-me-first",toGithub:"Feedback(Github)",toKeylol:"Feedback(Keylol)",copySuccess:"The error message has been copied to the clipboard. Do you want to go to the Keylol forum to give feedback?",copyFailed:"Please copy the error information below and report back to the Keylol forum!",updateText:"Updates in version %0:",Active:"Active",Ended:"Ended",Banned:"Banned",Paused:"Paused",notStart:"notStart",noRemoteData:"No data remotely",errorRemoteDataFormat:"Remote data has wrong format",updateHistory:'Click here to view the historical update record.',AsfEnabled:'Use ASF to do Steam related tasks (requires ASFEnhance plugin)',AsfIpcUrl:"ASF IPC URL",AsfIpcPassword:"ASF IPC Password",groups:"Group",officialGroups:"Official Group",wishlists:"Wishlist",follows:"Follow Game",forums:"Forum",workshops:"Favorite Workshop",curators:"Curator",workshopVotes:"Voteup Workshop",announcements:"Announcement",steamCommunity:"Steam Community",steamStore:"Steam Store",licenses:"Add License",playtests:"Playtest Access",needLoginSteamStore:'Please log in to the Steam Store',needLoginSteamCommunity:'Please log in to the Steam Community',joiningSteamGroup:"Joining Steam Group",leavingSteamGroup:"Leaving Steam Group",gettingSteamGroupId:"Getting Steam Group Id",joiningSteamOfficialGroup:"Joining Steam Official Group",leavingSteamOfficialGroup:"Leaving Steam Official Group",gettingSteamOfficialGroupId:"Getting Steam Official Group Id",subscribingForum:"Subscribing the Steam Forum",unsubscribingForum:"Unsubscribing the Steam Forum",gettingForumId:"Getting Steam Forum Id",followingCurator:"Following Steam Curator",unfollowingCurator:"Unfollowing Steam Curator",gettingCuratorId:"Getting Steam Curator Id",addingToWishlist:"Adding the game to the Steam wishlist",removingFromWishlist:"Removing the game from the Steam wishlist",followingGame:"Following Steam games",unfollowingGame:"Unfollowing Steam games",favoritingWorkshop:"Favouring Steam Workshop Items",unfavoritingWorkshop:"Unfavoriting Steam Workshop Items",gettingWorkshopAppId:"Getting Steam Workshop Item Id",votingUpWorkshop:"Liking Steam workshop items",gettingAnnouncementParams:"Getting Steam announcement information",likingAnnouncement:"Liking Steam announcement",changingArea:"Changing Steam area: %0...",notNeededChangeArea:"The current area does not need to be changed",noAnotherArea:"Please check whether the proxy is turned on correctly",gettingAreaInfo:"Getting Steam area information...",changeAreaNotice:"Suspected of a locked zone game, try to change the zone to execute",steamFinishNotice:"Steam task completed, try to change the shopping cart area back to CN",gettingSubid:"Getting subid",addingFreeLicense:"Adding free license",missParams:"Missing parameters",gettingLicenses:"Getting licenses...",requestingPlayTestAccess:"Requesting play test access",tryChangeAreaNotice:"This function cannot detect whether the game is limited, so it will try to change the area before entering the library. Failure to change the area will not affect the subsequent storage.",versionNotMatched:"The script manager version is too low, requiring TamperMonkey >= 5.2.0 or TamperMonkey Beta >= 5.2.6196",gettingUserLink:"Getting steam user community link...",retry:"Retry",initingASF:"Initing ASF...",servers:"Server",joiningDiscordServer:"Joining Discord Server",leavingDiscordServer:"Leaving Discord Server",gettingDiscordGuild:"Getting Discord server Id",getDiscordAuthFailed:"Failed to get Discord token, please check whether the Discord account is logged in",discordImportantNotice:"Important Reminder! ! !",discordImportantNoticeText:"Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !",continue:"Continue",skipDiscordTask:"Skip",continueAndDontRemindAgain:"Continue without Reminders",users:"User",loginIns:'Please log in to Instagram',insBanned:"Your Instagram account has been banned",verifyingInsAuth:"Verifying Instagram token...",gettingInsUserId:"Getting Instagram user Id",followingIns:"Following Instagram user",unfollowingIns:"Unfollowing Instagram user",reddits:"Reddit/User",loginReddit:'Please log in to Reddit',changingRedditVersion:"Switching Reddit to a new version page...",joiningReddit:"Joining the Reddit",leavingReddit:"Leaving the Reddit",followingRedditUser:"Following Reddit User",unfollowingRedditUser:"Unfollowing Reddit User",channels:"Channel",followingTwitchChannel:"Following Twitch Channel",unfollowingTwitchChannel:"Unfollowing Twitch Channel",gettingTwitchChannelId:"Getting Twitch Channel Id",checkingTwitchIntegrity:"Checking Twitch integrity...",twitterUser:"Twitter User",retweets:"Retweet",gettingTwitterUserId:"Getting Twitter User Id",followingTwitterUser:"Following Twitter User",unfollowingTwitterUser:"Unfollowing Twitter User",retweetting:"Retweetting",unretweetting:"Unretweetting",names:"Group/Public/Wall",loginVk:'Please log in to Vk',gettingVkId:"Getting Vk task Id",joiningVkGroup:"Joining Vk Group",leavingVkGroup:"Leaving Vk Group",joiningVkPublic:"Joining Vk Public",leavingVkPublic:"Leaving Vk Public",sendingVkWall:"Sending Vk Wall",deletingVkWall:"Deleting Vk Wall",youtubeChannel:"YouTube Channel",likes:"Like",loginYtb:'Please log in to YouTube',tryUpdateYtbAuth:'Please try to update YouTube token',gettingYtbToken:"Getting YouTube Token...",followingYtbChannel:"Subscribing to YouTube channel",unfollowingYtbChannel:"Unsubscribing to YouTube channel",likingYtbVideo:"Liking YouTube video",unlikingYtbVideo:"Unliking YouTube video",giveKeyNoticeBefore:"Each verification interval is 15s",giveKeyNoticeAfter:'If there is no key, please check at https://givekey.ru/profile',noPoints:"Not enough points, skip the lottery",getNeedPointsFailed:"ailed to obtain the required points, skip the lottery",joiningLottery:"Joining the lottery",doingGleamTask:"Doing Gleam Task...",gettingGleamLink:"Getting Gleam task link...",gleamTaskNotice:"If this page has not been closed for a long time, please close it yourself after completing any task!",verifiedGleamTasks:"Attempted to verify all tasks. If the verification fails, please try to verify manually or complete it!",campaign:"ReCAPTCHA detected, please complete it and re-verify the tasks!",gsNotice:'In order to avoid getting the "0000-0000-0000" key, the "Grab Key" button has been hidden, please close the script when obtaining the key!',giveeClubVerifyNotice:"Verifying task...",giveeClubVerifyFinished:"Wait for the verification to complete and join it by yourself",doingKeyhubTask:"Doing Keyhub Task...",SweepWidgetNotice:"The task is being processed and verified. There is an interval of 1~3s for each verification task to prevent the triggering of too fast verification warning...",tasksNotCompleted:"Tasks Not Completed",confirmingTask:"Confirming task..."}},language=["zh","en"].includes(globalOptions.other.language)?globalOptions.other.language:"en",i18n=(key,...argvs)=>languages[language]?.[key]?languages[language][key].replace(/%([\d]+)/g,(match,index)=>argvs[parseInt(index,10)]):key;external_Swal_namespaceObject=class{tasks;getRealParams(name,links,doTask,link2param){try{let realParams=[];return 0link2param(link)).filter(link=>link)]),!doTask&&0!!isConfirmed||!!isDenied&&(GM_setValue("dontRemindDiscordAgain",!0),!0)))return this.#initialized=!1,"skip";return GM_getValue("dontRemindDiscordAgain")||"do"===action&&!globalOptions.doTask.discord.servers||"undo"===action&&!globalOptions.undoTask.discord.servers?(this.#initialized=!1,"skip"):!!this.#initialized||(this.#auth.auth?await this.#verifyAuth()||(GM_setValue("discordAuth",{auth:null}),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Discord")),!1):!!await this.#updateAuth()&&(this.#initialized=!0))}catch(error){return throwError_throwError(error,"Discord.init"),!1}}async#verifyAuth(){try{var logStatus=scripts_echoLog({text:i18n("verifyingAuth","Discord")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v6/users/@me",method:"HEAD",headers:{authorization:this.#auth.auth}});return"Success"===result?200===data?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.verifyAuth"),!1}}async#updateAuth(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Discord")});return await new Promise(resolve=>{GM_openInTab("https://discord.com/channels/@me#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{var auth=GM_getValue("discordAuth")?.auth;auth?(this.#auth={auth:auth},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error("Error: Update discord auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Discord.updateAuth"),!1}}async#joinServer(inviteId){try{var guild,logStatus=scripts_echoLog({type:"joiningDiscordServer",text:inviteId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,method:"POST",dataType:"json",headers:{authorization:this.#auth.auth,origin:"https://discord.com",referer:"https://discord.com/invite/"+inviteId}});return"Success"===result&&200===data?.status?(logStatus.success(),(guild=String(data.response?.guild?.id))&&(this.#setCache(inviteId,guild),this.tasks.servers=unique([...this.tasks.servers,inviteId])),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.joinServer"),!1}}async#leaveServer(inviteId){try{if(this.whiteList.servers.includes(inviteId))return scripts_echoLog({type:"whiteList",text:"Discord.leaveServer",id:inviteId}),!0;var guild=await this.#getGuild(inviteId);if(guild){var logStatus=scripts_echoLog({type:"leavingDiscordServer",text:guild}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/users/@me/guilds/"+guild,method:"DELETE",headers:{authorization:this.#auth.auth}});if("Success"===result&&204===data?.status)return logStatus.success(),!0;logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Discord.leaveServer"),!1}}async#getGuild(inviteId){try{var logStatus=scripts_echoLog({type:"gettingDiscordGuild",text:inviteId}),guild=this.#cache[inviteId];if(guild)return logStatus.success(),guild;var{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,responseType:"json",method:"GET"});if("Success"!==result||200!==data?.status)return logStatus.error(result+`:${statusText}(${status})`),!1;{let guild=data.response?.guild?.id;return guild?(logStatus.success(),this.#setCache(inviteId,guild),guild):(logStatus.error(result+`:${statusText}(${status})`),!1)}}catch(error){return throwError_throwError(error,"Discord.getGuild"),!1}}async toggle({doTask=!0,serverLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.discord.servers||!doTask&&!globalOptions.undoTask.discord.servers)scripts_echoLog({type:"globalOptionsSkip",text:"discord.servers"});else{var realServers=this.getRealParams("servers",serverLinks,doTask,link=>link.match(/invite\/(.+)/)?.[1]);if(0!0)}catch(error){return throwError_throwError(error,"Discord.toggleServers"),!1}}#setCache(inviteId,guild){try{this.#cache[inviteId]=guild,GM_setValue("discordCache",this.#cache)}catch(error){throwError_throwError(error,"Discord.setCache")}}}let social_Discord=Discord;class Instagram extends external_Swal_namespaceObject{tasks;whiteList;#cache=GM_getValue("instagramCache")||{};#auth={};#initialized=!1;constructor(){super();var defaultTasksTemplate={users:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.instagram||{}}}async init(){try{return this.#initialized?!0:await this.#getUserInfo()?(scripts_echoLog({}).success(i18n("initSuccess","Instagram")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Instagram")),!1)}catch(error){return throwError_throwError(error,"Instagram.init"),!1}}async#getUserInfo(name="instagram"){try{var logStatus=scripts_echoLog({type:"instagram"===name?"verifyingInsAuth":"gettingInsUserId",text:name}),userId=this.#cache[name];if(userId&&"instagram"!==name)return logStatus.success(),userId;var csrftoken,hash,id,{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/${name}/`,method:"GET"});if("Success"===result)if(data?.finalUrl.includes("accounts/login"))logStatus.error("Error:"+i18n("loginIns"),!0);else if(data?.finalUrl.includes("www.instagram.com/challenge"))logStatus.error("Error:"+i18n("insBanned"));else{if(200===data?.status)return csrftoken=data.responseText.match(/"csrf_token":"(.+?)"/)?.[1],hash=data.responseText.match(/"rollout_hash":"(.+?)"/)?.[1],"instagram"===name?!(!csrftoken||!hash||(this.#auth={csrftoken:csrftoken,hash:hash},0)):(id=data.responseText.match(/"profilePage_([\d]+?)"/)?.[1])?(this.#setCache(name,id),logStatus.success(),id):(logStatus.error("Error: Get ins data error!"),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Instagram.getUserInfo"),!1}}async#followUser(name){try{var id=await this.#getUserInfo(name);if(id){var logStatus=scripts_echoLog({type:"followingIns",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/web/friendships/${id}/follow/`,method:"POST",dataType:"json",headers:{"x-csrftoken":this.#auth.csrftoken,origin:"https://www.instagram.com",referer:`https://www.instagram.com/${name}/`,"content-type":"application/x-www-form-urlencoded","sec-fetch-site":"same-origin","x-instagram-ajax":this.#auth.hash}});if("Success"===result)return 200===data?.status&&"following"===data.response?.result?(logStatus.success(),this.tasks.users=unique([...this.tasks.users,name]),!0):(logStatus.error("Error:"+(data?.response?.feedback_message||`${data?.statusText}(${data?.status})`)),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Instagram.followUser"),!1}}async#unfollowUser(name){try{if(this.whiteList.users.includes(name))return scripts_echoLog({type:"whiteList",text:"Instagram.unfollowUser",id:name}),!0;var id=await this.#getUserInfo(name);if(id){var logStatus=scripts_echoLog({type:"unfollowingIns",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/web/friendships/${id}/unfollow/`,method:"POST",dataType:"json",headers:{"x-csrftoken":this.#auth.csrftoken,origin:"https://www.instagram.com",referer:`https://www.instagram.com/${name}/`,"content-type":"application/x-www-form-urlencoded","sec-fetch-site":"same-origin","x-instagram-ajax":this.#auth.hash}});if("Success"===result)return 200===data?.status&&"ok"===data.response?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Instagram.unfollowUser"),!1}}async toggle({doTask=!0,userLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.instagram.users||!doTask&&!globalOptions.undoTask.instagram.users)scripts_echoLog({type:"globalOptionsSkip",text:"instagram.users"});else{var realUsers=this.getRealParams("users",userLinks,doTask,link=>link.match(/https:\/\/www\.instagram\.com\/(.+)?\//)?.[1]);if(0!0)}catch(error){return throwError_throwError(error,"Instagram.toggleUsers"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("instagramCache",this.#cache)}catch(error){throwError_throwError(error,"Instagram.setCache")}}}let social_Instagram=Instagram;class Reddit extends external_Swal_namespaceObject{tasks;whiteList;#auth;#initialized=!1;constructor(){super();var defaultTasksTemplate={reddits:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.reddit||{}}}async init(){try{return this.#initialized?!0:await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Reddit")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Reddit")),!1)}catch(error){return throwError_throwError(error,"Reddit.init"),!1}}async#useBeta(){try{let logStatus=scripts_echoLog({text:i18n("changingRedditVersion")});return GM_setValue("redditAuth",null),await new Promise(resolve=>{GM_openInTab("https://www.reddit.com/#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{logStatus.success(),resolve(await this.#updateAuth(!0))}})}catch(error){return throwError_throwError(error,"Reddit.useBeta"),!1}}async#updateAuth(beta=!1){try{var accessToken,logStatus=scripts_echoLog({text:i18n("updatingAuth","Reddit")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://www.reddit.com/",method:"GET",nochche:!0,headers:{"Cache-Control":"no-cache"}});if("Success"===result)if(data?.responseText.includes("www.reddit.com/login/"))logStatus.error("Error:"+i18n("loginReddit"),!0);else{if(200===data?.status)return data.responseText.includes("redesign-beta-optin-btn")&&!beta?await this.#useBeta():(accessToken=data.responseText.match(/"accessToken":"(.*?)","expires":"(.*?)"/)?.[1])?(this.#auth={token:accessToken},logStatus.success(),!0):(logStatus.error('Error: Parameter "accessToken" not found!'),!1);logStatus.error(`Error:${data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Reddit.updateAuth"),!1}}async toggleTask({name,doTask=!0}){try{if(!doTask&&this.whiteList.reddits.includes(name))return scripts_echoLog({type:"whiteList",text:"Reddit.undoTask",id:name}),!0;let type=doTask?"joiningReddit":"leavingReddit";/^u_/.test(name)&&(type=doTask?"followingRedditUser":"unfollowingRedditUser");var logStatus=scripts_echoLog({type:type,text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://oauth.reddit.com/api/subscribe?redditWebClient=desktop2x&app=desktop2x-client-production&raw_json=1&gilding_detail=1",method:"POST",headers:{authorization:"Bearer "+this.#auth.token,"content-type":"application/x-www-form-urlencoded"},data:$.param({action:doTask?"sub":"unsub",sr_name:name,api_type:"json"})});return"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.reddits=unique([...this.tasks.reddits,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Reddit.toggleTask"),!1}}async toggle({doTask=!0,redditLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.reddit.reddits||!doTask&&!globalOptions.undoTask.reddit.reddits)scripts_echoLog({type:"globalOptionsSkip",text:"reddit.reddits"});else{var realReddits=this.getRealParams("reddits",redditLinks,doTask,link=>{var name=link.match(/https?:\/\/www\.reddit\.com\/r\/([^/]*)/)?.[1],link=link.match(/https?:\/\/www\.reddit\.com\/user\/([^/]*)/)?.[1];return link?name||link:name});if(0!0)}catch(error){return throwError_throwError(error,"Reddit.toggle"),!1}}}let social_Reddit=Reddit;class Twitch extends external_Swal_namespaceObject{tasks;whiteList;#auth=GM_getValue("twitchAuth")||{};#cache=GM_getValue("twitchCache")||{};#initialized=!1;#integrityToken;constructor(){super();var defaultTasksTemplate={channels:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.twitch||{}}}async init(){try{return this.#initialized?!0:this.#auth.authToken&&this.#auth.clientId&&this.#auth.clientVersion&&this.#auth.deviceId&&this.#auth.clientSessionId?await this.#verifyAuth(!0)||(GM_setValue("twitchAuth",null),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Twitch")),!1):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError_throwError(error,"Twitch.init"),!1}}async#verifyAuth(isFirst){try{var logStatus=scripts_echoLog({text:i18n("verifyingAuth","Twitch")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},data:'[{"operationName":"FrontPageNew_User","variables":{"limit":1},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"64bd07a2cbaca80699d62636d966cf6395a5d14a1f0a14282067dcb28b13eb11"}}}]'});return"Success"===result?200===data?.status&&data.response?.[0]?.data?.currentUser?(await this.#integrity(isFirst),logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Twitch.verifyAuth"),!1}}async#integrity(isFirst=!0,ct=""){try{var result,statusText,status,data,logStatus=scripts_echoLog({text:i18n("checkingTwitchIntegrity")});return!isFirst||this.#auth.authToken&&this.#auth.clientId&&this.#auth.clientVersion&&this.#auth.deviceId&&this.#auth.clientSessionId?({result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/integrity",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId,"Client-Version":this.#auth.clientVersion,"X-Device-Id":this.#auth.deviceId,"Client-Session-Id":this.#auth.clientSessionId,"x-kpsdk-ct":ct}}),"Success"===result?!ct&&data?.responseHeaders?.["x-kpsdk-ct"]?await this.#integrity(isFirst,data.responseHeaders["x-kpsdk-ct"]):200===data?.status&&data.response?.token?(this.#integrityToken=data.response.token,logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)):await this.#updateAuth(!1)}catch(error){return throwError_throwError(error,"Twitch.integrity"),!1}}async#updateAuth(isFirst=!0){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Twitch")});return await new Promise(resolve=>{GM_openInTab("https://www.twitch.tv/#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{var auth=GM_getValue("twitchAuth");auth?(this.#auth=auth,logStatus.success(),resolve(await this.#verifyAuth(isFirst))):(logStatus.error("Error: Update twitch auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Twitch.updateAuth"),!1}}async#toggleChannel({name,doTask=!0}){try{if(!doTask&&this.whiteList.channels.includes(name))return scripts_echoLog({type:"whiteList",text:"Twitch.unfollowChannel",id:name}),!0;var channelId=await this.#getChannelId(name);if(channelId){var logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingTwitchChannel`,text:name}),followData='[{"operationName":"FollowButton_FollowUser","variables":{"input":{"disableNotifications":false,"targetID":"'+channelId+'"}},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"800e7346bdf7e5278a3c1d3f21b2b56e2639928f86815677a7126b093b2fdd08"}}}]',unfollowData=`[{"operationName":"FollowButton_UnfollowUser","variables":{"input":{"targetID":"${channelId}"}},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"f7dae976ebf41c755ae2d758546bfd176b4eeb856656098bb40e0a672ca0d880"}}}]',{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId,"Client-Version":this.#auth.clientVersion,"X-Device-Id":this.#auth.deviceId,"Client-Session-Id":this.#auth.clientSessionId,"Client-Integrity":this.#integrityToken},data:doTask?followData:unfollowData});if("Success"===result)return 200===data?.status&&data.response?.[0]&&!data.response[0].errors?(logStatus.success(),doTask&&(this.tasks.channels=unique([...this.tasks.channels,name])),!0):(logStatus.error("Error:"+(data?.response?.[0].errors?.[0]?.message||`${data?.statusText}(${data?.status})`)),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Twitch.toggleChannel"),!1}}async#getChannelId(name){try{var logStatus=scripts_echoLog({type:"gettingTwitchChannelId",text:name}),channelId=this.#cache[name];if(channelId)return logStatus.success(),channelId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},responseType:"json",data:`[{"operationName":"ActiveWatchParty","variables":{"channelLogin":"${name}"},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"4a8156c97b19e3a36e081cf6d6ddb5dbf9f9b02ae60e4d2ff26ed70aebc80a30"}}}]'});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let channelId=data.response?.[0]?.data?.user?.id;return channelId?(this.#setCache(name,String(channelId)),logStatus.success(),channelId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Twitch.getChannelId"),!1}}async toggle({doTask=!0,channelLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.twitch.channels||!doTask&&!globalOptions.undoTask.twitch.channels)scripts_echoLog({type:"globalOptionsSkip",text:"twitch.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>link.match(/https:\/\/(www\.)?twitch\.tv\/(.+)/)?.[2]);if(0!0)}catch(error){return throwError_throwError(error,"Twitch.toggle"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("twitchCache",this.#cache)}catch(error){throwError_throwError(error,"Twitch.setCache")}}}let social_Twitch=Twitch;class Vk extends external_Swal_namespaceObject{tasks;whiteList;#username="";#cache=GM_getValue("vkCache")||{};#initialized=!1;constructor(){super();var defaultTasksTemplate={names:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.vk||{}}}async init(){try{return this.#initialized?!0:await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Vk")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Vk")),!1)}catch(error){return throwError_throwError(error,"Vk.init"),!1}}async#verifyAuth(){try{var logStatus=scripts_echoLog({text:i18n("verifyAuth","Vk")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/im",method:"GET"});if("Success"===result)if(data?.finalUrl.includes("vk.com/login"))logStatus.error("Error:"+i18n("loginVk"),!0);else{if(200===data?.status)return this.#username=data.responseText.match(/TopNavBtn__profileLink" href="\/(.*?)"/)?.[1]||"",logStatus.success(),!0;logStatus.error(`Error:${data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Vk.verifyAuth"),!1}}async#toggleGroup(name,dataParam,doTask=!0){try{var reqData,result,statusText,status,data,logStatus=scripts_echoLog({type:doTask?"joiningVkGroup":"leavingVkGroup",text:name});return"enter"===dataParam.groupAct&&!doTask||"leave"===dataParam.groupAct&&doTask?(logStatus.success(),!0):(reqData={act:doTask?"enter":"leave",al:1,gid:dataParam.groupId,hash:dataParam.groupHash},{result,statusText,status,data}=(doTask&&(reqData.context="_"),await tools_httpRequest({url:"https://vk.com/al_groups.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param(reqData)})),"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.names=unique([...this.tasks.names,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Vk.toggleGroup"),!1}}async#togglePublic(name,dataParam,doTask=!0){try{var result,statusText,status,data,logStatus=scripts_echoLog({type:doTask?"joiningVkPublic":"leavingVkPublic",text:name});return dataParam.publicJoined&&doTask||!dataParam.publicJoined&&!doTask?(logStatus.success(),!0):({result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/al_public.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:doTask?"a_enter":"a_leave",al:1,pid:dataParam.publicPid,hash:dataParam.publicHash})}),"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.names=unique([...this.tasks.names,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Vk.togglePublic"),!1}}async#sendWall(name){try{var logStatus=scripts_echoLog({type:"sendingVkWall",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/like.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:"publish_box",al:1,object:name})});if("Success"===result)if(200===data?.status){var hash=data.responseText.match(/shHash:[\s]*'(.*?)'/)?.[1];if(hash){var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://vk.com/like.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({Message:"",act:"a_do_publish",al:1,close_comments:0,friends_only:0,from:"box",hash:hash,list:"",mark_as_ads:0,mute_notifications:0,object:name,ret_data:1,to:0})});if("Success"===resultR){if(200===dataR?.status){var postId,ownerId,jsonData=JSON.parse(dataR.responseText?.replace("\x3c!--","")||"{}");if(!0===jsonData?.payload?.[1]?.[1]?.share_my)return logStatus.success(),postId=String(jsonData?.payload?.[1]?.[1]?.post_id),ownerId=String(jsonData?.payload?.[1]?.[1]?.owner_id),postId&&ownerId&&this.#setCache(name,ownerId+"_"+postId),this.tasks.names=unique([...this.tasks.names,name]),!0}logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`)}else logStatus.error(resultR+`:${statusTextR}(${statusR})`)}else logStatus.error('Error: Get "hash" failed')}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Vk.sendWall"),!1}}async#deleteWall(name,dataParams){try{var logStatus=scripts_echoLog({type:"deletingVkWall",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/al_wall.php?act=delete",method:"POST",headers:{origin:"https://vk.com",referer:`https://vk.com/${this.#username}?w=wall${this.#cache[name]}%2Fall`,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:"delete",al:1,confirm:0,from:"wkview",hash:dataParams.wallHash,post:this.#cache[name]})});return"Success"===result?200===data?.status&&JSON.parse(data.responseText?.replace("\x3c!--","")||"{}")?.payload?.[1]?.[1]?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Vk.deleteWall"),!1}}async#getId(name,doTask){try{let url="https://vk.com/"+name;if(/^wall-/.test(name)){if(doTask)return{type:"sendWall"};if(!this.#cache[name])return{type:"unSupport"};url=`https://vk.com/${this.#username}?w=wall`+this.#cache[name]}var logStatus=scripts_echoLog({type:"gettingVkId",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:url,method:"GET"});if("Success"===result)if(200===data?.status){var[,groupAct,groupId,,groupHash]=data.responseText.match(/Groups.(enter|leave)\(.*?,.*?([\d]+?), ('|')(.*?)('|')/)||[],publicHash=data.responseText.match(/"enterHash":"(.*?)"/)?.[1],publicPid=data.responseText.match(/"public_id":([\d]+?),/)?.[1],publicJoined=!data.responseText.includes("Public.subscribe");if(groupAct&&groupId&&groupHash)return logStatus.success(),{groupAct:groupAct,groupId:groupId,groupHash:groupHash,type:"group"};if(publicHash&&publicPid)return logStatus.success(),{publicHash:publicHash,publicPid:publicPid,publicJoined:publicJoined,type:"public"};if(data.responseText.includes("wall.deletePost")&&!doTask){var wallHash=data.responseText.match(/wall\.deletePost\(this, '.*?', '(.*?)'\)/)?.[1];if(wallHash)return logStatus.success(),{type:"deleteWall",wallHash:wallHash}}else if(name.includes("wall")&&doTask)return logStatus.success(),{type:"sendWall"};logStatus.error("Error: Parameters not found!")}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Vk.getId"),!1}}async#toggleVk({name,doTask=!0}){try{if(!doTask&&this.whiteList.names.includes(name))return scripts_echoLog({type:"whiteList",text:"Vk.undoTask",id:name}),!0;var formatName=name.replace(/\/$/,""),data=await this.#getId(formatName,doTask);if(!data)return!1;switch(data.type){case"group":return await this.#toggleGroup(formatName,data,doTask);case"public":return await this.#togglePublic(formatName,data,doTask);case"sendWall":return!doTask||await this.#sendWall(formatName);case"deleteWall":return!!doTask||await this.#deleteWall(formatName,data);default:return!1}}catch(error){return throwError_throwError(error,"Vk.toggleVk"),!1}}async toggle({doTask=!0,nameLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.vk.names||!doTask&&!globalOptions.undoTask.vk.names)scripts_echoLog({type:"globalOptionsSkip",text:"vk.names"});else{var realNames=this.getRealParams("names",nameLinks,doTask,link=>link.match(/https:\/\/vk\.com\/([^/]+)/)?.[1]);if(0!0)}catch(error){return throwError_throwError(error,"Vk.toggle"),!1}}#setCache(name,postId){try{this.#cache[name]=postId,GM_setValue("vkCache",this.#cache)}catch(error){throwError_throwError(error,"Vk.setCache")}}}let social_Vk=Vk;class Youtube extends external_Swal_namespaceObject{tasks;whiteList;#auth=GM_getValue("youtubeAuth")||{};#initialized=!1;#verifyChannel="https://www.youtube.com/channel/"+globalOptions.other.youtubeVerifyChannel;constructor(){super();var defaultTasksTemplate={channels:[],likes:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.youtube||{}}}async init(){try{return this.#initialized?!0:this.#auth.PAPISID?await this.#verifyAuth()||(GM_setValue("youtubeAuth",null),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Youtube")),!1):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError_throwError(error,"Youtube.init"),!1}}async#verifyAuth(){try{return await this.#toggleChannel({link:this.#verifyChannel,doTask:!0,verify:!0})}catch(error){return throwError_throwError(error,"Youtube.verifyAuth"),!1}}async#updateAuth(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Youtube")});return await new Promise(resolve=>{GM_cookie.list({url:"https://www.youtube.com/@YouTube"},async(cookies,error)=>{error?(logStatus.error("Error: Update youtube auth failed!"),resolve(!1)):(error=cookies.find(cookie=>"__Secure-3PAPISID"===cookie.name)?.value)?(GM_setValue("youtubeAuth",{PAPISID:error}),this.#auth={PAPISID:error},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error(i18n("needLogin")),resolve(!1))})})}catch(error){return throwError_throwError(error,"Youtube.updateAuth"),!1}}#getInfo(link,type){return(async(link,type)=>{try{var apiKey,context,client,request,channelId,videoId,likeParams,logStatus=scripts_echoLog({text:i18n("gettingYtbToken")}),{result,statusText,status,data}=await tools_httpRequest({url:link,method:"GET"});return"Success"===result?200===data?.status?data.responseText.includes("accounts.google.com/ServiceLogin?service=youtube")?(logStatus.error("Error:"+i18n("loginYtb"),!0),{needLogin:!0}):(apiKey=data.responseText.match(/"INNERTUBE_API_KEY":"(.*?)"/)?.[1],context=(data.responseText.match(/\(\{"INNERTUBE_CONTEXT":([\w\W]*?)\}\)/)||data.responseText.match(/"INNERTUBE_CONTEXT":([\w\W]*?\}),"INNERTUBE/))?.[1]||"{}",{client,request}=JSON.parse(context),apiKey&&client&&request?(client.hl="en","channel"===type?(channelId=data.responseText.match(/"channelId":"(.+?)"/)?.[1])?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,channelId:channelId}}):(logStatus.error('Error: Get "channelId" failed!'),{}):"likeVideo"===type?(videoId=data.responseText.match(//)?.[1],likeParams=data.responseText.match(/"likeParams":"(.*?)"/)?.[1],videoId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,videoId:videoId,likeParams:likeParams}}):(logStatus.error('Error: Get "videoId" failed!'),{})):(logStatus.error("Error: Unknown type"),{})):(logStatus.error('Error: Parameter "apiKey" not found!'),{})):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),{}):(logStatus.error(result+`:${statusText}(${status})`),{})}catch(error){return throwError_throwError(error,"Youtube.getInfo"),{}}})(link,type)}async#toggleChannel({link,doTask=!0,verify=!1}){try{var{params,needLogin}=await this.#getInfo(link,"channel"),{apiKey,client,request,channelId}=params||{};if(needLogin)scripts_echoLog({html:i18n("loginYtb")});else if(apiKey&&client&&request&&channelId){if(!doTask&&!verify&&this.whiteList.channels.includes(channelId))return scripts_echoLog({type:"whiteList",text:"Youtube.unfollowChannel",id:channelId}),!0;var logStatus=verify?scripts_echoLog({text:i18n("verifyingAuth","Youtube")}):scripts_echoLog({type:doTask?"followingYtbChannel":"unfollowingYtbChannel",text:channelId}),nowTime=parseInt(String((new Date).getTime()/1e3),10),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/subscription/${doTask?"":"un"}subscribe?key=${apiKey}&prettyPrint=false`,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/channel/"+channelId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client?.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify({context:{client:client,request:{sessionId:request?.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},channelIds:[channelId],params:doTask?"EgIIAhgA":"CgIIAhgA"})});if("Success"===result)return 200===data?.status?doTask&&(/"subscribed":true/.test(data.responseText)||data.responseText.includes("The subscription already exists"))||!doTask&&/"subscribed":false/.test(data.responseText)?(logStatus.success(),doTask&&!verify&&(this.tasks.channels=unique([...this.tasks.channels,link])),!0):verify&&data.responseText.includes("You may not subscribe to yourself")?(logStatus.success(),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}else scripts_echoLog({text:'"getYtbToken" failed'});return!1}catch(error){return throwError_throwError(error,"Youtube.toggleChannel"),!1}}async#toggleLikeVideo({link,doTask=!0}){try{var{params,needLogin}=await this.#getInfo(link,"likeVideo"),{apiKey,client,request,videoId,likeParams}=params||{};if(needLogin)scripts_echoLog({html:""+i18n("loginYtb")});else if(apiKey&&client&&request&&videoId&&likeParams){if(!doTask&&this.whiteList.likes.includes(videoId))return scripts_echoLog({type:"whiteList",text:"Youtube.unlikeVideo",id:videoId}),!0;var logStatus=scripts_echoLog({type:doTask?"likingYtbVideo":"unlikingYtbVideo",text:videoId}),nowTime=parseInt(String((new Date).getTime()/1e3),10),likeVideoData={context:{client:client,request:{sessionId:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},target:{videoId:videoId}};if(doTask){if(!likeParams)return logStatus.error("Empty likeParams"),!1;likeVideoData.params=likeParams}var{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/like/${doTask?"":"remove"}like?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/watch?v="+videoId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify(likeVideoData)});if("Success"===result)return 200===data?.status?doTask&&data.responseText.includes("Added to Liked videos")||!doTask&&(data.responseText.includes("Removed from Liked videos")||data.responseText.includes("Dislike removed"))?(logStatus.success(),doTask&&(this.tasks.likes=unique([...this.tasks.likes,link])),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}else scripts_echoLog({text:'"getYtbToken" failed'});return!1}catch(error){return throwError_throwError(error,"Youtube.toggleLikeVideo"),!1}}async toggle({doTask=!0,channelLinks=[],videoLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.youtube.channels||!doTask&&!globalOptions.undoTask.youtube.channels)scripts_echoLog({type:"globalOptionsSkip",text:"youtube.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)?.[1]:link);if(0/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)?.[1]:link);if(0!0)}catch(error){return throwError_throwError(error,"Youtube.toggle"),!1}}}let social_SteamASF=class{#asfOptions;#botName="asf";#groupInfo;async init(){try{var asfCommandsUrl=new URL("/Api/Command/",globalOptions.ASF.AsfIpcUrl),logStatus=(this.#asfOptions={url:asfCommandsUrl.href,method:"POST",responseType:"json",headers:{accept:"application/json","Content-Type":"application/json",Host:asfCommandsUrl.host,Origin:asfCommandsUrl.origin,Referer:asfCommandsUrl.href,Authentication:globalOptions.ASF.AsfIpcPassword}},globalOptions.ASF.AsfBotname&&(this.#botName=globalOptions.ASF.AsfBotname),scripts_echoLog({text:i18n("initingASF")})),{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:'{"Command":"!stats"}'});return"Success"===result?!0===data?.response?.Success&&"OK"===data.response.Message&&data.response.Result?(logStatus.success(),!0):(data?.response?.Result||data?.response?.Message?logStatus.error(data?.response?.Result||data.response.Message):logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.init"),!1}}async joinGroup(groupName){try{var logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!JOINGROUP ${this.#botName} `+groupName})});return"Success"===result?200===data?.status&&["已加入","已申请","Joined","Applied","Присоединился","costs"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.joinGroup"),!1}}async leaveGroup(groupName){try{if(this.#groupInfo||await this.#getGroupId()){var groupId=await this.#groupInfo[groupName];if(groupId){var logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!LEAVEGROUP ${this.#botName} `+groupId})});if("Success"===result)return 200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}return!1}catch(error){return throwError_throwError(error,"SteamASF.leaveGroup"),!1}}async#getGroupId(){try{var logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:"All"}),{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:"!GROUPLIST "+this.#botName})});return"Success"===result?200===data?.status&&data.response?.Result?.includes("|")?(this.#groupInfo=Object.fromEntries(data.response.Result.split("\n").map(line=>{var[,line,id]=line.trim().split("|");return line&&id?[line,id]:null}).filter(ele=>ele)),logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.getGroupID"),!1}}async addToWishlist(gameId){try{var logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!ADDWISHLIST ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.addToWishlist"),!1}}async removeFromWishlist(gameId){try{var logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!REMOVEWISHLIST ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.removeFromWishlist"),!1}}async toggleFollowGame(gameId,doTask){try{var logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!${doTask?"":"UN"}FOLLOWGAME ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.toggleFollowGame"),!1}}async toggleCurator(curatorId,doTask=!0){try{var logStatus=scripts_echoLog({type:doTask?"followingCurator":"unfollowingCurator",text:curatorId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!${doTask?"":"UN"}FOLLOWCURATOR ${this.#botName} `+curatorId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.toggleCurator"),!1}}async addLicense(id){try{var[type,ids]=id.split("-");if("appid"===type){var logStatus=scripts_echoLog({type:"addingFreeLicense",text:ids});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!addlicense ${this.#botName} app/`+ids})});return"Success"===result?200===data?.status&&["AlreadyPurchased","OK"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}if("subid"===type){var idsArr=ids.split(",");let logStatus=scripts_echoLog({type:"addingFreeLicenseSubid",text:ids});var{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!addlicense ${this.#botName} `+idsArr.map(id=>"sub/"+id).join(",")})});if("Success"===result){if(200===data?.status&&data.response?.Result){let resultLines=data.response.Result.split("\n");return idsArr.forEach(subid=>{let targetLine=resultLines.find(text=>text.includes(subid));targetLine&&["成功","Success","Успех"].find(text=>targetLine.includes(text))?scripts_echoLog({}).success(targetLine):scripts_echoLog({}).error(targetLine)}),!0}logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"SteamASF.addLicense"),!1}}async requestPlayTestAccess(id){try{var logStatus=scripts_echoLog({type:"requestingPlayTestAccess",text:id});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!REQUESTACCESS ${this.#botName} `+id})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.requestPlayTestAccess"),!1}}};class Steam extends external_Swal_namespaceObject{tasks;whiteList;#cache={group:{},officialGroup:{},forum:{},workshop:{},curator:{},...GM_getValue("steamCache")};#auth={};#storeInitialized=!1;#communityInitialized=!1;#area="CN";#areaStatus="end";#ASF;constructor(){super();var defaultTasksTemplate={groups:[],officialGroups:[],wishlists:[],follows:[],forums:[],workshops:[],workshopVotes:[],curators:[],curatorLikes:[],announcements:[],licenses:[],playtests:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.steam||{}}}async init(type="all"){try{if(globalOptions.ASF.AsfEnabled&&globalOptions.ASF.AsfIpcUrl&&globalOptions.ASF.AsfIpcPassword)return this.#ASF=new social_SteamASF,!!await this.#ASF.init()&&(this.#storeInitialized=!0,this.#communityInitialized=!0);if("store"===type){if(!this.#storeInitialized){let storeInitialized=await this.#updateStoreAuth();if(storeInitialized=storeInitialized||await this.#updateStoreAuthTab(),this.#storeInitialized=storeInitialized,!this.#storeInitialized)return scripts_echoLog({}).error(i18n("initFailed","Steam")),!1;scripts_echoLog({}).success(i18n("initSuccess","SteamStore"))}}else{if("community"!==type)return this.#storeInitialized&&this.#communityInitialized?(scripts_echoLog({}).success(i18n("initSuccess","Steam")),!0):(scripts_echoLog({}).error(i18n("initFailed","Steam")),!1);if(!this.#communityInitialized){let communityInitialized=await this.#getUserLink();if(communityInitialized||(communityInitialized=await this.#updateCommunityAuthTab(),GM_setValue("steamCommunityAuth",null)),this.#communityInitialized=communityInitialized,!this.#communityInitialized)return scripts_echoLog({}).error(i18n("initFailed","Steam")),!1;scripts_echoLog({}).success(i18n("initSuccess","SteamCommunity"))}}return!0}catch(error){return throwError_throwError(error,"Steam.init"),!1}}async#refreshToken(type="steamStore"){try{var host={steamStore:"store.steampowered.com",steamCommunity:"steamcommunity.com"},logStatus=scripts_echoLog({text:i18n("refreshingToken",i18n(type))}),formData=new FormData,{result,statusText,status,data}=(formData.append("redir",`https://${host[type]}/`),await tools_httpRequest({url:"https://login.steampowered.com/jwt/ajaxrefresh",method:"POST",responseType:"json",headers:{Host:"login.steampowered.com",Origin:"https://"+host[type],Referer:`https://${host[type]}/`},data:formData}));return"Success"===result?data?.response?.success?await this.#setStoreToken(data.response,type)?(logStatus.success(),!0):(logStatus.error("Error"),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.refreshToken"),!1}}async#setStoreToken(param,type){try{var host={steamStore:"store.steampowered.com",steamCommunity:"steamcommunity.com"},logStatus=scripts_echoLog({text:i18n("settingToken",i18n(type))}),formData=new FormData,{result,statusText,status,data}=(formData.append("steamID",param.steamID),formData.append("nonce",param.nonce),formData.append("redir",param.redir),formData.append("auth",param.auth),await tools_httpRequest({url:`https://${host[type]}/login/settoken`,method:"POST",headers:{Accept:"application/json, text/plain, */*",Host:host[type],Origin:"https://"+host[type]},data:formData}));return"Success"===result?200===data?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.setStoreToken"),!1}}async#updateStoreAuth(retry=!1){try{var storeSessionID,logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamStore"))}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"},fetch:!1,redirect:"manual"});return 200===data?.status?data.responseText.includes("data-miniprofile=")?(storeSessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1])?(this.#auth.storeSessionID=storeSessionID,logStatus.success(),!0):(logStatus.error('Error: Get "sessionID" failed'),!1):!await this.#refreshToken("steamStore")||(logStatus.warning(i18n("retry")),retry)?(logStatus.error("Error:"+i18n("needLoginSteamStore"),!0),!1):this.#updateStoreAuth(!0):[301,302].includes(data?.status)?!await this.#refreshToken("steamStore")||(logStatus.warning(i18n("retry")),retry)?(logStatus.error("Error:"+i18n("needLoginSteamStore"),!0),!1):this.#updateStoreAuth(!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.updateStoreAuth"),!1}}async#updateStoreAuthTab(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamStore"))});return await new Promise(resolve=>{let newTab=window.open("https://store.steampowered.com/","mozillaWindow","pop=1;"),listenerId=(GM_setValue("steamStoreAuth","update"),GM_addValueChangeListener("steamStoreAuth",(key,oldValue,newValue,remote)=>{GM_removeValueChangeListener(listenerId),newTab?.close(),newValue&&JSON.stringify(newValue)!==JSON.stringify(oldValue)?(this.#auth.storeSessionID=newValue.storeSessionID,logStatus.success(),resolve(!0)):(logStatus.error("Failed"),resolve(!1))}))})}catch(error){return throwError_throwError(error,"Steam.updateStoreAuthTab"),!1}}async#updateCommunityAuthTab(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamCommunity"))});return await new Promise(resolve=>{let newTab=window.open("https://steamcommunity.com/my","mozillaWindow","pop=1;"),listenerId=(GM_setValue("steamCommunityAuth","update"),GM_addValueChangeListener("steamCommunityAuth",(key,oldValue,newValue,remote)=>{GM_removeValueChangeListener(listenerId),newTab?.close(),newValue&&JSON.stringify(newValue)!==JSON.stringify(oldValue)?(this.#auth.steam64Id=newValue.steam64Id,this.#auth.userName=newValue.userName,this.#auth.communitySessionID=newValue.communitySessionID,logStatus.success(),resolve(!0)):(logStatus.error("Failed"),resolve(!1))}))})}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuthTab"),!1}}async#getUserLink(retry=!1){try{var logStatus=scripts_echoLog({text:i18n("gettingUserLink")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/my",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"},fetch:!1,redirect:"manual"});if(200===data?.status)if(data.finalUrl.includes("https://steamcommunity.com/login/home"))logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0);else{var steam64Id=data.responseText.match(/g_steamID = "(.+?)";/)?.[1],communitySessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1],userName=data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//)?.[1];if(steam64Id&&(this.#auth.steam64Id=steam64Id),userName&&(this.#auth.userName=userName),communitySessionID)return this.#auth.communitySessionID=communitySessionID,logStatus.success(),!0;logStatus.error('Error: Get "sessionID" failed')}else{if(302===data?.status)return!await this.#refreshToken("steamCommunity")||retry?(logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0),!1):(logStatus.warning(i18n("retry")),this.#getUserLink(!0));var location=data?.responseHeaders?.split("\n")?.find(header=>header.includes("location")?header.replace("loctation:","").trim():null);if(301===data?.status&&location?.includes("steamcommunity.com/id"))return logStatus.success(),await this.#updateCommunityAuth(data.finalUrl);301===data?.status&&location?.includes("https://steamcommunity.com/login/home")?logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0):logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuth"),!1}}async#updateCommunityAuth(url){try{var logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamCommunity"))}),{result,statusText,status,data}=await tools_httpRequest({url:url,method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"}});if("Success"===result)if(200===data?.status)if(data.finalUrl.includes("https://steamcommunity.com/login/home"))logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0);else{var steam64Id=data.responseText.match(/g_steamID = "(.+?)";/)?.[1],communitySessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1],userName=data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//)?.[1];if(steam64Id&&(this.#auth.steam64Id=steam64Id),userName&&(this.#auth.userName=userName),communitySessionID)return this.#auth.communitySessionID=communitySessionID,logStatus.success(),!0;logStatus.error('Error: Get "sessionID" failed')}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuth"),!1}}async#getAreaInfo(){try{var logStatus=scripts_echoLog({text:i18n("gettingAreaInfo")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/cart/",method:"GET"});if("Success"===result)if(200===data?.status){var cartConfigRaw=data.responseText.match(/data-cart_config="(.*?)"/)?.[1],temp=document.createElement("div"),cartConfigStr=(temp.innerHTML=cartConfigRaw||"{}",temp.textContent||temp.innerText);let cartConfig;try{cartConfig=JSON.parse(cartConfigStr)}catch(error){return logStatus.error("Error: get country info filed"),console.error(error),{}}if(cartConfig.rgUserCountryOptions){var userInfoRaw=data.responseText.match(/data-userinfo="(.*?)"/)?.[1],temp1=document.createElement("div"),userInfoStr=(temp1.innerHTML=userInfoRaw||"{}",temp1.textContent||temp1.innerText);let userInfo;try{userInfo=JSON.parse(userInfoStr)}catch(error){return logStatus.error("Error: get country info filed"),console.error(error),{}}var currentArea=userInfo.country_code,areas=Object.keys(cartConfig.rgUserCountryOptions).filter(area=>"help"!==area);if(currentArea&&0{let checker=setInterval(()=>{"waiting"!==this.#areaStatus&&(clearInterval(checker),resolve(!0))})}),this.#area===area||!area&&"CN"!==this.#area)return!0;this.#areaStatus="waiting";let aimedArea=area;if(!aimedArea){var{currentArea,areas}=await this.#getAreaInfo();if(!currentArea||!areas)return!(this.#areaStatus="error");if("CN"!==currentArea)return this.#areaStatus="skip",scripts_echoLog({text:"notNeededChangeArea"}),"skip";var anotherArea=areas.filter(area=>area&&"CN"!==area);if(!anotherArea||0===anotherArea.length)return this.#areaStatus="noAnotherArea",scripts_echoLog({text:"noAnotherArea"}),!1;[aimedArea]=anotherArea}var logStatus=scripts_echoLog({text:i18n("changingArea",aimedArea)}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/country/setcountry",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({cc:aimedArea,sessionid:this.#auth.storeSessionID})});if("Success"!==result)return this.#areaStatus="error",logStatus.error(result+`:${statusText}(${status})`),"CN";if(200!==data?.status||"true"!==data.responseText)return this.#areaStatus="error",logStatus.error(`Error:${data?.statusText}(${data?.status})`),"CN";{let currentArea=(await this.#getAreaInfo()).currentArea;return currentArea===aimedArea?(this.#areaStatus="success",logStatus.success(),currentArea):(this.#areaStatus="error",logStatus.error("Error: change country filed"),"CN")}}catch(error){return this.#areaStatus="error",throwError_throwError(error,"Steam.changeArea"),!1}}async#joinGroup(groupName){try{var logStatus,result,statusText,status,data;return this.#ASF?!!await this.#ASF.joinGroup(groupName)&&(this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({action:"join",sessionID:this.#auth.communitySessionID})}),"Success"===result?200!==data?.status||data.responseText.includes("grouppage_join_area")?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.success(),this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.joinGroup"),!1}}async#leaveGroup(groupName){try{if(this.whiteList.groups.includes(groupName))return scripts_echoLog({type:"whiteList",text:"Steam.leaveGroup",id:groupName}),!0;if(this.#ASF)return await this.#ASF.leaveGroup(groupName);var groupId=await this.#getGroupId(groupName);if(groupId){var logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"===result)return 200===data?.status&&data.finalUrl.includes("groups")&&0===$(data.responseText.replace(//g,"").toLowerCase()).find(`a[href='https://steamcommunity.com/groups/${groupName.toLowerCase()}']`).length?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.leaveGroup"),!1}}async#getGroupId(groupName){try{var logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:groupName}),groupId=this.#cache.group[groupName];if(groupId)return logStatus.success(),groupId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let groupId=data.responseText.match(/OpenGroupChat\( '([0-9]+)'/)?.[1];return groupId?(this.#setCache("group",groupName,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async#joinOfficialGroup(gameId){try{var logStatus,result,statusText,status,data,groupId;return this.#ASF?!!await this.#ASF.joinGroup(gameId)&&(this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]),!0):(logStatus=scripts_echoLog({type:"joiningSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/games/${gameId}?action=join&sessionID=`+this.#auth.communitySessionID,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}),"Success"===result?200!==data?.status||data.responseText.includes('id="publicGroupJoin"')?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.success(),this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]),(groupId=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)?.[1])&&this.#setCache("officialGroup",gameId,groupId),!0):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.joinOfficialGroup"),!1}}async#leaveOfficialGroup(gameId){try{if(this.whiteList.officialGroups.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.leaveOfficialGroup",id:gameId}),!0;if(this.#ASF)return await this.#ASF.leaveGroup(gameId);var groupId=await this.#getOfficialGroupId(gameId);if(groupId){var resultR,statusTextR,statusR,dataR,logStatus=scripts_echoLog({type:"leavingSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"===result)return 200===data?.status?({result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}),"Success"===resultR?200===dataR?.status&&dataR.responseText.includes('id="publicGroupJoin"')?(logStatus.success(),!0):(logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.leaveOfficialGroup"),!1}}async#getOfficialGroupId(gameId){try{var logStatus=scripts_echoLog({type:"gettingSteamOfficialGroupId",text:gameId}),groupId=this.#cache.officialGroup[gameId];if(groupId)return logStatus.success(),groupId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let groupId=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)?.[1];return groupId?(this.#setCache("officialGroup",gameId,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async#addToWishlist(gameId){try{if(this.#ASF)return!!await this.#ASF.addToWishlist(gameId)&&(this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0);var logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId}),{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/addtowishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"!==result||200!==data?.status||!0!==data.response?.success){var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==dataR?.status)return logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1;if("CN"===this.#area&&dataR.responseText.includes('id="error_box"'))return logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#addToWishlist(gameId);if((!dataR.responseText.includes('class="queue_actions_ctn"')||!dataR.responseText.includes('class="already_in_library"'))&&(dataR.responseText.includes('class="queue_actions_ctn"')&&dataR.responseText.includes('id="add_to_wishlist_area_success" style="display: none;')||!dataR.responseText.includes('class="queue_actions_ctn"')))return logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1}return logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0}catch(error){return throwError_throwError(error,"Steam.addToWishlist"),!1}}async#removeFromWishlist(gameId){try{if(this.whiteList.wishlists.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.removeFromWishlist",id:gameId}),!0;if(this.#ASF)return await this.#ASF.removeFromWishlist(gameId);var logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId}),{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/removefromwishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===data?.status&&!0===data.response?.success)return logStatus.success(),!0;var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==dataR?.status)return logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1;if("CN"===this.#area&&dataR.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result&&"skip"!==result?await this.#removeFromWishlist(gameId):!1}return dataR.responseText.includes('class="queue_actions_ctn"')&&(dataR.responseText.includes("ds_owned_flag ds_flag")||dataR.responseText.includes("add_to_wishlist_area"))?(logStatus.success(),!0):(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.removeFromWishlist"),!1}}async#toggleFollowGame(gameId,doTask){try{var logStatus,requestData,result,data,followed;return!doTask&&this.whiteList.follows.includes(gameId)?(scripts_echoLog({type:"whiteList",text:"Steam.unfollowGame",id:gameId}),!0):this.#ASF?!!await this.#ASF.toggleFollowGame(gameId,doTask)&&(doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId}),requestData={sessionid:this.#auth.storeSessionID,appid:gameId},{result,data}=(doTask||(requestData.unfollow="1"),await tools_httpRequest({url:"https://store.steampowered.com/explore/followgame/",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param(requestData)})),"Success"===result&&200===data?.status&&"true"===data.responseText?(logStatus.success(),!0):(followed=await this.#isFollowedGame(gameId),"CN"===this.#area&&"areaLocked"===followed?(logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#removeFromWishlist(gameId)):doTask===followed?(logStatus.success(),doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1)))}catch(error){return throwError_throwError(error,"Steam.toggleFollowGame"),!1}}async#isFollowedGame(gameId){try{var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===result?200===data?.status&&("CN"===this.#area&&data.responseText.includes('id="error_box"')?"areaLocked":"none"!==$(data.responseText.replace(//g,"")).find(".queue_control_button.queue_btn_follow>.btnv6_blue_hoverfade.btn_medium.queue_btn_active").css("display")):!1}catch(error){return throwError_throwError(error,"Steam.isFollowedGame"),!1}}async#toggleForum(gameId,doTask=!0){try{if(!doTask&&this.whiteList.forums.includes(gameId))scripts_echoLog({type:"whiteList",text:"Steam.unsubscribeForum",id:gameId});else{var forumId=await this.#getForumId(gameId);if(!forumId)return!1;var logStatus=scripts_echoLog({type:`${doTask?"":"un"}subscribingForum`,text:gameId}),[id,feature]=forumId.split("_"),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/forum/${id}/General/${doTask?"":"un"}subscribe/${feature||"0"}/`,method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.communitySessionID})});"Success"===result?200!==data?.status||1!==data.response?.success&&29!==data.response?.success?logStatus.error(`Error:${data?.statusText}(${data?.status})`):(doTask&&(this.tasks.forums=unique([...this.tasks.forums,gameId])),logStatus.success()):logStatus.error(result+`:${statusText}(${status})`)}return!0}catch(error){return throwError_throwError(error,"Steam.toggleForum"),!0}}async#getForumId(gameId){try{var logStatus=scripts_echoLog({type:"gettingForumId",text:gameId}),forumId=this.#cache.forum[gameId];if(forumId)return logStatus.success(),forumId;var{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/app/${gameId}/discussions/`,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let forumId=data.responseText?.match(/General_([\d]+(_[\d]+)?)/)?.[1];return forumId?(this.#setCache("forum",gameId,forumId),logStatus.success(),forumId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getForumId"),!1}}async#toggleFavoriteWorkshop(id,doTask=!0){try{if(!doTask&&this.whiteList.workshops.includes(id))return scripts_echoLog({type:"whiteList",text:"Steam.unfavoriteWorkshop",id:id}),!0;var appid=await this.#getWorkshopAppId(id);if(appid){var logStatus=scripts_echoLog({type:doTask?"favoritingWorkshop":"unfavoritingWorkshop",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/sharedfiles/${doTask?"":"un"}favorite`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,appid:appid,sessionid:this.#auth.communitySessionID})});if("Success"===result)return 200!==data?.status||data.responseText?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(doTask&&(this.tasks.workshops=unique([...this.tasks.workshops,id])),logStatus.success(),!0);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.toggleFavoriteWorkshop"),!1}}async#getWorkshopAppId(id){try{var logStatus=scripts_echoLog({type:"gettingWorkshopAppId",text:id}),appId=this.#cache.workshop[id];if(appId)return logStatus.success(),appId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/filedetails/?id="+id,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let appId=data.responseText.match(//)?.[1];return appId?(this.#setCache("workshop",id,appId),logStatus.success(),appId):(logStatus.error("Error: getWorkshopAppId failed"),!1)}}catch(error){return throwError_throwError(error,"Steam.getWorkshopAppId"),!1}}async#voteUpWorkshop(id){try{var logStatus=scripts_echoLog({type:"votingUpWorkshop",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/voteup",method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,sessionid:this.#auth.communitySessionID})});return"Success"===result?200===data?.status&&1===data.response?.success?logStatus.success():logStatus.error(`Error:${data?.statusText}(${data?.status})`):logStatus.error(result+`:${statusText}(${status})`),!0}catch(error){return throwError_throwError(error,"Steam.voteupWorkshop"),!0}}async#toggleCurator(curatorId,doTask=!0){try{var logStatus,result,statusText,status,data;return!doTask&&this.whiteList.curators.includes(curatorId)?(scripts_echoLog({type:"whiteList",text:"Steam.unfollowCurator",id:curatorId}),!0):this.#ASF?await this.#ASF.toggleCurator(curatorId,doTask):(logStatus=scripts_echoLog({type:doTask?"followingCurator":"unfollowingCurator",text:curatorId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/curators/ajaxfollow",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({clanid:curatorId,sessionid:this.#auth.storeSessionID,follow:doTask}),dataType:"json"}),"Success"===result?200===data?.status&&1===data.response?.success?.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(`+data?.response?.success||data?.status+")"),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.toggleCurator"),!1}}async getCuratorId(path,name){try{var logStatus=scripts_echoLog({type:"gettingCuratorId",text:path+"/"+name}),curatorId=this.#cache.curator[path+"/"+name];if(curatorId)return logStatus.success(),curatorId;var{result,statusText,status,data}=await tools_httpRequest({url:`https://store.steampowered.com/${path}/`+name,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let curatorId=data.responseText.match(/g_pagingData.*?"clanid":([\d]+)/)?.[1];return curatorId?(this.#setCache("curator",path+"/"+name,curatorId),logStatus.success(),curatorId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getCuratorID"),!1}}async#toggleCuratorLike(link,doTask=!0){try{var curatorId,[path,name]=link.split("/");return path&&name?!!(curatorId=await this.getCuratorId(path,name))&&await this.#toggleCurator(curatorId,doTask):(scripts_echoLog({text:i18n("errorLink",link)}),!1)}catch(error){return throwError_throwError(error,"Steam.toggleCuratorLike"),!1}}async#getAnnouncementParams(appId,viewId){try{var clanid,gid,logStatus=scripts_echoLog({type:"gettingAnnouncementParams",text:appId,id:viewId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://store.steampowered.com/events/ajaxgetpartnerevent?appid=${appId}&announcement_gid=${viewId}&lang_list=6_0&last_modified_time=0&origin=https:%2F%2Fstore.steampowered.com&for_edit=false`,method:"GET",responseType:"json",headers:{Host:"store.steampowered.com",Referer:`https://store.steampowered.com/news/app/${appId}/view/`+viewId}});return"Success"===result?200===data?.status&&1===data?.response?.success?({clanid,gid}=data.response.event?.announcement_body||{},clanid?(logStatus.success(),{clanId:clanid,gid:gid}):(logStatus.error(`Error:${data.statusText}(${data.status})`),{})):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),{}):(logStatus.error(result+`:${statusText}(${status})`),{})}catch(error){return throwError_throwError(error,"Steam.likeAnnouncement"),{}}}async#likeAnnouncement(id){try{var[appId,viewId]=id.split("/");if(appId&&viewId){var{clanId,gid}=await this.#getAnnouncementParams(appId,viewId);if(clanId){var logStatus=scripts_echoLog({type:"likingAnnouncement",text:appId,id:viewId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/updated/ajaxrateupdate/"+(gid||viewId),method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:`https://store.steampowered.com/news/app/${appId}/view/`+viewId},data:$.param({sessionid:this.#auth.storeSessionID,voteup:1,clanid:clanId,ajax:1}),dataType:"json"});if("Success"===result)return 200===data?.status&&1===data.response.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}else scripts_echoLog({}).error(i18n("missParams")+"(id)");return!1}catch(error){return throwError_throwError(error,"Steam.likeAnnouncement"),!1}}async#appid2subid(id){try{var logStatus=scripts_echoLog({type:"gettingSubid",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+id,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;if("CN"===this.#area&&data.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result&&"skip"!==result?await this.#appid2subid(id):!1}var subid=data.responseText.match(/name="subid" value="([\d]+?)"/)?.[1];return subid?(logStatus.success(),subid):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.appid2subid"),!1}}async#getLicenses(){try{var logStatus=scripts_echoLog({text:i18n("gettingLicenses")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/dynamicstore/userdata/?t="+(new Date).getTime(),method:"GET",responseType:"json"});return"Success"===result?200===data?.status?(logStatus.success(),data.response?.rgOwnedPackages):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.getLicenses"),!1}}async#addLicense(id){try{if(this.#ASF)return await this.#ASF.addLicense(id);var[type,ids]=id.split("-");if("appid"===type){var subid=await this.#appid2subid(ids);if(subid){var logStatus=scripts_echoLog({type:"addingFreeLicense",text:ids});if(await this.#addFreeLicense(subid,logStatus)){var{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+ids,method:"GET"});if("Success"===result)return 200===data?.status?data.responseText.includes("ds_owned_flag ds_flag")||data.responseText.includes('class="already_in_library"')?(logStatus.success(),!0):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}return!1}if("subid"!==type)return!1;"CN"===this.#area&&(scripts_echoLog({}).success(i18n("tryChangeAreaNotice")),await this.#changeArea());var logStatusArr={},idsArr=ids.split(",");for(let subid of idsArr){let logStatus=scripts_echoLog({type:"addingFreeLicenseSubid",text:subid});if(!await this.#addFreeLicense(subid,logStatus))return!1;logStatusArr[subid]=logStatus}var licenses=await this.#getLicenses();if(!licenses)return!1;for(let subid of idsArr)licenses.includes(parseInt(subid,10))?logStatusArr[subid].success():logStatusArr[subid].error();return!0}catch(error){return throwError_throwError(error,"Steam.addLicense"),!1}}async#addFreeLicense(id,logStatusPre){try{var logStatus=logStatusPre||scripts_echoLog({type:"addingFreeLicenseSubid",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/checkout/addfreelicense",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/account/licenses/"},data:$.param({action:"add_to_cart",sessionid:this.#auth.storeSessionID,subid:id}),dataType:"json"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;if("CN"===this.#area&&data.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result?await this.#addFreeLicense(id):!1}return logStatus.success(),!0}catch(error){return throwError_throwError(error,"Steam.addFreeLicense"),!1}}async#requestPlayTestAccess(id){try{var logStatus,result,statusText,status,data;return this.#ASF?await this.#ASF.requestPlayTestAccess(id):(logStatus=scripts_echoLog({type:"requestingPlayTestAccess",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/ajaxrequestplaytestaccess/"+id,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/app/"+id},data:$.param({sessionid:this.#auth.storeSessionID}),dataType:"json"}),"Success"===result?200===data?.status&&1===data?.response?.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.requestPlayTestAccess"),!1}}async toggle({doTask=!0,groupLinks=[],officialGroupLinks=[],wishlistLinks=[],followLinks=[],forumLinks=[],workshopLinks=[],workshopVoteLinks=[],curatorLinks=[],curatorLikeLinks=[],announcementLinks=[],licenseLinks=[],playtestLinks=[]}){try{if(0<[...groupLinks,...officialGroupLinks,...forumLinks,...workshopLinks,...workshopVoteLinks].length&&!this.#communityInitialized)return scripts_echoLog({text:i18n("needInit")}),!1;if(0<[...wishlistLinks,...followLinks,...curatorLinks,...curatorLikeLinks,...announcementLinks,...licenseLinks,...playtestLinks].length&&!this.#storeInitialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.steam.groups||!doTask&&!globalOptions.undoTask.steam.groups)scripts_echoLog({type:"globalOptionsSkip",text:"steam.groups"});else{var realGroups=this.getRealParams("groups",groupLinks,doTask,link=>link.match(/groups\/(.+)\/?/)?.[1]);if(0link.match(/games\/(.+)\/?/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/\?id=([\d]+)/)?.[1]);if(0link.match(/\?id=([\d]+)/)?.[1]);if(doTask&&0link.match(/curator\/([\d]+)/)?.[1]),realCuratorLikes=this.getRealParams("curatorLikes",curatorLikeLinks,doTask,link=>link.match(/https?:\/\/store\.steampowered\.com\/(.*?)\/([^/?]+)/)?.slice(1,3).join("/"));if(0(link.includes("store.steampowered.com")?link.match(/store\.steampowered\.com\/news\/app\/([\d]+)\/view\/([\d]+)/):link.match(/steamcommunity\.com\/games\/([\d]+)\/announcements\/detail\/([\d]+)/))?.slice(1,3).join("/"));if(doTask&&0link.match(/app\/([\d]+)/)?.[1]);if(doTask&&globalOptions.doTask.steam.playtests&&0("CN"!==this.#area&&(scripts_echoLog({}).warning(i18n("steamFinishNotice")),await this.#changeArea("CN")),!0))}catch(error){return throwError_throwError(error,"Steam.toggle"),!1}}#setCache(type,name,id){try{this.#cache[type][name]=id,GM_setValue("steamCache",this.#cache)}catch(error){throwError_throwError(error,"Steam.setCache")}}}let social_Steam=Steam;class GiveawaySu{undoneTasks={steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],curatorLikeLinks:[],followLinks:[],forumLinks:[],announcementLinks:[],workshopVoteLinks:[],playtestLinks:[]},discord:{serverLinks:[]},instagram:{userLinks:[]},vk:{nameLinks:[]},twitch:{channelLinks:[]},reddit:{redditLinks:[]},youtube:{channelLinks:[],likeLinks:[]},twitter:{userLinks:[],retweetLinks:[]}};giveawayId;socialInitialized={discord:!1,instagram:!1,reddit:!1,twitch:!1,vk:!1,youtube:!1,steamStore:!1,steamCommunity:!1,twitter:!0};initialized=!1;social={};static test(){return/^https?:\/\/giveaway\.su\/giveaway\/view\/[\d]+/.test(window.location.href)}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){throwError_throwError(error,"Giveawaysu.after")}}init(){try{var logStatus=scripts_echoLog({text:i18n("initing")});return 0<$("a.steam-login").length?(window.open("/steam/redirect","_self"),logStatus.warning(i18n("needLogin")),!1):!!this.#getGiveawayId()&&(this.initialized=!0,logStatus.success(),!0)}catch(error){return throwError_throwError(error,"Giveawaysu.init"),!1}}async#classifyTask(){try{var logStatus=scripts_echoLog({text:i18n("getTasksInfo")}),pro=[],tasks=$("#actions tr");$("div.bind-discord").is(":visible")&&$("div.bind-discord a")[0].click(),$("div.bind-twitch").is(":visible")&&$("div.bind-twitch a")[0].click();for(let task of tasks)pro.push(new Promise(resolve=>{var td=$(task).find('td:not(".hidden")'),colorfulTask=td.eq(1).find('a:not([data-trigger="link"])'),colorlessTask=td.eq(2).find('a:not([data-trigger="link"])'),colorfulTask=0{try{if(!link)return null;let redirectLinksCache=GM_getValue("redirectLinks")||{};return redirectLinksCache[link],await tools_httpRequest({url:link,method:"GET"}).then(({data})=>data?.finalUrl?(redirectLinksCache[link]=data.finalUrl,GM_setValue("redirectLinks",redirectLinksCache),data.finalUrl):null)}catch(error){return throwError_throwError(error,"getRedirectLink"),null}})(colorfulTask.attr("href")).then(taskLink=>{if(!taskLink)return resolve(!1);taskIcon.includes("steam")&&/join/gi.test(taskName)?this.undoneTasks.steam.groupLinks.push(taskLink):/like.*announcement/gi.test(taskName)?this.undoneTasks.steam.announcementLinks.push(taskLink):/(follow|subscribe).*curator/gim.test(taskName)&&/^https?:\/\/store\.steampowered\.com\/curator\//.test(taskLink)?this.undoneTasks.steam.curatorLinks.push(taskLink):taskIcon.includes("steam")&&/follow|subscribe/gim.test(taskName)?this.undoneTasks.steam.curatorLikeLinks.push(taskLink):/subscribe.*steam.*forum/gim.test(taskName)?this.undoneTasks.steam.forumLinks.push(taskLink):taskIcon.includes("thumbs-up")&&/^https?:\/\/steamcommunity\.com\/sharedfiles\/filedetails\/\?id=[\d]+/.test(taskLink)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):taskIcon.includes("plus")&&/request.*playtest/gim.test(taskName)?this.undoneTasks.steam.playtestLinks.push(taskLink):taskIcon.includes("discord")||/join.*discord/gim.test(taskName)?this.undoneTasks.discord.serverLinks.push(taskLink):taskIcon.includes("instagram")||/follow.*instagram/gim.test(taskName)?this.undoneTasks.instagram.userLinks.push(taskLink):taskIcon.includes("twitch")||/follow.*twitch.*channel/gim.test(taskName)?this.undoneTasks.twitch.channelLinks.push(taskLink):taskIcon.includes("reddit")||/subscribe.*subreddit/gim.test(taskName)||/follow.*reddit/gim.test(taskName)?this.undoneTasks.reddit.redditLinks.push(taskLink):/watch.*art/gim.test(taskName)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):/subscribe.*youtube.*channel/gim.test(taskName)?this.undoneTasks.youtube.channelLinks.push(taskLink):/(watch|like).*youtube.*video/gim.test(taskName)||(taskIcon.includes("youtube")||taskIcon.includes("thumbs-up"))&&/(watch|like).*video/gim.test(taskName)?this.undoneTasks.youtube.likeLinks.push(taskLink):taskIcon.includes("vk")||/join.*vk.*group/gim.test(taskName)?this.undoneTasks.vk.nameLinks.push(taskLink):/(on twitter)|(Follow.*on.*Facebook)/gim.test(taskName)||(/wishlist.*game|add.*wishlist/gim.test(taskName)&&this.undoneTasks.steam.wishlistLinks.push(taskLink),/follow.*button/gim.test(taskName)&&this.undoneTasks.steam.followLinks.push(taskLink)),resolve(!0)}).catch(error=>(throwError_throwError(error,"Giveawaysu.classifyTask->getRedirectLink"),!1))}));return await Promise.all(pro),logStatus.success(),this.undoneTasks=this.#uniqueTasks(this.undoneTasks),!0}catch(error){return throwError_throwError(error,"Giveawaysu.classifyTask"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin&&0<$("a.steam-login").length&&window.open("/steam/redirect","_self"),!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLogin"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey&&0<$(".giveaway-ended").length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(({value})=>{value&&window.close()}),!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLeftKey"),!1}}#getGiveawayId(){var giveawayId=window.location.href.match(/\/view\/([\d]+)/)?.[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}async#bind(name,init){try{return{name:name,result:await init}}catch(error){return throwError_throwError(error,"GiveawaySu.bind"),{name:name,result:!1}}}async#initSocial(){try{var steamLength,steamCommunityLength,pro=[];let tasks=this.undoneTasks;return tasks.discord&&0[...total,...arr]).length&&!this.socialInitialized.discord&&(this.social.discord=new social_Discord,pro.push(this.#bind("discord",this.social.discord.init("do")))),tasks.instagram&&0[...total,...arr]).length&&!this.socialInitialized.instagram&&(this.social.instagram=new social_Instagram,pro.push(this.#bind("instagram",this.social.instagram.init()))),tasks.reddit&&0[...total,...arr]).length&&!this.socialInitialized.reddit&&(this.social.reddit=new social_Reddit,pro.push(this.#bind("reddit",this.social.reddit.init()))),tasks.twitch&&0[...total,...arr]).length&&!this.socialInitialized.twitch&&(this.social.twitch=new social_Twitch,pro.push(this.#bind("twitch",this.social.twitch.init()))),tasks.vk&&0[...total,...arr]).length&&!this.socialInitialized.vk&&(this.social.vk=new social_Vk,pro.push(this.#bind("vk",this.social.vk.init()))),tasks.youtube&&0[...total,...arr]).length&&!this.socialInitialized.youtube&&(this.social.youtube=new Youtube,pro.push(this.#bind("youtube",this.social.youtube.init()))),tasks.steam&&0<(steamLength=Object.values(tasks.steam).reduce((total,arr)=>[...total,...arr]).length)&&(this.social.steam||(this.social.steam=new social_Steam),0["groupLinks","forumLinks","workshopLinks","workshopVoteLinks"].includes(type)&&tasks.steam?.[type]?.length||0).reduce((total,number)=>total+number,0))&&!this.socialInitialized.steamStore&&pro.push(this.#bind("steamStore",this.social.steam.init("store"))),0{let checked=!0;for(var data of result)data.result?this.socialInitialized[data.name]=data.result:checked=!1;return checked})}catch(error){return throwError_throwError(error,"GiveawaySu.initSocial"),!1}}#uniqueTasks(allTasks){var social,types,result={};for([social,types]of Object.entries(allTasks)){result[social]={};for(var[type,tasks]of Object.entries(types))result[social][type]=unique(tasks)}return result}async#toggleTask(){try{var pro,tasks;return this.initialized||this.init()?!!await this.#classifyTask()&&!!await this.#initSocial()&&(pro=[],tasks=this.undoneTasks,"skip"!==this.socialInitialized.discord&&this.social.discord&&pro.push(this.social.discord.toggle({doTask:!0,...tasks.discord})),this.social.instagram&&pro.push(this.social.instagram.toggle({doTask:!0,...tasks.instagram})),this.social.reddit&&pro.push(this.social.reddit.toggle({doTask:!0,...tasks.reddit})),this.social.twitch&&pro.push(this.social.twitch.toggle({doTask:!0,...tasks.twitch})),this.social.vk&&pro.push(this.social.vk.toggle({doTask:!0,...tasks.vk})),this.social.youtube&&pro.push(this.social.youtube.toggle({doTask:!0,...tasks.youtube})),this.social.steam&&pro.push(this.social.steam.toggle({doTask:!0,...tasks.steam})),await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!0):!1}catch(error){return throwError_throwError(error,"GiveawaySu.toggleTask"),!1}}async doTask(){try{return $("#getKey").on("click",()=>{$("#auto-task-info-div").remove(),$(window.STYLE).remove(),$("#getKey").off()}),await this.#toggleTask()}catch(error){return throwError_throwError(error,"GiveawaySu.doTask"),!1}}async verifyTask(){try{var task;for(task of $("#actions tr")){var icon,button,href,$task=$(task);"adjs"!==$task.attr("data-action-id")&&("A"===(button=(icon=$task.find("i.glyphicon-refresh")).parent()).prop("tagName")?(href=button.attr("href"),button.attr("href","javascript:void(0);").attr("target","_self")[0].click(),button.attr("href",href)):icon.hasClass("spin")||icon.hasClass("glyphicon-ok")||(button[0].click(),await delay(1e3)))}}catch(error){throwError_throwError(error,"GiveawaySu.verifyTask")}}}let Giveawaysu=GiveawaySu,for_giveawaysu=__webpack_require__(738);if(window.STYLE=GM_addStyle(for_giveawaysu.A+`.swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4!important;grid-row:1/4!important;grid-template-columns:1fr 99fr 1fr;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:700}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-container{display:grid;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;box-sizing:border-box;grid-template-areas:"top-start top top-end" "center-start center center-end" "bottom-start bottom-center bottom-end";grid-template-rows:minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto);grid-template-rows:minmax(min-content,auto) minmax(min-content,auto) minmax(min-content,auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}.swal2-container.swal2-backdrop-show,.swal2-container.swal2-noanimation{background:rgba(0,0,0,.4)}.swal2-container.swal2-backdrop-hide{background:0 0!important}.swal2-container.swal2-bottom-start,.swal2-container.swal2-center-start,.swal2-container.swal2-top-start{grid-template-columns:minmax(0,1fr) auto auto}.swal2-container.swal2-bottom,.swal2-container.swal2-center,.swal2-container.swal2-top{grid-template-columns:auto minmax(0,1fr) auto}.swal2-container.swal2-bottom-end,.swal2-container.swal2-center-end,.swal2-container.swal2-top-end{grid-template-columns:auto auto minmax(0,1fr)}.swal2-container.swal2-top-start>.swal2-popup{align-self:start}.swal2-container.swal2-top>.swal2-popup{grid-column:2;align-self:start;justify-self:center}.swal2-container.swal2-top-end>.swal2-popup,.swal2-container.swal2-top-right>.swal2-popup{grid-column:3;align-self:start;justify-self:end}.swal2-container.swal2-center-left>.swal2-popup,.swal2-container.swal2-center-start>.swal2-popup{grid-row:2;align-self:center}.swal2-container.swal2-center>.swal2-popup{grid-column:2;grid-row:2;align-self:center;justify-self:center}.swal2-container.swal2-center-end>.swal2-popup,.swal2-container.swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;align-self:center;justify-self:end}.swal2-container.swal2-bottom-left>.swal2-popup,.swal2-container.swal2-bottom-start>.swal2-popup{grid-column:1;grid-row:3;align-self:end}.swal2-container.swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;justify-self:center;align-self:end}.swal2-container.swal2-bottom-end>.swal2-popup,.swal2-container.swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;align-self:end;justify-self:end}.swal2-container.swal2-grow-fullscreen>.swal2-popup,.swal2-container.swal2-grow-row>.swal2-popup{grid-column:1/4;width:100%}.swal2-container.swal2-grow-column>.swal2-popup,.swal2-container.swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}.swal2-container.swal2-no-transition{transition:none!important}.swal2-popup{display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0,100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-title{position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-loader{display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 transparent #2778c4 transparent}.swal2-styled{margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px transparent;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}.swal2-styled.swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}.swal2-styled.swal2-deny{border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}.swal2-styled.swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}.swal2-styled.swal2-cancel:focus{box-shadow:0 0 0 3px rgba(110,120,129,.5)}.swal2-styled.swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}.swal2-styled:focus{outline:0}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em}.swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto!important;height:.25em;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}.swal2-timer-progress-bar{width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:2em auto 1em}.swal2-close{z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:0 0;color:#ccc;font-family:serif;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-close:focus{outline:0;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}.swal2-close::-moz-focus-inner{border:0}.swal2-html-container{z-index:1;justify-content:center;margin:1em 1.6em .3em;padding:0;overflow:auto;color:inherit;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em 2em 3px}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px transparent;color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em 2em 3px;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-file{width:75%;margin-right:auto;margin-left:auto;background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{flex-shrink:0;margin:0 .4em}.swal2-input-label{display:flex;justify-content:center;margin:1em auto 0}.swal2-validation-message{align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:.25em solid transparent;border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-warning.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-warning.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .5s;animation:swal2-animate-i-mark .5s}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-info.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-info.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .8s;animation:swal2-animate-i-mark .8s}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-question.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-question.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-question-mark .8s;animation:swal2-animate-question-mark .8s}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@-webkit-keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@-webkit-keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{background-color:transparent!important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:transparent;pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}`),"discord.com"===window.location.hostname){external_Swal_namespaceObject=window.localStorage;if("#auth"===window.location.hash){window.localStorage.removeItem=()=>!0;var discordAuth=external_Swal_namespaceObject?.getItem("token")?.replace(/^"|"$/g,"");discordAuth&&0{if("www.twitch.tv"===window.location.hostname&&"#auth"===window.location.hash&&(authToken=external_Cookies_namespaceObject.get("auth-token"),!!external_Cookies_namespaceObject.get("login")?(GM_setValue("twitchAuth",{authToken:authToken,clientId:commonOptions?.headers?.["Client-ID"]}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"x.com"===window.location.hostname&&"#auth"===window.location.hash){var authToken=external_Cookies_namespaceObject.get("ct0");let isLogin=!!external_Cookies_namespaceObject.get("twid");isLogin&&authToken?(GM_setValue("twitterAuth",{ct0:authToken}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))}if("www.youtube.com"===window.location.hostname&&"#auth"===window.location.hash&&((authToken=external_Cookies_namespaceObject.get("__Secure-3PAPISID"))?(GM_setValue("youtubeAuth",{PAPISID:authToken}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"www.reddit.com"===window.location.hostname&&("#auth"===window.location.hash||"#auth"===GM_getValue("redditAuth"))){authToken=$("#redesign-beta-optin-btn");if(0

    `),await website.after(),$("#auto-do-task").on("click",()=>{website.doTask()}),$("#auto-verify-task").on("click",()=>{website.verifyTask()}),console.log("%c%s","color:#1bbe1a","Auto Task GS特供脚本初始化完成!")}})}})(); \ No newline at end of file + ${text?.replace("u_","")}]...`);break;case"followingYtbChannel":case"unfollowingYtbChannel":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"likingYtbVideo":case"unlikingYtbVideo":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingVkId":case"joiningVkGroup":case"leavingVkGroup":case"joiningVkPublic":case"leavingVkPublic":case"sendingVkWall":case"deletingVkWall":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"visitingLink":ele=$(`
  • ${i18n("visitingLink")}[${text}]...
  • `);break;case"verifyingInsAuth":case"text":ele=$(`
  • ${i18n(text)}
  • `);break;case"html":ele=$(text||html);break;case"whiteList":ele=$(`
  • ${i18n("skipTask")}[${text}(${id})](${i18n("whiteList")})
  • `);break;case"globalOptionsSkip":ele=$(`
  • ${i18n("skipTaskOption")}${text}
  • `);break;default:ele=$(`
  • ${i18n("unKnown")}:${type}(${text})...
  • `)}else ele=text?$(`
  • ${i18n(text)}
  • `):html?$(html):$("
  • ");return ele.addClass("card-text"),$("#auto-task-info").append(ele),ele[0]?.scrollIntoView(),{font:ele.find("font"),success(text="Success",html=!1){return this.font?.attr("class","").addClass("success"),html?this.font?.html(text):this.font?.text(text),this},error(text="Error",html=!1){return this.font?.attr("class","").addClass("error"),html?this.font?.html(text):this.font?.text(text),this},warning(text="Warning",html=!1){return this.font?.attr("class","").addClass("warning"),html?this.font?.html(text):this.font?.text(text),this},info(text="Info",html=!1){return this.font?.attr("class","").addClass("info"),html?this.font?.html(text):this.font?.text(text),this},view(){return this.font?.[0].scrollIntoView(),this}}}catch(error){return throwError_throwError(error,"echoLog"),emptyStatus}},unique=array=>{try{return[...new Set(array)]}catch(error){return throwError_throwError(error,"unique"),[]}},delay=(time=1e3)=>new Promise(resolve=>{setTimeout(()=>{resolve(!0)},time)}),defaultGlobalOptions={doTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0,workshopVotes:!0,announcements:!0,licenses:!0,playtests:!0}},undoTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0}},ASF:{AsfEnabled:!1,AsfIpcUrl:"",AsfIpcPassword:"",AsfBotname:"asf"},position:{buttonSideX:"right",buttonSideY:"top",buttonDistance:"15,30",showButtonSideX:"right",showButtonSideY:"top",showButtonDistance:"15,30",logSideX:"right",logSideY:"bottom",logDistance:"10,10"},hotKey:{doTaskKey:"alt + d",undoTaskKey:"alt + u",toggleLogKey:"alt + l"},other:{twitterVerifyId:"783214",youtubeVerifyChannel:"UCrXUsMBcfTVqwAS7DKg9C0Q",autoUpdateSource:"jsdelivr",language:"zh",checkLogin:!0,checkLeftKey:!0,defaultShowButton:!0,defaultShowLog:!0,debug:!1,receivePreview:!0}},assignObject=(external_Swal_namespaceObject=GM_getValue("globalOptions")||{},(obj1,obj2)=>{try{var key,value,newObj={};for([key,value]of Object.entries(obj1))"[object Object]"===Object.prototype.toString.call(value)&&"[object Object]"===Object.prototype.toString.call(obj2[key])?newObj[key]=assignObject(value,obj2[key]):newObj[key]=obj2[key]??value;return newObj}catch(error){return throwError_throwError(error,"assignObject"),defaultGlobalOptions}}),globalOptions=assignObject(defaultGlobalOptions,external_Swal_namespaceObject),languages={zh:{website:"网站",type:"类型",edit:"编辑",whiteList:"白名单",skipTask:"跳过撤销任务",whiteListOptions:"白名单设置",changeWhiteListOption:"设置白名单(%0)",whiteListNotFound:"找不到此项白名单: %0",changeWhiteListSuccess:"白名单修改成功,刷新生效!",changeWebsiteOptions:"网站设置",changeGlobalOptions:"全局设置",ok:"是",save:"保存",close:"关闭",return:"返回",option:"选项",value:"值",websiteOptions:"当前网站设置",changeWebsiteOptionsSuccess:"更改当前网站设置成功,刷新生效!",changeGlobalOptionsSuccess:"更改全局设置成功,刷新生效!",needLogin:"请先登录!",getTasksInfo:"正在获取并处理任务信息...",gettingKey:"正在获取Key...",verifyingTask:"正在验证任务",notice:"自动任务脚本提醒",noKeysLeft:"此页面已经没有剩余key了,是否关闭?",giveawayEnded:"此活动已结束,是否关闭?",giveawayNotWork:"此活动因某些原因(已结束/暂停/未开始...)不可用(如果是脚本误判请及时反馈),是否关闭?",confirm:"确定",cancel:"取消",unKnown:"未知",unKnownTaskType:"未识别的任务",doing:"正在做任务",allTasksComplete:"所有任务已完成!",getTaskIdFailed:"获取任务Id失败!",initSuccess:"%0 初始化成功!",initFailed:"%0 初始化失败!",errorLink:"链接错误: %0",needInit:"请先初始化",verifyingAuth:"正在验证%0凭证...",updatingAuth:"正在更新%0凭证...",refreshingToken:"正在刷新%0凭证...",settingToken:"正在设置%0凭证...",initing:"正在初始化...",getFailed:"获取%0失败!",checkLoginFailed:"检测登录状态失败!",checkLeftKeyFailed:"检测剩余Key失败!",userId:"用户Id",joiningGiveaway:"正在加入赠Key",needJoinGiveaway:"需要先加入赠Key",cannotUndo:"此网站不支持取消任务",verifyAuth:"正在验证 %0 凭证...",closePageNotice:"如果此页面没有自动关闭,请自行关闭本页面。",errorReport:"检测到脚本报错,是否前往反馈BUG?",visitingLink:"正在访问链接: ",doTask:"做任务",undoTask:"撤销任务",verifyTask:"验证任务",getKey:"获取Key",selectAll:"全选",selectNone:"全不选",invertSelect:"反选",doFreeTask:"加入免费赠品",doPointTask:"加入点数赠品",skipTaskOption:"设置中已配置跳过任务",other:"其他",globalOptions:"全局设置",checkLogin:"登录检测
    需要登录的网站自动登录,部分网站支持",checkLeftKey:"剩余Key检测
    赠Key活动结束提示是否关闭,部分网站支持",twitterVerifyId:"通过尝试关注该账号验证Twitter凭证
    默认为Twitter官方帐号 783214
    不想关注官方账号可以改为自己的帐号",youtubeVerifyChannel:"通过尝试订阅该频道验证YouTube凭证
    默认为YouTube官方频道 UCrXUsMBcfTVqwAS7DKg9C0Q
    不想关注官方频道可以改为自己的频道",autoUpdateSource:"更新源
    github: 需代理,实时更新
    jsdelivr: 可不用代理,更新有延迟
    standby: 备用
    auto: 依次使用github, jsdelivr, standby源进行尝试更新",saveGlobalOptions:"保存全局设置",settingPage:"设置页面",name:"名称",version:"版本",scriptManager:"脚本管理器",script:"脚本",environment:"环境",os:"系统",browser:"浏览器",getId:"获取 %0 id",getTwitterUserId:"获取Twitter用户id(获取id功能仅在设置页面可用)",getYoutubeChannelId:"获取Youtube频道id(获取id功能仅在设置页面可用)",showButton:"显示按钮",hideButton:"隐藏按钮",showLog:"显示日志",hideLog:"隐藏日志",defaultShowButton:"默认显示按钮",defaultShowLog:"默认显示日志",debug:"输出调试日志,不要开启此选项!",receivePreview:"接收预览版更新",position:"组件位置",buttonSideX:"按钮区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",buttonSideY:"按钮区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",buttonDistance:"按钮区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",showButtonSideX:"显示按钮水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",showButtonSideY:"显示按钮垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",showButtonDistance:"显示按钮距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",logSideX:"日志区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",logSideY:"日志区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",logDistance:"日志区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",hotKey:"快捷键",doTaskKey:"做任务快捷键
    (实时预览功能仅在设置页面可用)",undoTaskKey:"撤销任务快捷键
    (实时预览功能仅在设置页面可用)",toggleLogKey:"显示/隐藏日志快捷键
    (实时预览功能仅在设置页面可用)",tasksHistory:"任务历史",clearHistory:"清空历史",clearHistoryFinished:"已清空任务历史!",deleteTask:"删除任务",lastChangeTime:"最后一次修改时间",clearTaskFinished:"删除以下任务完成!",clearTaskFailed:"删除任务失败,没有找到任务名!",syncData:"数据同步",settingData:"正在上传数据...",gettingData:"正在获取数据...",help:"帮助",fileName:"文件名",upload2gist:"同步到Gist",downloadFromGist:"从Gist同步",saveAndTest:"保存配置并测试",testSuccess:"测试成功!",testFailed:"测试失败!",saveAndTestNotice:"请先保存配置并测试!",processingData:"正在处理数据...",updatingData:"正在上传数据...",syncDataSuccess:"同步数据成功!",syncDataFailed:"同步数据失败,请在控制台查看错误信息!",downloadingData:"正在下载数据...",checkedNoData:"没有检测到远程数据,请确认配置是否正确!",savingData:"正在保存数据...",syncHistory:"同步任务历史",checkUpdateFailed:"检测更新失败",newVersionNotice:'检测到新版本V%0, 点此更新',language:"语言
    目前仅支持zh: 中文, en: 英文",gistOptions:"Gist 设置",swalNotice:"检测到您第一次安装V4版本脚本,请前往阅读用前必读内容!",echoNotice:'检测到您第一次安装V4版本脚本,请点此前往阅读用前必读内容!',noticeLink:"https://auto-task-doc.js.org/guide/#用前必读",toGithub:"前往Github反馈",toKeylol:"前往其乐论坛反馈",copySuccess:"错误信息已复制到剪切板,是否前往其乐论坛反馈?",copyFailed:"请复制下方错误信息后前往Keylol论坛反馈!",updateText:"%0 版本更新内容:",Active:"进行中",Ended:"已结束",Banned:"已封禁",Paused:"已暂停",notStart:"未开始",noRemoteData:"检测到远程无数据",errorRemoteDataFormat:"远程数据格式错误",updateHistory:'历史更新记录点此查看',AsfEnabled:'使用ASF做Steam相关任务(需ASFEnhance插件)',AsfIpcUrl:"ASF IPC 地址",AsfIpcPassword:"ASF IPC 密码",versionNotMatched:"脚本管理器版本过低,需TamperMonkey >= 5.2.0或TamperMonkey Beta >= 5.2.6196",groups:"组",officialGroups:"官方组",wishlists:"愿望单",follows:"游戏关注",forums:"论坛",workshops:"创意工坊收藏",curators:"鉴赏家",workshopVotes:"创意工坊点赞",announcements:"社区通知",steamCommunity:"Steam社区",steamStore:"Steam商店",licenses:"入库免费游戏",playtests:"请求访问权限",needLoginSteamStore:'请先登录Steam商店',needLoginSteamCommunity:'请先登录Steam社区',joiningSteamGroup:"正在加入Steam组",leavingSteamGroup:"正在退出Steam组",gettingSteamGroupId:"正在获取Steam组Id",joiningSteamOfficialGroup:"正在加入Steam官方组",leavingSteamOfficialGroup:"正在退出Steam官方组",gettingSteamOfficialGroupId:"正在获取Steam官方组Id",subscribingForum:"正在订阅Steam论坛",unsubscribingForum:"正在取消订阅Steam论坛",gettingForumId:"正在获取Steam论坛Id",followingCurator:"正在关注Steam鉴赏家",unfollowingCurator:"正在取关Steam鉴赏家",gettingCuratorId:"正在获取Steam鉴赏家Id",addingToWishlist:"正在添加游戏到Steam愿望单",removingFromWishlist:"正在从Steam愿望单移除游戏",followingGame:"正在关注Steam游戏",unfollowingGame:"正在取关Steam游戏",favoritingWorkshop:"正在收藏Steam创意工坊物品",unfavoritingWorkshop:"正在取消收藏Steam创意工坊物品",gettingWorkshopAppId:"正在获取Steam创意工坊物品Id",votingUpWorkshop:"正在点赞Steam创意工坊物品",gettingAnnouncementParams:"正在获取Steam通知信息",likingAnnouncement:"正在点赞Steam通知",changingArea:"正在更换Steam地区: %0...",notNeededChangeArea:"当前地区不需要更换",noAnotherArea:"请检测是否开启正确开启代理",gettingAreaInfo:"正在获取Steam地区信息...",changeAreaNotice:"疑似锁区游戏,尝试换区执行",steamFinishNotice:"Steam任务完成,尝试将购物车地区换回CN",gettingSubid:"正在获取游戏subid",addingFreeLicense:"正在入库",missParams:"缺少参数",gettingLicenses:"正在获取Licenses...",requestingPlayTestAccess:"正在请求访问权限",tryChangeAreaNotice:"此功能无法检测游戏是否限区,因此会尝试换区后再入库,换区失败也不影响后续入库",gettingUserLink:"正在获取Steam用户社区链接...",retry:"重试",initingASF:"正在初始化ASF...",servers:"服务器",joiningDiscordServer:"正在加入Discord服务器",leavingDiscordServer:"正在退出Discord服务器",gettingDiscordGuild:"正在获取Discord服务器Id",getDiscordAuthFailed:"获取Discord凭证失败,请检测Discord帐号是否已登录",discordImportantNotice:"重要提醒!!!",discordImportantNoticeText:"由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!",continue:"继续",skipDiscordTask:"跳过Discord任务",continueAndDontRemindAgain:"继续且不再提醒",users:"用户",loginIns:'请先登录Instagram',insBanned:"您的Instagram账户已被封禁",verifyingInsAuth:"正在验证Instagram凭证...",gettingInsUserId:"正在获取Instagram用户Id",followingIns:"正在关注Instagram用户",unfollowingIns:"正在取关Instagram用户",reddits:"社区/用户",loginReddit:'请先登录Reddit',changingRedditVersion:"正在切换Reddit为新版页面...",joiningReddit:"正在加入Reddit社区",leavingReddit:"正在退出Reddit社区",followingRedditUser:"正在关注Reddit用户",unfollowingRedditUser:"正在取关Reddit用户",channels:"频道",followingTwitchChannel:"正在关注Twitch频道",unfollowingTwitchChannel:"正在取关Twitch频道",gettingTwitchChannelId:"正在获取Twitch频道Id",checkingTwitchIntegrity:"正在检查Twitch完整性...",twitterUser:"推特用户",retweets:"转推",gettingTwitterUserId:"正在获取推特用户Id",followingTwitterUser:"正在关注推特用户",unfollowingTwitterUser:"正在取关推特用户",retweetting:"正在转推",unretweetting:"正在撤销转推",names:"组/社区/动态",loginVk:'请先登录Vk',gettingVkId:"正在获取Vk任务Id",joiningVkGroup:"正在加入Vk组",leavingVkGroup:"正在退出Vk组",joiningVkPublic:"正在加入Vk社区",leavingVkPublic:"正在退出Vk社区",sendingVkWall:"正在转发Vk动态",deletingVkWall:"正在撤销转发Vk动态",youtubeChannel:"YouTube频道",likes:"点赞",loginYtb:'请先登录YouTube',tryUpdateYtbAuth:'请尝试更新YouTube凭证',gettingYtbToken:"正在获取YouTube Token...",followingYtbChannel:"正在订阅YouTube频道",unfollowingYtbChannel:"正在退订YouTube频道",likingYtbVideo:"正在点赞YouTube视频",unlikingYtbVideo:"正在取消点赞YouTube视频",giveKeyNoticeBefore:"每次验证间隔15s",giveKeyNoticeAfter:'如果没有key, 请在https://givekey.ru/profile查看',noPoints:"点数不够,跳过抽奖",getNeedPointsFailed:"获取所需点数失败,跳过抽奖",joiningLottery:"正在加入抽奖",doingGleamTask:"正在做Gleam任务...",gettingGleamLink:"正在获取Gleam任务链接...",gleamTaskNotice:"如果此页面长时间未关闭,请完成任一任务后自行关闭!",verifiedGleamTasks:"已尝试验证所有任务,验证失败的任务请尝试手动验证或完成!",campaign:"检测到人机验证,请完成验证后重新验证任务!",gsNotice:'为避免得到"0000-0000-0000"key, 已自动屏蔽"Grab Key"按钮,获取key时请关闭脚本!',giveeClubVerifyNotice:"正在验证任务...",giveeClubVerifyFinished:"请等待验证完成后自行加入赠Key",doingKeyhubTask:"正在做Keyhub任务...",SweepWidgetNotice:"正在处理并验证任务,每次验证任务有1~3s间隔防止触发验证过快警告...",tasksNotCompleted:"任务未完成",confirmingTask:"正在跳过警告页面..."},en:{website:"Website",type:"Type",edit:"Edit",whiteList:"Whitelist",skipTask:"Skip undo task",whiteListOptions:"Whitelist options",changeWhiteListOption:"Whitelist option(%0)",whiteListNotFound:"Cannot find this whitelist: %0",changeWhiteListSuccess:"The whitelist is successfully modified, and the page refresh will take effect!",changeWebsiteOptions:"Website options",changeGlobalOptions:"Global options",ok:"OK",save:"Save",close:"Close",return:"Return",option:"Option",value:"Value",websiteOptions:"Current website settings",changeWebsiteOptionsSuccess:"The current website setting is changed successfully, and the page refresh will take effect!",changeGlobalOptionsSuccess:"The global setting is changed successfully, and the refresh will take effect!",needLogin:"Please log in first!",getTasksInfo:"Obtaining and processing task information...",gettingKey:"Getting Key...",verifyingTask:"Verifying task",notice:"Automatic task script notice",noKeysLeft:"There are no more keys left on this page. Do you want to close it?",giveawayEnded:"This event has ended, do you want to close it?",giveawayNotWork:"This activity is unavailable for some reasons (banned/ended/paused/not started...) (if it is a script misjudgment, please give us feedback in time), is it closed?",confirm:"Confirm",cancel:"Cancel",unKnown:"Unknown",unKnownTaskType:"Unrecognized task",doing:"Doing a task",allTasksComplete:"All tasks have been completed!",getTaskIdFailed:"Failed to obtain task Id!",initSuccess:"%0 was initialized successfully!",initFailed:"%0 initialization failed!",errorLink:"Link error: %0",needInit:"Please initialize first",verifyingAuth:"Verifying %0 token...",updatingAuth:"Update %0 token...",initing:"Initializing...",getFailed:"Failed to get %0!",checkLoginFailed:"Failed to detect login status!",checkLeftKeyFailed:"Failed to detect the remaining keys!",userId:"User Id",joiningGiveaway:"Joining giveaway",needJoinGiveaway:"Need to join the giveaway first",cannotUndo:"This website does not support canceling tasks",verifyAuth:"Verifying %0 token...",closePageNotice:"f this page does not close automatically, please close this page yourself.",errorReport:"A script error is detected, do you want to report the BUG?",visitingLink:"Visiting link: ",doTask:"DoTask",undoTask:"UndoTask",verifyTask:"Verify",getKey:"GetKey",selectAll:"SelectAll",selectNone:"SelectNone",invertSelect:"InvertSelect",doFreeTask:"FreeTask",doPointTask:"PointTask",skipTaskOption:"Skip task has been configured in the settings",other:"Other",globalOptions:"Global Options",checkLogin:"Login detection
    Need to log in to the website automatically log in, part of this website supports.",checkLeftKey:"Key remaining detection
    The end of the giveaway event prompts whether to close or not, part of this website supports.",twitterVerifyId:"Verify Twitter token by trying to follow the account.
    The default is the official Twitter account 783214.
    If you don't want to follow the official account, you can change it to your own account.",youtubeVerifyChannel:"Verify YouTube token by trying to subscribe to the channel.
    The default is the official YouTube channel UCrXUsMBcfTVqwAS7DKg9C0Q.
    If you don't want to follow the official channel, you can change it to your own channel.",autoUpdateSource:"The source to update
    github: Fast update.
    jsdelivr: Update is delayed.
    standby: Standby source.
    auto: Try to update using github, jsdelivr, standby sources in turn.",saveGlobalOptions:"SaveSettings",settingPage:"Setting Page",name:"Name",version:"Version",scriptManager:"Script Manager",script:"Script",environment:"Environment",os:"OS",browser:"Browser",getId:"Get %0 id",getTwitterUserId:"Get Twitter user id (Get id function is only available on the settings page).",getYoutubeChannelId:"Get Youtube channel id (Get id function is only available on the settings page).",showButton:"ShowButton",hideButton:"HideButton",showLog:"ShowLog",hideLog:"HideLog",defaultShowButton:"Default display button",defaultShowLog:"Display log by default",debug:"Output debug log, do not enable this option!",receivePreview:"Receive preview updates",position:"Component position",buttonSideX:"Horizontal positioning of the button area (real-time preview function is only available on the setting page).
    left: left | right: right",buttonSideY:"The button area is positioned in the vertical direction (real-time preview function is only available on the settings page).
    top: top | bottom: bottom",buttonDistance:"The distance between the button area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",showButtonSideX:"ShowButton horizontal positioning (real-time preview function is only available on the setting page).
    left: left | right: right",showButtonSideY:"ShowButton vertical positioning (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",showButtonDistance:"The distance between the ShowButton and the edge (real-time preview function is only available on the setting page).
    Format: X distance, Y distance",logSideX:"Horizontal positioning of the log area (real-time preview function is only available on the setting page).
    left: left | right: right",logSideY:"Vertical positioning of the log area (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",logDistance:"The distance between the log area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",hotKey:"Shortcut key",doTaskKey:"DoTask shortcut keys
    (real-time preview function is only available on the settings page).",undoTaskKey:"UndoTask shortcut keys
    (real-time preview function is only available on the settings page).",toggleLogKey:"ShowLog/HideLog shortcut keys
    (real-time preview function is only available on the settings page).",tasksHistory:"TasksHistory",clearHistory:"Clear history",clearHistoryFinished:"The mission history has been cleared!",deleteTask:"Delete task",lastChangeTime:"Last Change Time",clearTaskFinished:"Delete the following tasks completed!",clearTaskFailed:"Failed to delete the task, the task name was not found!",syncData:"DataSync",settingData:"Uploading data...",gettingData:"Getting data...",help:"Help",fileName:"Filename",upload2gist:"Sync to Gist",downloadFromGist:"Sync from Gist",saveAndTest:"Save configuration and test",testSuccess:"Test success!",testFailed:"Test failed!",saveAndTestNotice:"Please save the configuration and test first!",processingData:"Processing data...",updatingData:"Uploading data...",syncDataSuccess:"Synchronized data successfully!",syncDataFailed:"Failed to synchronize data, please check the error message on the console!",downloadingData:"Downloading data...",checkedNoData:"No remote data is detected, please confirm whether the configuration is correct!",savingData:"Saving data...",syncHistory:"Synchronize tasks history",checkUpdateFailed:"Check update failed",newVersionNotice:'Checked a new version V%0, click to update',language:"Language
    Currently only supports zh: Chinese, en: English",gistOptions:"Gist Settings",swalNotice:"It is detected that you are installing the V4 version script for the first time, please go to read the READ ME FIRST content before use!",echoNotice:'It is detected that you are installing the V4 version script for the first time, please click here to read the READ ME FIRST content before use!',noticeLink:"https://auto-task-doc.js.org/en/guide/#read-me-first",toGithub:"Feedback(Github)",toKeylol:"Feedback(Keylol)",copySuccess:"The error message has been copied to the clipboard. Do you want to go to the Keylol forum to give feedback?",copyFailed:"Please copy the error information below and report back to the Keylol forum!",updateText:"Updates in version %0:",Active:"Active",Ended:"Ended",Banned:"Banned",Paused:"Paused",notStart:"notStart",noRemoteData:"No data remotely",errorRemoteDataFormat:"Remote data has wrong format",updateHistory:'Click here to view the historical update record.',AsfEnabled:'Use ASF to do Steam related tasks (requires ASFEnhance plugin)',AsfIpcUrl:"ASF IPC URL",AsfIpcPassword:"ASF IPC Password",groups:"Group",officialGroups:"Official Group",wishlists:"Wishlist",follows:"Follow Game",forums:"Forum",workshops:"Favorite Workshop",curators:"Curator",workshopVotes:"Voteup Workshop",announcements:"Announcement",steamCommunity:"Steam Community",steamStore:"Steam Store",licenses:"Add License",playtests:"Playtest Access",needLoginSteamStore:'Please log in to the Steam Store',needLoginSteamCommunity:'Please log in to the Steam Community',joiningSteamGroup:"Joining Steam Group",leavingSteamGroup:"Leaving Steam Group",gettingSteamGroupId:"Getting Steam Group Id",joiningSteamOfficialGroup:"Joining Steam Official Group",leavingSteamOfficialGroup:"Leaving Steam Official Group",gettingSteamOfficialGroupId:"Getting Steam Official Group Id",subscribingForum:"Subscribing the Steam Forum",unsubscribingForum:"Unsubscribing the Steam Forum",gettingForumId:"Getting Steam Forum Id",followingCurator:"Following Steam Curator",unfollowingCurator:"Unfollowing Steam Curator",gettingCuratorId:"Getting Steam Curator Id",addingToWishlist:"Adding the game to the Steam wishlist",removingFromWishlist:"Removing the game from the Steam wishlist",followingGame:"Following Steam games",unfollowingGame:"Unfollowing Steam games",favoritingWorkshop:"Favouring Steam Workshop Items",unfavoritingWorkshop:"Unfavoriting Steam Workshop Items",gettingWorkshopAppId:"Getting Steam Workshop Item Id",votingUpWorkshop:"Liking Steam workshop items",gettingAnnouncementParams:"Getting Steam announcement information",likingAnnouncement:"Liking Steam announcement",changingArea:"Changing Steam area: %0...",notNeededChangeArea:"The current area does not need to be changed",noAnotherArea:"Please check whether the proxy is turned on correctly",gettingAreaInfo:"Getting Steam area information...",changeAreaNotice:"Suspected of a locked zone game, try to change the zone to execute",steamFinishNotice:"Steam task completed, try to change the shopping cart area back to CN",gettingSubid:"Getting subid",addingFreeLicense:"Adding free license",missParams:"Missing parameters",gettingLicenses:"Getting licenses...",requestingPlayTestAccess:"Requesting play test access",tryChangeAreaNotice:"This function cannot detect whether the game is limited, so it will try to change the area before entering the library. Failure to change the area will not affect the subsequent storage.",versionNotMatched:"The script manager version is too low, requiring TamperMonkey >= 5.2.0 or TamperMonkey Beta >= 5.2.6196",gettingUserLink:"Getting steam user community link...",retry:"Retry",initingASF:"Initing ASF...",servers:"Server",joiningDiscordServer:"Joining Discord Server",leavingDiscordServer:"Leaving Discord Server",gettingDiscordGuild:"Getting Discord server Id",getDiscordAuthFailed:"Failed to get Discord token, please check whether the Discord account is logged in",discordImportantNotice:"Important Reminder! ! !",discordImportantNoticeText:"Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !",continue:"Continue",skipDiscordTask:"Skip",continueAndDontRemindAgain:"Continue without Reminders",users:"User",loginIns:'Please log in to Instagram',insBanned:"Your Instagram account has been banned",verifyingInsAuth:"Verifying Instagram token...",gettingInsUserId:"Getting Instagram user Id",followingIns:"Following Instagram user",unfollowingIns:"Unfollowing Instagram user",reddits:"Reddit/User",loginReddit:'Please log in to Reddit',changingRedditVersion:"Switching Reddit to a new version page...",joiningReddit:"Joining the Reddit",leavingReddit:"Leaving the Reddit",followingRedditUser:"Following Reddit User",unfollowingRedditUser:"Unfollowing Reddit User",channels:"Channel",followingTwitchChannel:"Following Twitch Channel",unfollowingTwitchChannel:"Unfollowing Twitch Channel",gettingTwitchChannelId:"Getting Twitch Channel Id",checkingTwitchIntegrity:"Checking Twitch integrity...",twitterUser:"Twitter User",retweets:"Retweet",gettingTwitterUserId:"Getting Twitter User Id",followingTwitterUser:"Following Twitter User",unfollowingTwitterUser:"Unfollowing Twitter User",retweetting:"Retweetting",unretweetting:"Unretweetting",names:"Group/Public/Wall",loginVk:'Please log in to Vk',gettingVkId:"Getting Vk task Id",joiningVkGroup:"Joining Vk Group",leavingVkGroup:"Leaving Vk Group",joiningVkPublic:"Joining Vk Public",leavingVkPublic:"Leaving Vk Public",sendingVkWall:"Sending Vk Wall",deletingVkWall:"Deleting Vk Wall",youtubeChannel:"YouTube Channel",likes:"Like",loginYtb:'Please log in to YouTube',tryUpdateYtbAuth:'Please try to update YouTube token',gettingYtbToken:"Getting YouTube Token...",followingYtbChannel:"Subscribing to YouTube channel",unfollowingYtbChannel:"Unsubscribing to YouTube channel",likingYtbVideo:"Liking YouTube video",unlikingYtbVideo:"Unliking YouTube video",giveKeyNoticeBefore:"Each verification interval is 15s",giveKeyNoticeAfter:'If there is no key, please check at https://givekey.ru/profile',noPoints:"Not enough points, skip the lottery",getNeedPointsFailed:"ailed to obtain the required points, skip the lottery",joiningLottery:"Joining the lottery",doingGleamTask:"Doing Gleam Task...",gettingGleamLink:"Getting Gleam task link...",gleamTaskNotice:"If this page has not been closed for a long time, please close it yourself after completing any task!",verifiedGleamTasks:"Attempted to verify all tasks. If the verification fails, please try to verify manually or complete it!",campaign:"ReCAPTCHA detected, please complete it and re-verify the tasks!",gsNotice:'In order to avoid getting the "0000-0000-0000" key, the "Grab Key" button has been hidden, please close the script when obtaining the key!',giveeClubVerifyNotice:"Verifying task...",giveeClubVerifyFinished:"Wait for the verification to complete and join it by yourself",doingKeyhubTask:"Doing Keyhub Task...",SweepWidgetNotice:"The task is being processed and verified. There is an interval of 1~3s for each verification task to prevent the triggering of too fast verification warning...",tasksNotCompleted:"Tasks Not Completed",confirmingTask:"Confirming task..."}},language=["zh","en"].includes(globalOptions.other.language)?globalOptions.other.language:"en",i18n=(key,...argvs)=>languages[language]?.[key]?languages[language][key].replace(/%([\d]+)/g,(match,index)=>argvs[parseInt(index,10)]):key;external_Swal_namespaceObject=class{tasks;getRealParams(name,links,doTask,link2param){try{let realParams=[];return 0link2param(link)).filter(link=>link)]),!doTask&&0!!isConfirmed||!!isDenied&&(GM_setValue("dontRemindDiscordAgain",!0),!0)))return this.#initialized=!1,"skip";return GM_getValue("dontRemindDiscordAgain")||"do"===action&&!globalOptions.doTask.discord.servers||"undo"===action&&!globalOptions.undoTask.discord.servers?(this.#initialized=!1,"skip"):!!this.#initialized||(this.#auth.auth?await this.#verifyAuth()||(GM_setValue("discordAuth",{auth:null}),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Discord")),!1):!!await this.#updateAuth()&&(this.#initialized=!0))}catch(error){return throwError_throwError(error,"Discord.init"),!1}}async#verifyAuth(){try{var logStatus=scripts_echoLog({text:i18n("verifyingAuth","Discord")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v6/users/@me",method:"HEAD",headers:{authorization:this.#auth.auth}});return"Success"===result?200===data?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.verifyAuth"),!1}}async#updateAuth(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Discord")});return await new Promise(resolve=>{GM_openInTab("https://discord.com/channels/@me#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{var auth=GM_getValue("discordAuth")?.auth;auth?(this.#auth={auth:auth},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error("Error: Update discord auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Discord.updateAuth"),!1}}async#joinServer(inviteId){try{var guild,logStatus=scripts_echoLog({type:"joiningDiscordServer",text:inviteId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,method:"POST",dataType:"json",headers:{authorization:this.#auth.auth,origin:"https://discord.com",referer:"https://discord.com/invite/"+inviteId}});return"Success"===result&&200===data?.status?(logStatus.success(),(guild=String(data.response?.guild?.id))&&(this.#setCache(inviteId,guild),this.tasks.servers=unique([...this.tasks.servers,inviteId])),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.joinServer"),!1}}async#leaveServer(inviteId){try{if(this.whiteList.servers.includes(inviteId))return scripts_echoLog({type:"whiteList",text:"Discord.leaveServer",id:inviteId}),!0;var guild=await this.#getGuild(inviteId);if(guild){var logStatus=scripts_echoLog({type:"leavingDiscordServer",text:guild}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/users/@me/guilds/"+guild,method:"DELETE",headers:{authorization:this.#auth.auth}});if("Success"===result&&204===data?.status)return logStatus.success(),!0;logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Discord.leaveServer"),!1}}async#getGuild(inviteId){try{var logStatus=scripts_echoLog({type:"gettingDiscordGuild",text:inviteId}),guild=this.#cache[inviteId];if(guild)return logStatus.success(),guild;var{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,responseType:"json",method:"GET"});if("Success"!==result||200!==data?.status)return logStatus.error(result+`:${statusText}(${status})`),!1;{let guild=data.response?.guild?.id;return guild?(logStatus.success(),this.#setCache(inviteId,guild),guild):(logStatus.error(result+`:${statusText}(${status})`),!1)}}catch(error){return throwError_throwError(error,"Discord.getGuild"),!1}}async toggle({doTask=!0,serverLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.discord.servers||!doTask&&!globalOptions.undoTask.discord.servers)scripts_echoLog({type:"globalOptionsSkip",text:"discord.servers"});else{var realServers=this.getRealParams("servers",serverLinks,doTask,link=>link.match(/invite\/(.+)/)?.[1]);if(0!0)}catch(error){return throwError_throwError(error,"Discord.toggleServers"),!1}}#setCache(inviteId,guild){try{this.#cache[inviteId]=guild,GM_setValue("discordCache",this.#cache)}catch(error){throwError_throwError(error,"Discord.setCache")}}}let social_Discord=Discord;class Instagram extends external_Swal_namespaceObject{tasks;whiteList;#cache=GM_getValue("instagramCache")||{};#auth={};#initialized=!1;constructor(){super();var defaultTasksTemplate={users:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.instagram||{}}}async init(){try{return this.#initialized?!0:await this.#getUserInfo()?(scripts_echoLog({}).success(i18n("initSuccess","Instagram")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Instagram")),!1)}catch(error){return throwError_throwError(error,"Instagram.init"),!1}}async#getUserInfo(name="instagram"){try{var logStatus=scripts_echoLog({type:"instagram"===name?"verifyingInsAuth":"gettingInsUserId",text:name}),userId=this.#cache[name];if(userId&&"instagram"!==name)return logStatus.success(),userId;var csrftoken,hash,id,{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/${name}/`,method:"GET"});if("Success"===result)if(data?.finalUrl.includes("accounts/login"))logStatus.error("Error:"+i18n("loginIns"),!0);else if(data?.finalUrl.includes("www.instagram.com/challenge"))logStatus.error("Error:"+i18n("insBanned"));else{if(200===data?.status)return csrftoken=data.responseText.match(/"csrf_token":"(.+?)"/)?.[1],hash=data.responseText.match(/"rollout_hash":"(.+?)"/)?.[1],"instagram"===name?!(!csrftoken||!hash||(this.#auth={csrftoken:csrftoken,hash:hash},0)):(id=data.responseText.match(/"profilePage_([\d]+?)"/)?.[1])?(this.#setCache(name,id),logStatus.success(),id):(logStatus.error("Error: Get ins data error!"),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Instagram.getUserInfo"),!1}}async#followUser(name){try{var id=await this.#getUserInfo(name);if(id){var logStatus=scripts_echoLog({type:"followingIns",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/web/friendships/${id}/follow/`,method:"POST",dataType:"json",headers:{"x-csrftoken":this.#auth.csrftoken,origin:"https://www.instagram.com",referer:`https://www.instagram.com/${name}/`,"content-type":"application/x-www-form-urlencoded","sec-fetch-site":"same-origin","x-instagram-ajax":this.#auth.hash}});if("Success"===result)return 200===data?.status&&"following"===data.response?.result?(logStatus.success(),this.tasks.users=unique([...this.tasks.users,name]),!0):(logStatus.error("Error:"+(data?.response?.feedback_message||`${data?.statusText}(${data?.status})`)),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Instagram.followUser"),!1}}async#unfollowUser(name){try{if(this.whiteList.users.includes(name))return scripts_echoLog({type:"whiteList",text:"Instagram.unfollowUser",id:name}),!0;var id=await this.#getUserInfo(name);if(id){var logStatus=scripts_echoLog({type:"unfollowingIns",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/web/friendships/${id}/unfollow/`,method:"POST",dataType:"json",headers:{"x-csrftoken":this.#auth.csrftoken,origin:"https://www.instagram.com",referer:`https://www.instagram.com/${name}/`,"content-type":"application/x-www-form-urlencoded","sec-fetch-site":"same-origin","x-instagram-ajax":this.#auth.hash}});if("Success"===result)return 200===data?.status&&"ok"===data.response?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Instagram.unfollowUser"),!1}}async toggle({doTask=!0,userLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.instagram.users||!doTask&&!globalOptions.undoTask.instagram.users)scripts_echoLog({type:"globalOptionsSkip",text:"instagram.users"});else{var realUsers=this.getRealParams("users",userLinks,doTask,link=>link.match(/https:\/\/www\.instagram\.com\/(.+)?\//)?.[1]);if(0!0)}catch(error){return throwError_throwError(error,"Instagram.toggleUsers"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("instagramCache",this.#cache)}catch(error){throwError_throwError(error,"Instagram.setCache")}}}let social_Instagram=Instagram;class Reddit extends external_Swal_namespaceObject{tasks;whiteList;#auth;#initialized=!1;constructor(){super();var defaultTasksTemplate={reddits:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.reddit||{}}}async init(){try{return this.#initialized?!0:await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Reddit")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Reddit")),!1)}catch(error){return throwError_throwError(error,"Reddit.init"),!1}}async#useBeta(){try{let logStatus=scripts_echoLog({text:i18n("changingRedditVersion")});return GM_setValue("redditAuth",null),await new Promise(resolve=>{GM_openInTab("https://www.reddit.com/#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{logStatus.success(),resolve(await this.#updateAuth(!0))}})}catch(error){return throwError_throwError(error,"Reddit.useBeta"),!1}}async#updateAuth(beta=!1){try{var accessToken,logStatus=scripts_echoLog({text:i18n("updatingAuth","Reddit")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://www.reddit.com/",method:"GET",nochche:!0,headers:{"Cache-Control":"no-cache"}});if("Success"===result)if(data?.responseText.includes("www.reddit.com/login/"))logStatus.error("Error:"+i18n("loginReddit"),!0);else{if(200===data?.status)return data.responseText.includes("redesign-beta-optin-btn")&&!beta?await this.#useBeta():(accessToken=data.responseText.match(/"accessToken":"(.*?)","expires":"(.*?)"/)?.[1])?(this.#auth={token:accessToken},logStatus.success(),!0):(logStatus.error('Error: Parameter "accessToken" not found!'),!1);logStatus.error(`Error:${data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Reddit.updateAuth"),!1}}async toggleTask({name,doTask=!0}){try{if(!doTask&&this.whiteList.reddits.includes(name))return scripts_echoLog({type:"whiteList",text:"Reddit.undoTask",id:name}),!0;let type=doTask?"joiningReddit":"leavingReddit";/^u_/.test(name)&&(type=doTask?"followingRedditUser":"unfollowingRedditUser");var logStatus=scripts_echoLog({type:type,text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://oauth.reddit.com/api/subscribe?redditWebClient=desktop2x&app=desktop2x-client-production&raw_json=1&gilding_detail=1",method:"POST",headers:{authorization:"Bearer "+this.#auth.token,"content-type":"application/x-www-form-urlencoded"},data:$.param({action:doTask?"sub":"unsub",sr_name:name,api_type:"json"})});return"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.reddits=unique([...this.tasks.reddits,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Reddit.toggleTask"),!1}}async toggle({doTask=!0,redditLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.reddit.reddits||!doTask&&!globalOptions.undoTask.reddit.reddits)scripts_echoLog({type:"globalOptionsSkip",text:"reddit.reddits"});else{var realReddits=this.getRealParams("reddits",redditLinks,doTask,link=>{var name=link.match(/https?:\/\/www\.reddit\.com\/r\/([^/]*)/)?.[1],link=link.match(/https?:\/\/www\.reddit\.com\/user\/([^/]*)/)?.[1];return link?name||link:name});if(0!0)}catch(error){return throwError_throwError(error,"Reddit.toggle"),!1}}}let social_Reddit=Reddit;class Twitch extends external_Swal_namespaceObject{tasks;whiteList;#auth=GM_getValue("twitchAuth")||{};#cache=GM_getValue("twitchCache")||{};#initialized=!1;#integrityToken;constructor(){super();var defaultTasksTemplate={channels:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.twitch||{}}}async init(){try{return this.#initialized?!0:this.#auth.authToken&&this.#auth.clientId&&this.#auth.clientVersion&&this.#auth.deviceId&&this.#auth.clientSessionId?await this.#verifyAuth(!0)||(GM_setValue("twitchAuth",null),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Twitch")),!1):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError_throwError(error,"Twitch.init"),!1}}async#verifyAuth(isFirst){try{var logStatus=scripts_echoLog({text:i18n("verifyingAuth","Twitch")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},data:'[{"operationName":"FrontPageNew_User","variables":{"limit":1},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"64bd07a2cbaca80699d62636d966cf6395a5d14a1f0a14282067dcb28b13eb11"}}}]'});return"Success"===result?200===data?.status&&data.response?.[0]?.data?.currentUser?(await this.#integrity(isFirst),logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Twitch.verifyAuth"),!1}}async#integrity(isFirst=!0,ct=""){try{var result,statusText,status,data,logStatus=scripts_echoLog({text:i18n("checkingTwitchIntegrity")});return!isFirst||this.#auth.authToken&&this.#auth.clientId&&this.#auth.clientVersion&&this.#auth.deviceId&&this.#auth.clientSessionId?({result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/integrity",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId,"Client-Version":this.#auth.clientVersion,"X-Device-Id":this.#auth.deviceId,"Client-Session-Id":this.#auth.clientSessionId,"x-kpsdk-ct":ct}}),"Success"===result?!ct&&data?.responseHeaders?.["x-kpsdk-ct"]?await this.#integrity(isFirst,data.responseHeaders["x-kpsdk-ct"]):200===data?.status&&data.response?.token?(this.#integrityToken=data.response.token,logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)):await this.#updateAuth(!1)}catch(error){return throwError_throwError(error,"Twitch.integrity"),!1}}async#updateAuth(isFirst=!0){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Twitch")});return await new Promise(resolve=>{GM_openInTab("https://www.twitch.tv/#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{var auth=GM_getValue("twitchAuth");auth?(this.#auth=auth,logStatus.success(),resolve(await this.#verifyAuth(isFirst))):(logStatus.error("Error: Update twitch auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Twitch.updateAuth"),!1}}async#toggleChannel({name,doTask=!0}){try{if(!doTask&&this.whiteList.channels.includes(name))return scripts_echoLog({type:"whiteList",text:"Twitch.unfollowChannel",id:name}),!0;var channelId=await this.#getChannelId(name);if(channelId){var logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingTwitchChannel`,text:name}),followData='[{"operationName":"FollowButton_FollowUser","variables":{"input":{"disableNotifications":false,"targetID":"'+channelId+'"}},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"800e7346bdf7e5278a3c1d3f21b2b56e2639928f86815677a7126b093b2fdd08"}}}]',unfollowData=`[{"operationName":"FollowButton_UnfollowUser","variables":{"input":{"targetID":"${channelId}"}},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"f7dae976ebf41c755ae2d758546bfd176b4eeb856656098bb40e0a672ca0d880"}}}]',{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId,"Client-Version":this.#auth.clientVersion,"X-Device-Id":this.#auth.deviceId,"Client-Session-Id":this.#auth.clientSessionId,"Client-Integrity":this.#integrityToken},data:doTask?followData:unfollowData});if("Success"===result)return 200===data?.status&&data.response?.[0]&&!data.response[0].errors?(logStatus.success(),doTask&&(this.tasks.channels=unique([...this.tasks.channels,name])),!0):(logStatus.error("Error:"+(data?.response?.[0].errors?.[0]?.message||`${data?.statusText}(${data?.status})`)),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Twitch.toggleChannel"),!1}}async#getChannelId(name){try{var logStatus=scripts_echoLog({type:"gettingTwitchChannelId",text:name}),channelId=this.#cache[name];if(channelId)return logStatus.success(),channelId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},responseType:"json",data:`[{"operationName":"ActiveWatchParty","variables":{"channelLogin":"${name}"},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"4a8156c97b19e3a36e081cf6d6ddb5dbf9f9b02ae60e4d2ff26ed70aebc80a30"}}}]'});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let channelId=data.response?.[0]?.data?.user?.id;return channelId?(this.#setCache(name,String(channelId)),logStatus.success(),channelId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Twitch.getChannelId"),!1}}async toggle({doTask=!0,channelLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.twitch.channels||!doTask&&!globalOptions.undoTask.twitch.channels)scripts_echoLog({type:"globalOptionsSkip",text:"twitch.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>link.match(/https:\/\/(www\.)?twitch\.tv\/(.+)/)?.[2]);if(0!0)}catch(error){return throwError_throwError(error,"Twitch.toggle"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("twitchCache",this.#cache)}catch(error){throwError_throwError(error,"Twitch.setCache")}}}let social_Twitch=Twitch;class Vk extends external_Swal_namespaceObject{tasks;whiteList;#username="";#cache=GM_getValue("vkCache")||{};#initialized=!1;constructor(){super();var defaultTasksTemplate={names:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.vk||{}}}async init(){try{return this.#initialized?!0:await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Vk")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Vk")),!1)}catch(error){return throwError_throwError(error,"Vk.init"),!1}}async#verifyAuth(){try{var logStatus=scripts_echoLog({text:i18n("verifyAuth","Vk")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/im",method:"GET"});if("Success"===result)if(data?.finalUrl.includes("vk.com/login"))logStatus.error("Error:"+i18n("loginVk"),!0);else{if(200===data?.status)return this.#username=data.responseText.match(/TopNavBtn__profileLink" href="\/(.*?)"/)?.[1]||"",logStatus.success(),!0;logStatus.error(`Error:${data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Vk.verifyAuth"),!1}}async#toggleGroup(name,dataParam,doTask=!0){try{var reqData,result,statusText,status,data,logStatus=scripts_echoLog({type:doTask?"joiningVkGroup":"leavingVkGroup",text:name});return"enter"===dataParam.groupAct&&!doTask||"leave"===dataParam.groupAct&&doTask?(logStatus.success(),!0):(reqData={act:doTask?"enter":"leave",al:1,gid:dataParam.groupId,hash:dataParam.groupHash},{result,statusText,status,data}=(doTask&&(reqData.context="_"),await tools_httpRequest({url:"https://vk.com/al_groups.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param(reqData)})),"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.names=unique([...this.tasks.names,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Vk.toggleGroup"),!1}}async#togglePublic(name,dataParam,doTask=!0){try{var result,statusText,status,data,logStatus=scripts_echoLog({type:doTask?"joiningVkPublic":"leavingVkPublic",text:name});return dataParam.publicJoined&&doTask||!dataParam.publicJoined&&!doTask?(logStatus.success(),!0):({result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/al_public.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:doTask?"a_enter":"a_leave",al:1,pid:dataParam.publicPid,hash:dataParam.publicHash})}),"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.names=unique([...this.tasks.names,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Vk.togglePublic"),!1}}async#sendWall(name){try{var logStatus=scripts_echoLog({type:"sendingVkWall",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/like.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:"publish_box",al:1,object:name})});if("Success"===result)if(200===data?.status){var hash=data.responseText.match(/shHash:[\s]*'(.*?)'/)?.[1];if(hash){var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://vk.com/like.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({Message:"",act:"a_do_publish",al:1,close_comments:0,friends_only:0,from:"box",hash:hash,list:"",mark_as_ads:0,mute_notifications:0,object:name,ret_data:1,to:0})});if("Success"===resultR){if(200===dataR?.status){var postId,ownerId,jsonData=JSON.parse(dataR.responseText?.replace("\x3c!--","")||"{}");if(!0===jsonData?.payload?.[1]?.[1]?.share_my)return logStatus.success(),postId=String(jsonData?.payload?.[1]?.[1]?.post_id),ownerId=String(jsonData?.payload?.[1]?.[1]?.owner_id),postId&&ownerId&&this.#setCache(name,ownerId+"_"+postId),this.tasks.names=unique([...this.tasks.names,name]),!0}logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`)}else logStatus.error(resultR+`:${statusTextR}(${statusR})`)}else logStatus.error('Error: Get "hash" failed')}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Vk.sendWall"),!1}}async#deleteWall(name,dataParams){try{var logStatus=scripts_echoLog({type:"deletingVkWall",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/al_wall.php?act=delete",method:"POST",headers:{origin:"https://vk.com",referer:`https://vk.com/${this.#username}?w=wall${this.#cache[name]}%2Fall`,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:"delete",al:1,confirm:0,from:"wkview",hash:dataParams.wallHash,post:this.#cache[name]})});return"Success"===result?200===data?.status&&JSON.parse(data.responseText?.replace("\x3c!--","")||"{}")?.payload?.[1]?.[1]?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Vk.deleteWall"),!1}}async#getId(name,doTask){try{let url="https://vk.com/"+name;if(/^wall-/.test(name)){if(doTask)return{type:"sendWall"};if(!this.#cache[name])return{type:"unSupport"};url=`https://vk.com/${this.#username}?w=wall`+this.#cache[name]}var logStatus=scripts_echoLog({type:"gettingVkId",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:url,method:"GET"});if("Success"===result)if(200===data?.status){var[,groupAct,groupId,,groupHash]=data.responseText.match(/Groups.(enter|leave)\(.*?,.*?([\d]+?), ('|')(.*?)('|')/)||[],publicHash=data.responseText.match(/"enterHash":"(.*?)"/)?.[1],publicPid=data.responseText.match(/"public_id":([\d]+?),/)?.[1],publicJoined=!data.responseText.includes("Public.subscribe");if(groupAct&&groupId&&groupHash)return logStatus.success(),{groupAct:groupAct,groupId:groupId,groupHash:groupHash,type:"group"};if(publicHash&&publicPid)return logStatus.success(),{publicHash:publicHash,publicPid:publicPid,publicJoined:publicJoined,type:"public"};if(data.responseText.includes("wall.deletePost")&&!doTask){var wallHash=data.responseText.match(/wall\.deletePost\(this, '.*?', '(.*?)'\)/)?.[1];if(wallHash)return logStatus.success(),{type:"deleteWall",wallHash:wallHash}}else if(name.includes("wall")&&doTask)return logStatus.success(),{type:"sendWall"};logStatus.error("Error: Parameters not found!")}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Vk.getId"),!1}}async#toggleVk({name,doTask=!0}){try{if(!doTask&&this.whiteList.names.includes(name))return scripts_echoLog({type:"whiteList",text:"Vk.undoTask",id:name}),!0;var formatName=name.replace(/\/$/,""),data=await this.#getId(formatName,doTask);if(!data)return!1;switch(data.type){case"group":return await this.#toggleGroup(formatName,data,doTask);case"public":return await this.#togglePublic(formatName,data,doTask);case"sendWall":return!doTask||await this.#sendWall(formatName);case"deleteWall":return!!doTask||await this.#deleteWall(formatName,data);default:return!1}}catch(error){return throwError_throwError(error,"Vk.toggleVk"),!1}}async toggle({doTask=!0,nameLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.vk.names||!doTask&&!globalOptions.undoTask.vk.names)scripts_echoLog({type:"globalOptionsSkip",text:"vk.names"});else{var realNames=this.getRealParams("names",nameLinks,doTask,link=>link.match(/https:\/\/vk\.com\/([^/]+)/)?.[1]);if(0!0)}catch(error){return throwError_throwError(error,"Vk.toggle"),!1}}#setCache(name,postId){try{this.#cache[name]=postId,GM_setValue("vkCache",this.#cache)}catch(error){throwError_throwError(error,"Vk.setCache")}}}let social_Vk=Vk;class Youtube extends external_Swal_namespaceObject{tasks;whiteList;#auth=GM_getValue("youtubeAuth")||{};#initialized=!1;#verifyChannel="https://www.youtube.com/channel/"+globalOptions.other.youtubeVerifyChannel;constructor(){super();var defaultTasksTemplate={channels:[],likes:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.youtube||{}}}async init(){try{return this.#initialized?!0:this.#auth.PAPISID?await this.#verifyAuth()||(GM_setValue("youtubeAuth",null),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Youtube")),!1):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError_throwError(error,"Youtube.init"),!1}}async#verifyAuth(){try{return await this.#toggleChannel({link:this.#verifyChannel,doTask:!0,verify:!0})}catch(error){return throwError_throwError(error,"Youtube.verifyAuth"),!1}}async#updateAuth(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Youtube")});return await new Promise(resolve=>{GM_cookie.list({url:"https://www.youtube.com/@YouTube"},async(cookies,error)=>{error?(logStatus.error("Error: Update youtube auth failed!"),resolve(!1)):(error=cookies.find(cookie=>"__Secure-3PAPISID"===cookie.name)?.value)?(GM_setValue("youtubeAuth",{PAPISID:error}),this.#auth={PAPISID:error},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error(i18n("needLogin")),resolve(!1))})})}catch(error){return throwError_throwError(error,"Youtube.updateAuth"),!1}}#getInfo(link,type){return(async(link,type)=>{try{var apiKey,context,client,request,channelId,videoId,likeParams,logStatus=scripts_echoLog({text:i18n("gettingYtbToken")}),{result,statusText,status,data}=await tools_httpRequest({url:link,method:"GET"});return"Success"===result?200===data?.status?data.responseText.includes("accounts.google.com/ServiceLogin?service=youtube")?(logStatus.error("Error:"+i18n("loginYtb"),!0),{needLogin:!0}):(apiKey=data.responseText.match(/"INNERTUBE_API_KEY":"(.*?)"/)?.[1],context=(data.responseText.match(/\(\{"INNERTUBE_CONTEXT":([\w\W]*?)\}\)/)||data.responseText.match(/"INNERTUBE_CONTEXT":([\w\W]*?\}),"INNERTUBE/))?.[1]||"{}",{client,request}=JSON.parse(context),apiKey&&client&&request?(client.hl="en","channel"===type?(channelId=data.responseText.match(/"channelId":"(.+?)"/)?.[1])?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,channelId:channelId}}):(logStatus.error('Error: Get "channelId" failed!'),{}):"likeVideo"===type?(videoId=data.responseText.match(//)?.[1],likeParams=data.responseText.match(/"likeParams":"(.*?)"/)?.[1],videoId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,videoId:videoId,likeParams:likeParams}}):(logStatus.error('Error: Get "videoId" failed!'),{})):(logStatus.error("Error: Unknown type"),{})):(logStatus.error('Error: Parameter "apiKey" not found!'),{})):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),{}):(logStatus.error(result+`:${statusText}(${status})`),{})}catch(error){return throwError_throwError(error,"Youtube.getInfo"),{}}})(link,type)}async#toggleChannel({link,doTask=!0,verify=!1}){try{var{params,needLogin}=await this.#getInfo(link,"channel"),{apiKey,client,request,channelId}=params||{};if(needLogin)scripts_echoLog({html:i18n("loginYtb")});else if(apiKey&&client&&request&&channelId){if(!doTask&&!verify&&this.whiteList.channels.includes(channelId))return scripts_echoLog({type:"whiteList",text:"Youtube.unfollowChannel",id:channelId}),!0;var logStatus=verify?scripts_echoLog({text:i18n("verifyingAuth","Youtube")}):scripts_echoLog({type:doTask?"followingYtbChannel":"unfollowingYtbChannel",text:channelId}),nowTime=parseInt(String((new Date).getTime()/1e3),10),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/subscription/${doTask?"":"un"}subscribe?key=${apiKey}&prettyPrint=false`,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/channel/"+channelId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client?.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify({context:{client:client,request:{sessionId:request?.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},channelIds:[channelId],params:doTask?"EgIIAhgA":"CgIIAhgA"})});if("Success"===result)return 200===data?.status?doTask&&(/"subscribed":true/.test(data.responseText)||data.responseText.includes("The subscription already exists"))||!doTask&&/"subscribed":false/.test(data.responseText)?(logStatus.success(),doTask&&!verify&&(this.tasks.channels=unique([...this.tasks.channels,link])),!0):verify&&data.responseText.includes("You may not subscribe to yourself")?(logStatus.success(),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}else scripts_echoLog({text:'"getYtbToken" failed'});return!1}catch(error){return throwError_throwError(error,"Youtube.toggleChannel"),!1}}async#toggleLikeVideo({link,doTask=!0}){try{var{params,needLogin}=await this.#getInfo(link,"likeVideo"),{apiKey,client,request,videoId,likeParams}=params||{};if(needLogin)scripts_echoLog({html:""+i18n("loginYtb")});else if(apiKey&&client&&request&&videoId&&likeParams){if(!doTask&&this.whiteList.likes.includes(videoId))return scripts_echoLog({type:"whiteList",text:"Youtube.unlikeVideo",id:videoId}),!0;var logStatus=scripts_echoLog({type:doTask?"likingYtbVideo":"unlikingYtbVideo",text:videoId}),nowTime=parseInt(String((new Date).getTime()/1e3),10),likeVideoData={context:{client:client,request:{sessionId:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},target:{videoId:videoId}};if(doTask){if(!likeParams)return logStatus.error("Empty likeParams"),!1;likeVideoData.params=likeParams}var{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/like/${doTask?"":"remove"}like?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/watch?v="+videoId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify(likeVideoData)});if("Success"===result)return 200===data?.status?doTask&&data.responseText.includes("Added to Liked videos")||!doTask&&(data.responseText.includes("Removed from Liked videos")||data.responseText.includes("Dislike removed"))?(logStatus.success(),doTask&&(this.tasks.likes=unique([...this.tasks.likes,link])),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}else scripts_echoLog({text:'"getYtbToken" failed'});return!1}catch(error){return throwError_throwError(error,"Youtube.toggleLikeVideo"),!1}}async toggle({doTask=!0,channelLinks=[],videoLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.youtube.channels||!doTask&&!globalOptions.undoTask.youtube.channels)scripts_echoLog({type:"globalOptionsSkip",text:"youtube.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)?.[1]:link);if(0/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)?.[1]:link);if(0!0)}catch(error){return throwError_throwError(error,"Youtube.toggle"),!1}}}let social_SteamASF=class{#asfOptions;#botName="asf";#groupInfo;async init(){try{var asfCommandsUrl=new URL("/Api/Command/",globalOptions.ASF.AsfIpcUrl),logStatus=(this.#asfOptions={url:asfCommandsUrl.href,method:"POST",responseType:"json",headers:{accept:"application/json","Content-Type":"application/json",Host:asfCommandsUrl.host,Origin:asfCommandsUrl.origin,Referer:asfCommandsUrl.href,Authentication:globalOptions.ASF.AsfIpcPassword}},globalOptions.ASF.AsfBotname&&(this.#botName=globalOptions.ASF.AsfBotname),scripts_echoLog({text:i18n("initingASF")})),{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:'{"Command":"!stats"}'});return"Success"===result?!0===data?.response?.Success&&"OK"===data.response.Message&&data.response.Result?(logStatus.success(),!0):(data?.response?.Result||data?.response?.Message?logStatus.error(data?.response?.Result||data.response.Message):logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.init"),!1}}async joinGroup(groupName){try{var logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!JOINGROUP ${this.#botName} `+groupName})});return"Success"===result?200===data?.status&&["已加入","已申请","Joined","Applied","Присоединился","costs"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.joinGroup"),!1}}async leaveGroup(groupName){try{if(this.#groupInfo||await this.#getGroupId()){var groupId=await this.#groupInfo[groupName];if(groupId){var logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!LEAVEGROUP ${this.#botName} `+groupId})});if("Success"===result)return 200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}return!1}catch(error){return throwError_throwError(error,"SteamASF.leaveGroup"),!1}}async#getGroupId(){try{var logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:"All"}),{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:"!GROUPLIST "+this.#botName})});return"Success"===result?200===data?.status&&data.response?.Result?.includes("|")?(this.#groupInfo=Object.fromEntries(data.response.Result.split("\n").map(line=>{var[,line,id]=line.trim().split("|");return line&&id?[line,id]:null}).filter(ele=>ele)),logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.getGroupID"),!1}}async addToWishlist(gameId){try{var logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!ADDWISHLIST ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.addToWishlist"),!1}}async removeFromWishlist(gameId){try{var logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!REMOVEWISHLIST ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.removeFromWishlist"),!1}}async toggleFollowGame(gameId,doTask){try{var logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!${doTask?"":"UN"}FOLLOWGAME ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.toggleFollowGame"),!1}}async toggleCurator(curatorId,doTask=!0){try{var logStatus=scripts_echoLog({type:doTask?"followingCurator":"unfollowingCurator",text:curatorId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!${doTask?"":"UN"}FOLLOWCURATOR ${this.#botName} `+curatorId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.toggleCurator"),!1}}async addLicense(id){try{var[type,ids]=id.split("-");if("appid"===type){var logStatus=scripts_echoLog({type:"addingFreeLicense",text:ids});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!addlicense ${this.#botName} app/`+ids})});return"Success"===result?200===data?.status&&["AlreadyPurchased","OK"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}if("subid"===type){var idsArr=ids.split(",");let logStatus=scripts_echoLog({type:"addingFreeLicenseSubid",text:ids});var{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!addlicense ${this.#botName} `+idsArr.map(id=>"sub/"+id).join(",")})});if("Success"===result){if(200===data?.status&&data.response?.Result){let resultLines=data.response.Result.split("\n");return idsArr.forEach(subid=>{let targetLine=resultLines.find(text=>text.includes(subid));targetLine&&["成功","Success","Успех"].find(text=>targetLine.includes(text))?scripts_echoLog({}).success(targetLine):scripts_echoLog({}).error(targetLine)}),!0}logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"SteamASF.addLicense"),!1}}async requestPlayTestAccess(id){try{var logStatus=scripts_echoLog({type:"requestingPlayTestAccess",text:id});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!REQUESTACCESS ${this.#botName} `+id})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.requestPlayTestAccess"),!1}}};class Steam extends external_Swal_namespaceObject{tasks;whiteList;#cache={group:{},officialGroup:{},forum:{},workshop:{},curator:{},...GM_getValue("steamCache")};#auth={};#storeInitialized=!1;#communityInitialized=!1;#area="CN";#areaStatus="end";#ASF;constructor(){super();var defaultTasksTemplate={groups:[],officialGroups:[],wishlists:[],follows:[],forums:[],workshops:[],workshopVotes:[],curators:[],curatorLikes:[],announcements:[],licenses:[],playtests:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.steam||{}}}async init(type="all"){try{if(globalOptions.ASF.AsfEnabled&&globalOptions.ASF.AsfIpcUrl&&globalOptions.ASF.AsfIpcPassword)return this.#ASF=new social_SteamASF,!!await this.#ASF.init()&&(this.#storeInitialized=!0,this.#communityInitialized=!0);if("store"===type){if(!this.#storeInitialized){let storeInitialized=await this.#updateStoreAuth();if(storeInitialized=storeInitialized||await this.#updateStoreAuthTab(),this.#storeInitialized=storeInitialized,!this.#storeInitialized)return scripts_echoLog({}).error(i18n("initFailed","Steam")),!1;scripts_echoLog({}).success(i18n("initSuccess","SteamStore"))}}else{if("community"!==type)return this.#storeInitialized&&this.#communityInitialized?(scripts_echoLog({}).success(i18n("initSuccess","Steam")),!0):(scripts_echoLog({}).error(i18n("initFailed","Steam")),!1);if(!this.#communityInitialized){let communityInitialized=await this.#getUserLink();if(communityInitialized||(communityInitialized=await this.#updateCommunityAuthTab(),GM_setValue("steamCommunityAuth",null)),this.#communityInitialized=communityInitialized,!this.#communityInitialized)return scripts_echoLog({}).error(i18n("initFailed","Steam")),!1;scripts_echoLog({}).success(i18n("initSuccess","SteamCommunity"))}}return!0}catch(error){return throwError_throwError(error,"Steam.init"),!1}}async#refreshToken(type="steamStore"){try{var host={steamStore:"store.steampowered.com",steamCommunity:"steamcommunity.com"},logStatus=scripts_echoLog({text:i18n("refreshingToken",i18n(type))}),formData=new FormData,{result,statusText,status,data}=(formData.append("redir",`https://${host[type]}/`),await tools_httpRequest({url:"https://login.steampowered.com/jwt/ajaxrefresh",method:"POST",responseType:"json",headers:{Host:"login.steampowered.com",Origin:"https://"+host[type],Referer:`https://${host[type]}/`},data:formData}));return"Success"===result?data?.response?.success?await this.#setStoreToken(data.response,type)?(logStatus.success(),!0):(logStatus.error("Error"),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.refreshToken"),!1}}async#setStoreToken(param,type){try{var host={steamStore:"store.steampowered.com",steamCommunity:"steamcommunity.com"},logStatus=scripts_echoLog({text:i18n("settingToken",i18n(type))}),formData=new FormData,{result,statusText,status,data}=(formData.append("steamID",param.steamID),formData.append("nonce",param.nonce),formData.append("redir",param.redir),formData.append("auth",param.auth),await tools_httpRequest({url:`https://${host[type]}/login/settoken`,method:"POST",headers:{Accept:"application/json, text/plain, */*",Host:host[type],Origin:"https://"+host[type]},data:formData}));return"Success"===result?200===data?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.setStoreToken"),!1}}async#updateStoreAuth(retry=!1){try{var storeSessionID,logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamStore"))}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"},fetch:!1,redirect:"manual"});return 200===data?.status?data.responseText.includes("data-miniprofile=")?(storeSessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1])?(this.#auth.storeSessionID=storeSessionID,logStatus.success(),!0):(logStatus.error('Error: Get "sessionID" failed'),!1):!await this.#refreshToken("steamStore")||(logStatus.warning(i18n("retry")),retry)?(logStatus.error("Error:"+i18n("needLoginSteamStore"),!0),!1):this.#updateStoreAuth(!0):[301,302].includes(data?.status)?!await this.#refreshToken("steamStore")||(logStatus.warning(i18n("retry")),retry)?(logStatus.error("Error:"+i18n("needLoginSteamStore"),!0),!1):this.#updateStoreAuth(!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.updateStoreAuth"),!1}}async#updateStoreAuthTab(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamStore"))});return await new Promise(resolve=>{let newTab=window.open("https://store.steampowered.com/","mozillaWindow","pop=1;"),listenerId=(GM_setValue("steamStoreAuth","update"),GM_addValueChangeListener("steamStoreAuth",(key,oldValue,newValue,remote)=>{GM_removeValueChangeListener(listenerId),newTab?.close(),newValue&&JSON.stringify(newValue)!==JSON.stringify(oldValue)?(this.#auth.storeSessionID=newValue.storeSessionID,logStatus.success(),resolve(!0)):(logStatus.error("Failed"),resolve(!1))}))})}catch(error){return throwError_throwError(error,"Steam.updateStoreAuthTab"),!1}}async#updateCommunityAuthTab(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamCommunity"))});return await new Promise(resolve=>{let newTab=window.open("https://steamcommunity.com/my","mozillaWindow","pop=1;"),listenerId=(GM_setValue("steamCommunityAuth","update"),GM_addValueChangeListener("steamCommunityAuth",(key,oldValue,newValue,remote)=>{GM_removeValueChangeListener(listenerId),newTab?.close(),newValue&&JSON.stringify(newValue)!==JSON.stringify(oldValue)?(this.#auth.steam64Id=newValue.steam64Id,this.#auth.userName=newValue.userName,this.#auth.communitySessionID=newValue.communitySessionID,logStatus.success(),resolve(!0)):(logStatus.error("Failed"),resolve(!1))}))})}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuthTab"),!1}}async#getUserLink(retry=!1){try{var logStatus=scripts_echoLog({text:i18n("gettingUserLink")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/my",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"},fetch:!1,redirect:"manual"});if(200===data?.status)if(data.finalUrl.includes("https://steamcommunity.com/login/home"))logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0);else{var steam64Id=data.responseText.match(/g_steamID = "(.+?)";/)?.[1],communitySessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1],userName=data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//)?.[1];if(steam64Id&&(this.#auth.steam64Id=steam64Id),userName&&(this.#auth.userName=userName),communitySessionID)return this.#auth.communitySessionID=communitySessionID,logStatus.success(),!0;logStatus.error('Error: Get "sessionID" failed')}else{if(302===data?.status)return!await this.#refreshToken("steamCommunity")||retry?(logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0),!1):(logStatus.warning(i18n("retry")),this.#getUserLink(!0));var location=data?.responseHeaders?.split("\n")?.find(header=>header.includes("location")?header.replace("loctation:","").trim():null);if(301===data?.status&&location?.includes("steamcommunity.com/id"))return logStatus.success(),await this.#updateCommunityAuth(data.finalUrl);301===data?.status&&location?.includes("https://steamcommunity.com/login/home")?logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0):logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuth"),!1}}async#updateCommunityAuth(url){try{var logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamCommunity"))}),{result,statusText,status,data}=await tools_httpRequest({url:url,method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"}});if("Success"===result)if(200===data?.status)if(data.finalUrl.includes("https://steamcommunity.com/login/home"))logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0);else{var steam64Id=data.responseText.match(/g_steamID = "(.+?)";/)?.[1],communitySessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1],userName=data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//)?.[1];if(steam64Id&&(this.#auth.steam64Id=steam64Id),userName&&(this.#auth.userName=userName),communitySessionID)return this.#auth.communitySessionID=communitySessionID,logStatus.success(),!0;logStatus.error('Error: Get "sessionID" failed')}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuth"),!1}}async#getAreaInfo(){try{var logStatus=scripts_echoLog({text:i18n("gettingAreaInfo")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/cart/",method:"GET"});if("Success"===result)if(200===data?.status){var cartConfigRaw=data.responseText.match(/data-cart_config="(.*?)"/)?.[1],temp=document.createElement("div"),cartConfigStr=(temp.innerHTML=cartConfigRaw||"{}",temp.textContent||temp.innerText);let cartConfig;try{cartConfig=JSON.parse(cartConfigStr)}catch(error){return logStatus.error("Error: get country info filed"),console.error(error),{}}if(cartConfig.rgUserCountryOptions){var userInfoRaw=data.responseText.match(/data-userinfo="(.*?)"/)?.[1],temp1=document.createElement("div"),userInfoStr=(temp1.innerHTML=userInfoRaw||"{}",temp1.textContent||temp1.innerText);let userInfo;try{userInfo=JSON.parse(userInfoStr)}catch(error){return logStatus.error("Error: get country info filed"),console.error(error),{}}var currentArea=userInfo.country_code,areas=Object.keys(cartConfig.rgUserCountryOptions).filter(area=>"help"!==area);if(currentArea&&0{let checker=setInterval(()=>{"waiting"!==this.#areaStatus&&(clearInterval(checker),resolve(!0))})}),this.#area===area||!area&&"CN"!==this.#area)return!0;this.#areaStatus="waiting";let aimedArea=area;if(!aimedArea){var{currentArea,areas}=await this.#getAreaInfo();if(!currentArea||!areas)return!(this.#areaStatus="error");if("CN"!==currentArea)return this.#areaStatus="skip",scripts_echoLog({text:"notNeededChangeArea"}),"skip";var anotherArea=areas.filter(area=>area&&"CN"!==area);if(!anotherArea||0===anotherArea.length)return this.#areaStatus="noAnotherArea",scripts_echoLog({text:"noAnotherArea"}),!1;[aimedArea]=anotherArea}var logStatus=scripts_echoLog({text:i18n("changingArea",aimedArea)}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/country/setcountry",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({cc:aimedArea,sessionid:this.#auth.storeSessionID})});if("Success"!==result)return this.#areaStatus="error",logStatus.error(result+`:${statusText}(${status})`),"CN";if(200!==data?.status||"true"!==data.responseText)return this.#areaStatus="error",logStatus.error(`Error:${data?.statusText}(${data?.status})`),"CN";{let currentArea=(await this.#getAreaInfo()).currentArea;return currentArea===aimedArea?(this.#areaStatus="success",logStatus.success(),currentArea):(this.#areaStatus="error",logStatus.error("Error: change country filed"),"CN")}}catch(error){return this.#areaStatus="error",throwError_throwError(error,"Steam.changeArea"),!1}}async#joinGroup(groupName){try{var logStatus,result,statusText,status,data;return this.#ASF?!!await this.#ASF.joinGroup(groupName)&&(this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({action:"join",sessionID:this.#auth.communitySessionID})}),"Success"===result?200!==data?.status||data.responseText.includes("grouppage_join_area")?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.success(),this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.joinGroup"),!1}}async#leaveGroup(groupName){try{if(this.whiteList.groups.includes(groupName))return scripts_echoLog({type:"whiteList",text:"Steam.leaveGroup",id:groupName}),!0;if(this.#ASF)return await this.#ASF.leaveGroup(groupName);var groupId=await this.#getGroupId(groupName);if(groupId){var logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"===result)return 200===data?.status&&data.finalUrl.includes("groups")&&0===$(data.responseText.replace(//g,"").toLowerCase()).find(`a[href='https://steamcommunity.com/groups/${groupName.toLowerCase()}']`).length?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.leaveGroup"),!1}}async#getGroupId(groupName){try{var logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:groupName}),groupId=this.#cache.group[groupName];if(groupId)return logStatus.success(),groupId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let groupId=data.responseText.match(/OpenGroupChat\( '([0-9]+)'/)?.[1];return groupId?(this.#setCache("group",groupName,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async#joinOfficialGroup(gameId){try{var logStatus,result,statusText,status,data,groupId;return this.#ASF?!!await this.#ASF.joinGroup(gameId)&&(this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]),!0):(logStatus=scripts_echoLog({type:"joiningSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/games/${gameId}?action=join&sessionID=`+this.#auth.communitySessionID,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}),"Success"===result?200!==data?.status||data.responseText.includes('id="publicGroupJoin"')?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.success(),this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]),(groupId=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)?.[1])&&this.#setCache("officialGroup",gameId,groupId),!0):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.joinOfficialGroup"),!1}}async#leaveOfficialGroup(gameId){try{if(this.whiteList.officialGroups.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.leaveOfficialGroup",id:gameId}),!0;if(this.#ASF)return await this.#ASF.leaveGroup(gameId);var groupId=await this.#getOfficialGroupId(gameId);if(groupId){var resultR,statusTextR,statusR,dataR,logStatus=scripts_echoLog({type:"leavingSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"===result)return 200===data?.status?({result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}),"Success"===resultR?200===dataR?.status&&dataR.responseText.includes('id="publicGroupJoin"')?(logStatus.success(),!0):(logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.leaveOfficialGroup"),!1}}async#getOfficialGroupId(gameId){try{var logStatus=scripts_echoLog({type:"gettingSteamOfficialGroupId",text:gameId}),groupId=this.#cache.officialGroup[gameId];if(groupId)return logStatus.success(),groupId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let groupId=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)?.[1];return groupId?(this.#setCache("officialGroup",gameId,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async#addToWishlist(gameId){try{if(this.#ASF)return!!await this.#ASF.addToWishlist(gameId)&&(this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0);var logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId}),{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/addtowishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"!==result||200!==data?.status||!0!==data.response?.success){var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==dataR?.status)return logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1;if("CN"===this.#area&&dataR.responseText.includes('id="error_box"'))return logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#addToWishlist(gameId);if((!dataR.responseText.includes('class="queue_actions_ctn"')||!dataR.responseText.includes('class="already_in_library"'))&&(dataR.responseText.includes('class="queue_actions_ctn"')&&dataR.responseText.includes('id="add_to_wishlist_area_success" style="display: none;')||!dataR.responseText.includes('class="queue_actions_ctn"')))return logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1}return logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0}catch(error){return throwError_throwError(error,"Steam.addToWishlist"),!1}}async#removeFromWishlist(gameId){try{if(this.whiteList.wishlists.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.removeFromWishlist",id:gameId}),!0;if(this.#ASF)return await this.#ASF.removeFromWishlist(gameId);var logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId}),{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/removefromwishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===data?.status&&!0===data.response?.success)return logStatus.success(),!0;var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==dataR?.status)return logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1;if("CN"===this.#area&&dataR.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result&&"skip"!==result?await this.#removeFromWishlist(gameId):!1}return dataR.responseText.includes('class="queue_actions_ctn"')&&(dataR.responseText.includes("ds_owned_flag ds_flag")||dataR.responseText.includes("add_to_wishlist_area"))?(logStatus.success(),!0):(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.removeFromWishlist"),!1}}async#toggleFollowGame(gameId,doTask){try{var logStatus,requestData,result,data,followed;return!doTask&&this.whiteList.follows.includes(gameId)?(scripts_echoLog({type:"whiteList",text:"Steam.unfollowGame",id:gameId}),!0):this.#ASF?!!await this.#ASF.toggleFollowGame(gameId,doTask)&&(doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId}),requestData={sessionid:this.#auth.storeSessionID,appid:gameId},{result,data}=(doTask||(requestData.unfollow="1"),await tools_httpRequest({url:"https://store.steampowered.com/explore/followgame/",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param(requestData)})),"Success"===result&&200===data?.status&&"true"===data.responseText?(logStatus.success(),!0):(followed=await this.#isFollowedGame(gameId),"CN"===this.#area&&"areaLocked"===followed?(logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#removeFromWishlist(gameId)):doTask===followed?(logStatus.success(),doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1)))}catch(error){return throwError_throwError(error,"Steam.toggleFollowGame"),!1}}async#isFollowedGame(gameId){try{var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===result?200===data?.status&&("CN"===this.#area&&data.responseText.includes('id="error_box"')?"areaLocked":"none"!==$(data.responseText.replace(//g,"")).find(".queue_control_button.queue_btn_follow>.btnv6_blue_hoverfade.btn_medium.queue_btn_active").css("display")):!1}catch(error){return throwError_throwError(error,"Steam.isFollowedGame"),!1}}async#toggleForum(gameId,doTask=!0){try{if(!doTask&&this.whiteList.forums.includes(gameId))scripts_echoLog({type:"whiteList",text:"Steam.unsubscribeForum",id:gameId});else{var forumId=await this.#getForumId(gameId);if(!forumId)return!1;var logStatus=scripts_echoLog({type:`${doTask?"":"un"}subscribingForum`,text:gameId}),[id,feature]=forumId.split("_"),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/forum/${id}/General/${doTask?"":"un"}subscribe/${feature||"0"}/`,method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.communitySessionID})});"Success"===result?200!==data?.status||1!==data.response?.success&&29!==data.response?.success?logStatus.error(`Error:${data?.statusText}(${data?.status})`):(doTask&&(this.tasks.forums=unique([...this.tasks.forums,gameId])),logStatus.success()):logStatus.error(result+`:${statusText}(${status})`)}return!0}catch(error){return throwError_throwError(error,"Steam.toggleForum"),!0}}async#getForumId(gameId){try{var logStatus=scripts_echoLog({type:"gettingForumId",text:gameId}),forumId=this.#cache.forum[gameId];if(forumId)return logStatus.success(),forumId;var{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/app/${gameId}/discussions/`,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let forumId=data.responseText?.match(/General_([\d]+(_[\d]+)?)/)?.[1];return forumId?(this.#setCache("forum",gameId,forumId),logStatus.success(),forumId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getForumId"),!1}}async#toggleFavoriteWorkshop(id,doTask=!0){try{if(!doTask&&this.whiteList.workshops.includes(id))return scripts_echoLog({type:"whiteList",text:"Steam.unfavoriteWorkshop",id:id}),!0;var appid=await this.#getWorkshopAppId(id);if(appid){var logStatus=scripts_echoLog({type:doTask?"favoritingWorkshop":"unfavoritingWorkshop",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/sharedfiles/${doTask?"":"un"}favorite`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,appid:appid,sessionid:this.#auth.communitySessionID})});if("Success"===result)return 200!==data?.status||data.responseText?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(doTask&&(this.tasks.workshops=unique([...this.tasks.workshops,id])),logStatus.success(),!0);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.toggleFavoriteWorkshop"),!1}}async#getWorkshopAppId(id){try{var logStatus=scripts_echoLog({type:"gettingWorkshopAppId",text:id}),appId=this.#cache.workshop[id];if(appId)return logStatus.success(),appId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/filedetails/?id="+id,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let appId=data.responseText.match(//)?.[1];return appId?(this.#setCache("workshop",id,appId),logStatus.success(),appId):(logStatus.error("Error: getWorkshopAppId failed"),!1)}}catch(error){return throwError_throwError(error,"Steam.getWorkshopAppId"),!1}}async#voteUpWorkshop(id){try{var logStatus=scripts_echoLog({type:"votingUpWorkshop",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/voteup",method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,sessionid:this.#auth.communitySessionID})});return"Success"===result?200===data?.status&&1===data.response?.success?logStatus.success():logStatus.error(`Error:${data?.statusText}(${data?.status})`):logStatus.error(result+`:${statusText}(${status})`),!0}catch(error){return throwError_throwError(error,"Steam.voteupWorkshop"),!0}}async#toggleCurator(curatorId,doTask=!0){try{var logStatus,result,statusText,status,data;return!doTask&&this.whiteList.curators.includes(curatorId)?(scripts_echoLog({type:"whiteList",text:"Steam.unfollowCurator",id:curatorId}),!0):this.#ASF?await this.#ASF.toggleCurator(curatorId,doTask):(logStatus=scripts_echoLog({type:doTask?"followingCurator":"unfollowingCurator",text:curatorId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/curators/ajaxfollow",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({clanid:curatorId,sessionid:this.#auth.storeSessionID,follow:doTask}),dataType:"json"}),"Success"===result?200===data?.status&&1===data.response?.success?.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(`+data?.response?.success||data?.status+")"),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.toggleCurator"),!1}}async getCuratorId(path,name){try{var logStatus=scripts_echoLog({type:"gettingCuratorId",text:path+"/"+name}),curatorId=this.#cache.curator[path+"/"+name];if(curatorId)return logStatus.success(),curatorId;var{result,statusText,status,data}=await tools_httpRequest({url:`https://store.steampowered.com/${path}/`+name,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let curatorId=data.responseText.match(/g_pagingData.*?"clanid":([\d]+)/)?.[1];return curatorId?(this.#setCache("curator",path+"/"+name,curatorId),logStatus.success(),curatorId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getCuratorID"),!1}}async#toggleCuratorLike(link,doTask=!0){try{var curatorId,[path,name]=link.split("/");return path&&name?!!(curatorId=await this.getCuratorId(path,name))&&await this.#toggleCurator(curatorId,doTask):(scripts_echoLog({text:i18n("errorLink",link)}),!1)}catch(error){return throwError_throwError(error,"Steam.toggleCuratorLike"),!1}}async#getAnnouncementParams(appId,viewId){try{var clanid,gid,logStatus=scripts_echoLog({type:"gettingAnnouncementParams",text:appId,id:viewId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://store.steampowered.com/events/ajaxgetpartnerevent?appid=${appId}&announcement_gid=${viewId}&lang_list=6_0&last_modified_time=0&origin=https:%2F%2Fstore.steampowered.com&for_edit=false`,method:"GET",responseType:"json",headers:{Host:"store.steampowered.com",Referer:`https://store.steampowered.com/news/app/${appId}/view/`+viewId}});return"Success"===result?200===data?.status&&1===data?.response?.success?({clanid,gid}=data.response.event?.announcement_body||{},clanid?(logStatus.success(),{clanId:clanid,gid:gid}):(logStatus.error(`Error:${data.statusText}(${data.status})`),{})):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),{}):(logStatus.error(result+`:${statusText}(${status})`),{})}catch(error){return throwError_throwError(error,"Steam.likeAnnouncement"),{}}}async#likeAnnouncement(id){try{var[appId,viewId]=id.split("/");if(appId&&viewId){var{clanId,gid}=await this.#getAnnouncementParams(appId,viewId);if(clanId){var logStatus=scripts_echoLog({type:"likingAnnouncement",text:appId,id:viewId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/updated/ajaxrateupdate/"+(gid||viewId),method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:`https://store.steampowered.com/news/app/${appId}/view/`+viewId},data:$.param({sessionid:this.#auth.storeSessionID,voteup:1,clanid:clanId,ajax:1}),dataType:"json"});if("Success"===result)return 200===data?.status&&1===data.response.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}else scripts_echoLog({}).error(i18n("missParams")+"(id)");return!1}catch(error){return throwError_throwError(error,"Steam.likeAnnouncement"),!1}}async#appid2subid(id){try{var logStatus=scripts_echoLog({type:"gettingSubid",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+id,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;if("CN"===this.#area&&data.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result&&"skip"!==result?await this.#appid2subid(id):!1}var subid=data.responseText.match(/name="subid" value="([\d]+?)"/)?.[1];return subid?(logStatus.success(),subid):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.appid2subid"),!1}}async#getLicenses(){try{var logStatus=scripts_echoLog({text:i18n("gettingLicenses")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/dynamicstore/userdata/?t="+(new Date).getTime(),method:"GET",responseType:"json"});return"Success"===result?200===data?.status?(logStatus.success(),data.response?.rgOwnedPackages):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.getLicenses"),!1}}async#addLicense(id){try{if(this.#ASF)return await this.#ASF.addLicense(id);var[type,ids]=id.split("-");if("appid"===type){var subid=await this.#appid2subid(ids);if(subid){var logStatus=scripts_echoLog({type:"addingFreeLicense",text:ids});if(await this.#addFreeLicense(subid,logStatus)){var{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+ids,method:"GET"});if("Success"===result)return 200===data?.status?data.responseText.includes("ds_owned_flag ds_flag")||data.responseText.includes('class="already_in_library"')?(logStatus.success(),!0):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}return!1}if("subid"!==type)return!1;"CN"===this.#area&&(scripts_echoLog({}).success(i18n("tryChangeAreaNotice")),await this.#changeArea());var logStatusArr={},idsArr=ids.split(",");for(let subid of idsArr){let logStatus=scripts_echoLog({type:"addingFreeLicenseSubid",text:subid});if(!await this.#addFreeLicense(subid,logStatus))return!1;logStatusArr[subid]=logStatus}var licenses=await this.#getLicenses();if(!licenses)return!1;for(let subid of idsArr)licenses.includes(parseInt(subid,10))?logStatusArr[subid].success():logStatusArr[subid].error();return!0}catch(error){return throwError_throwError(error,"Steam.addLicense"),!1}}async#addFreeLicense(id,logStatusPre){try{var logStatus=logStatusPre||scripts_echoLog({type:"addingFreeLicenseSubid",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/checkout/addfreelicense",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/account/licenses/"},data:$.param({action:"add_to_cart",sessionid:this.#auth.storeSessionID,subid:id}),dataType:"json"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;if("CN"===this.#area&&data.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result?await this.#addFreeLicense(id):!1}return logStatus.success(),!0}catch(error){return throwError_throwError(error,"Steam.addFreeLicense"),!1}}async#requestPlayTestAccess(id){try{var logStatus,result,statusText,status,data;return this.#ASF?await this.#ASF.requestPlayTestAccess(id):(logStatus=scripts_echoLog({type:"requestingPlayTestAccess",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/ajaxrequestplaytestaccess/"+id,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/app/"+id},data:$.param({sessionid:this.#auth.storeSessionID}),dataType:"json"}),"Success"===result?200===data?.status&&1===data?.response?.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.requestPlayTestAccess"),!1}}async toggle({doTask=!0,groupLinks=[],officialGroupLinks=[],wishlistLinks=[],followLinks=[],forumLinks=[],workshopLinks=[],workshopVoteLinks=[],curatorLinks=[],curatorLikeLinks=[],announcementLinks=[],licenseLinks=[],playtestLinks=[]}){try{if(0<[...groupLinks,...officialGroupLinks,...forumLinks,...workshopLinks,...workshopVoteLinks].length&&!this.#communityInitialized)return scripts_echoLog({text:i18n("needInit")}),!1;if(0<[...wishlistLinks,...followLinks,...curatorLinks,...curatorLikeLinks,...announcementLinks,...licenseLinks,...playtestLinks].length&&!this.#storeInitialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.steam.groups||!doTask&&!globalOptions.undoTask.steam.groups)scripts_echoLog({type:"globalOptionsSkip",text:"steam.groups"});else{var realGroups=this.getRealParams("groups",groupLinks,doTask,link=>link.match(/groups\/(.+)\/?/)?.[1]);if(0link.match(/games\/(.+)\/?/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/\?id=([\d]+)/)?.[1]);if(0link.match(/\?id=([\d]+)/)?.[1]);if(doTask&&0link.match(/curator\/([\d]+)/)?.[1]),realCuratorLikes=this.getRealParams("curatorLikes",curatorLikeLinks,doTask,link=>link.match(/https?:\/\/store\.steampowered\.com\/(.*?)\/([^/?]+)/)?.slice(1,3).join("/"));if(0(link.includes("store.steampowered.com")?link.match(/store\.steampowered\.com\/news\/app\/([\d]+)\/view\/([\d]+)/):link.match(/steamcommunity\.com\/games\/([\d]+)\/announcements\/detail\/([\d]+)/))?.slice(1,3).join("/"));if(doTask&&0link.match(/app\/([\d]+)/)?.[1]);if(doTask&&globalOptions.doTask.steam.playtests&&0("CN"!==this.#area&&(scripts_echoLog({}).warning(i18n("steamFinishNotice")),await this.#changeArea("CN")),!0))}catch(error){return throwError_throwError(error,"Steam.toggle"),!1}}#setCache(type,name,id){try{this.#cache[type][name]=id,GM_setValue("steamCache",this.#cache)}catch(error){throwError_throwError(error,"Steam.setCache")}}}let social_Steam=Steam;class GiveawaySu{undoneTasks={steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],curatorLikeLinks:[],followLinks:[],forumLinks:[],announcementLinks:[],workshopVoteLinks:[],playtestLinks:[]},discord:{serverLinks:[]},instagram:{userLinks:[]},vk:{nameLinks:[]},twitch:{channelLinks:[]},reddit:{redditLinks:[]},youtube:{channelLinks:[],likeLinks:[]},twitter:{userLinks:[],retweetLinks:[]}};giveawayId;socialInitialized={discord:!1,instagram:!1,reddit:!1,twitch:!1,vk:!1,youtube:!1,steamStore:!1,steamCommunity:!1,twitter:!0};initialized=!1;social={};static test(){return/^https?:\/\/giveaway\.su\/giveaway\/view\/[\d]+/.test(window.location.href)}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){throwError_throwError(error,"Giveawaysu.after")}}init(){try{var logStatus=scripts_echoLog({text:i18n("initing")});return 0<$("a.steam-login").length?(window.open("/steam/redirect","_self"),logStatus.warning(i18n("needLogin")),!1):!!this.#getGiveawayId()&&(this.initialized=!0,logStatus.success(),!0)}catch(error){return throwError_throwError(error,"Giveawaysu.init"),!1}}async#classifyTask(){try{var logStatus=scripts_echoLog({text:i18n("getTasksInfo")}),pro=[],tasks=$("#actions tr");$("div.bind-discord").is(":visible")&&$("div.bind-discord a")[0].click(),$("div.bind-twitch").is(":visible")&&$("div.bind-twitch a")[0].click();for(let task of tasks)pro.push(new Promise(resolve=>{var td=$(task).find('td:not(".hidden")'),colorfulTask=td.eq(1).find('a:not([data-trigger="link"])'),colorlessTask=td.eq(2).find('a:not([data-trigger="link"])'),colorfulTask=0{try{if(!link)return null;let redirectLinksCache=GM_getValue("redirectLinks")||{};return redirectLinksCache[link],await tools_httpRequest({url:link,method:"GET"}).then(({data})=>data?.finalUrl?(redirectLinksCache[link]=data.finalUrl,GM_setValue("redirectLinks",redirectLinksCache),data.finalUrl):null)}catch(error){return throwError_throwError(error,"getRedirectLink"),null}})(colorfulTask.attr("href")).then(taskLink=>{if(!taskLink)return resolve(!1);taskIcon.includes("steam")&&/join/gi.test(taskName)?this.undoneTasks.steam.groupLinks.push(taskLink):/like.*announcement/gi.test(taskName)?this.undoneTasks.steam.announcementLinks.push(taskLink):/(follow|subscribe).*curator/gim.test(taskName)&&/^https?:\/\/store\.steampowered\.com\/curator\//.test(taskLink)?this.undoneTasks.steam.curatorLinks.push(taskLink):taskIcon.includes("steam")&&/follow|subscribe/gim.test(taskName)?this.undoneTasks.steam.curatorLikeLinks.push(taskLink):/subscribe.*steam.*forum/gim.test(taskName)?this.undoneTasks.steam.forumLinks.push(taskLink):taskIcon.includes("thumbs-up")&&/^https?:\/\/steamcommunity\.com\/sharedfiles\/filedetails\/\?id=[\d]+/.test(taskLink)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):taskIcon.includes("plus")&&/request.*playtest/gim.test(taskName)?this.undoneTasks.steam.playtestLinks.push(taskLink):taskIcon.includes("discord")||/join.*discord/gim.test(taskName)?this.undoneTasks.discord.serverLinks.push(taskLink):taskIcon.includes("instagram")||/follow.*instagram/gim.test(taskName)?this.undoneTasks.instagram.userLinks.push(taskLink):taskIcon.includes("twitch")||/follow.*twitch.*channel/gim.test(taskName)?this.undoneTasks.twitch.channelLinks.push(taskLink):taskIcon.includes("reddit")||/subscribe.*subreddit/gim.test(taskName)||/follow.*reddit/gim.test(taskName)?this.undoneTasks.reddit.redditLinks.push(taskLink):/watch.*art/gim.test(taskName)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):/subscribe.*youtube.*channel/gim.test(taskName)?this.undoneTasks.youtube.channelLinks.push(taskLink):/(watch|like).*youtube.*video/gim.test(taskName)||(taskIcon.includes("youtube")||taskIcon.includes("thumbs-up"))&&/(watch|like).*video/gim.test(taskName)?this.undoneTasks.youtube.likeLinks.push(taskLink):taskIcon.includes("vk")||/join.*vk.*group/gim.test(taskName)?this.undoneTasks.vk.nameLinks.push(taskLink):/(on twitter)|(Follow.*on.*Facebook)/gim.test(taskName)||(/wishlist.*game|add.*wishlist/gim.test(taskName)&&this.undoneTasks.steam.wishlistLinks.push(taskLink),/follow.*button/gim.test(taskName)&&this.undoneTasks.steam.followLinks.push(taskLink)),resolve(!0)}).catch(error=>(throwError_throwError(error,"Giveawaysu.classifyTask->getRedirectLink"),!1))}));return await Promise.all(pro),logStatus.success(),this.undoneTasks=this.#uniqueTasks(this.undoneTasks),!0}catch(error){return throwError_throwError(error,"Giveawaysu.classifyTask"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin&&0<$("a.steam-login").length&&window.open("/steam/redirect","_self"),!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLogin"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey&&0<$(".giveaway-ended").length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(({value})=>{value&&window.close()}),!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLeftKey"),!1}}#getGiveawayId(){var giveawayId=window.location.href.match(/\/view\/([\d]+)/)?.[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}async#bind(name,init){try{return{name:name,result:await init}}catch(error){return throwError_throwError(error,"GiveawaySu.bind"),{name:name,result:!1}}}async#initSocial(){try{var steamLength,steamCommunityLength,pro=[];let tasks=this.undoneTasks;return tasks.discord&&0[...total,...arr]).length&&!this.socialInitialized.discord&&(this.social.discord=new social_Discord,pro.push(this.#bind("discord",this.social.discord.init("do")))),tasks.instagram&&0[...total,...arr]).length&&!this.socialInitialized.instagram&&(this.social.instagram=new social_Instagram,pro.push(this.#bind("instagram",this.social.instagram.init()))),tasks.reddit&&0[...total,...arr]).length&&!this.socialInitialized.reddit&&(this.social.reddit=new social_Reddit,pro.push(this.#bind("reddit",this.social.reddit.init()))),tasks.twitch&&0[...total,...arr]).length&&!this.socialInitialized.twitch&&(this.social.twitch=new social_Twitch,pro.push(this.#bind("twitch",this.social.twitch.init()))),tasks.vk&&0[...total,...arr]).length&&!this.socialInitialized.vk&&(this.social.vk=new social_Vk,pro.push(this.#bind("vk",this.social.vk.init()))),tasks.youtube&&0[...total,...arr]).length&&!this.socialInitialized.youtube&&(this.social.youtube=new Youtube,pro.push(this.#bind("youtube",this.social.youtube.init()))),tasks.steam&&0<(steamLength=Object.values(tasks.steam).reduce((total,arr)=>[...total,...arr]).length)&&(this.social.steam||(this.social.steam=new social_Steam),0["groupLinks","forumLinks","workshopLinks","workshopVoteLinks"].includes(type)&&tasks.steam?.[type]?.length||0).reduce((total,number)=>total+number,0))&&!this.socialInitialized.steamStore&&pro.push(this.#bind("steamStore",this.social.steam.init("store"))),0{let checked=!0;for(var data of result)data.result?this.socialInitialized[data.name]=data.result:checked=!1;return checked})}catch(error){return throwError_throwError(error,"GiveawaySu.initSocial"),!1}}#uniqueTasks(allTasks){var social,types,result={};for([social,types]of Object.entries(allTasks)){result[social]={};for(var[type,tasks]of Object.entries(types))result[social][type]=unique(tasks)}return result}async#toggleTask(){try{var pro,tasks;return this.initialized||this.init()?!!await this.#classifyTask()&&!!await this.#initSocial()&&(pro=[],tasks=this.undoneTasks,"skip"!==this.socialInitialized.discord&&this.social.discord&&pro.push(this.social.discord.toggle({doTask:!0,...tasks.discord})),this.social.instagram&&pro.push(this.social.instagram.toggle({doTask:!0,...tasks.instagram})),this.social.reddit&&pro.push(this.social.reddit.toggle({doTask:!0,...tasks.reddit})),this.social.twitch&&pro.push(this.social.twitch.toggle({doTask:!0,...tasks.twitch})),this.social.vk&&pro.push(this.social.vk.toggle({doTask:!0,...tasks.vk})),this.social.youtube&&pro.push(this.social.youtube.toggle({doTask:!0,...tasks.youtube})),this.social.steam&&pro.push(this.social.steam.toggle({doTask:!0,...tasks.steam})),await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!0):!1}catch(error){return throwError_throwError(error,"GiveawaySu.toggleTask"),!1}}async doTask(){try{return $("#getKey").on("click",()=>{$("#auto-task-info-div").remove(),$(window.STYLE).remove(),$("#getKey").off()}),await this.#toggleTask()}catch(error){return throwError_throwError(error,"GiveawaySu.doTask"),!1}}async verifyTask(){try{var task;for(task of $("#actions tr")){var icon,button,href,$task=$(task);"adjs"!==$task.attr("data-action-id")&&("A"===(button=(icon=$task.find("i.glyphicon-refresh")).parent()).prop("tagName")?(href=button.attr("href"),button.attr("href","javascript:void(0);").attr("target","_self")[0].click(),button.attr("href",href)):icon.hasClass("spin")||icon.hasClass("glyphicon-ok")||(button[0].click(),await delay(1e3)))}}catch(error){throwError_throwError(error,"GiveawaySu.verifyTask")}}}let Giveawaysu=GiveawaySu,for_giveawaysu=__webpack_require__(738);if(window.STYLE=GM_addStyle(for_giveawaysu.A+`.swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4!important;grid-row:1/4!important;grid-template-columns:1fr 99fr 1fr;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px rgba(0,0,0,.075),0 1px 2px rgba(0,0,0,.075),1px 2px 4px rgba(0,0,0,.075),1px 3px 8px rgba(0,0,0,.075),2px 4px 16px rgba(0,0,0,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:700}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-container{display:grid;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;box-sizing:border-box;grid-template-areas:"top-start top top-end" "center-start center center-end" "bottom-start bottom-center bottom-end";grid-template-rows:minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto);grid-template-rows:minmax(min-content,auto) minmax(min-content,auto) minmax(min-content,auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}.swal2-container.swal2-backdrop-show,.swal2-container.swal2-noanimation{background:rgba(0,0,0,.4)}.swal2-container.swal2-backdrop-hide{background:0 0!important}.swal2-container.swal2-bottom-start,.swal2-container.swal2-center-start,.swal2-container.swal2-top-start{grid-template-columns:minmax(0,1fr) auto auto}.swal2-container.swal2-bottom,.swal2-container.swal2-center,.swal2-container.swal2-top{grid-template-columns:auto minmax(0,1fr) auto}.swal2-container.swal2-bottom-end,.swal2-container.swal2-center-end,.swal2-container.swal2-top-end{grid-template-columns:auto auto minmax(0,1fr)}.swal2-container.swal2-top-start>.swal2-popup{align-self:start}.swal2-container.swal2-top>.swal2-popup{grid-column:2;align-self:start;justify-self:center}.swal2-container.swal2-top-end>.swal2-popup,.swal2-container.swal2-top-right>.swal2-popup{grid-column:3;align-self:start;justify-self:end}.swal2-container.swal2-center-left>.swal2-popup,.swal2-container.swal2-center-start>.swal2-popup{grid-row:2;align-self:center}.swal2-container.swal2-center>.swal2-popup{grid-column:2;grid-row:2;align-self:center;justify-self:center}.swal2-container.swal2-center-end>.swal2-popup,.swal2-container.swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;align-self:center;justify-self:end}.swal2-container.swal2-bottom-left>.swal2-popup,.swal2-container.swal2-bottom-start>.swal2-popup{grid-column:1;grid-row:3;align-self:end}.swal2-container.swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;justify-self:center;align-self:end}.swal2-container.swal2-bottom-end>.swal2-popup,.swal2-container.swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;align-self:end;justify-self:end}.swal2-container.swal2-grow-fullscreen>.swal2-popup,.swal2-container.swal2-grow-row>.swal2-popup{grid-column:1/4;width:100%}.swal2-container.swal2-grow-column>.swal2-popup,.swal2-container.swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}.swal2-container.swal2-no-transition{transition:none!important}.swal2-popup{display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0,100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-title{position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-loader{display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 transparent #2778c4 transparent}.swal2-styled{margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px transparent;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}.swal2-styled.swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}.swal2-styled.swal2-deny{border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}.swal2-styled.swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}.swal2-styled.swal2-cancel:focus{box-shadow:0 0 0 3px rgba(110,120,129,.5)}.swal2-styled.swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}.swal2-styled:focus{outline:0}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em}.swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto!important;height:.25em;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}.swal2-timer-progress-bar{width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:2em auto 1em}.swal2-close{z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:0 0;color:#ccc;font-family:serif;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-close:focus{outline:0;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}.swal2-close::-moz-focus-inner{border:0}.swal2-html-container{z-index:1;justify-content:center;margin:1em 1.6em .3em;padding:0;overflow:auto;color:inherit;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em 2em 3px}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px transparent;color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em 2em 3px;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-file{width:75%;margin-right:auto;margin-left:auto;background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{flex-shrink:0;margin:0 .4em}.swal2-input-label{display:flex;justify-content:center;margin:1em auto 0}.swal2-validation-message{align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:.25em solid transparent;border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-warning.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-warning.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .5s;animation:swal2-animate-i-mark .5s}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-info.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-info.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .8s;animation:swal2-animate-i-mark .8s}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-question.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-question.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-question-mark .8s;animation:swal2-animate-question-mark .8s}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@-webkit-keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@-webkit-keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{background-color:transparent!important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:transparent;pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}`),"discord.com"===window.location.hostname){external_Swal_namespaceObject=window.localStorage;if("#auth"===window.location.hash){window.localStorage.removeItem=()=>!0;var discordAuth=external_Swal_namespaceObject?.getItem("token")?.replace(/^"|"$/g,"");discordAuth&&0{if("www.twitch.tv"===window.location.hostname&&"#auth"===window.location.hash&&(authToken=external_Cookies_namespaceObject.get("auth-token"),!!external_Cookies_namespaceObject.get("login")?(GM_setValue("twitchAuth",{authToken:authToken,clientId:commonOptions?.headers?.["Client-ID"]}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"x.com"===window.location.hostname&&"#auth"===window.location.hash){var authToken=external_Cookies_namespaceObject.get("ct0");let isLogin=!!external_Cookies_namespaceObject.get("twid");isLogin&&authToken?(GM_setValue("twitterAuth",{ct0:authToken}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))}if("www.youtube.com"===window.location.hostname&&"#auth"===window.location.hash&&((authToken=external_Cookies_namespaceObject.get("__Secure-3PAPISID"))?(GM_setValue("youtubeAuth",{PAPISID:authToken}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"www.reddit.com"===window.location.hostname&&("#auth"===window.location.hash||"#auth"===GM_getValue("redditAuth"))){authToken=$("#redesign-beta-optin-btn");if(0

    `),await website.after(),$("#auto-do-task").on("click",()=>{website.doTask()}),$("#auto-verify-task").on("click",()=>{website.verifyTask()}),console.log("%c%s","color:#1bbe1a","Auto Task GS特供脚本初始化完成!")}})}})(); \ No newline at end of file diff --git a/dist/auto-task-v4-for-giveawaysu.user.js b/dist/auto-task-v4-for-giveawaysu.user.js index 14ca9de..73880a7 100644 --- a/dist/auto-task-v4-for-giveawaysu.user.js +++ b/dist/auto-task-v4-for-giveawaysu.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name auto-task-v4-for-giveawaysu // @namespace auto-task-v4-for-giveawaysu -// @version 4.4.12 +// @version 4.4.13 // @description 赠Key站自动任务 // @author HCLonely // @license MIT @@ -92,4 +92,4 @@ console.log('%c%s', 'color:blue', 'Auto Task GS特供脚本开始加载'); `+error.stack)}let httpRequest_httpRequest=async(options,times=0)=>{window.TRACE&&console.trace("%cAuto-Task[Debug]:","color:blue");try{var result=await new Promise(resolve=>{options.dataType&&(options.responseType=options.dataType);var requestObj={timeout:3e4,ontimeout(data){resolve({result:"Error",statusText:"Timeout",status:601,data:data,options:options})},onabort(data){resolve({result:"Error",statusText:"Aborted",status:602,data:data,options:options})},onerror(data){resolve({result:"Error",statusText:"Error",status:603,data:data,options:options})},onload(data){if("json"===options.responseType&&data?.response&&"object"!=typeof data.response)try{data.response=JSON.parse(data.responseText)}catch(error){}resolve({result:"Success",statusText:"Load",status:600,data:data,options:options})},...options};GM_xmlhttpRequest(requestObj)});return window.DEBUG&&console.log("%cAuto-Task[httpRequest]:","color:blue",JSON.stringify(result)),600!==result.status&×<2?await httpRequest_httpRequest(options,times+1):result}catch(error){return console.log("%cAuto-Task[httpRequest]:","color:red",JSON.stringify({errorMsg:error,options:options})),throwError_throwError(error,"httpRequest"),{result:"JsError",statusText:"Error",status:604,error:error,options:options}}},tools_httpRequest=httpRequest_httpRequest,scripts_echoLog=({type,text,html,id})=>{let emptyStatus={success:()=>emptyStatus,error:()=>emptyStatus,warning:()=>emptyStatus,info:()=>emptyStatus,view:()=>emptyStatus};try{let ele;if(type)switch(type){case"joiningSteamGroup":case"leavingSteamGroup":case"gettingSteamGroupId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"joiningSteamOfficialGroup":case"leavingSteamOfficialGroup":case"gettingSteamOfficialGroupId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"subscribingForum":case"unsubscribingForum":case"gettingForumId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"followingCurator":case"unfollowingCurator":case"gettingCuratorId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"addingToWishlist":case"removingFromWishlist":case"followingGame":case"unfollowingGame":case"gettingSubid":case"addingFreeLicense":case"requestingPlayTestAccess":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"addingFreeLicenseSubid":ele=$(`
  • ${i18n("addingFreeLicense")}[${text}]...
  • `);break;case"favoritingWorkshop":case"unfavoritingWorkshop":case"gettingWorkshopAppId":case"votingUpWorkshop":ele=$(`
  • ${i18n(type)}[ ${text}]...
  • `);break;case"gettingAnnouncementParams":case"likingAnnouncement":ele=$(`
  • ${i18n(type)}[ ${id}]...
  • `);break;case"joiningDiscordServer":case"gettingDiscordGuild":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"leavingDiscordServer":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"updateDiscordAuth":ele=$(`
  • ${i18n("updateDiscordAuth")}
  • `);break;case"followingTwitchChannel":case"unfollowingTwitchChannel":case"gettingTwitchChannelId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingInsUserId":case"followingIns":case"unfollowingIns":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingTwitterUserId":case"followingTwitterUser":case"unfollowingTwitterUser":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"retweetting":case"unretweetting":ele=$(`
  • ${i18n(type)}${text}...
  • `);break;case"joiningReddit":case"leavingReddit":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"followingRedditUser":case"unfollowingRedditUser":ele=$(`
  • ${i18n(type)}[ - ${text?.replace("u_","")}]...
  • `);break;case"followingYtbChannel":case"unfollowingYtbChannel":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"likingYtbVideo":case"unlikingYtbVideo":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingVkId":case"joiningVkGroup":case"leavingVkGroup":case"joiningVkPublic":case"leavingVkPublic":case"sendingVkWall":case"deletingVkWall":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"visitingLink":ele=$(`
  • ${i18n("visitingLink")}[${text}]...
  • `);break;case"verifyingInsAuth":case"text":ele=$(`
  • ${i18n(text)}
  • `);break;case"html":ele=$(text||html);break;case"whiteList":ele=$(`
  • ${i18n("skipTask")}[${text}(${id})](${i18n("whiteList")})
  • `);break;case"globalOptionsSkip":ele=$(`
  • ${i18n("skipTaskOption")}${text}
  • `);break;default:ele=$(`
  • ${i18n("unKnown")}:${type}(${text})...
  • `)}else ele=text?$(`
  • ${i18n(text)}
  • `):html?$(html):$("
  • ");return ele.addClass("card-text"),$("#auto-task-info").append(ele),ele[0]?.scrollIntoView(),{font:ele.find("font"),success(text="Success",html=!1){return this.font?.attr("class","").addClass("success"),html?this.font?.html(text):this.font?.text(text),this},error(text="Error",html=!1){return this.font?.attr("class","").addClass("error"),html?this.font?.html(text):this.font?.text(text),this},warning(text="Warning",html=!1){return this.font?.attr("class","").addClass("warning"),html?this.font?.html(text):this.font?.text(text),this},info(text="Info",html=!1){return this.font?.attr("class","").addClass("info"),html?this.font?.html(text):this.font?.text(text),this},view(){return this.font?.[0].scrollIntoView(),this}}}catch(error){return throwError_throwError(error,"echoLog"),emptyStatus}},unique=array=>{try{return[...new Set(array)]}catch(error){return throwError_throwError(error,"unique"),[]}},delay=(time=1e3)=>new Promise(resolve=>{setTimeout(()=>{resolve(!0)},time)}),defaultGlobalOptions={doTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0,workshopVotes:!0,announcements:!0,licenses:!0,playtests:!0}},undoTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0}},ASF:{AsfEnabled:!1,AsfIpcUrl:"",AsfIpcPassword:"",AsfBotname:"asf"},position:{buttonSideX:"right",buttonSideY:"top",buttonDistance:"15,30",showButtonSideX:"right",showButtonSideY:"top",showButtonDistance:"15,30",logSideX:"right",logSideY:"bottom",logDistance:"10,10"},hotKey:{doTaskKey:"alt + d",undoTaskKey:"alt + u",toggleLogKey:"alt + l"},other:{twitterVerifyId:"783214",youtubeVerifyChannel:"UCrXUsMBcfTVqwAS7DKg9C0Q",autoUpdateSource:"jsdelivr",language:"zh",checkLogin:!0,checkLeftKey:!0,defaultShowButton:!0,defaultShowLog:!0,debug:!1,receivePreview:!0}},assignObject=(external_Swal_namespaceObject=GM_getValue("globalOptions")||{},(obj1,obj2)=>{try{var key,value,newObj={};for([key,value]of Object.entries(obj1))"[object Object]"===Object.prototype.toString.call(value)&&"[object Object]"===Object.prototype.toString.call(obj2[key])?newObj[key]=assignObject(value,obj2[key]):newObj[key]=obj2[key]??value;return newObj}catch(error){return throwError_throwError(error,"assignObject"),defaultGlobalOptions}}),globalOptions=assignObject(defaultGlobalOptions,external_Swal_namespaceObject),languages={zh:{website:"网站",type:"类型",edit:"编辑",whiteList:"白名单",skipTask:"跳过撤销任务",whiteListOptions:"白名单设置",changeWhiteListOption:"设置白名单(%0)",whiteListNotFound:"找不到此项白名单: %0",changeWhiteListSuccess:"白名单修改成功,刷新生效!",changeWebsiteOptions:"网站设置",changeGlobalOptions:"全局设置",ok:"是",save:"保存",close:"关闭",return:"返回",option:"选项",value:"值",websiteOptions:"当前网站设置",changeWebsiteOptionsSuccess:"更改当前网站设置成功,刷新生效!",changeGlobalOptionsSuccess:"更改全局设置成功,刷新生效!",needLogin:"请先登录!",getTasksInfo:"正在获取并处理任务信息...",gettingKey:"正在获取Key...",verifyingTask:"正在验证任务",notice:"自动任务脚本提醒",noKeysLeft:"此页面已经没有剩余key了,是否关闭?",giveawayEnded:"此活动已结束,是否关闭?",giveawayNotWork:"此活动因某些原因(已结束/暂停/未开始...)不可用(如果是脚本误判请及时反馈),是否关闭?",confirm:"确定",cancel:"取消",unKnown:"未知",unKnownTaskType:"未识别的任务",doing:"正在做任务",allTasksComplete:"所有任务已完成!",getTaskIdFailed:"获取任务Id失败!",initSuccess:"%0 初始化成功!",initFailed:"%0 初始化失败!",errorLink:"链接错误: %0",needInit:"请先初始化",verifyingAuth:"正在验证%0凭证...",updatingAuth:"正在更新%0凭证...",refreshingToken:"正在刷新%0凭证...",settingToken:"正在设置%0凭证...",initing:"正在初始化...",getFailed:"获取%0失败!",checkLoginFailed:"检测登录状态失败!",checkLeftKeyFailed:"检测剩余Key失败!",userId:"用户Id",joiningGiveaway:"正在加入赠Key",needJoinGiveaway:"需要先加入赠Key",cannotUndo:"此网站不支持取消任务",verifyAuth:"正在验证 %0 凭证...",closePageNotice:"如果此页面没有自动关闭,请自行关闭本页面。",errorReport:"检测到脚本报错,是否前往反馈BUG?",visitingLink:"正在访问链接: ",doTask:"做任务",undoTask:"撤销任务",verifyTask:"验证任务",getKey:"获取Key",selectAll:"全选",selectNone:"全不选",invertSelect:"反选",doFreeTask:"加入免费赠品",doPointTask:"加入点数赠品",skipTaskOption:"设置中已配置跳过任务",other:"其他",globalOptions:"全局设置",checkLogin:"登录检测
    需要登录的网站自动登录,部分本网站支持",checkLeftKey:"剩余Key检测
    赠Key活动结束提示是否关闭,部分本网站支持",twitterVerifyId:"通过尝试关注该账号验证Twitter凭证
    默认为Twitter官方帐号 783214
    不想关注官方账号可以改为自己的帐号",youtubeVerifyChannel:"通过尝试订阅该频道验证YouTube凭证
    默认为YouTube官方频道 UCrXUsMBcfTVqwAS7DKg9C0Q
    不想关注官方频道可以改为自己的频道",autoUpdateSource:"更新源
    github: 需代理,实时更新
    jsdelivr: 可不用代理,更新有延迟
    standby: 备用
    auto: 依次使用github, jsdelivr, standby源进行尝试更新",saveGlobalOptions:"保存全局设置",settingPage:"设置页面",name:"名称",version:"版本",scriptManager:"脚本管理器",script:"脚本",environment:"环境",os:"系统",browser:"浏览器",getId:"获取 %0 id",getTwitterUserId:"获取Twitter用户id(获取id功能仅在设置页面可用)",getYoutubeChannelId:"获取Youtube频道id(获取id功能仅在设置页面可用)",showButton:"显示按钮",hideButton:"隐藏按钮",showLog:"显示日志",hideLog:"隐藏日志",defaultShowButton:"默认显示按钮",defaultShowLog:"默认显示日志",debug:"输出调试日志,不要开启此选项!",receivePreview:"接收预览版更新",position:"组件位置",buttonSideX:"按钮区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",buttonSideY:"按钮区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",buttonDistance:"按钮区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",showButtonSideX:"显示按钮水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",showButtonSideY:"显示按钮垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",showButtonDistance:"显示按钮距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",logSideX:"日志区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",logSideY:"日志区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",logDistance:"日志区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",hotKey:"快捷键",doTaskKey:"做任务快捷键
    (实时预览功能仅在设置页面可用)",undoTaskKey:"撤销任务快捷键
    (实时预览功能仅在设置页面可用)",toggleLogKey:"显示/隐藏日志快捷键
    (实时预览功能仅在设置页面可用)",tasksHistory:"任务历史",clearHistory:"清空历史",clearHistoryFinished:"已清空任务历史!",deleteTask:"删除任务",lastChangeTime:"最后一次修改时间",clearTaskFinished:"删除以下任务完成!",clearTaskFailed:"删除任务失败,没有找到任务名!",syncData:"数据同步",settingData:"正在上传数据...",gettingData:"正在获取数据...",help:"帮助",fileName:"文件名",upload2gist:"同步到Gist",downloadFromGist:"从Gist同步",saveAndTest:"保存配置并测试",testSuccess:"测试成功!",testFailed:"测试失败!",saveAndTestNotice:"请先保存配置并测试!",processingData:"正在处理数据...",updatingData:"正在上传数据...",syncDataSuccess:"同步数据成功!",syncDataFailed:"同步数据失败,请在控制台查看错误信息!",downloadingData:"正在下载数据...",checkedNoData:"没有检测到远程数据,请确认配置是否正确!",savingData:"正在保存数据...",syncHistory:"同步任务历史",checkUpdateFailed:"检测更新失败",newVersionNotice:'检测到新版本V%0, 点此更新',language:"语言
    目前仅支持zh: 中文, en: 英文",gistOptions:"Gist 设置",swalNotice:"检测到您第一次安装V4版本脚本,请前往阅读用前必读内容!",echoNotice:'检测到您第一次安装V4版本脚本,请点此前往阅读用前必读内容!',noticeLink:"https://auto-task-doc.js.org/guide/#用前必读",toGithub:"前往Github反馈",toKeylol:"前往其乐论坛反馈",copySuccess:"错误信息已复制到剪切板,是否前往其乐论坛反馈?",copyFailed:"请复制下方错误信息后前往Keylol论坛反馈!",updateText:"%0 版本更新内容:",Active:"进行中",Ended:"已结束",Banned:"已封禁",Paused:"已暂停",notStart:"未开始",noRemoteData:"检测到远程无数据",errorRemoteDataFormat:"远程数据格式错误",updateHistory:'历史更新记录点此查看',AsfEnabled:'使用ASF做Steam相关任务(需ASFEnhance插件)',AsfIpcUrl:"ASF IPC 地址",AsfIpcPassword:"ASF IPC 密码",versionNotMatched:"脚本管理器版本过低,需TamperMonkey >= 5.2.0或TamperMonkey Beta >= 5.2.6196",groups:"组",officialGroups:"官方组",wishlists:"愿望单",follows:"游戏关注",forums:"论坛",workshops:"创意工坊收藏",curators:"鉴赏家",workshopVotes:"创意工坊点赞",announcements:"社区通知",steamCommunity:"Steam社区",steamStore:"Steam商店",licenses:"入库免费游戏",playtests:"请求访问权限",needLoginSteamStore:'请先登录Steam商店',needLoginSteamCommunity:'请先登录Steam社区',joiningSteamGroup:"正在加入Steam组",leavingSteamGroup:"正在退出Steam组",gettingSteamGroupId:"正在获取Steam组Id",joiningSteamOfficialGroup:"正在加入Steam官方组",leavingSteamOfficialGroup:"正在退出Steam官方组",gettingSteamOfficialGroupId:"正在获取Steam官方组Id",subscribingForum:"正在订阅Steam论坛",unsubscribingForum:"正在取消订阅Steam论坛",gettingForumId:"正在获取Steam论坛Id",followingCurator:"正在关注Steam鉴赏家",unfollowingCurator:"正在取关Steam鉴赏家",gettingCuratorId:"正在获取Steam鉴赏家Id",addingToWishlist:"正在添加游戏到Steam愿望单",removingFromWishlist:"正在从Steam愿望单移除游戏",followingGame:"正在关注Steam游戏",unfollowingGame:"正在取关Steam游戏",favoritingWorkshop:"正在收藏Steam创意工坊物品",unfavoritingWorkshop:"正在取消收藏Steam创意工坊物品",gettingWorkshopAppId:"正在获取Steam创意工坊物品Id",votingUpWorkshop:"正在点赞Steam创意工坊物品",gettingAnnouncementParams:"正在获取Steam通知信息",likingAnnouncement:"正在点赞Steam通知",changingArea:"正在更换Steam地区: %0...",notNeededChangeArea:"当前地区不需要更换",noAnotherArea:"请检测是否开启正确开启代理",gettingAreaInfo:"正在获取Steam地区信息...",changeAreaNotice:"疑似锁区游戏,尝试换区执行",steamFinishNotice:"Steam任务完成,尝试将购物车地区换回CN",gettingSubid:"正在获取游戏subid",addingFreeLicense:"正在入库",missParams:"缺少参数",gettingLicenses:"正在获取Licenses...",requestingPlayTestAccess:"正在请求访问权限",tryChangeAreaNotice:"此功能无法检测游戏是否限区,因此会尝试换区后再入库,换区失败也不影响后续入库",gettingUserLink:"正在获取Steam用户社区链接...",retry:"重试",initingASF:"正在初始化ASF...",servers:"服务器",joiningDiscordServer:"正在加入Discord服务器",leavingDiscordServer:"正在退出Discord服务器",gettingDiscordGuild:"正在获取Discord服务器Id",getDiscordAuthFailed:"获取Discord凭证失败,请检测Discord帐号是否已登录",discordImportantNotice:"重要提醒!!!",discordImportantNoticeText:"由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!",continue:"继续",skipDiscordTask:"跳过Discord任务",continueAndDontRemindAgain:"继续且不再提醒",users:"用户",loginIns:'请先登录Instagram',insBanned:"您的Instagram账户已被封禁",verifyingInsAuth:"正在验证Instagram凭证...",gettingInsUserId:"正在获取Instagram用户Id",followingIns:"正在关注Instagram用户",unfollowingIns:"正在取关Instagram用户",reddits:"社区/用户",loginReddit:'请先登录Reddit',changingRedditVersion:"正在切换Reddit为新版页面...",joiningReddit:"正在加入Reddit社区",leavingReddit:"正在退出Reddit社区",followingRedditUser:"正在关注Reddit用户",unfollowingRedditUser:"正在取关Reddit用户",channels:"频道",followingTwitchChannel:"正在关注Twitch频道",unfollowingTwitchChannel:"正在取关Twitch频道",gettingTwitchChannelId:"正在获取Twitch频道Id",checkingTwitchIntegrity:"正在检查Twitch完整性...",twitterUser:"推特用户",retweets:"转推",gettingTwitterUserId:"正在获取推特用户Id",followingTwitterUser:"正在关注推特用户",unfollowingTwitterUser:"正在取关推特用户",retweetting:"正在转推",unretweetting:"正在撤销转推",names:"组/社区/动态",loginVk:'请先登录Vk',gettingVkId:"正在获取Vk任务Id",joiningVkGroup:"正在加入Vk组",leavingVkGroup:"正在退出Vk组",joiningVkPublic:"正在加入Vk社区",leavingVkPublic:"正在退出Vk社区",sendingVkWall:"正在转发Vk动态",deletingVkWall:"正在撤销转发Vk动态",youtubeChannel:"YouTube频道",likes:"点赞",loginYtb:'请先登录YouTube',tryUpdateYtbAuth:'请尝试更新YouTube凭证',gettingYtbToken:"正在获取YouTube Token...",followingYtbChannel:"正在订阅YouTube频道",unfollowingYtbChannel:"正在退订YouTube频道",likingYtbVideo:"正在点赞YouTube视频",unlikingYtbVideo:"正在取消点赞YouTube视频",giveKeyNoticeBefore:"每次验证间隔15s",giveKeyNoticeAfter:'如果没有key, 请在https://givekey.ru/profile查看',noPoints:"点数不够,跳过抽奖",getNeedPointsFailed:"获取所需点数失败,跳过抽奖",joiningLottery:"正在加入抽奖",doingGleamTask:"正在做Gleam任务...",gettingGleamLink:"正在获取Gleam任务链接...",gleamTaskNotice:"如果此页面长时间未关闭,请完成任一任务后自行关闭!",verifiedGleamTasks:"已尝试验证所有任务,验证失败的任务请尝试手动验证或完成!",campaign:"检测到人机验证,请完成验证后重新验证任务!",gsNotice:'为避免得到"0000-0000-0000"key, 已自动屏蔽"Grab Key"按钮,获取key时请关闭脚本!',giveeClubVerifyNotice:"正在验证任务...",giveeClubVerifyFinished:"请等待验证完成后自行加入赠Key",doingKeyhubTask:"正在做Keyhub任务...",SweepWidgetNotice:"正在处理并验证任务,每次验证任务有1~3s间隔防止触发验证过快警告...",tasksNotCompleted:"任务未完成",confirmingTask:"正在跳过警告页面..."},en:{website:"Website",type:"Type",edit:"Edit",whiteList:"Whitelist",skipTask:"Skip undo task",whiteListOptions:"Whitelist options",changeWhiteListOption:"Whitelist option(%0)",whiteListNotFound:"Cannot find this whitelist: %0",changeWhiteListSuccess:"The whitelist is successfully modified, and the page refresh will take effect!",changeWebsiteOptions:"Website options",changeGlobalOptions:"Global options",ok:"OK",save:"Save",close:"Close",return:"Return",option:"Option",value:"Value",websiteOptions:"Current website settings",changeWebsiteOptionsSuccess:"The current website setting is changed successfully, and the page refresh will take effect!",changeGlobalOptionsSuccess:"The global setting is changed successfully, and the refresh will take effect!",needLogin:"Please log in first!",getTasksInfo:"Obtaining and processing task information...",gettingKey:"Getting Key...",verifyingTask:"Verifying task",notice:"Automatic task script notice",noKeysLeft:"There are no more keys left on this page. Do you want to close it?",giveawayEnded:"This event has ended, do you want to close it?",giveawayNotWork:"This activity is unavailable for some reasons (banned/ended/paused/not started...) (if it is a script misjudgment, please give us feedback in time), is it closed?",confirm:"Confirm",cancel:"Cancel",unKnown:"Unknown",unKnownTaskType:"Unrecognized task",doing:"Doing a task",allTasksComplete:"All tasks have been completed!",getTaskIdFailed:"Failed to obtain task Id!",initSuccess:"%0 was initialized successfully!",initFailed:"%0 initialization failed!",errorLink:"Link error: %0",needInit:"Please initialize first",verifyingAuth:"Verifying %0 token...",updatingAuth:"Update %0 token...",initing:"Initializing...",getFailed:"Failed to get %0!",checkLoginFailed:"Failed to detect login status!",checkLeftKeyFailed:"Failed to detect the remaining keys!",userId:"User Id",joiningGiveaway:"Joining giveaway",needJoinGiveaway:"Need to join the giveaway first",cannotUndo:"This website does not support canceling tasks",verifyAuth:"Verifying %0 token...",closePageNotice:"f this page does not close automatically, please close this page yourself.",errorReport:"A script error is detected, do you want to report the BUG?",visitingLink:"Visiting link: ",doTask:"DoTask",undoTask:"UndoTask",verifyTask:"Verify",getKey:"GetKey",selectAll:"SelectAll",selectNone:"SelectNone",invertSelect:"InvertSelect",doFreeTask:"FreeTask",doPointTask:"PointTask",skipTaskOption:"Skip task has been configured in the settings",other:"Other",globalOptions:"Global Options",checkLogin:"Login detection
    Need to log in to the website automatically log in, part of this website supports.",checkLeftKey:"Key remaining detection
    The end of the giveaway event prompts whether to close or not, part of this website supports.",twitterVerifyId:"Verify Twitter token by trying to follow the account.
    The default is the official Twitter account 783214.
    If you don't want to follow the official account, you can change it to your own account.",youtubeVerifyChannel:"Verify YouTube token by trying to subscribe to the channel.
    The default is the official YouTube channel UCrXUsMBcfTVqwAS7DKg9C0Q.
    If you don't want to follow the official channel, you can change it to your own channel.",autoUpdateSource:"The source to update
    github: Fast update.
    jsdelivr: Update is delayed.
    standby: Standby source.
    auto: Try to update using github, jsdelivr, standby sources in turn.",saveGlobalOptions:"SaveSettings",settingPage:"Setting Page",name:"Name",version:"Version",scriptManager:"Script Manager",script:"Script",environment:"Environment",os:"OS",browser:"Browser",getId:"Get %0 id",getTwitterUserId:"Get Twitter user id (Get id function is only available on the settings page).",getYoutubeChannelId:"Get Youtube channel id (Get id function is only available on the settings page).",showButton:"ShowButton",hideButton:"HideButton",showLog:"ShowLog",hideLog:"HideLog",defaultShowButton:"Default display button",defaultShowLog:"Display log by default",debug:"Output debug log, do not enable this option!",receivePreview:"Receive preview updates",position:"Component position",buttonSideX:"Horizontal positioning of the button area (real-time preview function is only available on the setting page).
    left: left | right: right",buttonSideY:"The button area is positioned in the vertical direction (real-time preview function is only available on the settings page).
    top: top | bottom: bottom",buttonDistance:"The distance between the button area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",showButtonSideX:"ShowButton horizontal positioning (real-time preview function is only available on the setting page).
    left: left | right: right",showButtonSideY:"ShowButton vertical positioning (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",showButtonDistance:"The distance between the ShowButton and the edge (real-time preview function is only available on the setting page).
    Format: X distance, Y distance",logSideX:"Horizontal positioning of the log area (real-time preview function is only available on the setting page).
    left: left | right: right",logSideY:"Vertical positioning of the log area (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",logDistance:"The distance between the log area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",hotKey:"Shortcut key",doTaskKey:"DoTask shortcut keys
    (real-time preview function is only available on the settings page).",undoTaskKey:"UndoTask shortcut keys
    (real-time preview function is only available on the settings page).",toggleLogKey:"ShowLog/HideLog shortcut keys
    (real-time preview function is only available on the settings page).",tasksHistory:"TasksHistory",clearHistory:"Clear history",clearHistoryFinished:"The mission history has been cleared!",deleteTask:"Delete task",lastChangeTime:"Last Change Time",clearTaskFinished:"Delete the following tasks completed!",clearTaskFailed:"Failed to delete the task, the task name was not found!",syncData:"DataSync",settingData:"Uploading data...",gettingData:"Getting data...",help:"Help",fileName:"Filename",upload2gist:"Sync to Gist",downloadFromGist:"Sync from Gist",saveAndTest:"Save configuration and test",testSuccess:"Test success!",testFailed:"Test failed!",saveAndTestNotice:"Please save the configuration and test first!",processingData:"Processing data...",updatingData:"Uploading data...",syncDataSuccess:"Synchronized data successfully!",syncDataFailed:"Failed to synchronize data, please check the error message on the console!",downloadingData:"Downloading data...",checkedNoData:"No remote data is detected, please confirm whether the configuration is correct!",savingData:"Saving data...",syncHistory:"Synchronize tasks history",checkUpdateFailed:"Check update failed",newVersionNotice:'Checked a new version V%0, click to update',language:"Language
    Currently only supports zh: Chinese, en: English",gistOptions:"Gist Settings",swalNotice:"It is detected that you are installing the V4 version script for the first time, please go to read the READ ME FIRST content before use!",echoNotice:'It is detected that you are installing the V4 version script for the first time, please click here to read the READ ME FIRST content before use!',noticeLink:"https://auto-task-doc.js.org/en/guide/#read-me-first",toGithub:"Feedback(Github)",toKeylol:"Feedback(Keylol)",copySuccess:"The error message has been copied to the clipboard. Do you want to go to the Keylol forum to give feedback?",copyFailed:"Please copy the error information below and report back to the Keylol forum!",updateText:"Updates in version %0:",Active:"Active",Ended:"Ended",Banned:"Banned",Paused:"Paused",notStart:"notStart",noRemoteData:"No data remotely",errorRemoteDataFormat:"Remote data has wrong format",updateHistory:'Click here to view the historical update record.',AsfEnabled:'Use ASF to do Steam related tasks (requires ASFEnhance plugin)',AsfIpcUrl:"ASF IPC URL",AsfIpcPassword:"ASF IPC Password",groups:"Group",officialGroups:"Official Group",wishlists:"Wishlist",follows:"Follow Game",forums:"Forum",workshops:"Favorite Workshop",curators:"Curator",workshopVotes:"Voteup Workshop",announcements:"Announcement",steamCommunity:"Steam Community",steamStore:"Steam Store",licenses:"Add License",playtests:"Playtest Access",needLoginSteamStore:'Please log in to the Steam Store',needLoginSteamCommunity:'Please log in to the Steam Community',joiningSteamGroup:"Joining Steam Group",leavingSteamGroup:"Leaving Steam Group",gettingSteamGroupId:"Getting Steam Group Id",joiningSteamOfficialGroup:"Joining Steam Official Group",leavingSteamOfficialGroup:"Leaving Steam Official Group",gettingSteamOfficialGroupId:"Getting Steam Official Group Id",subscribingForum:"Subscribing the Steam Forum",unsubscribingForum:"Unsubscribing the Steam Forum",gettingForumId:"Getting Steam Forum Id",followingCurator:"Following Steam Curator",unfollowingCurator:"Unfollowing Steam Curator",gettingCuratorId:"Getting Steam Curator Id",addingToWishlist:"Adding the game to the Steam wishlist",removingFromWishlist:"Removing the game from the Steam wishlist",followingGame:"Following Steam games",unfollowingGame:"Unfollowing Steam games",favoritingWorkshop:"Favouring Steam Workshop Items",unfavoritingWorkshop:"Unfavoriting Steam Workshop Items",gettingWorkshopAppId:"Getting Steam Workshop Item Id",votingUpWorkshop:"Liking Steam workshop items",gettingAnnouncementParams:"Getting Steam announcement information",likingAnnouncement:"Liking Steam announcement",changingArea:"Changing Steam area: %0...",notNeededChangeArea:"The current area does not need to be changed",noAnotherArea:"Please check whether the proxy is turned on correctly",gettingAreaInfo:"Getting Steam area information...",changeAreaNotice:"Suspected of a locked zone game, try to change the zone to execute",steamFinishNotice:"Steam task completed, try to change the shopping cart area back to CN",gettingSubid:"Getting subid",addingFreeLicense:"Adding free license",missParams:"Missing parameters",gettingLicenses:"Getting licenses...",requestingPlayTestAccess:"Requesting play test access",tryChangeAreaNotice:"This function cannot detect whether the game is limited, so it will try to change the area before entering the library. Failure to change the area will not affect the subsequent storage.",versionNotMatched:"The script manager version is too low, requiring TamperMonkey >= 5.2.0 or TamperMonkey Beta >= 5.2.6196",gettingUserLink:"Getting steam user community link...",retry:"Retry",initingASF:"Initing ASF...",servers:"Server",joiningDiscordServer:"Joining Discord Server",leavingDiscordServer:"Leaving Discord Server",gettingDiscordGuild:"Getting Discord server Id",getDiscordAuthFailed:"Failed to get Discord token, please check whether the Discord account is logged in",discordImportantNotice:"Important Reminder! ! !",discordImportantNoticeText:"Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !",continue:"Continue",skipDiscordTask:"Skip",continueAndDontRemindAgain:"Continue without Reminders",users:"User",loginIns:'Please log in to Instagram',insBanned:"Your Instagram account has been banned",verifyingInsAuth:"Verifying Instagram token...",gettingInsUserId:"Getting Instagram user Id",followingIns:"Following Instagram user",unfollowingIns:"Unfollowing Instagram user",reddits:"Reddit/User",loginReddit:'Please log in to Reddit',changingRedditVersion:"Switching Reddit to a new version page...",joiningReddit:"Joining the Reddit",leavingReddit:"Leaving the Reddit",followingRedditUser:"Following Reddit User",unfollowingRedditUser:"Unfollowing Reddit User",channels:"Channel",followingTwitchChannel:"Following Twitch Channel",unfollowingTwitchChannel:"Unfollowing Twitch Channel",gettingTwitchChannelId:"Getting Twitch Channel Id",checkingTwitchIntegrity:"Checking Twitch integrity...",twitterUser:"Twitter User",retweets:"Retweet",gettingTwitterUserId:"Getting Twitter User Id",followingTwitterUser:"Following Twitter User",unfollowingTwitterUser:"Unfollowing Twitter User",retweetting:"Retweetting",unretweetting:"Unretweetting",names:"Group/Public/Wall",loginVk:'Please log in to Vk',gettingVkId:"Getting Vk task Id",joiningVkGroup:"Joining Vk Group",leavingVkGroup:"Leaving Vk Group",joiningVkPublic:"Joining Vk Public",leavingVkPublic:"Leaving Vk Public",sendingVkWall:"Sending Vk Wall",deletingVkWall:"Deleting Vk Wall",youtubeChannel:"YouTube Channel",likes:"Like",loginYtb:'Please log in to YouTube',tryUpdateYtbAuth:'Please try to update YouTube token',gettingYtbToken:"Getting YouTube Token...",followingYtbChannel:"Subscribing to YouTube channel",unfollowingYtbChannel:"Unsubscribing to YouTube channel",likingYtbVideo:"Liking YouTube video",unlikingYtbVideo:"Unliking YouTube video",giveKeyNoticeBefore:"Each verification interval is 15s",giveKeyNoticeAfter:'If there is no key, please check at https://givekey.ru/profile',noPoints:"Not enough points, skip the lottery",getNeedPointsFailed:"ailed to obtain the required points, skip the lottery",joiningLottery:"Joining the lottery",doingGleamTask:"Doing Gleam Task...",gettingGleamLink:"Getting Gleam task link...",gleamTaskNotice:"If this page has not been closed for a long time, please close it yourself after completing any task!",verifiedGleamTasks:"Attempted to verify all tasks. If the verification fails, please try to verify manually or complete it!",campaign:"ReCAPTCHA detected, please complete it and re-verify the tasks!",gsNotice:'In order to avoid getting the "0000-0000-0000" key, the "Grab Key" button has been hidden, please close the script when obtaining the key!',giveeClubVerifyNotice:"Verifying task...",giveeClubVerifyFinished:"Wait for the verification to complete and join it by yourself",doingKeyhubTask:"Doing Keyhub Task...",SweepWidgetNotice:"The task is being processed and verified. There is an interval of 1~3s for each verification task to prevent the triggering of too fast verification warning...",tasksNotCompleted:"Tasks Not Completed",confirmingTask:"Confirming task..."}},language=["zh","en"].includes(globalOptions.other.language)?globalOptions.other.language:"en",i18n=(key,...argvs)=>languages[language]?.[key]?languages[language][key].replace(/%([\d]+)/g,(match,index)=>argvs[parseInt(index,10)]):key;external_Swal_namespaceObject=class{tasks;getRealParams(name,links,doTask,link2param){try{let realParams=[];return 0link2param(link)).filter(link=>link)]),!doTask&&0!!isConfirmed||!!isDenied&&(GM_setValue("dontRemindDiscordAgain",!0),!0)))return this.#initialized=!1,"skip";return GM_getValue("dontRemindDiscordAgain")||"do"===action&&!globalOptions.doTask.discord.servers||"undo"===action&&!globalOptions.undoTask.discord.servers?(this.#initialized=!1,"skip"):!!this.#initialized||(this.#auth.auth?await this.#verifyAuth()||(GM_setValue("discordAuth",{auth:null}),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Discord")),!1):!!await this.#updateAuth()&&(this.#initialized=!0))}catch(error){return throwError_throwError(error,"Discord.init"),!1}}async#verifyAuth(){try{var logStatus=scripts_echoLog({text:i18n("verifyingAuth","Discord")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v6/users/@me",method:"HEAD",headers:{authorization:this.#auth.auth}});return"Success"===result?200===data?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.verifyAuth"),!1}}async#updateAuth(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Discord")});return await new Promise(resolve=>{GM_openInTab("https://discord.com/channels/@me#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{var auth=GM_getValue("discordAuth")?.auth;auth?(this.#auth={auth:auth},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error("Error: Update discord auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Discord.updateAuth"),!1}}async#joinServer(inviteId){try{var guild,logStatus=scripts_echoLog({type:"joiningDiscordServer",text:inviteId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,method:"POST",dataType:"json",headers:{authorization:this.#auth.auth,origin:"https://discord.com",referer:"https://discord.com/invite/"+inviteId}});return"Success"===result&&200===data?.status?(logStatus.success(),(guild=String(data.response?.guild?.id))&&(this.#setCache(inviteId,guild),this.tasks.servers=unique([...this.tasks.servers,inviteId])),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.joinServer"),!1}}async#leaveServer(inviteId){try{if(this.whiteList.servers.includes(inviteId))return scripts_echoLog({type:"whiteList",text:"Discord.leaveServer",id:inviteId}),!0;var guild=await this.#getGuild(inviteId);if(guild){var logStatus=scripts_echoLog({type:"leavingDiscordServer",text:guild}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/users/@me/guilds/"+guild,method:"DELETE",headers:{authorization:this.#auth.auth}});if("Success"===result&&204===data?.status)return logStatus.success(),!0;logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Discord.leaveServer"),!1}}async#getGuild(inviteId){try{var logStatus=scripts_echoLog({type:"gettingDiscordGuild",text:inviteId}),guild=this.#cache[inviteId];if(guild)return logStatus.success(),guild;var{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,responseType:"json",method:"GET"});if("Success"!==result||200!==data?.status)return logStatus.error(result+`:${statusText}(${status})`),!1;{let guild=data.response?.guild?.id;return guild?(logStatus.success(),this.#setCache(inviteId,guild),guild):(logStatus.error(result+`:${statusText}(${status})`),!1)}}catch(error){return throwError_throwError(error,"Discord.getGuild"),!1}}async toggle({doTask=!0,serverLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.discord.servers||!doTask&&!globalOptions.undoTask.discord.servers)scripts_echoLog({type:"globalOptionsSkip",text:"discord.servers"});else{var realServers=this.getRealParams("servers",serverLinks,doTask,link=>link.match(/invite\/(.+)/)?.[1]);if(0!0)}catch(error){return throwError_throwError(error,"Discord.toggleServers"),!1}}#setCache(inviteId,guild){try{this.#cache[inviteId]=guild,GM_setValue("discordCache",this.#cache)}catch(error){throwError_throwError(error,"Discord.setCache")}}}let social_Discord=Discord;class Instagram extends external_Swal_namespaceObject{tasks;whiteList;#cache=GM_getValue("instagramCache")||{};#auth={};#initialized=!1;constructor(){super();var defaultTasksTemplate={users:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.instagram||{}}}async init(){try{return this.#initialized?!0:await this.#getUserInfo()?(scripts_echoLog({}).success(i18n("initSuccess","Instagram")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Instagram")),!1)}catch(error){return throwError_throwError(error,"Instagram.init"),!1}}async#getUserInfo(name="instagram"){try{var logStatus=scripts_echoLog({type:"instagram"===name?"verifyingInsAuth":"gettingInsUserId",text:name}),userId=this.#cache[name];if(userId&&"instagram"!==name)return logStatus.success(),userId;var csrftoken,hash,id,{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/${name}/`,method:"GET"});if("Success"===result)if(data?.finalUrl.includes("accounts/login"))logStatus.error("Error:"+i18n("loginIns"),!0);else if(data?.finalUrl.includes("www.instagram.com/challenge"))logStatus.error("Error:"+i18n("insBanned"));else{if(200===data?.status)return csrftoken=data.responseText.match(/"csrf_token":"(.+?)"/)?.[1],hash=data.responseText.match(/"rollout_hash":"(.+?)"/)?.[1],"instagram"===name?!(!csrftoken||!hash||(this.#auth={csrftoken:csrftoken,hash:hash},0)):(id=data.responseText.match(/"profilePage_([\d]+?)"/)?.[1])?(this.#setCache(name,id),logStatus.success(),id):(logStatus.error("Error: Get ins data error!"),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Instagram.getUserInfo"),!1}}async#followUser(name){try{var id=await this.#getUserInfo(name);if(id){var logStatus=scripts_echoLog({type:"followingIns",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/web/friendships/${id}/follow/`,method:"POST",dataType:"json",headers:{"x-csrftoken":this.#auth.csrftoken,origin:"https://www.instagram.com",referer:`https://www.instagram.com/${name}/`,"content-type":"application/x-www-form-urlencoded","sec-fetch-site":"same-origin","x-instagram-ajax":this.#auth.hash}});if("Success"===result)return 200===data?.status&&"following"===data.response?.result?(logStatus.success(),this.tasks.users=unique([...this.tasks.users,name]),!0):(logStatus.error("Error:"+(data?.response?.feedback_message||`${data?.statusText}(${data?.status})`)),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Instagram.followUser"),!1}}async#unfollowUser(name){try{if(this.whiteList.users.includes(name))return scripts_echoLog({type:"whiteList",text:"Instagram.unfollowUser",id:name}),!0;var id=await this.#getUserInfo(name);if(id){var logStatus=scripts_echoLog({type:"unfollowingIns",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/web/friendships/${id}/unfollow/`,method:"POST",dataType:"json",headers:{"x-csrftoken":this.#auth.csrftoken,origin:"https://www.instagram.com",referer:`https://www.instagram.com/${name}/`,"content-type":"application/x-www-form-urlencoded","sec-fetch-site":"same-origin","x-instagram-ajax":this.#auth.hash}});if("Success"===result)return 200===data?.status&&"ok"===data.response?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Instagram.unfollowUser"),!1}}async toggle({doTask=!0,userLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.instagram.users||!doTask&&!globalOptions.undoTask.instagram.users)scripts_echoLog({type:"globalOptionsSkip",text:"instagram.users"});else{var realUsers=this.getRealParams("users",userLinks,doTask,link=>link.match(/https:\/\/www\.instagram\.com\/(.+)?\//)?.[1]);if(0!0)}catch(error){return throwError_throwError(error,"Instagram.toggleUsers"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("instagramCache",this.#cache)}catch(error){throwError_throwError(error,"Instagram.setCache")}}}let social_Instagram=Instagram;class Reddit extends external_Swal_namespaceObject{tasks;whiteList;#auth;#initialized=!1;constructor(){super();var defaultTasksTemplate={reddits:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.reddit||{}}}async init(){try{return this.#initialized?!0:await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Reddit")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Reddit")),!1)}catch(error){return throwError_throwError(error,"Reddit.init"),!1}}async#useBeta(){try{let logStatus=scripts_echoLog({text:i18n("changingRedditVersion")});return GM_setValue("redditAuth",null),await new Promise(resolve=>{GM_openInTab("https://www.reddit.com/#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{logStatus.success(),resolve(await this.#updateAuth(!0))}})}catch(error){return throwError_throwError(error,"Reddit.useBeta"),!1}}async#updateAuth(beta=!1){try{var accessToken,logStatus=scripts_echoLog({text:i18n("updatingAuth","Reddit")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://www.reddit.com/",method:"GET",nochche:!0,headers:{"Cache-Control":"no-cache"}});if("Success"===result)if(data?.responseText.includes("www.reddit.com/login/"))logStatus.error("Error:"+i18n("loginReddit"),!0);else{if(200===data?.status)return data.responseText.includes("redesign-beta-optin-btn")&&!beta?await this.#useBeta():(accessToken=data.responseText.match(/"accessToken":"(.*?)","expires":"(.*?)"/)?.[1])?(this.#auth={token:accessToken},logStatus.success(),!0):(logStatus.error('Error: Parameter "accessToken" not found!'),!1);logStatus.error(`Error:${data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Reddit.updateAuth"),!1}}async toggleTask({name,doTask=!0}){try{if(!doTask&&this.whiteList.reddits.includes(name))return scripts_echoLog({type:"whiteList",text:"Reddit.undoTask",id:name}),!0;let type=doTask?"joiningReddit":"leavingReddit";/^u_/.test(name)&&(type=doTask?"followingRedditUser":"unfollowingRedditUser");var logStatus=scripts_echoLog({type:type,text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://oauth.reddit.com/api/subscribe?redditWebClient=desktop2x&app=desktop2x-client-production&raw_json=1&gilding_detail=1",method:"POST",headers:{authorization:"Bearer "+this.#auth.token,"content-type":"application/x-www-form-urlencoded"},data:$.param({action:doTask?"sub":"unsub",sr_name:name,api_type:"json"})});return"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.reddits=unique([...this.tasks.reddits,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Reddit.toggleTask"),!1}}async toggle({doTask=!0,redditLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.reddit.reddits||!doTask&&!globalOptions.undoTask.reddit.reddits)scripts_echoLog({type:"globalOptionsSkip",text:"reddit.reddits"});else{var realReddits=this.getRealParams("reddits",redditLinks,doTask,link=>{var name=link.match(/https?:\/\/www\.reddit\.com\/r\/([^/]*)/)?.[1],link=link.match(/https?:\/\/www\.reddit\.com\/user\/([^/]*)/)?.[1];return link?name||link:name});if(0!0)}catch(error){return throwError_throwError(error,"Reddit.toggle"),!1}}}let social_Reddit=Reddit;class Twitch extends external_Swal_namespaceObject{tasks;whiteList;#auth=GM_getValue("twitchAuth")||{};#cache=GM_getValue("twitchCache")||{};#initialized=!1;#integrityToken;constructor(){super();var defaultTasksTemplate={channels:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.twitch||{}}}async init(){try{return this.#initialized?!0:this.#auth.authToken&&this.#auth.clientId&&this.#auth.clientVersion&&this.#auth.deviceId&&this.#auth.clientSessionId?await this.#verifyAuth(!0)||(GM_setValue("twitchAuth",null),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Twitch")),!1):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError_throwError(error,"Twitch.init"),!1}}async#verifyAuth(isFirst){try{var logStatus=scripts_echoLog({text:i18n("verifyingAuth","Twitch")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},data:'[{"operationName":"FrontPageNew_User","variables":{"limit":1},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"64bd07a2cbaca80699d62636d966cf6395a5d14a1f0a14282067dcb28b13eb11"}}}]'});return"Success"===result?200===data?.status&&data.response?.[0]?.data?.currentUser?(await this.#integrity(isFirst),logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Twitch.verifyAuth"),!1}}async#integrity(isFirst=!0,ct=""){try{var result,statusText,status,data,logStatus=scripts_echoLog({text:i18n("checkingTwitchIntegrity")});return!isFirst||this.#auth.authToken&&this.#auth.clientId&&this.#auth.clientVersion&&this.#auth.deviceId&&this.#auth.clientSessionId?({result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/integrity",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId,"Client-Version":this.#auth.clientVersion,"X-Device-Id":this.#auth.deviceId,"Client-Session-Id":this.#auth.clientSessionId,"x-kpsdk-ct":ct}}),"Success"===result?!ct&&data?.responseHeaders?.["x-kpsdk-ct"]?await this.#integrity(isFirst,data.responseHeaders["x-kpsdk-ct"]):200===data?.status&&data.response?.token?(this.#integrityToken=data.response.token,logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)):await this.#updateAuth(!1)}catch(error){return throwError_throwError(error,"Twitch.integrity"),!1}}async#updateAuth(isFirst=!0){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Twitch")});return await new Promise(resolve=>{GM_openInTab("https://www.twitch.tv/#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{var auth=GM_getValue("twitchAuth");auth?(this.#auth=auth,logStatus.success(),resolve(await this.#verifyAuth(isFirst))):(logStatus.error("Error: Update twitch auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Twitch.updateAuth"),!1}}async#toggleChannel({name,doTask=!0}){try{if(!doTask&&this.whiteList.channels.includes(name))return scripts_echoLog({type:"whiteList",text:"Twitch.unfollowChannel",id:name}),!0;var channelId=await this.#getChannelId(name);if(channelId){var logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingTwitchChannel`,text:name}),followData='[{"operationName":"FollowButton_FollowUser","variables":{"input":{"disableNotifications":false,"targetID":"'+channelId+'"}},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"800e7346bdf7e5278a3c1d3f21b2b56e2639928f86815677a7126b093b2fdd08"}}}]',unfollowData=`[{"operationName":"FollowButton_UnfollowUser","variables":{"input":{"targetID":"${channelId}"}},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"f7dae976ebf41c755ae2d758546bfd176b4eeb856656098bb40e0a672ca0d880"}}}]',{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId,"Client-Version":this.#auth.clientVersion,"X-Device-Id":this.#auth.deviceId,"Client-Session-Id":this.#auth.clientSessionId,"Client-Integrity":this.#integrityToken},data:doTask?followData:unfollowData});if("Success"===result)return 200===data?.status&&data.response?.[0]&&!data.response[0].errors?(logStatus.success(),doTask&&(this.tasks.channels=unique([...this.tasks.channels,name])),!0):(logStatus.error("Error:"+(data?.response?.[0].errors?.[0]?.message||`${data?.statusText}(${data?.status})`)),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Twitch.toggleChannel"),!1}}async#getChannelId(name){try{var logStatus=scripts_echoLog({type:"gettingTwitchChannelId",text:name}),channelId=this.#cache[name];if(channelId)return logStatus.success(),channelId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},responseType:"json",data:`[{"operationName":"ActiveWatchParty","variables":{"channelLogin":"${name}"},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"4a8156c97b19e3a36e081cf6d6ddb5dbf9f9b02ae60e4d2ff26ed70aebc80a30"}}}]'});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let channelId=data.response?.[0]?.data?.user?.id;return channelId?(this.#setCache(name,String(channelId)),logStatus.success(),channelId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Twitch.getChannelId"),!1}}async toggle({doTask=!0,channelLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.twitch.channels||!doTask&&!globalOptions.undoTask.twitch.channels)scripts_echoLog({type:"globalOptionsSkip",text:"twitch.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>link.match(/https:\/\/(www\.)?twitch\.tv\/(.+)/)?.[2]);if(0!0)}catch(error){return throwError_throwError(error,"Twitch.toggle"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("twitchCache",this.#cache)}catch(error){throwError_throwError(error,"Twitch.setCache")}}}let social_Twitch=Twitch;class Vk extends external_Swal_namespaceObject{tasks;whiteList;#username="";#cache=GM_getValue("vkCache")||{};#initialized=!1;constructor(){super();var defaultTasksTemplate={names:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.vk||{}}}async init(){try{return this.#initialized?!0:await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Vk")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Vk")),!1)}catch(error){return throwError_throwError(error,"Vk.init"),!1}}async#verifyAuth(){try{var logStatus=scripts_echoLog({text:i18n("verifyAuth","Vk")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/im",method:"GET"});if("Success"===result)if(data?.finalUrl.includes("vk.com/login"))logStatus.error("Error:"+i18n("loginVk"),!0);else{if(200===data?.status)return this.#username=data.responseText.match(/TopNavBtn__profileLink" href="\/(.*?)"/)?.[1]||"",logStatus.success(),!0;logStatus.error(`Error:${data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Vk.verifyAuth"),!1}}async#toggleGroup(name,dataParam,doTask=!0){try{var reqData,result,statusText,status,data,logStatus=scripts_echoLog({type:doTask?"joiningVkGroup":"leavingVkGroup",text:name});return"enter"===dataParam.groupAct&&!doTask||"leave"===dataParam.groupAct&&doTask?(logStatus.success(),!0):(reqData={act:doTask?"enter":"leave",al:1,gid:dataParam.groupId,hash:dataParam.groupHash},{result,statusText,status,data}=(doTask&&(reqData.context="_"),await tools_httpRequest({url:"https://vk.com/al_groups.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param(reqData)})),"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.names=unique([...this.tasks.names,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Vk.toggleGroup"),!1}}async#togglePublic(name,dataParam,doTask=!0){try{var result,statusText,status,data,logStatus=scripts_echoLog({type:doTask?"joiningVkPublic":"leavingVkPublic",text:name});return dataParam.publicJoined&&doTask||!dataParam.publicJoined&&!doTask?(logStatus.success(),!0):({result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/al_public.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:doTask?"a_enter":"a_leave",al:1,pid:dataParam.publicPid,hash:dataParam.publicHash})}),"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.names=unique([...this.tasks.names,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Vk.togglePublic"),!1}}async#sendWall(name){try{var logStatus=scripts_echoLog({type:"sendingVkWall",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/like.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:"publish_box",al:1,object:name})});if("Success"===result)if(200===data?.status){var hash=data.responseText.match(/shHash:[\s]*'(.*?)'/)?.[1];if(hash){var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://vk.com/like.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({Message:"",act:"a_do_publish",al:1,close_comments:0,friends_only:0,from:"box",hash:hash,list:"",mark_as_ads:0,mute_notifications:0,object:name,ret_data:1,to:0})});if("Success"===resultR){if(200===dataR?.status){var postId,ownerId,jsonData=JSON.parse(dataR.responseText?.replace("\x3c!--","")||"{}");if(!0===jsonData?.payload?.[1]?.[1]?.share_my)return logStatus.success(),postId=String(jsonData?.payload?.[1]?.[1]?.post_id),ownerId=String(jsonData?.payload?.[1]?.[1]?.owner_id),postId&&ownerId&&this.#setCache(name,ownerId+"_"+postId),this.tasks.names=unique([...this.tasks.names,name]),!0}logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`)}else logStatus.error(resultR+`:${statusTextR}(${statusR})`)}else logStatus.error('Error: Get "hash" failed')}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Vk.sendWall"),!1}}async#deleteWall(name,dataParams){try{var logStatus=scripts_echoLog({type:"deletingVkWall",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/al_wall.php?act=delete",method:"POST",headers:{origin:"https://vk.com",referer:`https://vk.com/${this.#username}?w=wall${this.#cache[name]}%2Fall`,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:"delete",al:1,confirm:0,from:"wkview",hash:dataParams.wallHash,post:this.#cache[name]})});return"Success"===result?200===data?.status&&JSON.parse(data.responseText?.replace("\x3c!--","")||"{}")?.payload?.[1]?.[1]?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Vk.deleteWall"),!1}}async#getId(name,doTask){try{let url="https://vk.com/"+name;if(/^wall-/.test(name)){if(doTask)return{type:"sendWall"};if(!this.#cache[name])return{type:"unSupport"};url=`https://vk.com/${this.#username}?w=wall`+this.#cache[name]}var logStatus=scripts_echoLog({type:"gettingVkId",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:url,method:"GET"});if("Success"===result)if(200===data?.status){var[,groupAct,groupId,,groupHash]=data.responseText.match(/Groups.(enter|leave)\(.*?,.*?([\d]+?), ('|')(.*?)('|')/)||[],publicHash=data.responseText.match(/"enterHash":"(.*?)"/)?.[1],publicPid=data.responseText.match(/"public_id":([\d]+?),/)?.[1],publicJoined=!data.responseText.includes("Public.subscribe");if(groupAct&&groupId&&groupHash)return logStatus.success(),{groupAct:groupAct,groupId:groupId,groupHash:groupHash,type:"group"};if(publicHash&&publicPid)return logStatus.success(),{publicHash:publicHash,publicPid:publicPid,publicJoined:publicJoined,type:"public"};if(data.responseText.includes("wall.deletePost")&&!doTask){var wallHash=data.responseText.match(/wall\.deletePost\(this, '.*?', '(.*?)'\)/)?.[1];if(wallHash)return logStatus.success(),{type:"deleteWall",wallHash:wallHash}}else if(name.includes("wall")&&doTask)return logStatus.success(),{type:"sendWall"};logStatus.error("Error: Parameters not found!")}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Vk.getId"),!1}}async#toggleVk({name,doTask=!0}){try{if(!doTask&&this.whiteList.names.includes(name))return scripts_echoLog({type:"whiteList",text:"Vk.undoTask",id:name}),!0;var formatName=name.replace(/\/$/,""),data=await this.#getId(formatName,doTask);if(!data)return!1;switch(data.type){case"group":return await this.#toggleGroup(formatName,data,doTask);case"public":return await this.#togglePublic(formatName,data,doTask);case"sendWall":return!doTask||await this.#sendWall(formatName);case"deleteWall":return!!doTask||await this.#deleteWall(formatName,data);default:return!1}}catch(error){return throwError_throwError(error,"Vk.toggleVk"),!1}}async toggle({doTask=!0,nameLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.vk.names||!doTask&&!globalOptions.undoTask.vk.names)scripts_echoLog({type:"globalOptionsSkip",text:"vk.names"});else{var realNames=this.getRealParams("names",nameLinks,doTask,link=>link.match(/https:\/\/vk\.com\/([^/]+)/)?.[1]);if(0!0)}catch(error){return throwError_throwError(error,"Vk.toggle"),!1}}#setCache(name,postId){try{this.#cache[name]=postId,GM_setValue("vkCache",this.#cache)}catch(error){throwError_throwError(error,"Vk.setCache")}}}let social_Vk=Vk;class Youtube extends external_Swal_namespaceObject{tasks;whiteList;#auth=GM_getValue("youtubeAuth")||{};#initialized=!1;#verifyChannel="https://www.youtube.com/channel/"+globalOptions.other.youtubeVerifyChannel;constructor(){super();var defaultTasksTemplate={channels:[],likes:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.youtube||{}}}async init(){try{return this.#initialized?!0:this.#auth.PAPISID?await this.#verifyAuth()||(GM_setValue("youtubeAuth",null),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Youtube")),!1):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError_throwError(error,"Youtube.init"),!1}}async#verifyAuth(){try{return await this.#toggleChannel({link:this.#verifyChannel,doTask:!0,verify:!0})}catch(error){return throwError_throwError(error,"Youtube.verifyAuth"),!1}}async#updateAuth(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Youtube")});return await new Promise(resolve=>{GM_cookie.list({url:"https://www.youtube.com/@YouTube"},async(cookies,error)=>{error?(logStatus.error("Error: Update youtube auth failed!"),resolve(!1)):(error=cookies.find(cookie=>"__Secure-3PAPISID"===cookie.name)?.value)?(GM_setValue("youtubeAuth",{PAPISID:error}),this.#auth={PAPISID:error},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error(i18n("needLogin")),resolve(!1))})})}catch(error){return throwError_throwError(error,"Youtube.updateAuth"),!1}}#getInfo(link,type){return(async(link,type)=>{try{var apiKey,context,client,request,channelId,videoId,likeParams,logStatus=scripts_echoLog({text:i18n("gettingYtbToken")}),{result,statusText,status,data}=await tools_httpRequest({url:link,method:"GET"});return"Success"===result?200===data?.status?data.responseText.includes("accounts.google.com/ServiceLogin?service=youtube")?(logStatus.error("Error:"+i18n("loginYtb"),!0),{needLogin:!0}):(apiKey=data.responseText.match(/"INNERTUBE_API_KEY":"(.*?)"/)?.[1],context=(data.responseText.match(/\(\{"INNERTUBE_CONTEXT":([\w\W]*?)\}\)/)||data.responseText.match(/"INNERTUBE_CONTEXT":([\w\W]*?\}),"INNERTUBE/))?.[1]||"{}",{client,request}=JSON.parse(context),apiKey&&client&&request?(client.hl="en","channel"===type?(channelId=data.responseText.match(/"channelId":"(.+?)"/)?.[1])?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,channelId:channelId}}):(logStatus.error('Error: Get "channelId" failed!'),{}):"likeVideo"===type?(videoId=data.responseText.match(//)?.[1],likeParams=data.responseText.match(/"likeParams":"(.*?)"/)?.[1],videoId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,videoId:videoId,likeParams:likeParams}}):(logStatus.error('Error: Get "videoId" failed!'),{})):(logStatus.error("Error: Unknown type"),{})):(logStatus.error('Error: Parameter "apiKey" not found!'),{})):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),{}):(logStatus.error(result+`:${statusText}(${status})`),{})}catch(error){return throwError_throwError(error,"Youtube.getInfo"),{}}})(link,type)}async#toggleChannel({link,doTask=!0,verify=!1}){try{var{params,needLogin}=await this.#getInfo(link,"channel"),{apiKey,client,request,channelId}=params||{};if(needLogin)scripts_echoLog({html:i18n("loginYtb")});else if(apiKey&&client&&request&&channelId){if(!doTask&&!verify&&this.whiteList.channels.includes(channelId))return scripts_echoLog({type:"whiteList",text:"Youtube.unfollowChannel",id:channelId}),!0;var logStatus=verify?scripts_echoLog({text:i18n("verifyingAuth","Youtube")}):scripts_echoLog({type:doTask?"followingYtbChannel":"unfollowingYtbChannel",text:channelId}),nowTime=parseInt(String((new Date).getTime()/1e3),10),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/subscription/${doTask?"":"un"}subscribe?key=${apiKey}&prettyPrint=false`,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/channel/"+channelId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client?.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify({context:{client:client,request:{sessionId:request?.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},channelIds:[channelId],params:doTask?"EgIIAhgA":"CgIIAhgA"})});if("Success"===result)return 200===data?.status?doTask&&(/"subscribed":true/.test(data.responseText)||data.responseText.includes("The subscription already exists"))||!doTask&&/"subscribed":false/.test(data.responseText)?(logStatus.success(),doTask&&!verify&&(this.tasks.channels=unique([...this.tasks.channels,link])),!0):verify&&data.responseText.includes("You may not subscribe to yourself")?(logStatus.success(),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}else scripts_echoLog({text:'"getYtbToken" failed'});return!1}catch(error){return throwError_throwError(error,"Youtube.toggleChannel"),!1}}async#toggleLikeVideo({link,doTask=!0}){try{var{params,needLogin}=await this.#getInfo(link,"likeVideo"),{apiKey,client,request,videoId,likeParams}=params||{};if(needLogin)scripts_echoLog({html:""+i18n("loginYtb")});else if(apiKey&&client&&request&&videoId&&likeParams){if(!doTask&&this.whiteList.likes.includes(videoId))return scripts_echoLog({type:"whiteList",text:"Youtube.unlikeVideo",id:videoId}),!0;var logStatus=scripts_echoLog({type:doTask?"likingYtbVideo":"unlikingYtbVideo",text:videoId}),nowTime=parseInt(String((new Date).getTime()/1e3),10),likeVideoData={context:{client:client,request:{sessionId:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},target:{videoId:videoId}};if(doTask){if(!likeParams)return logStatus.error("Empty likeParams"),!1;likeVideoData.params=likeParams}var{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/like/${doTask?"":"remove"}like?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/watch?v="+videoId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify(likeVideoData)});if("Success"===result)return 200===data?.status?doTask&&data.responseText.includes("Added to Liked videos")||!doTask&&(data.responseText.includes("Removed from Liked videos")||data.responseText.includes("Dislike removed"))?(logStatus.success(),doTask&&(this.tasks.likes=unique([...this.tasks.likes,link])),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}else scripts_echoLog({text:'"getYtbToken" failed'});return!1}catch(error){return throwError_throwError(error,"Youtube.toggleLikeVideo"),!1}}async toggle({doTask=!0,channelLinks=[],videoLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.youtube.channels||!doTask&&!globalOptions.undoTask.youtube.channels)scripts_echoLog({type:"globalOptionsSkip",text:"youtube.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)?.[1]:link);if(0/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)?.[1]:link);if(0!0)}catch(error){return throwError_throwError(error,"Youtube.toggle"),!1}}}let social_SteamASF=class{#asfOptions;#botName="asf";#groupInfo;async init(){try{var asfCommandsUrl=new URL("/Api/Command/",globalOptions.ASF.AsfIpcUrl),logStatus=(this.#asfOptions={url:asfCommandsUrl.href,method:"POST",responseType:"json",headers:{accept:"application/json","Content-Type":"application/json",Host:asfCommandsUrl.host,Origin:asfCommandsUrl.origin,Referer:asfCommandsUrl.href,Authentication:globalOptions.ASF.AsfIpcPassword}},globalOptions.ASF.AsfBotname&&(this.#botName=globalOptions.ASF.AsfBotname),scripts_echoLog({text:i18n("initingASF")})),{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:'{"Command":"!stats"}'});return"Success"===result?!0===data?.response?.Success&&"OK"===data.response.Message&&data.response.Result?(logStatus.success(),!0):(data?.response?.Result||data?.response?.Message?logStatus.error(data?.response?.Result||data.response.Message):logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.init"),!1}}async joinGroup(groupName){try{var logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!JOINGROUP ${this.#botName} `+groupName})});return"Success"===result?200===data?.status&&["已加入","已申请","Joined","Applied","Присоединился","costs"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.joinGroup"),!1}}async leaveGroup(groupName){try{if(this.#groupInfo||await this.#getGroupId()){var groupId=await this.#groupInfo[groupName];if(groupId){var logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!LEAVEGROUP ${this.#botName} `+groupId})});if("Success"===result)return 200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}return!1}catch(error){return throwError_throwError(error,"SteamASF.leaveGroup"),!1}}async#getGroupId(){try{var logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:"All"}),{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:"!GROUPLIST "+this.#botName})});return"Success"===result?200===data?.status&&data.response?.Result?.includes("|")?(this.#groupInfo=Object.fromEntries(data.response.Result.split("\n").map(line=>{var[,line,id]=line.trim().split("|");return line&&id?[line,id]:null}).filter(ele=>ele)),logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.getGroupID"),!1}}async addToWishlist(gameId){try{var logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!ADDWISHLIST ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.addToWishlist"),!1}}async removeFromWishlist(gameId){try{var logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!REMOVEWISHLIST ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.removeFromWishlist"),!1}}async toggleFollowGame(gameId,doTask){try{var logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!${doTask?"":"UN"}FOLLOWGAME ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.toggleFollowGame"),!1}}async toggleCurator(curatorId,doTask=!0){try{var logStatus=scripts_echoLog({type:doTask?"followingCurator":"unfollowingCurator",text:curatorId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!${doTask?"":"UN"}FOLLOWCURATOR ${this.#botName} `+curatorId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.toggleCurator"),!1}}async addLicense(id){try{var[type,ids]=id.split("-");if("appid"===type){var logStatus=scripts_echoLog({type:"addingFreeLicense",text:ids});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!addlicense ${this.#botName} app/`+ids})});return"Success"===result?200===data?.status&&["AlreadyPurchased","OK"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}if("subid"===type){var idsArr=ids.split(",");let logStatus=scripts_echoLog({type:"addingFreeLicenseSubid",text:ids});var{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!addlicense ${this.#botName} `+idsArr.map(id=>"sub/"+id).join(",")})});if("Success"===result){if(200===data?.status&&data.response?.Result){let resultLines=data.response.Result.split("\n");return idsArr.forEach(subid=>{let targetLine=resultLines.find(text=>text.includes(subid));targetLine&&["成功","Success","Успех"].find(text=>targetLine.includes(text))?scripts_echoLog({}).success(targetLine):scripts_echoLog({}).error(targetLine)}),!0}logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"SteamASF.addLicense"),!1}}async requestPlayTestAccess(id){try{var logStatus=scripts_echoLog({type:"requestingPlayTestAccess",text:id});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!REQUESTACCESS ${this.#botName} `+id})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.requestPlayTestAccess"),!1}}};class Steam extends external_Swal_namespaceObject{tasks;whiteList;#cache={group:{},officialGroup:{},forum:{},workshop:{},curator:{},...GM_getValue("steamCache")};#auth={};#storeInitialized=!1;#communityInitialized=!1;#area="CN";#areaStatus="end";#ASF;constructor(){super();var defaultTasksTemplate={groups:[],officialGroups:[],wishlists:[],follows:[],forums:[],workshops:[],workshopVotes:[],curators:[],curatorLikes:[],announcements:[],licenses:[],playtests:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.steam||{}}}async init(type="all"){try{if(globalOptions.ASF.AsfEnabled&&globalOptions.ASF.AsfIpcUrl&&globalOptions.ASF.AsfIpcPassword)return this.#ASF=new social_SteamASF,!!await this.#ASF.init()&&(this.#storeInitialized=!0,this.#communityInitialized=!0);if("store"===type){if(!this.#storeInitialized){let storeInitialized=await this.#updateStoreAuth();if(storeInitialized=storeInitialized||await this.#updateStoreAuthTab(),this.#storeInitialized=storeInitialized,!this.#storeInitialized)return scripts_echoLog({}).error(i18n("initFailed","Steam")),!1;scripts_echoLog({}).success(i18n("initSuccess","SteamStore"))}}else{if("community"!==type)return this.#storeInitialized&&this.#communityInitialized?(scripts_echoLog({}).success(i18n("initSuccess","Steam")),!0):(scripts_echoLog({}).error(i18n("initFailed","Steam")),!1);if(!this.#communityInitialized){let communityInitialized=await this.#getUserLink();if(communityInitialized||(communityInitialized=await this.#updateCommunityAuthTab(),GM_setValue("steamCommunityAuth",null)),this.#communityInitialized=communityInitialized,!this.#communityInitialized)return scripts_echoLog({}).error(i18n("initFailed","Steam")),!1;scripts_echoLog({}).success(i18n("initSuccess","SteamCommunity"))}}return!0}catch(error){return throwError_throwError(error,"Steam.init"),!1}}async#refreshToken(type="steamStore"){try{var host={steamStore:"store.steampowered.com",steamCommunity:"steamcommunity.com"},logStatus=scripts_echoLog({text:i18n("refreshingToken",i18n(type))}),formData=new FormData,{result,statusText,status,data}=(formData.append("redir",`https://${host[type]}/`),await tools_httpRequest({url:"https://login.steampowered.com/jwt/ajaxrefresh",method:"POST",responseType:"json",headers:{Host:"login.steampowered.com",Origin:"https://"+host[type],Referer:`https://${host[type]}/`},data:formData}));return"Success"===result?data?.response?.success?await this.#setStoreToken(data.response,type)?(logStatus.success(),!0):(logStatus.error("Error"),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.refreshToken"),!1}}async#setStoreToken(param,type){try{var host={steamStore:"store.steampowered.com",steamCommunity:"steamcommunity.com"},logStatus=scripts_echoLog({text:i18n("settingToken",i18n(type))}),formData=new FormData,{result,statusText,status,data}=(formData.append("steamID",param.steamID),formData.append("nonce",param.nonce),formData.append("redir",param.redir),formData.append("auth",param.auth),await tools_httpRequest({url:`https://${host[type]}/login/settoken`,method:"POST",headers:{Accept:"application/json, text/plain, */*",Host:host[type],Origin:"https://"+host[type]},data:formData}));return"Success"===result?200===data?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.setStoreToken"),!1}}async#updateStoreAuth(retry=!1){try{var storeSessionID,logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamStore"))}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"},fetch:!1,redirect:"manual"});return 200===data?.status?data.responseText.includes("data-miniprofile=")?(storeSessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1])?(this.#auth.storeSessionID=storeSessionID,logStatus.success(),!0):(logStatus.error('Error: Get "sessionID" failed'),!1):!await this.#refreshToken("steamStore")||(logStatus.warning(i18n("retry")),retry)?(logStatus.error("Error:"+i18n("needLoginSteamStore"),!0),!1):this.#updateStoreAuth(!0):[301,302].includes(data?.status)?!await this.#refreshToken("steamStore")||(logStatus.warning(i18n("retry")),retry)?(logStatus.error("Error:"+i18n("needLoginSteamStore"),!0),!1):this.#updateStoreAuth(!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.updateStoreAuth"),!1}}async#updateStoreAuthTab(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamStore"))});return await new Promise(resolve=>{let newTab=window.open("https://store.steampowered.com/","mozillaWindow","pop=1;"),listenerId=(GM_setValue("steamStoreAuth","update"),GM_addValueChangeListener("steamStoreAuth",(key,oldValue,newValue,remote)=>{GM_removeValueChangeListener(listenerId),newTab?.close(),newValue&&JSON.stringify(newValue)!==JSON.stringify(oldValue)?(this.#auth.storeSessionID=newValue.storeSessionID,logStatus.success(),resolve(!0)):(logStatus.error("Failed"),resolve(!1))}))})}catch(error){return throwError_throwError(error,"Steam.updateStoreAuthTab"),!1}}async#updateCommunityAuthTab(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamCommunity"))});return await new Promise(resolve=>{let newTab=window.open("https://steamcommunity.com/my","mozillaWindow","pop=1;"),listenerId=(GM_setValue("steamCommunityAuth","update"),GM_addValueChangeListener("steamCommunityAuth",(key,oldValue,newValue,remote)=>{GM_removeValueChangeListener(listenerId),newTab?.close(),newValue&&JSON.stringify(newValue)!==JSON.stringify(oldValue)?(this.#auth.steam64Id=newValue.steam64Id,this.#auth.userName=newValue.userName,this.#auth.communitySessionID=newValue.communitySessionID,logStatus.success(),resolve(!0)):(logStatus.error("Failed"),resolve(!1))}))})}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuthTab"),!1}}async#getUserLink(retry=!1){try{var logStatus=scripts_echoLog({text:i18n("gettingUserLink")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/my",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"},fetch:!1,redirect:"manual"});if(200===data?.status)if(data.finalUrl.includes("https://steamcommunity.com/login/home"))logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0);else{var steam64Id=data.responseText.match(/g_steamID = "(.+?)";/)?.[1],communitySessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1],userName=data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//)?.[1];if(steam64Id&&(this.#auth.steam64Id=steam64Id),userName&&(this.#auth.userName=userName),communitySessionID)return this.#auth.communitySessionID=communitySessionID,logStatus.success(),!0;logStatus.error('Error: Get "sessionID" failed')}else{if(302===data?.status)return!await this.#refreshToken("steamCommunity")||retry?(logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0),!1):(logStatus.warning(i18n("retry")),this.#getUserLink(!0));var location=data?.responseHeaders?.split("\n")?.find(header=>header.includes("location")?header.replace("loctation:","").trim():null);if(301===data?.status&&location?.includes("steamcommunity.com/id"))return logStatus.success(),await this.#updateCommunityAuth(data.finalUrl);301===data?.status&&location?.includes("https://steamcommunity.com/login/home")?logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0):logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuth"),!1}}async#updateCommunityAuth(url){try{var logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamCommunity"))}),{result,statusText,status,data}=await tools_httpRequest({url:url,method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"}});if("Success"===result)if(200===data?.status)if(data.finalUrl.includes("https://steamcommunity.com/login/home"))logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0);else{var steam64Id=data.responseText.match(/g_steamID = "(.+?)";/)?.[1],communitySessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1],userName=data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//)?.[1];if(steam64Id&&(this.#auth.steam64Id=steam64Id),userName&&(this.#auth.userName=userName),communitySessionID)return this.#auth.communitySessionID=communitySessionID,logStatus.success(),!0;logStatus.error('Error: Get "sessionID" failed')}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuth"),!1}}async#getAreaInfo(){try{var logStatus=scripts_echoLog({text:i18n("gettingAreaInfo")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/cart/",method:"GET"});if("Success"===result)if(200===data?.status){var cartConfigRaw=data.responseText.match(/data-cart_config="(.*?)"/)?.[1],temp=document.createElement("div"),cartConfigStr=(temp.innerHTML=cartConfigRaw||"{}",temp.textContent||temp.innerText);let cartConfig;try{cartConfig=JSON.parse(cartConfigStr)}catch(error){return logStatus.error("Error: get country info filed"),console.error(error),{}}if(cartConfig.rgUserCountryOptions){var userInfoRaw=data.responseText.match(/data-userinfo="(.*?)"/)?.[1],temp1=document.createElement("div"),userInfoStr=(temp1.innerHTML=userInfoRaw||"{}",temp1.textContent||temp1.innerText);let userInfo;try{userInfo=JSON.parse(userInfoStr)}catch(error){return logStatus.error("Error: get country info filed"),console.error(error),{}}var currentArea=userInfo.country_code,areas=Object.keys(cartConfig.rgUserCountryOptions).filter(area=>"help"!==area);if(currentArea&&0{let checker=setInterval(()=>{"waiting"!==this.#areaStatus&&(clearInterval(checker),resolve(!0))})}),this.#area===area||!area&&"CN"!==this.#area)return!0;this.#areaStatus="waiting";let aimedArea=area;if(!aimedArea){var{currentArea,areas}=await this.#getAreaInfo();if(!currentArea||!areas)return!(this.#areaStatus="error");if("CN"!==currentArea)return this.#areaStatus="skip",scripts_echoLog({text:"notNeededChangeArea"}),"skip";var anotherArea=areas.filter(area=>area&&"CN"!==area);if(!anotherArea||0===anotherArea.length)return this.#areaStatus="noAnotherArea",scripts_echoLog({text:"noAnotherArea"}),!1;[aimedArea]=anotherArea}var logStatus=scripts_echoLog({text:i18n("changingArea",aimedArea)}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/country/setcountry",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({cc:aimedArea,sessionid:this.#auth.storeSessionID})});if("Success"!==result)return this.#areaStatus="error",logStatus.error(result+`:${statusText}(${status})`),"CN";if(200!==data?.status||"true"!==data.responseText)return this.#areaStatus="error",logStatus.error(`Error:${data?.statusText}(${data?.status})`),"CN";{let currentArea=(await this.#getAreaInfo()).currentArea;return currentArea===aimedArea?(this.#areaStatus="success",logStatus.success(),currentArea):(this.#areaStatus="error",logStatus.error("Error: change country filed"),"CN")}}catch(error){return this.#areaStatus="error",throwError_throwError(error,"Steam.changeArea"),!1}}async#joinGroup(groupName){try{var logStatus,result,statusText,status,data;return this.#ASF?!!await this.#ASF.joinGroup(groupName)&&(this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({action:"join",sessionID:this.#auth.communitySessionID})}),"Success"===result?200!==data?.status||data.responseText.includes("grouppage_join_area")?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.success(),this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.joinGroup"),!1}}async#leaveGroup(groupName){try{if(this.whiteList.groups.includes(groupName))return scripts_echoLog({type:"whiteList",text:"Steam.leaveGroup",id:groupName}),!0;if(this.#ASF)return await this.#ASF.leaveGroup(groupName);var groupId=await this.#getGroupId(groupName);if(groupId){var logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"===result)return 200===data?.status&&data.finalUrl.includes("groups")&&0===$(data.responseText.replace(//g,"").toLowerCase()).find(`a[href='https://steamcommunity.com/groups/${groupName.toLowerCase()}']`).length?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.leaveGroup"),!1}}async#getGroupId(groupName){try{var logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:groupName}),groupId=this.#cache.group[groupName];if(groupId)return logStatus.success(),groupId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let groupId=data.responseText.match(/OpenGroupChat\( '([0-9]+)'/)?.[1];return groupId?(this.#setCache("group",groupName,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async#joinOfficialGroup(gameId){try{var logStatus,result,statusText,status,data,groupId;return this.#ASF?!!await this.#ASF.joinGroup(gameId)&&(this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]),!0):(logStatus=scripts_echoLog({type:"joiningSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/games/${gameId}?action=join&sessionID=`+this.#auth.communitySessionID,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}),"Success"===result?200!==data?.status||data.responseText.includes('id="publicGroupJoin"')?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.success(),this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]),(groupId=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)?.[1])&&this.#setCache("officialGroup",gameId,groupId),!0):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.joinOfficialGroup"),!1}}async#leaveOfficialGroup(gameId){try{if(this.whiteList.officialGroups.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.leaveOfficialGroup",id:gameId}),!0;if(this.#ASF)return await this.#ASF.leaveGroup(gameId);var groupId=await this.#getOfficialGroupId(gameId);if(groupId){var resultR,statusTextR,statusR,dataR,logStatus=scripts_echoLog({type:"leavingSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"===result)return 200===data?.status?({result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}),"Success"===resultR?200===dataR?.status&&dataR.responseText.includes('id="publicGroupJoin"')?(logStatus.success(),!0):(logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.leaveOfficialGroup"),!1}}async#getOfficialGroupId(gameId){try{var logStatus=scripts_echoLog({type:"gettingSteamOfficialGroupId",text:gameId}),groupId=this.#cache.officialGroup[gameId];if(groupId)return logStatus.success(),groupId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let groupId=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)?.[1];return groupId?(this.#setCache("officialGroup",gameId,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async#addToWishlist(gameId){try{if(this.#ASF)return!!await this.#ASF.addToWishlist(gameId)&&(this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0);var logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId}),{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/addtowishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"!==result||200!==data?.status||!0!==data.response?.success){var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==dataR?.status)return logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1;if("CN"===this.#area&&dataR.responseText.includes('id="error_box"'))return logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#addToWishlist(gameId);if((!dataR.responseText.includes('class="queue_actions_ctn"')||!dataR.responseText.includes('class="already_in_library"'))&&(dataR.responseText.includes('class="queue_actions_ctn"')&&dataR.responseText.includes('id="add_to_wishlist_area_success" style="display: none;')||!dataR.responseText.includes('class="queue_actions_ctn"')))return logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1}return logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0}catch(error){return throwError_throwError(error,"Steam.addToWishlist"),!1}}async#removeFromWishlist(gameId){try{if(this.whiteList.wishlists.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.removeFromWishlist",id:gameId}),!0;if(this.#ASF)return await this.#ASF.removeFromWishlist(gameId);var logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId}),{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/removefromwishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===data?.status&&!0===data.response?.success)return logStatus.success(),!0;var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==dataR?.status)return logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1;if("CN"===this.#area&&dataR.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result&&"skip"!==result?await this.#removeFromWishlist(gameId):!1}return dataR.responseText.includes('class="queue_actions_ctn"')&&(dataR.responseText.includes("ds_owned_flag ds_flag")||dataR.responseText.includes("add_to_wishlist_area"))?(logStatus.success(),!0):(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.removeFromWishlist"),!1}}async#toggleFollowGame(gameId,doTask){try{var logStatus,requestData,result,data,followed;return!doTask&&this.whiteList.follows.includes(gameId)?(scripts_echoLog({type:"whiteList",text:"Steam.unfollowGame",id:gameId}),!0):this.#ASF?!!await this.#ASF.toggleFollowGame(gameId,doTask)&&(doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId}),requestData={sessionid:this.#auth.storeSessionID,appid:gameId},{result,data}=(doTask||(requestData.unfollow="1"),await tools_httpRequest({url:"https://store.steampowered.com/explore/followgame/",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param(requestData)})),"Success"===result&&200===data?.status&&"true"===data.responseText?(logStatus.success(),!0):(followed=await this.#isFollowedGame(gameId),"CN"===this.#area&&"areaLocked"===followed?(logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#removeFromWishlist(gameId)):doTask===followed?(logStatus.success(),doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1)))}catch(error){return throwError_throwError(error,"Steam.toggleFollowGame"),!1}}async#isFollowedGame(gameId){try{var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===result?200===data?.status&&("CN"===this.#area&&data.responseText.includes('id="error_box"')?"areaLocked":"none"!==$(data.responseText.replace(//g,"")).find(".queue_control_button.queue_btn_follow>.btnv6_blue_hoverfade.btn_medium.queue_btn_active").css("display")):!1}catch(error){return throwError_throwError(error,"Steam.isFollowedGame"),!1}}async#toggleForum(gameId,doTask=!0){try{if(!doTask&&this.whiteList.forums.includes(gameId))scripts_echoLog({type:"whiteList",text:"Steam.unsubscribeForum",id:gameId});else{var forumId=await this.#getForumId(gameId);if(!forumId)return!1;var logStatus=scripts_echoLog({type:`${doTask?"":"un"}subscribingForum`,text:gameId}),[id,feature]=forumId.split("_"),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/forum/${id}/General/${doTask?"":"un"}subscribe/${feature||"0"}/`,method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.communitySessionID})});"Success"===result?200!==data?.status||1!==data.response?.success&&29!==data.response?.success?logStatus.error(`Error:${data?.statusText}(${data?.status})`):(doTask&&(this.tasks.forums=unique([...this.tasks.forums,gameId])),logStatus.success()):logStatus.error(result+`:${statusText}(${status})`)}return!0}catch(error){return throwError_throwError(error,"Steam.toggleForum"),!0}}async#getForumId(gameId){try{var logStatus=scripts_echoLog({type:"gettingForumId",text:gameId}),forumId=this.#cache.forum[gameId];if(forumId)return logStatus.success(),forumId;var{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/app/${gameId}/discussions/`,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let forumId=data.responseText?.match(/General_([\d]+(_[\d]+)?)/)?.[1];return forumId?(this.#setCache("forum",gameId,forumId),logStatus.success(),forumId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getForumId"),!1}}async#toggleFavoriteWorkshop(id,doTask=!0){try{if(!doTask&&this.whiteList.workshops.includes(id))return scripts_echoLog({type:"whiteList",text:"Steam.unfavoriteWorkshop",id:id}),!0;var appid=await this.#getWorkshopAppId(id);if(appid){var logStatus=scripts_echoLog({type:doTask?"favoritingWorkshop":"unfavoritingWorkshop",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/sharedfiles/${doTask?"":"un"}favorite`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,appid:appid,sessionid:this.#auth.communitySessionID})});if("Success"===result)return 200!==data?.status||data.responseText?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(doTask&&(this.tasks.workshops=unique([...this.tasks.workshops,id])),logStatus.success(),!0);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.toggleFavoriteWorkshop"),!1}}async#getWorkshopAppId(id){try{var logStatus=scripts_echoLog({type:"gettingWorkshopAppId",text:id}),appId=this.#cache.workshop[id];if(appId)return logStatus.success(),appId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/filedetails/?id="+id,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let appId=data.responseText.match(//)?.[1];return appId?(this.#setCache("workshop",id,appId),logStatus.success(),appId):(logStatus.error("Error: getWorkshopAppId failed"),!1)}}catch(error){return throwError_throwError(error,"Steam.getWorkshopAppId"),!1}}async#voteUpWorkshop(id){try{var logStatus=scripts_echoLog({type:"votingUpWorkshop",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/voteup",method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,sessionid:this.#auth.communitySessionID})});return"Success"===result?200===data?.status&&1===data.response?.success?logStatus.success():logStatus.error(`Error:${data?.statusText}(${data?.status})`):logStatus.error(result+`:${statusText}(${status})`),!0}catch(error){return throwError_throwError(error,"Steam.voteupWorkshop"),!0}}async#toggleCurator(curatorId,doTask=!0){try{var logStatus,result,statusText,status,data;return!doTask&&this.whiteList.curators.includes(curatorId)?(scripts_echoLog({type:"whiteList",text:"Steam.unfollowCurator",id:curatorId}),!0):this.#ASF?await this.#ASF.toggleCurator(curatorId,doTask):(logStatus=scripts_echoLog({type:doTask?"followingCurator":"unfollowingCurator",text:curatorId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/curators/ajaxfollow",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({clanid:curatorId,sessionid:this.#auth.storeSessionID,follow:doTask}),dataType:"json"}),"Success"===result?200===data?.status&&1===data.response?.success?.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(`+data?.response?.success||data?.status+")"),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.toggleCurator"),!1}}async getCuratorId(path,name){try{var logStatus=scripts_echoLog({type:"gettingCuratorId",text:path+"/"+name}),curatorId=this.#cache.curator[path+"/"+name];if(curatorId)return logStatus.success(),curatorId;var{result,statusText,status,data}=await tools_httpRequest({url:`https://store.steampowered.com/${path}/`+name,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let curatorId=data.responseText.match(/g_pagingData.*?"clanid":([\d]+)/)?.[1];return curatorId?(this.#setCache("curator",path+"/"+name,curatorId),logStatus.success(),curatorId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getCuratorID"),!1}}async#toggleCuratorLike(link,doTask=!0){try{var curatorId,[path,name]=link.split("/");return path&&name?!!(curatorId=await this.getCuratorId(path,name))&&await this.#toggleCurator(curatorId,doTask):(scripts_echoLog({text:i18n("errorLink",link)}),!1)}catch(error){return throwError_throwError(error,"Steam.toggleCuratorLike"),!1}}async#getAnnouncementParams(appId,viewId){try{var clanid,gid,logStatus=scripts_echoLog({type:"gettingAnnouncementParams",text:appId,id:viewId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://store.steampowered.com/events/ajaxgetpartnerevent?appid=${appId}&announcement_gid=${viewId}&lang_list=6_0&last_modified_time=0&origin=https:%2F%2Fstore.steampowered.com&for_edit=false`,method:"GET",responseType:"json",headers:{Host:"store.steampowered.com",Referer:`https://store.steampowered.com/news/app/${appId}/view/`+viewId}});return"Success"===result?200===data?.status&&1===data?.response?.success?({clanid,gid}=data.response.event?.announcement_body||{},clanid?(logStatus.success(),{clanId:clanid,gid:gid}):(logStatus.error(`Error:${data.statusText}(${data.status})`),{})):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),{}):(logStatus.error(result+`:${statusText}(${status})`),{})}catch(error){return throwError_throwError(error,"Steam.likeAnnouncement"),{}}}async#likeAnnouncement(id){try{var[appId,viewId]=id.split("/");if(appId&&viewId){var{clanId,gid}=await this.#getAnnouncementParams(appId,viewId);if(clanId){var logStatus=scripts_echoLog({type:"likingAnnouncement",text:appId,id:viewId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/updated/ajaxrateupdate/"+(gid||viewId),method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:`https://store.steampowered.com/news/app/${appId}/view/`+viewId},data:$.param({sessionid:this.#auth.storeSessionID,voteup:1,clanid:clanId,ajax:1}),dataType:"json"});if("Success"===result)return 200===data?.status&&1===data.response.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}else scripts_echoLog({}).error(i18n("missParams")+"(id)");return!1}catch(error){return throwError_throwError(error,"Steam.likeAnnouncement"),!1}}async#appid2subid(id){try{var logStatus=scripts_echoLog({type:"gettingSubid",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+id,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;if("CN"===this.#area&&data.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result&&"skip"!==result?await this.#appid2subid(id):!1}var subid=data.responseText.match(/name="subid" value="([\d]+?)"/)?.[1];return subid?(logStatus.success(),subid):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.appid2subid"),!1}}async#getLicenses(){try{var logStatus=scripts_echoLog({text:i18n("gettingLicenses")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/dynamicstore/userdata/?t="+(new Date).getTime(),method:"GET",responseType:"json"});return"Success"===result?200===data?.status?(logStatus.success(),data.response?.rgOwnedPackages):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.getLicenses"),!1}}async#addLicense(id){try{if(this.#ASF)return await this.#ASF.addLicense(id);var[type,ids]=id.split("-");if("appid"===type){var subid=await this.#appid2subid(ids);if(subid){var logStatus=scripts_echoLog({type:"addingFreeLicense",text:ids});if(await this.#addFreeLicense(subid,logStatus)){var{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+ids,method:"GET"});if("Success"===result)return 200===data?.status?data.responseText.includes("ds_owned_flag ds_flag")||data.responseText.includes('class="already_in_library"')?(logStatus.success(),!0):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}return!1}if("subid"!==type)return!1;"CN"===this.#area&&(scripts_echoLog({}).success(i18n("tryChangeAreaNotice")),await this.#changeArea());var logStatusArr={},idsArr=ids.split(",");for(let subid of idsArr){let logStatus=scripts_echoLog({type:"addingFreeLicenseSubid",text:subid});if(!await this.#addFreeLicense(subid,logStatus))return!1;logStatusArr[subid]=logStatus}var licenses=await this.#getLicenses();if(!licenses)return!1;for(let subid of idsArr)licenses.includes(parseInt(subid,10))?logStatusArr[subid].success():logStatusArr[subid].error();return!0}catch(error){return throwError_throwError(error,"Steam.addLicense"),!1}}async#addFreeLicense(id,logStatusPre){try{var logStatus=logStatusPre||scripts_echoLog({type:"addingFreeLicenseSubid",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/checkout/addfreelicense",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/account/licenses/"},data:$.param({action:"add_to_cart",sessionid:this.#auth.storeSessionID,subid:id}),dataType:"json"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;if("CN"===this.#area&&data.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result?await this.#addFreeLicense(id):!1}return logStatus.success(),!0}catch(error){return throwError_throwError(error,"Steam.addFreeLicense"),!1}}async#requestPlayTestAccess(id){try{var logStatus,result,statusText,status,data;return this.#ASF?await this.#ASF.requestPlayTestAccess(id):(logStatus=scripts_echoLog({type:"requestingPlayTestAccess",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/ajaxrequestplaytestaccess/"+id,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/app/"+id},data:$.param({sessionid:this.#auth.storeSessionID}),dataType:"json"}),"Success"===result?200===data?.status&&1===data?.response?.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.requestPlayTestAccess"),!1}}async toggle({doTask=!0,groupLinks=[],officialGroupLinks=[],wishlistLinks=[],followLinks=[],forumLinks=[],workshopLinks=[],workshopVoteLinks=[],curatorLinks=[],curatorLikeLinks=[],announcementLinks=[],licenseLinks=[],playtestLinks=[]}){try{if(0<[...groupLinks,...officialGroupLinks,...forumLinks,...workshopLinks,...workshopVoteLinks].length&&!this.#communityInitialized)return scripts_echoLog({text:i18n("needInit")}),!1;if(0<[...wishlistLinks,...followLinks,...curatorLinks,...curatorLikeLinks,...announcementLinks,...licenseLinks,...playtestLinks].length&&!this.#storeInitialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.steam.groups||!doTask&&!globalOptions.undoTask.steam.groups)scripts_echoLog({type:"globalOptionsSkip",text:"steam.groups"});else{var realGroups=this.getRealParams("groups",groupLinks,doTask,link=>link.match(/groups\/(.+)\/?/)?.[1]);if(0link.match(/games\/(.+)\/?/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/\?id=([\d]+)/)?.[1]);if(0link.match(/\?id=([\d]+)/)?.[1]);if(doTask&&0link.match(/curator\/([\d]+)/)?.[1]),realCuratorLikes=this.getRealParams("curatorLikes",curatorLikeLinks,doTask,link=>link.match(/https?:\/\/store\.steampowered\.com\/(.*?)\/([^/?]+)/)?.slice(1,3).join("/"));if(0(link.includes("store.steampowered.com")?link.match(/store\.steampowered\.com\/news\/app\/([\d]+)\/view\/([\d]+)/):link.match(/steamcommunity\.com\/games\/([\d]+)\/announcements\/detail\/([\d]+)/))?.slice(1,3).join("/"));if(doTask&&0link.match(/app\/([\d]+)/)?.[1]);if(doTask&&globalOptions.doTask.steam.playtests&&0("CN"!==this.#area&&(scripts_echoLog({}).warning(i18n("steamFinishNotice")),await this.#changeArea("CN")),!0))}catch(error){return throwError_throwError(error,"Steam.toggle"),!1}}#setCache(type,name,id){try{this.#cache[type][name]=id,GM_setValue("steamCache",this.#cache)}catch(error){throwError_throwError(error,"Steam.setCache")}}}let social_Steam=Steam;class GiveawaySu{undoneTasks={steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],curatorLikeLinks:[],followLinks:[],forumLinks:[],announcementLinks:[],workshopVoteLinks:[],playtestLinks:[]},discord:{serverLinks:[]},instagram:{userLinks:[]},vk:{nameLinks:[]},twitch:{channelLinks:[]},reddit:{redditLinks:[]},youtube:{channelLinks:[],likeLinks:[]},twitter:{userLinks:[],retweetLinks:[]}};giveawayId;socialInitialized={discord:!1,instagram:!1,reddit:!1,twitch:!1,vk:!1,youtube:!1,steamStore:!1,steamCommunity:!1,twitter:!0};initialized=!1;social={};static test(){return/^https?:\/\/giveaway\.su\/giveaway\/view\/[\d]+/.test(window.location.href)}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){throwError_throwError(error,"Giveawaysu.after")}}init(){try{var logStatus=scripts_echoLog({text:i18n("initing")});return 0<$("a.steam-login").length?(window.open("/steam/redirect","_self"),logStatus.warning(i18n("needLogin")),!1):!!this.#getGiveawayId()&&(this.initialized=!0,logStatus.success(),!0)}catch(error){return throwError_throwError(error,"Giveawaysu.init"),!1}}async#classifyTask(){try{var logStatus=scripts_echoLog({text:i18n("getTasksInfo")}),pro=[],tasks=$("#actions tr");$("div.bind-discord").is(":visible")&&$("div.bind-discord a")[0].click(),$("div.bind-twitch").is(":visible")&&$("div.bind-twitch a")[0].click();for(let task of tasks)pro.push(new Promise(resolve=>{var td=$(task).find('td:not(".hidden")'),colorfulTask=td.eq(1).find('a:not([data-trigger="link"])'),colorlessTask=td.eq(2).find('a:not([data-trigger="link"])'),colorfulTask=0{try{if(!link)return null;let redirectLinksCache=GM_getValue("redirectLinks")||{};return redirectLinksCache[link],await tools_httpRequest({url:link,method:"GET"}).then(({data})=>data?.finalUrl?(redirectLinksCache[link]=data.finalUrl,GM_setValue("redirectLinks",redirectLinksCache),data.finalUrl):null)}catch(error){return throwError_throwError(error,"getRedirectLink"),null}})(colorfulTask.attr("href")).then(taskLink=>{if(!taskLink)return resolve(!1);taskIcon.includes("steam")&&/join/gi.test(taskName)?this.undoneTasks.steam.groupLinks.push(taskLink):/like.*announcement/gi.test(taskName)?this.undoneTasks.steam.announcementLinks.push(taskLink):/(follow|subscribe).*curator/gim.test(taskName)&&/^https?:\/\/store\.steampowered\.com\/curator\//.test(taskLink)?this.undoneTasks.steam.curatorLinks.push(taskLink):taskIcon.includes("steam")&&/follow|subscribe/gim.test(taskName)?this.undoneTasks.steam.curatorLikeLinks.push(taskLink):/subscribe.*steam.*forum/gim.test(taskName)?this.undoneTasks.steam.forumLinks.push(taskLink):taskIcon.includes("thumbs-up")&&/^https?:\/\/steamcommunity\.com\/sharedfiles\/filedetails\/\?id=[\d]+/.test(taskLink)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):taskIcon.includes("plus")&&/request.*playtest/gim.test(taskName)?this.undoneTasks.steam.playtestLinks.push(taskLink):taskIcon.includes("discord")||/join.*discord/gim.test(taskName)?this.undoneTasks.discord.serverLinks.push(taskLink):taskIcon.includes("instagram")||/follow.*instagram/gim.test(taskName)?this.undoneTasks.instagram.userLinks.push(taskLink):taskIcon.includes("twitch")||/follow.*twitch.*channel/gim.test(taskName)?this.undoneTasks.twitch.channelLinks.push(taskLink):taskIcon.includes("reddit")||/subscribe.*subreddit/gim.test(taskName)||/follow.*reddit/gim.test(taskName)?this.undoneTasks.reddit.redditLinks.push(taskLink):/watch.*art/gim.test(taskName)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):/subscribe.*youtube.*channel/gim.test(taskName)?this.undoneTasks.youtube.channelLinks.push(taskLink):/(watch|like).*youtube.*video/gim.test(taskName)||(taskIcon.includes("youtube")||taskIcon.includes("thumbs-up"))&&/(watch|like).*video/gim.test(taskName)?this.undoneTasks.youtube.likeLinks.push(taskLink):taskIcon.includes("vk")||/join.*vk.*group/gim.test(taskName)?this.undoneTasks.vk.nameLinks.push(taskLink):/(on twitter)|(Follow.*on.*Facebook)/gim.test(taskName)||(/wishlist.*game|add.*wishlist/gim.test(taskName)&&this.undoneTasks.steam.wishlistLinks.push(taskLink),/follow.*button/gim.test(taskName)&&this.undoneTasks.steam.followLinks.push(taskLink)),resolve(!0)}).catch(error=>(throwError_throwError(error,"Giveawaysu.classifyTask->getRedirectLink"),!1))}));return await Promise.all(pro),logStatus.success(),this.undoneTasks=this.#uniqueTasks(this.undoneTasks),!0}catch(error){return throwError_throwError(error,"Giveawaysu.classifyTask"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin&&0<$("a.steam-login").length&&window.open("/steam/redirect","_self"),!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLogin"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey&&0<$(".giveaway-ended").length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(({value})=>{value&&window.close()}),!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLeftKey"),!1}}#getGiveawayId(){var giveawayId=window.location.href.match(/\/view\/([\d]+)/)?.[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}async#bind(name,init){try{return{name:name,result:await init}}catch(error){return throwError_throwError(error,"GiveawaySu.bind"),{name:name,result:!1}}}async#initSocial(){try{var steamLength,steamCommunityLength,pro=[];let tasks=this.undoneTasks;return tasks.discord&&0[...total,...arr]).length&&!this.socialInitialized.discord&&(this.social.discord=new social_Discord,pro.push(this.#bind("discord",this.social.discord.init("do")))),tasks.instagram&&0[...total,...arr]).length&&!this.socialInitialized.instagram&&(this.social.instagram=new social_Instagram,pro.push(this.#bind("instagram",this.social.instagram.init()))),tasks.reddit&&0[...total,...arr]).length&&!this.socialInitialized.reddit&&(this.social.reddit=new social_Reddit,pro.push(this.#bind("reddit",this.social.reddit.init()))),tasks.twitch&&0[...total,...arr]).length&&!this.socialInitialized.twitch&&(this.social.twitch=new social_Twitch,pro.push(this.#bind("twitch",this.social.twitch.init()))),tasks.vk&&0[...total,...arr]).length&&!this.socialInitialized.vk&&(this.social.vk=new social_Vk,pro.push(this.#bind("vk",this.social.vk.init()))),tasks.youtube&&0[...total,...arr]).length&&!this.socialInitialized.youtube&&(this.social.youtube=new Youtube,pro.push(this.#bind("youtube",this.social.youtube.init()))),tasks.steam&&0<(steamLength=Object.values(tasks.steam).reduce((total,arr)=>[...total,...arr]).length)&&(this.social.steam||(this.social.steam=new social_Steam),0["groupLinks","forumLinks","workshopLinks","workshopVoteLinks"].includes(type)&&tasks.steam?.[type]?.length||0).reduce((total,number)=>total+number,0))&&!this.socialInitialized.steamStore&&pro.push(this.#bind("steamStore",this.social.steam.init("store"))),0{let checked=!0;for(var data of result)data.result?this.socialInitialized[data.name]=data.result:checked=!1;return checked})}catch(error){return throwError_throwError(error,"GiveawaySu.initSocial"),!1}}#uniqueTasks(allTasks){var social,types,result={};for([social,types]of Object.entries(allTasks)){result[social]={};for(var[type,tasks]of Object.entries(types))result[social][type]=unique(tasks)}return result}async#toggleTask(){try{var pro,tasks;return this.initialized||this.init()?!!await this.#classifyTask()&&!!await this.#initSocial()&&(pro=[],tasks=this.undoneTasks,"skip"!==this.socialInitialized.discord&&this.social.discord&&pro.push(this.social.discord.toggle({doTask:!0,...tasks.discord})),this.social.instagram&&pro.push(this.social.instagram.toggle({doTask:!0,...tasks.instagram})),this.social.reddit&&pro.push(this.social.reddit.toggle({doTask:!0,...tasks.reddit})),this.social.twitch&&pro.push(this.social.twitch.toggle({doTask:!0,...tasks.twitch})),this.social.vk&&pro.push(this.social.vk.toggle({doTask:!0,...tasks.vk})),this.social.youtube&&pro.push(this.social.youtube.toggle({doTask:!0,...tasks.youtube})),this.social.steam&&pro.push(this.social.steam.toggle({doTask:!0,...tasks.steam})),await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!0):!1}catch(error){return throwError_throwError(error,"GiveawaySu.toggleTask"),!1}}async doTask(){try{return $("#getKey").on("click",()=>{$("#auto-task-info-div").remove(),$(window.STYLE).remove(),$("#getKey").off()}),await this.#toggleTask()}catch(error){return throwError_throwError(error,"GiveawaySu.doTask"),!1}}async verifyTask(){try{var task;for(task of $("#actions tr")){var icon,button,href,$task=$(task);"adjs"!==$task.attr("data-action-id")&&("A"===(button=(icon=$task.find("i.glyphicon-refresh")).parent()).prop("tagName")?(href=button.attr("href"),button.attr("href","javascript:void(0);").attr("target","_self")[0].click(),button.attr("href",href)):icon.hasClass("spin")||icon.hasClass("glyphicon-ok")||(button[0].click(),await delay(1e3)))}}catch(error){throwError_throwError(error,"GiveawaySu.verifyTask")}}}let Giveawaysu=GiveawaySu,for_giveawaysu=__webpack_require__(738);if(window.STYLE=GM_addStyle(for_giveawaysu.A+GM_getResourceText("style")),"discord.com"===window.location.hostname){external_Swal_namespaceObject=window.localStorage;if("#auth"===window.location.hash){window.localStorage.removeItem=()=>!0;var discordAuth=external_Swal_namespaceObject?.getItem("token")?.replace(/^"|"$/g,"");discordAuth&&0{if("www.twitch.tv"===window.location.hostname&&"#auth"===window.location.hash&&(authToken=external_Cookies_namespaceObject.get("auth-token"),!!external_Cookies_namespaceObject.get("login")?(GM_setValue("twitchAuth",{authToken:authToken,clientId:commonOptions?.headers?.["Client-ID"]}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"x.com"===window.location.hostname&&"#auth"===window.location.hash){var authToken=external_Cookies_namespaceObject.get("ct0");let isLogin=!!external_Cookies_namespaceObject.get("twid");isLogin&&authToken?(GM_setValue("twitterAuth",{ct0:authToken}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))}if("www.youtube.com"===window.location.hostname&&"#auth"===window.location.hash&&((authToken=external_Cookies_namespaceObject.get("__Secure-3PAPISID"))?(GM_setValue("youtubeAuth",{PAPISID:authToken}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"www.reddit.com"===window.location.hostname&&("#auth"===window.location.hash||"#auth"===GM_getValue("redditAuth"))){authToken=$("#redesign-beta-optin-btn");if(0

    `),await website.after(),$("#auto-do-task").on("click",()=>{website.doTask()}),$("#auto-verify-task").on("click",()=>{website.verifyTask()}),console.log("%c%s","color:#1bbe1a","Auto Task GS特供脚本初始化完成!")}})}})(); \ No newline at end of file + ${text?.replace("u_","")}]...`);break;case"followingYtbChannel":case"unfollowingYtbChannel":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"likingYtbVideo":case"unlikingYtbVideo":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingVkId":case"joiningVkGroup":case"leavingVkGroup":case"joiningVkPublic":case"leavingVkPublic":case"sendingVkWall":case"deletingVkWall":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"visitingLink":ele=$(`
  • ${i18n("visitingLink")}[${text}]...
  • `);break;case"verifyingInsAuth":case"text":ele=$(`
  • ${i18n(text)}
  • `);break;case"html":ele=$(text||html);break;case"whiteList":ele=$(`
  • ${i18n("skipTask")}[${text}(${id})](${i18n("whiteList")})
  • `);break;case"globalOptionsSkip":ele=$(`
  • ${i18n("skipTaskOption")}${text}
  • `);break;default:ele=$(`
  • ${i18n("unKnown")}:${type}(${text})...
  • `)}else ele=text?$(`
  • ${i18n(text)}
  • `):html?$(html):$("
  • ");return ele.addClass("card-text"),$("#auto-task-info").append(ele),ele[0]?.scrollIntoView(),{font:ele.find("font"),success(text="Success",html=!1){return this.font?.attr("class","").addClass("success"),html?this.font?.html(text):this.font?.text(text),this},error(text="Error",html=!1){return this.font?.attr("class","").addClass("error"),html?this.font?.html(text):this.font?.text(text),this},warning(text="Warning",html=!1){return this.font?.attr("class","").addClass("warning"),html?this.font?.html(text):this.font?.text(text),this},info(text="Info",html=!1){return this.font?.attr("class","").addClass("info"),html?this.font?.html(text):this.font?.text(text),this},view(){return this.font?.[0].scrollIntoView(),this}}}catch(error){return throwError_throwError(error,"echoLog"),emptyStatus}},unique=array=>{try{return[...new Set(array)]}catch(error){return throwError_throwError(error,"unique"),[]}},delay=(time=1e3)=>new Promise(resolve=>{setTimeout(()=>{resolve(!0)},time)}),defaultGlobalOptions={doTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0,workshopVotes:!0,announcements:!0,licenses:!0,playtests:!0}},undoTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0}},ASF:{AsfEnabled:!1,AsfIpcUrl:"",AsfIpcPassword:"",AsfBotname:"asf"},position:{buttonSideX:"right",buttonSideY:"top",buttonDistance:"15,30",showButtonSideX:"right",showButtonSideY:"top",showButtonDistance:"15,30",logSideX:"right",logSideY:"bottom",logDistance:"10,10"},hotKey:{doTaskKey:"alt + d",undoTaskKey:"alt + u",toggleLogKey:"alt + l"},other:{twitterVerifyId:"783214",youtubeVerifyChannel:"UCrXUsMBcfTVqwAS7DKg9C0Q",autoUpdateSource:"jsdelivr",language:"zh",checkLogin:!0,checkLeftKey:!0,defaultShowButton:!0,defaultShowLog:!0,debug:!1,receivePreview:!0}},assignObject=(external_Swal_namespaceObject=GM_getValue("globalOptions")||{},(obj1,obj2)=>{try{var key,value,newObj={};for([key,value]of Object.entries(obj1))"[object Object]"===Object.prototype.toString.call(value)&&"[object Object]"===Object.prototype.toString.call(obj2[key])?newObj[key]=assignObject(value,obj2[key]):newObj[key]=obj2[key]??value;return newObj}catch(error){return throwError_throwError(error,"assignObject"),defaultGlobalOptions}}),globalOptions=assignObject(defaultGlobalOptions,external_Swal_namespaceObject),languages={zh:{website:"网站",type:"类型",edit:"编辑",whiteList:"白名单",skipTask:"跳过撤销任务",whiteListOptions:"白名单设置",changeWhiteListOption:"设置白名单(%0)",whiteListNotFound:"找不到此项白名单: %0",changeWhiteListSuccess:"白名单修改成功,刷新生效!",changeWebsiteOptions:"网站设置",changeGlobalOptions:"全局设置",ok:"是",save:"保存",close:"关闭",return:"返回",option:"选项",value:"值",websiteOptions:"当前网站设置",changeWebsiteOptionsSuccess:"更改当前网站设置成功,刷新生效!",changeGlobalOptionsSuccess:"更改全局设置成功,刷新生效!",needLogin:"请先登录!",getTasksInfo:"正在获取并处理任务信息...",gettingKey:"正在获取Key...",verifyingTask:"正在验证任务",notice:"自动任务脚本提醒",noKeysLeft:"此页面已经没有剩余key了,是否关闭?",giveawayEnded:"此活动已结束,是否关闭?",giveawayNotWork:"此活动因某些原因(已结束/暂停/未开始...)不可用(如果是脚本误判请及时反馈),是否关闭?",confirm:"确定",cancel:"取消",unKnown:"未知",unKnownTaskType:"未识别的任务",doing:"正在做任务",allTasksComplete:"所有任务已完成!",getTaskIdFailed:"获取任务Id失败!",initSuccess:"%0 初始化成功!",initFailed:"%0 初始化失败!",errorLink:"链接错误: %0",needInit:"请先初始化",verifyingAuth:"正在验证%0凭证...",updatingAuth:"正在更新%0凭证...",refreshingToken:"正在刷新%0凭证...",settingToken:"正在设置%0凭证...",initing:"正在初始化...",getFailed:"获取%0失败!",checkLoginFailed:"检测登录状态失败!",checkLeftKeyFailed:"检测剩余Key失败!",userId:"用户Id",joiningGiveaway:"正在加入赠Key",needJoinGiveaway:"需要先加入赠Key",cannotUndo:"此网站不支持取消任务",verifyAuth:"正在验证 %0 凭证...",closePageNotice:"如果此页面没有自动关闭,请自行关闭本页面。",errorReport:"检测到脚本报错,是否前往反馈BUG?",visitingLink:"正在访问链接: ",doTask:"做任务",undoTask:"撤销任务",verifyTask:"验证任务",getKey:"获取Key",selectAll:"全选",selectNone:"全不选",invertSelect:"反选",doFreeTask:"加入免费赠品",doPointTask:"加入点数赠品",skipTaskOption:"设置中已配置跳过任务",other:"其他",globalOptions:"全局设置",checkLogin:"登录检测
    需要登录的网站自动登录,部分网站支持",checkLeftKey:"剩余Key检测
    赠Key活动结束提示是否关闭,部分网站支持",twitterVerifyId:"通过尝试关注该账号验证Twitter凭证
    默认为Twitter官方帐号 783214
    不想关注官方账号可以改为自己的帐号",youtubeVerifyChannel:"通过尝试订阅该频道验证YouTube凭证
    默认为YouTube官方频道 UCrXUsMBcfTVqwAS7DKg9C0Q
    不想关注官方频道可以改为自己的频道",autoUpdateSource:"更新源
    github: 需代理,实时更新
    jsdelivr: 可不用代理,更新有延迟
    standby: 备用
    auto: 依次使用github, jsdelivr, standby源进行尝试更新",saveGlobalOptions:"保存全局设置",settingPage:"设置页面",name:"名称",version:"版本",scriptManager:"脚本管理器",script:"脚本",environment:"环境",os:"系统",browser:"浏览器",getId:"获取 %0 id",getTwitterUserId:"获取Twitter用户id(获取id功能仅在设置页面可用)",getYoutubeChannelId:"获取Youtube频道id(获取id功能仅在设置页面可用)",showButton:"显示按钮",hideButton:"隐藏按钮",showLog:"显示日志",hideLog:"隐藏日志",defaultShowButton:"默认显示按钮",defaultShowLog:"默认显示日志",debug:"输出调试日志,不要开启此选项!",receivePreview:"接收预览版更新",position:"组件位置",buttonSideX:"按钮区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",buttonSideY:"按钮区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",buttonDistance:"按钮区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",showButtonSideX:"显示按钮水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",showButtonSideY:"显示按钮垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",showButtonDistance:"显示按钮距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",logSideX:"日志区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",logSideY:"日志区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",logDistance:"日志区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",hotKey:"快捷键",doTaskKey:"做任务快捷键
    (实时预览功能仅在设置页面可用)",undoTaskKey:"撤销任务快捷键
    (实时预览功能仅在设置页面可用)",toggleLogKey:"显示/隐藏日志快捷键
    (实时预览功能仅在设置页面可用)",tasksHistory:"任务历史",clearHistory:"清空历史",clearHistoryFinished:"已清空任务历史!",deleteTask:"删除任务",lastChangeTime:"最后一次修改时间",clearTaskFinished:"删除以下任务完成!",clearTaskFailed:"删除任务失败,没有找到任务名!",syncData:"数据同步",settingData:"正在上传数据...",gettingData:"正在获取数据...",help:"帮助",fileName:"文件名",upload2gist:"同步到Gist",downloadFromGist:"从Gist同步",saveAndTest:"保存配置并测试",testSuccess:"测试成功!",testFailed:"测试失败!",saveAndTestNotice:"请先保存配置并测试!",processingData:"正在处理数据...",updatingData:"正在上传数据...",syncDataSuccess:"同步数据成功!",syncDataFailed:"同步数据失败,请在控制台查看错误信息!",downloadingData:"正在下载数据...",checkedNoData:"没有检测到远程数据,请确认配置是否正确!",savingData:"正在保存数据...",syncHistory:"同步任务历史",checkUpdateFailed:"检测更新失败",newVersionNotice:'检测到新版本V%0, 点此更新',language:"语言
    目前仅支持zh: 中文, en: 英文",gistOptions:"Gist 设置",swalNotice:"检测到您第一次安装V4版本脚本,请前往阅读用前必读内容!",echoNotice:'检测到您第一次安装V4版本脚本,请点此前往阅读用前必读内容!',noticeLink:"https://auto-task-doc.js.org/guide/#用前必读",toGithub:"前往Github反馈",toKeylol:"前往其乐论坛反馈",copySuccess:"错误信息已复制到剪切板,是否前往其乐论坛反馈?",copyFailed:"请复制下方错误信息后前往Keylol论坛反馈!",updateText:"%0 版本更新内容:",Active:"进行中",Ended:"已结束",Banned:"已封禁",Paused:"已暂停",notStart:"未开始",noRemoteData:"检测到远程无数据",errorRemoteDataFormat:"远程数据格式错误",updateHistory:'历史更新记录点此查看',AsfEnabled:'使用ASF做Steam相关任务(需ASFEnhance插件)',AsfIpcUrl:"ASF IPC 地址",AsfIpcPassword:"ASF IPC 密码",versionNotMatched:"脚本管理器版本过低,需TamperMonkey >= 5.2.0或TamperMonkey Beta >= 5.2.6196",groups:"组",officialGroups:"官方组",wishlists:"愿望单",follows:"游戏关注",forums:"论坛",workshops:"创意工坊收藏",curators:"鉴赏家",workshopVotes:"创意工坊点赞",announcements:"社区通知",steamCommunity:"Steam社区",steamStore:"Steam商店",licenses:"入库免费游戏",playtests:"请求访问权限",needLoginSteamStore:'请先登录Steam商店',needLoginSteamCommunity:'请先登录Steam社区',joiningSteamGroup:"正在加入Steam组",leavingSteamGroup:"正在退出Steam组",gettingSteamGroupId:"正在获取Steam组Id",joiningSteamOfficialGroup:"正在加入Steam官方组",leavingSteamOfficialGroup:"正在退出Steam官方组",gettingSteamOfficialGroupId:"正在获取Steam官方组Id",subscribingForum:"正在订阅Steam论坛",unsubscribingForum:"正在取消订阅Steam论坛",gettingForumId:"正在获取Steam论坛Id",followingCurator:"正在关注Steam鉴赏家",unfollowingCurator:"正在取关Steam鉴赏家",gettingCuratorId:"正在获取Steam鉴赏家Id",addingToWishlist:"正在添加游戏到Steam愿望单",removingFromWishlist:"正在从Steam愿望单移除游戏",followingGame:"正在关注Steam游戏",unfollowingGame:"正在取关Steam游戏",favoritingWorkshop:"正在收藏Steam创意工坊物品",unfavoritingWorkshop:"正在取消收藏Steam创意工坊物品",gettingWorkshopAppId:"正在获取Steam创意工坊物品Id",votingUpWorkshop:"正在点赞Steam创意工坊物品",gettingAnnouncementParams:"正在获取Steam通知信息",likingAnnouncement:"正在点赞Steam通知",changingArea:"正在更换Steam地区: %0...",notNeededChangeArea:"当前地区不需要更换",noAnotherArea:"请检测是否开启正确开启代理",gettingAreaInfo:"正在获取Steam地区信息...",changeAreaNotice:"疑似锁区游戏,尝试换区执行",steamFinishNotice:"Steam任务完成,尝试将购物车地区换回CN",gettingSubid:"正在获取游戏subid",addingFreeLicense:"正在入库",missParams:"缺少参数",gettingLicenses:"正在获取Licenses...",requestingPlayTestAccess:"正在请求访问权限",tryChangeAreaNotice:"此功能无法检测游戏是否限区,因此会尝试换区后再入库,换区失败也不影响后续入库",gettingUserLink:"正在获取Steam用户社区链接...",retry:"重试",initingASF:"正在初始化ASF...",servers:"服务器",joiningDiscordServer:"正在加入Discord服务器",leavingDiscordServer:"正在退出Discord服务器",gettingDiscordGuild:"正在获取Discord服务器Id",getDiscordAuthFailed:"获取Discord凭证失败,请检测Discord帐号是否已登录",discordImportantNotice:"重要提醒!!!",discordImportantNoticeText:"由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!",continue:"继续",skipDiscordTask:"跳过Discord任务",continueAndDontRemindAgain:"继续且不再提醒",users:"用户",loginIns:'请先登录Instagram',insBanned:"您的Instagram账户已被封禁",verifyingInsAuth:"正在验证Instagram凭证...",gettingInsUserId:"正在获取Instagram用户Id",followingIns:"正在关注Instagram用户",unfollowingIns:"正在取关Instagram用户",reddits:"社区/用户",loginReddit:'请先登录Reddit',changingRedditVersion:"正在切换Reddit为新版页面...",joiningReddit:"正在加入Reddit社区",leavingReddit:"正在退出Reddit社区",followingRedditUser:"正在关注Reddit用户",unfollowingRedditUser:"正在取关Reddit用户",channels:"频道",followingTwitchChannel:"正在关注Twitch频道",unfollowingTwitchChannel:"正在取关Twitch频道",gettingTwitchChannelId:"正在获取Twitch频道Id",checkingTwitchIntegrity:"正在检查Twitch完整性...",twitterUser:"推特用户",retweets:"转推",gettingTwitterUserId:"正在获取推特用户Id",followingTwitterUser:"正在关注推特用户",unfollowingTwitterUser:"正在取关推特用户",retweetting:"正在转推",unretweetting:"正在撤销转推",names:"组/社区/动态",loginVk:'请先登录Vk',gettingVkId:"正在获取Vk任务Id",joiningVkGroup:"正在加入Vk组",leavingVkGroup:"正在退出Vk组",joiningVkPublic:"正在加入Vk社区",leavingVkPublic:"正在退出Vk社区",sendingVkWall:"正在转发Vk动态",deletingVkWall:"正在撤销转发Vk动态",youtubeChannel:"YouTube频道",likes:"点赞",loginYtb:'请先登录YouTube',tryUpdateYtbAuth:'请尝试更新YouTube凭证',gettingYtbToken:"正在获取YouTube Token...",followingYtbChannel:"正在订阅YouTube频道",unfollowingYtbChannel:"正在退订YouTube频道",likingYtbVideo:"正在点赞YouTube视频",unlikingYtbVideo:"正在取消点赞YouTube视频",giveKeyNoticeBefore:"每次验证间隔15s",giveKeyNoticeAfter:'如果没有key, 请在https://givekey.ru/profile查看',noPoints:"点数不够,跳过抽奖",getNeedPointsFailed:"获取所需点数失败,跳过抽奖",joiningLottery:"正在加入抽奖",doingGleamTask:"正在做Gleam任务...",gettingGleamLink:"正在获取Gleam任务链接...",gleamTaskNotice:"如果此页面长时间未关闭,请完成任一任务后自行关闭!",verifiedGleamTasks:"已尝试验证所有任务,验证失败的任务请尝试手动验证或完成!",campaign:"检测到人机验证,请完成验证后重新验证任务!",gsNotice:'为避免得到"0000-0000-0000"key, 已自动屏蔽"Grab Key"按钮,获取key时请关闭脚本!',giveeClubVerifyNotice:"正在验证任务...",giveeClubVerifyFinished:"请等待验证完成后自行加入赠Key",doingKeyhubTask:"正在做Keyhub任务...",SweepWidgetNotice:"正在处理并验证任务,每次验证任务有1~3s间隔防止触发验证过快警告...",tasksNotCompleted:"任务未完成",confirmingTask:"正在跳过警告页面..."},en:{website:"Website",type:"Type",edit:"Edit",whiteList:"Whitelist",skipTask:"Skip undo task",whiteListOptions:"Whitelist options",changeWhiteListOption:"Whitelist option(%0)",whiteListNotFound:"Cannot find this whitelist: %0",changeWhiteListSuccess:"The whitelist is successfully modified, and the page refresh will take effect!",changeWebsiteOptions:"Website options",changeGlobalOptions:"Global options",ok:"OK",save:"Save",close:"Close",return:"Return",option:"Option",value:"Value",websiteOptions:"Current website settings",changeWebsiteOptionsSuccess:"The current website setting is changed successfully, and the page refresh will take effect!",changeGlobalOptionsSuccess:"The global setting is changed successfully, and the refresh will take effect!",needLogin:"Please log in first!",getTasksInfo:"Obtaining and processing task information...",gettingKey:"Getting Key...",verifyingTask:"Verifying task",notice:"Automatic task script notice",noKeysLeft:"There are no more keys left on this page. Do you want to close it?",giveawayEnded:"This event has ended, do you want to close it?",giveawayNotWork:"This activity is unavailable for some reasons (banned/ended/paused/not started...) (if it is a script misjudgment, please give us feedback in time), is it closed?",confirm:"Confirm",cancel:"Cancel",unKnown:"Unknown",unKnownTaskType:"Unrecognized task",doing:"Doing a task",allTasksComplete:"All tasks have been completed!",getTaskIdFailed:"Failed to obtain task Id!",initSuccess:"%0 was initialized successfully!",initFailed:"%0 initialization failed!",errorLink:"Link error: %0",needInit:"Please initialize first",verifyingAuth:"Verifying %0 token...",updatingAuth:"Update %0 token...",initing:"Initializing...",getFailed:"Failed to get %0!",checkLoginFailed:"Failed to detect login status!",checkLeftKeyFailed:"Failed to detect the remaining keys!",userId:"User Id",joiningGiveaway:"Joining giveaway",needJoinGiveaway:"Need to join the giveaway first",cannotUndo:"This website does not support canceling tasks",verifyAuth:"Verifying %0 token...",closePageNotice:"f this page does not close automatically, please close this page yourself.",errorReport:"A script error is detected, do you want to report the BUG?",visitingLink:"Visiting link: ",doTask:"DoTask",undoTask:"UndoTask",verifyTask:"Verify",getKey:"GetKey",selectAll:"SelectAll",selectNone:"SelectNone",invertSelect:"InvertSelect",doFreeTask:"FreeTask",doPointTask:"PointTask",skipTaskOption:"Skip task has been configured in the settings",other:"Other",globalOptions:"Global Options",checkLogin:"Login detection
    Need to log in to the website automatically log in, part of this website supports.",checkLeftKey:"Key remaining detection
    The end of the giveaway event prompts whether to close or not, part of this website supports.",twitterVerifyId:"Verify Twitter token by trying to follow the account.
    The default is the official Twitter account 783214.
    If you don't want to follow the official account, you can change it to your own account.",youtubeVerifyChannel:"Verify YouTube token by trying to subscribe to the channel.
    The default is the official YouTube channel UCrXUsMBcfTVqwAS7DKg9C0Q.
    If you don't want to follow the official channel, you can change it to your own channel.",autoUpdateSource:"The source to update
    github: Fast update.
    jsdelivr: Update is delayed.
    standby: Standby source.
    auto: Try to update using github, jsdelivr, standby sources in turn.",saveGlobalOptions:"SaveSettings",settingPage:"Setting Page",name:"Name",version:"Version",scriptManager:"Script Manager",script:"Script",environment:"Environment",os:"OS",browser:"Browser",getId:"Get %0 id",getTwitterUserId:"Get Twitter user id (Get id function is only available on the settings page).",getYoutubeChannelId:"Get Youtube channel id (Get id function is only available on the settings page).",showButton:"ShowButton",hideButton:"HideButton",showLog:"ShowLog",hideLog:"HideLog",defaultShowButton:"Default display button",defaultShowLog:"Display log by default",debug:"Output debug log, do not enable this option!",receivePreview:"Receive preview updates",position:"Component position",buttonSideX:"Horizontal positioning of the button area (real-time preview function is only available on the setting page).
    left: left | right: right",buttonSideY:"The button area is positioned in the vertical direction (real-time preview function is only available on the settings page).
    top: top | bottom: bottom",buttonDistance:"The distance between the button area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",showButtonSideX:"ShowButton horizontal positioning (real-time preview function is only available on the setting page).
    left: left | right: right",showButtonSideY:"ShowButton vertical positioning (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",showButtonDistance:"The distance between the ShowButton and the edge (real-time preview function is only available on the setting page).
    Format: X distance, Y distance",logSideX:"Horizontal positioning of the log area (real-time preview function is only available on the setting page).
    left: left | right: right",logSideY:"Vertical positioning of the log area (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",logDistance:"The distance between the log area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",hotKey:"Shortcut key",doTaskKey:"DoTask shortcut keys
    (real-time preview function is only available on the settings page).",undoTaskKey:"UndoTask shortcut keys
    (real-time preview function is only available on the settings page).",toggleLogKey:"ShowLog/HideLog shortcut keys
    (real-time preview function is only available on the settings page).",tasksHistory:"TasksHistory",clearHistory:"Clear history",clearHistoryFinished:"The mission history has been cleared!",deleteTask:"Delete task",lastChangeTime:"Last Change Time",clearTaskFinished:"Delete the following tasks completed!",clearTaskFailed:"Failed to delete the task, the task name was not found!",syncData:"DataSync",settingData:"Uploading data...",gettingData:"Getting data...",help:"Help",fileName:"Filename",upload2gist:"Sync to Gist",downloadFromGist:"Sync from Gist",saveAndTest:"Save configuration and test",testSuccess:"Test success!",testFailed:"Test failed!",saveAndTestNotice:"Please save the configuration and test first!",processingData:"Processing data...",updatingData:"Uploading data...",syncDataSuccess:"Synchronized data successfully!",syncDataFailed:"Failed to synchronize data, please check the error message on the console!",downloadingData:"Downloading data...",checkedNoData:"No remote data is detected, please confirm whether the configuration is correct!",savingData:"Saving data...",syncHistory:"Synchronize tasks history",checkUpdateFailed:"Check update failed",newVersionNotice:'Checked a new version V%0, click to update',language:"Language
    Currently only supports zh: Chinese, en: English",gistOptions:"Gist Settings",swalNotice:"It is detected that you are installing the V4 version script for the first time, please go to read the READ ME FIRST content before use!",echoNotice:'It is detected that you are installing the V4 version script for the first time, please click here to read the READ ME FIRST content before use!',noticeLink:"https://auto-task-doc.js.org/en/guide/#read-me-first",toGithub:"Feedback(Github)",toKeylol:"Feedback(Keylol)",copySuccess:"The error message has been copied to the clipboard. Do you want to go to the Keylol forum to give feedback?",copyFailed:"Please copy the error information below and report back to the Keylol forum!",updateText:"Updates in version %0:",Active:"Active",Ended:"Ended",Banned:"Banned",Paused:"Paused",notStart:"notStart",noRemoteData:"No data remotely",errorRemoteDataFormat:"Remote data has wrong format",updateHistory:'Click here to view the historical update record.',AsfEnabled:'Use ASF to do Steam related tasks (requires ASFEnhance plugin)',AsfIpcUrl:"ASF IPC URL",AsfIpcPassword:"ASF IPC Password",groups:"Group",officialGroups:"Official Group",wishlists:"Wishlist",follows:"Follow Game",forums:"Forum",workshops:"Favorite Workshop",curators:"Curator",workshopVotes:"Voteup Workshop",announcements:"Announcement",steamCommunity:"Steam Community",steamStore:"Steam Store",licenses:"Add License",playtests:"Playtest Access",needLoginSteamStore:'Please log in to the Steam Store',needLoginSteamCommunity:'Please log in to the Steam Community',joiningSteamGroup:"Joining Steam Group",leavingSteamGroup:"Leaving Steam Group",gettingSteamGroupId:"Getting Steam Group Id",joiningSteamOfficialGroup:"Joining Steam Official Group",leavingSteamOfficialGroup:"Leaving Steam Official Group",gettingSteamOfficialGroupId:"Getting Steam Official Group Id",subscribingForum:"Subscribing the Steam Forum",unsubscribingForum:"Unsubscribing the Steam Forum",gettingForumId:"Getting Steam Forum Id",followingCurator:"Following Steam Curator",unfollowingCurator:"Unfollowing Steam Curator",gettingCuratorId:"Getting Steam Curator Id",addingToWishlist:"Adding the game to the Steam wishlist",removingFromWishlist:"Removing the game from the Steam wishlist",followingGame:"Following Steam games",unfollowingGame:"Unfollowing Steam games",favoritingWorkshop:"Favouring Steam Workshop Items",unfavoritingWorkshop:"Unfavoriting Steam Workshop Items",gettingWorkshopAppId:"Getting Steam Workshop Item Id",votingUpWorkshop:"Liking Steam workshop items",gettingAnnouncementParams:"Getting Steam announcement information",likingAnnouncement:"Liking Steam announcement",changingArea:"Changing Steam area: %0...",notNeededChangeArea:"The current area does not need to be changed",noAnotherArea:"Please check whether the proxy is turned on correctly",gettingAreaInfo:"Getting Steam area information...",changeAreaNotice:"Suspected of a locked zone game, try to change the zone to execute",steamFinishNotice:"Steam task completed, try to change the shopping cart area back to CN",gettingSubid:"Getting subid",addingFreeLicense:"Adding free license",missParams:"Missing parameters",gettingLicenses:"Getting licenses...",requestingPlayTestAccess:"Requesting play test access",tryChangeAreaNotice:"This function cannot detect whether the game is limited, so it will try to change the area before entering the library. Failure to change the area will not affect the subsequent storage.",versionNotMatched:"The script manager version is too low, requiring TamperMonkey >= 5.2.0 or TamperMonkey Beta >= 5.2.6196",gettingUserLink:"Getting steam user community link...",retry:"Retry",initingASF:"Initing ASF...",servers:"Server",joiningDiscordServer:"Joining Discord Server",leavingDiscordServer:"Leaving Discord Server",gettingDiscordGuild:"Getting Discord server Id",getDiscordAuthFailed:"Failed to get Discord token, please check whether the Discord account is logged in",discordImportantNotice:"Important Reminder! ! !",discordImportantNoticeText:"Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !",continue:"Continue",skipDiscordTask:"Skip",continueAndDontRemindAgain:"Continue without Reminders",users:"User",loginIns:'Please log in to Instagram',insBanned:"Your Instagram account has been banned",verifyingInsAuth:"Verifying Instagram token...",gettingInsUserId:"Getting Instagram user Id",followingIns:"Following Instagram user",unfollowingIns:"Unfollowing Instagram user",reddits:"Reddit/User",loginReddit:'Please log in to Reddit',changingRedditVersion:"Switching Reddit to a new version page...",joiningReddit:"Joining the Reddit",leavingReddit:"Leaving the Reddit",followingRedditUser:"Following Reddit User",unfollowingRedditUser:"Unfollowing Reddit User",channels:"Channel",followingTwitchChannel:"Following Twitch Channel",unfollowingTwitchChannel:"Unfollowing Twitch Channel",gettingTwitchChannelId:"Getting Twitch Channel Id",checkingTwitchIntegrity:"Checking Twitch integrity...",twitterUser:"Twitter User",retweets:"Retweet",gettingTwitterUserId:"Getting Twitter User Id",followingTwitterUser:"Following Twitter User",unfollowingTwitterUser:"Unfollowing Twitter User",retweetting:"Retweetting",unretweetting:"Unretweetting",names:"Group/Public/Wall",loginVk:'Please log in to Vk',gettingVkId:"Getting Vk task Id",joiningVkGroup:"Joining Vk Group",leavingVkGroup:"Leaving Vk Group",joiningVkPublic:"Joining Vk Public",leavingVkPublic:"Leaving Vk Public",sendingVkWall:"Sending Vk Wall",deletingVkWall:"Deleting Vk Wall",youtubeChannel:"YouTube Channel",likes:"Like",loginYtb:'Please log in to YouTube',tryUpdateYtbAuth:'Please try to update YouTube token',gettingYtbToken:"Getting YouTube Token...",followingYtbChannel:"Subscribing to YouTube channel",unfollowingYtbChannel:"Unsubscribing to YouTube channel",likingYtbVideo:"Liking YouTube video",unlikingYtbVideo:"Unliking YouTube video",giveKeyNoticeBefore:"Each verification interval is 15s",giveKeyNoticeAfter:'If there is no key, please check at https://givekey.ru/profile',noPoints:"Not enough points, skip the lottery",getNeedPointsFailed:"ailed to obtain the required points, skip the lottery",joiningLottery:"Joining the lottery",doingGleamTask:"Doing Gleam Task...",gettingGleamLink:"Getting Gleam task link...",gleamTaskNotice:"If this page has not been closed for a long time, please close it yourself after completing any task!",verifiedGleamTasks:"Attempted to verify all tasks. If the verification fails, please try to verify manually or complete it!",campaign:"ReCAPTCHA detected, please complete it and re-verify the tasks!",gsNotice:'In order to avoid getting the "0000-0000-0000" key, the "Grab Key" button has been hidden, please close the script when obtaining the key!',giveeClubVerifyNotice:"Verifying task...",giveeClubVerifyFinished:"Wait for the verification to complete and join it by yourself",doingKeyhubTask:"Doing Keyhub Task...",SweepWidgetNotice:"The task is being processed and verified. There is an interval of 1~3s for each verification task to prevent the triggering of too fast verification warning...",tasksNotCompleted:"Tasks Not Completed",confirmingTask:"Confirming task..."}},language=["zh","en"].includes(globalOptions.other.language)?globalOptions.other.language:"en",i18n=(key,...argvs)=>languages[language]?.[key]?languages[language][key].replace(/%([\d]+)/g,(match,index)=>argvs[parseInt(index,10)]):key;external_Swal_namespaceObject=class{tasks;getRealParams(name,links,doTask,link2param){try{let realParams=[];return 0link2param(link)).filter(link=>link)]),!doTask&&0!!isConfirmed||!!isDenied&&(GM_setValue("dontRemindDiscordAgain",!0),!0)))return this.#initialized=!1,"skip";return GM_getValue("dontRemindDiscordAgain")||"do"===action&&!globalOptions.doTask.discord.servers||"undo"===action&&!globalOptions.undoTask.discord.servers?(this.#initialized=!1,"skip"):!!this.#initialized||(this.#auth.auth?await this.#verifyAuth()||(GM_setValue("discordAuth",{auth:null}),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Discord")),!1):!!await this.#updateAuth()&&(this.#initialized=!0))}catch(error){return throwError_throwError(error,"Discord.init"),!1}}async#verifyAuth(){try{var logStatus=scripts_echoLog({text:i18n("verifyingAuth","Discord")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v6/users/@me",method:"HEAD",headers:{authorization:this.#auth.auth}});return"Success"===result?200===data?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.verifyAuth"),!1}}async#updateAuth(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Discord")});return await new Promise(resolve=>{GM_openInTab("https://discord.com/channels/@me#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{var auth=GM_getValue("discordAuth")?.auth;auth?(this.#auth={auth:auth},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error("Error: Update discord auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Discord.updateAuth"),!1}}async#joinServer(inviteId){try{var guild,logStatus=scripts_echoLog({type:"joiningDiscordServer",text:inviteId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,method:"POST",dataType:"json",headers:{authorization:this.#auth.auth,origin:"https://discord.com",referer:"https://discord.com/invite/"+inviteId}});return"Success"===result&&200===data?.status?(logStatus.success(),(guild=String(data.response?.guild?.id))&&(this.#setCache(inviteId,guild),this.tasks.servers=unique([...this.tasks.servers,inviteId])),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Discord.joinServer"),!1}}async#leaveServer(inviteId){try{if(this.whiteList.servers.includes(inviteId))return scripts_echoLog({type:"whiteList",text:"Discord.leaveServer",id:inviteId}),!0;var guild=await this.#getGuild(inviteId);if(guild){var logStatus=scripts_echoLog({type:"leavingDiscordServer",text:guild}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/users/@me/guilds/"+guild,method:"DELETE",headers:{authorization:this.#auth.auth}});if("Success"===result&&204===data?.status)return logStatus.success(),!0;logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Discord.leaveServer"),!1}}async#getGuild(inviteId){try{var logStatus=scripts_echoLog({type:"gettingDiscordGuild",text:inviteId}),guild=this.#cache[inviteId];if(guild)return logStatus.success(),guild;var{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,responseType:"json",method:"GET"});if("Success"!==result||200!==data?.status)return logStatus.error(result+`:${statusText}(${status})`),!1;{let guild=data.response?.guild?.id;return guild?(logStatus.success(),this.#setCache(inviteId,guild),guild):(logStatus.error(result+`:${statusText}(${status})`),!1)}}catch(error){return throwError_throwError(error,"Discord.getGuild"),!1}}async toggle({doTask=!0,serverLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.discord.servers||!doTask&&!globalOptions.undoTask.discord.servers)scripts_echoLog({type:"globalOptionsSkip",text:"discord.servers"});else{var realServers=this.getRealParams("servers",serverLinks,doTask,link=>link.match(/invite\/(.+)/)?.[1]);if(0!0)}catch(error){return throwError_throwError(error,"Discord.toggleServers"),!1}}#setCache(inviteId,guild){try{this.#cache[inviteId]=guild,GM_setValue("discordCache",this.#cache)}catch(error){throwError_throwError(error,"Discord.setCache")}}}let social_Discord=Discord;class Instagram extends external_Swal_namespaceObject{tasks;whiteList;#cache=GM_getValue("instagramCache")||{};#auth={};#initialized=!1;constructor(){super();var defaultTasksTemplate={users:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.instagram||{}}}async init(){try{return this.#initialized?!0:await this.#getUserInfo()?(scripts_echoLog({}).success(i18n("initSuccess","Instagram")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Instagram")),!1)}catch(error){return throwError_throwError(error,"Instagram.init"),!1}}async#getUserInfo(name="instagram"){try{var logStatus=scripts_echoLog({type:"instagram"===name?"verifyingInsAuth":"gettingInsUserId",text:name}),userId=this.#cache[name];if(userId&&"instagram"!==name)return logStatus.success(),userId;var csrftoken,hash,id,{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/${name}/`,method:"GET"});if("Success"===result)if(data?.finalUrl.includes("accounts/login"))logStatus.error("Error:"+i18n("loginIns"),!0);else if(data?.finalUrl.includes("www.instagram.com/challenge"))logStatus.error("Error:"+i18n("insBanned"));else{if(200===data?.status)return csrftoken=data.responseText.match(/"csrf_token":"(.+?)"/)?.[1],hash=data.responseText.match(/"rollout_hash":"(.+?)"/)?.[1],"instagram"===name?!(!csrftoken||!hash||(this.#auth={csrftoken:csrftoken,hash:hash},0)):(id=data.responseText.match(/"profilePage_([\d]+?)"/)?.[1])?(this.#setCache(name,id),logStatus.success(),id):(logStatus.error("Error: Get ins data error!"),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Instagram.getUserInfo"),!1}}async#followUser(name){try{var id=await this.#getUserInfo(name);if(id){var logStatus=scripts_echoLog({type:"followingIns",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/web/friendships/${id}/follow/`,method:"POST",dataType:"json",headers:{"x-csrftoken":this.#auth.csrftoken,origin:"https://www.instagram.com",referer:`https://www.instagram.com/${name}/`,"content-type":"application/x-www-form-urlencoded","sec-fetch-site":"same-origin","x-instagram-ajax":this.#auth.hash}});if("Success"===result)return 200===data?.status&&"following"===data.response?.result?(logStatus.success(),this.tasks.users=unique([...this.tasks.users,name]),!0):(logStatus.error("Error:"+(data?.response?.feedback_message||`${data?.statusText}(${data?.status})`)),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Instagram.followUser"),!1}}async#unfollowUser(name){try{if(this.whiteList.users.includes(name))return scripts_echoLog({type:"whiteList",text:"Instagram.unfollowUser",id:name}),!0;var id=await this.#getUserInfo(name);if(id){var logStatus=scripts_echoLog({type:"unfollowingIns",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/web/friendships/${id}/unfollow/`,method:"POST",dataType:"json",headers:{"x-csrftoken":this.#auth.csrftoken,origin:"https://www.instagram.com",referer:`https://www.instagram.com/${name}/`,"content-type":"application/x-www-form-urlencoded","sec-fetch-site":"same-origin","x-instagram-ajax":this.#auth.hash}});if("Success"===result)return 200===data?.status&&"ok"===data.response?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Instagram.unfollowUser"),!1}}async toggle({doTask=!0,userLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.instagram.users||!doTask&&!globalOptions.undoTask.instagram.users)scripts_echoLog({type:"globalOptionsSkip",text:"instagram.users"});else{var realUsers=this.getRealParams("users",userLinks,doTask,link=>link.match(/https:\/\/www\.instagram\.com\/(.+)?\//)?.[1]);if(0!0)}catch(error){return throwError_throwError(error,"Instagram.toggleUsers"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("instagramCache",this.#cache)}catch(error){throwError_throwError(error,"Instagram.setCache")}}}let social_Instagram=Instagram;class Reddit extends external_Swal_namespaceObject{tasks;whiteList;#auth;#initialized=!1;constructor(){super();var defaultTasksTemplate={reddits:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.reddit||{}}}async init(){try{return this.#initialized?!0:await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Reddit")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Reddit")),!1)}catch(error){return throwError_throwError(error,"Reddit.init"),!1}}async#useBeta(){try{let logStatus=scripts_echoLog({text:i18n("changingRedditVersion")});return GM_setValue("redditAuth",null),await new Promise(resolve=>{GM_openInTab("https://www.reddit.com/#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{logStatus.success(),resolve(await this.#updateAuth(!0))}})}catch(error){return throwError_throwError(error,"Reddit.useBeta"),!1}}async#updateAuth(beta=!1){try{var accessToken,logStatus=scripts_echoLog({text:i18n("updatingAuth","Reddit")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://www.reddit.com/",method:"GET",nochche:!0,headers:{"Cache-Control":"no-cache"}});if("Success"===result)if(data?.responseText.includes("www.reddit.com/login/"))logStatus.error("Error:"+i18n("loginReddit"),!0);else{if(200===data?.status)return data.responseText.includes("redesign-beta-optin-btn")&&!beta?await this.#useBeta():(accessToken=data.responseText.match(/"accessToken":"(.*?)","expires":"(.*?)"/)?.[1])?(this.#auth={token:accessToken},logStatus.success(),!0):(logStatus.error('Error: Parameter "accessToken" not found!'),!1);logStatus.error(`Error:${data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Reddit.updateAuth"),!1}}async toggleTask({name,doTask=!0}){try{if(!doTask&&this.whiteList.reddits.includes(name))return scripts_echoLog({type:"whiteList",text:"Reddit.undoTask",id:name}),!0;let type=doTask?"joiningReddit":"leavingReddit";/^u_/.test(name)&&(type=doTask?"followingRedditUser":"unfollowingRedditUser");var logStatus=scripts_echoLog({type:type,text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://oauth.reddit.com/api/subscribe?redditWebClient=desktop2x&app=desktop2x-client-production&raw_json=1&gilding_detail=1",method:"POST",headers:{authorization:"Bearer "+this.#auth.token,"content-type":"application/x-www-form-urlencoded"},data:$.param({action:doTask?"sub":"unsub",sr_name:name,api_type:"json"})});return"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.reddits=unique([...this.tasks.reddits,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Reddit.toggleTask"),!1}}async toggle({doTask=!0,redditLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.reddit.reddits||!doTask&&!globalOptions.undoTask.reddit.reddits)scripts_echoLog({type:"globalOptionsSkip",text:"reddit.reddits"});else{var realReddits=this.getRealParams("reddits",redditLinks,doTask,link=>{var name=link.match(/https?:\/\/www\.reddit\.com\/r\/([^/]*)/)?.[1],link=link.match(/https?:\/\/www\.reddit\.com\/user\/([^/]*)/)?.[1];return link?name||link:name});if(0!0)}catch(error){return throwError_throwError(error,"Reddit.toggle"),!1}}}let social_Reddit=Reddit;class Twitch extends external_Swal_namespaceObject{tasks;whiteList;#auth=GM_getValue("twitchAuth")||{};#cache=GM_getValue("twitchCache")||{};#initialized=!1;#integrityToken;constructor(){super();var defaultTasksTemplate={channels:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.twitch||{}}}async init(){try{return this.#initialized?!0:this.#auth.authToken&&this.#auth.clientId&&this.#auth.clientVersion&&this.#auth.deviceId&&this.#auth.clientSessionId?await this.#verifyAuth(!0)||(GM_setValue("twitchAuth",null),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Twitch")),!1):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError_throwError(error,"Twitch.init"),!1}}async#verifyAuth(isFirst){try{var logStatus=scripts_echoLog({text:i18n("verifyingAuth","Twitch")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},data:'[{"operationName":"FrontPageNew_User","variables":{"limit":1},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"64bd07a2cbaca80699d62636d966cf6395a5d14a1f0a14282067dcb28b13eb11"}}}]'});return"Success"===result?200===data?.status&&data.response?.[0]?.data?.currentUser?(await this.#integrity(isFirst),logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Twitch.verifyAuth"),!1}}async#integrity(isFirst=!0,ct=""){try{var result,statusText,status,data,logStatus=scripts_echoLog({text:i18n("checkingTwitchIntegrity")});return!isFirst||this.#auth.authToken&&this.#auth.clientId&&this.#auth.clientVersion&&this.#auth.deviceId&&this.#auth.clientSessionId?({result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/integrity",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId,"Client-Version":this.#auth.clientVersion,"X-Device-Id":this.#auth.deviceId,"Client-Session-Id":this.#auth.clientSessionId,"x-kpsdk-ct":ct}}),"Success"===result?!ct&&data?.responseHeaders?.["x-kpsdk-ct"]?await this.#integrity(isFirst,data.responseHeaders["x-kpsdk-ct"]):200===data?.status&&data.response?.token?(this.#integrityToken=data.response.token,logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)):await this.#updateAuth(!1)}catch(error){return throwError_throwError(error,"Twitch.integrity"),!1}}async#updateAuth(isFirst=!0){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Twitch")});return await new Promise(resolve=>{GM_openInTab("https://www.twitch.tv/#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{var auth=GM_getValue("twitchAuth");auth?(this.#auth=auth,logStatus.success(),resolve(await this.#verifyAuth(isFirst))):(logStatus.error("Error: Update twitch auth failed!"),resolve(!1))}})}catch(error){return throwError_throwError(error,"Twitch.updateAuth"),!1}}async#toggleChannel({name,doTask=!0}){try{if(!doTask&&this.whiteList.channels.includes(name))return scripts_echoLog({type:"whiteList",text:"Twitch.unfollowChannel",id:name}),!0;var channelId=await this.#getChannelId(name);if(channelId){var logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingTwitchChannel`,text:name}),followData='[{"operationName":"FollowButton_FollowUser","variables":{"input":{"disableNotifications":false,"targetID":"'+channelId+'"}},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"800e7346bdf7e5278a3c1d3f21b2b56e2639928f86815677a7126b093b2fdd08"}}}]',unfollowData=`[{"operationName":"FollowButton_UnfollowUser","variables":{"input":{"targetID":"${channelId}"}},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"f7dae976ebf41c755ae2d758546bfd176b4eeb856656098bb40e0a672ca0d880"}}}]',{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId,"Client-Version":this.#auth.clientVersion,"X-Device-Id":this.#auth.deviceId,"Client-Session-Id":this.#auth.clientSessionId,"Client-Integrity":this.#integrityToken},data:doTask?followData:unfollowData});if("Success"===result)return 200===data?.status&&data.response?.[0]&&!data.response[0].errors?(logStatus.success(),doTask&&(this.tasks.channels=unique([...this.tasks.channels,name])),!0):(logStatus.error("Error:"+(data?.response?.[0].errors?.[0]?.message||`${data?.statusText}(${data?.status})`)),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Twitch.toggleChannel"),!1}}async#getChannelId(name){try{var logStatus=scripts_echoLog({type:"gettingTwitchChannelId",text:name}),channelId=this.#cache[name];if(channelId)return logStatus.success(),channelId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},responseType:"json",data:`[{"operationName":"ActiveWatchParty","variables":{"channelLogin":"${name}"},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"4a8156c97b19e3a36e081cf6d6ddb5dbf9f9b02ae60e4d2ff26ed70aebc80a30"}}}]'});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let channelId=data.response?.[0]?.data?.user?.id;return channelId?(this.#setCache(name,String(channelId)),logStatus.success(),channelId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Twitch.getChannelId"),!1}}async toggle({doTask=!0,channelLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.twitch.channels||!doTask&&!globalOptions.undoTask.twitch.channels)scripts_echoLog({type:"globalOptionsSkip",text:"twitch.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>link.match(/https:\/\/(www\.)?twitch\.tv\/(.+)/)?.[2]);if(0!0)}catch(error){return throwError_throwError(error,"Twitch.toggle"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("twitchCache",this.#cache)}catch(error){throwError_throwError(error,"Twitch.setCache")}}}let social_Twitch=Twitch;class Vk extends external_Swal_namespaceObject{tasks;whiteList;#username="";#cache=GM_getValue("vkCache")||{};#initialized=!1;constructor(){super();var defaultTasksTemplate={names:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.vk||{}}}async init(){try{return this.#initialized?!0:await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Vk")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Vk")),!1)}catch(error){return throwError_throwError(error,"Vk.init"),!1}}async#verifyAuth(){try{var logStatus=scripts_echoLog({text:i18n("verifyAuth","Vk")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/im",method:"GET"});if("Success"===result)if(data?.finalUrl.includes("vk.com/login"))logStatus.error("Error:"+i18n("loginVk"),!0);else{if(200===data?.status)return this.#username=data.responseText.match(/TopNavBtn__profileLink" href="\/(.*?)"/)?.[1]||"",logStatus.success(),!0;logStatus.error(`Error:${data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Vk.verifyAuth"),!1}}async#toggleGroup(name,dataParam,doTask=!0){try{var reqData,result,statusText,status,data,logStatus=scripts_echoLog({type:doTask?"joiningVkGroup":"leavingVkGroup",text:name});return"enter"===dataParam.groupAct&&!doTask||"leave"===dataParam.groupAct&&doTask?(logStatus.success(),!0):(reqData={act:doTask?"enter":"leave",al:1,gid:dataParam.groupId,hash:dataParam.groupHash},{result,statusText,status,data}=(doTask&&(reqData.context="_"),await tools_httpRequest({url:"https://vk.com/al_groups.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param(reqData)})),"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.names=unique([...this.tasks.names,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Vk.toggleGroup"),!1}}async#togglePublic(name,dataParam,doTask=!0){try{var result,statusText,status,data,logStatus=scripts_echoLog({type:doTask?"joiningVkPublic":"leavingVkPublic",text:name});return dataParam.publicJoined&&doTask||!dataParam.publicJoined&&!doTask?(logStatus.success(),!0):({result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/al_public.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:doTask?"a_enter":"a_leave",al:1,pid:dataParam.publicPid,hash:dataParam.publicHash})}),"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.names=unique([...this.tasks.names,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Vk.togglePublic"),!1}}async#sendWall(name){try{var logStatus=scripts_echoLog({type:"sendingVkWall",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/like.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:"publish_box",al:1,object:name})});if("Success"===result)if(200===data?.status){var hash=data.responseText.match(/shHash:[\s]*'(.*?)'/)?.[1];if(hash){var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://vk.com/like.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({Message:"",act:"a_do_publish",al:1,close_comments:0,friends_only:0,from:"box",hash:hash,list:"",mark_as_ads:0,mute_notifications:0,object:name,ret_data:1,to:0})});if("Success"===resultR){if(200===dataR?.status){var postId,ownerId,jsonData=JSON.parse(dataR.responseText?.replace("\x3c!--","")||"{}");if(!0===jsonData?.payload?.[1]?.[1]?.share_my)return logStatus.success(),postId=String(jsonData?.payload?.[1]?.[1]?.post_id),ownerId=String(jsonData?.payload?.[1]?.[1]?.owner_id),postId&&ownerId&&this.#setCache(name,ownerId+"_"+postId),this.tasks.names=unique([...this.tasks.names,name]),!0}logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`)}else logStatus.error(resultR+`:${statusTextR}(${statusR})`)}else logStatus.error('Error: Get "hash" failed')}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Vk.sendWall"),!1}}async#deleteWall(name,dataParams){try{var logStatus=scripts_echoLog({type:"deletingVkWall",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/al_wall.php?act=delete",method:"POST",headers:{origin:"https://vk.com",referer:`https://vk.com/${this.#username}?w=wall${this.#cache[name]}%2Fall`,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:"delete",al:1,confirm:0,from:"wkview",hash:dataParams.wallHash,post:this.#cache[name]})});return"Success"===result?200===data?.status&&JSON.parse(data.responseText?.replace("\x3c!--","")||"{}")?.payload?.[1]?.[1]?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Vk.deleteWall"),!1}}async#getId(name,doTask){try{let url="https://vk.com/"+name;if(/^wall-/.test(name)){if(doTask)return{type:"sendWall"};if(!this.#cache[name])return{type:"unSupport"};url=`https://vk.com/${this.#username}?w=wall`+this.#cache[name]}var logStatus=scripts_echoLog({type:"gettingVkId",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:url,method:"GET"});if("Success"===result)if(200===data?.status){var[,groupAct,groupId,,groupHash]=data.responseText.match(/Groups.(enter|leave)\(.*?,.*?([\d]+?), ('|')(.*?)('|')/)||[],publicHash=data.responseText.match(/"enterHash":"(.*?)"/)?.[1],publicPid=data.responseText.match(/"public_id":([\d]+?),/)?.[1],publicJoined=!data.responseText.includes("Public.subscribe");if(groupAct&&groupId&&groupHash)return logStatus.success(),{groupAct:groupAct,groupId:groupId,groupHash:groupHash,type:"group"};if(publicHash&&publicPid)return logStatus.success(),{publicHash:publicHash,publicPid:publicPid,publicJoined:publicJoined,type:"public"};if(data.responseText.includes("wall.deletePost")&&!doTask){var wallHash=data.responseText.match(/wall\.deletePost\(this, '.*?', '(.*?)'\)/)?.[1];if(wallHash)return logStatus.success(),{type:"deleteWall",wallHash:wallHash}}else if(name.includes("wall")&&doTask)return logStatus.success(),{type:"sendWall"};logStatus.error("Error: Parameters not found!")}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Vk.getId"),!1}}async#toggleVk({name,doTask=!0}){try{if(!doTask&&this.whiteList.names.includes(name))return scripts_echoLog({type:"whiteList",text:"Vk.undoTask",id:name}),!0;var formatName=name.replace(/\/$/,""),data=await this.#getId(formatName,doTask);if(!data)return!1;switch(data.type){case"group":return await this.#toggleGroup(formatName,data,doTask);case"public":return await this.#togglePublic(formatName,data,doTask);case"sendWall":return!doTask||await this.#sendWall(formatName);case"deleteWall":return!!doTask||await this.#deleteWall(formatName,data);default:return!1}}catch(error){return throwError_throwError(error,"Vk.toggleVk"),!1}}async toggle({doTask=!0,nameLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.vk.names||!doTask&&!globalOptions.undoTask.vk.names)scripts_echoLog({type:"globalOptionsSkip",text:"vk.names"});else{var realNames=this.getRealParams("names",nameLinks,doTask,link=>link.match(/https:\/\/vk\.com\/([^/]+)/)?.[1]);if(0!0)}catch(error){return throwError_throwError(error,"Vk.toggle"),!1}}#setCache(name,postId){try{this.#cache[name]=postId,GM_setValue("vkCache",this.#cache)}catch(error){throwError_throwError(error,"Vk.setCache")}}}let social_Vk=Vk;class Youtube extends external_Swal_namespaceObject{tasks;whiteList;#auth=GM_getValue("youtubeAuth")||{};#initialized=!1;#verifyChannel="https://www.youtube.com/channel/"+globalOptions.other.youtubeVerifyChannel;constructor(){super();var defaultTasksTemplate={channels:[],likes:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.youtube||{}}}async init(){try{return this.#initialized?!0:this.#auth.PAPISID?await this.#verifyAuth()||(GM_setValue("youtubeAuth",null),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Youtube")),!1):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError_throwError(error,"Youtube.init"),!1}}async#verifyAuth(){try{return await this.#toggleChannel({link:this.#verifyChannel,doTask:!0,verify:!0})}catch(error){return throwError_throwError(error,"Youtube.verifyAuth"),!1}}async#updateAuth(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Youtube")});return await new Promise(resolve=>{GM_cookie.list({url:"https://www.youtube.com/@YouTube"},async(cookies,error)=>{error?(logStatus.error("Error: Update youtube auth failed!"),resolve(!1)):(error=cookies.find(cookie=>"__Secure-3PAPISID"===cookie.name)?.value)?(GM_setValue("youtubeAuth",{PAPISID:error}),this.#auth={PAPISID:error},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error(i18n("needLogin")),resolve(!1))})})}catch(error){return throwError_throwError(error,"Youtube.updateAuth"),!1}}#getInfo(link,type){return(async(link,type)=>{try{var apiKey,context,client,request,channelId,videoId,likeParams,logStatus=scripts_echoLog({text:i18n("gettingYtbToken")}),{result,statusText,status,data}=await tools_httpRequest({url:link,method:"GET"});return"Success"===result?200===data?.status?data.responseText.includes("accounts.google.com/ServiceLogin?service=youtube")?(logStatus.error("Error:"+i18n("loginYtb"),!0),{needLogin:!0}):(apiKey=data.responseText.match(/"INNERTUBE_API_KEY":"(.*?)"/)?.[1],context=(data.responseText.match(/\(\{"INNERTUBE_CONTEXT":([\w\W]*?)\}\)/)||data.responseText.match(/"INNERTUBE_CONTEXT":([\w\W]*?\}),"INNERTUBE/))?.[1]||"{}",{client,request}=JSON.parse(context),apiKey&&client&&request?(client.hl="en","channel"===type?(channelId=data.responseText.match(/"channelId":"(.+?)"/)?.[1])?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,channelId:channelId}}):(logStatus.error('Error: Get "channelId" failed!'),{}):"likeVideo"===type?(videoId=data.responseText.match(//)?.[1],likeParams=data.responseText.match(/"likeParams":"(.*?)"/)?.[1],videoId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,videoId:videoId,likeParams:likeParams}}):(logStatus.error('Error: Get "videoId" failed!'),{})):(logStatus.error("Error: Unknown type"),{})):(logStatus.error('Error: Parameter "apiKey" not found!'),{})):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),{}):(logStatus.error(result+`:${statusText}(${status})`),{})}catch(error){return throwError_throwError(error,"Youtube.getInfo"),{}}})(link,type)}async#toggleChannel({link,doTask=!0,verify=!1}){try{var{params,needLogin}=await this.#getInfo(link,"channel"),{apiKey,client,request,channelId}=params||{};if(needLogin)scripts_echoLog({html:i18n("loginYtb")});else if(apiKey&&client&&request&&channelId){if(!doTask&&!verify&&this.whiteList.channels.includes(channelId))return scripts_echoLog({type:"whiteList",text:"Youtube.unfollowChannel",id:channelId}),!0;var logStatus=verify?scripts_echoLog({text:i18n("verifyingAuth","Youtube")}):scripts_echoLog({type:doTask?"followingYtbChannel":"unfollowingYtbChannel",text:channelId}),nowTime=parseInt(String((new Date).getTime()/1e3),10),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/subscription/${doTask?"":"un"}subscribe?key=${apiKey}&prettyPrint=false`,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/channel/"+channelId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client?.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify({context:{client:client,request:{sessionId:request?.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},channelIds:[channelId],params:doTask?"EgIIAhgA":"CgIIAhgA"})});if("Success"===result)return 200===data?.status?doTask&&(/"subscribed":true/.test(data.responseText)||data.responseText.includes("The subscription already exists"))||!doTask&&/"subscribed":false/.test(data.responseText)?(logStatus.success(),doTask&&!verify&&(this.tasks.channels=unique([...this.tasks.channels,link])),!0):verify&&data.responseText.includes("You may not subscribe to yourself")?(logStatus.success(),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}else scripts_echoLog({text:'"getYtbToken" failed'});return!1}catch(error){return throwError_throwError(error,"Youtube.toggleChannel"),!1}}async#toggleLikeVideo({link,doTask=!0}){try{var{params,needLogin}=await this.#getInfo(link,"likeVideo"),{apiKey,client,request,videoId,likeParams}=params||{};if(needLogin)scripts_echoLog({html:""+i18n("loginYtb")});else if(apiKey&&client&&request&&videoId&&likeParams){if(!doTask&&this.whiteList.likes.includes(videoId))return scripts_echoLog({type:"whiteList",text:"Youtube.unlikeVideo",id:videoId}),!0;var logStatus=scripts_echoLog({type:doTask?"likingYtbVideo":"unlikingYtbVideo",text:videoId}),nowTime=parseInt(String((new Date).getTime()/1e3),10),likeVideoData={context:{client:client,request:{sessionId:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},target:{videoId:videoId}};if(doTask){if(!likeParams)return logStatus.error("Empty likeParams"),!1;likeVideoData.params=likeParams}var{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/like/${doTask?"":"remove"}like?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/watch?v="+videoId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify(likeVideoData)});if("Success"===result)return 200===data?.status?doTask&&data.responseText.includes("Added to Liked videos")||!doTask&&(data.responseText.includes("Removed from Liked videos")||data.responseText.includes("Dislike removed"))?(logStatus.success(),doTask&&(this.tasks.likes=unique([...this.tasks.likes,link])),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}else scripts_echoLog({text:'"getYtbToken" failed'});return!1}catch(error){return throwError_throwError(error,"Youtube.toggleLikeVideo"),!1}}async toggle({doTask=!0,channelLinks=[],videoLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.youtube.channels||!doTask&&!globalOptions.undoTask.youtube.channels)scripts_echoLog({type:"globalOptionsSkip",text:"youtube.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)?.[1]:link);if(0/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)?.[1]:link);if(0!0)}catch(error){return throwError_throwError(error,"Youtube.toggle"),!1}}}let social_SteamASF=class{#asfOptions;#botName="asf";#groupInfo;async init(){try{var asfCommandsUrl=new URL("/Api/Command/",globalOptions.ASF.AsfIpcUrl),logStatus=(this.#asfOptions={url:asfCommandsUrl.href,method:"POST",responseType:"json",headers:{accept:"application/json","Content-Type":"application/json",Host:asfCommandsUrl.host,Origin:asfCommandsUrl.origin,Referer:asfCommandsUrl.href,Authentication:globalOptions.ASF.AsfIpcPassword}},globalOptions.ASF.AsfBotname&&(this.#botName=globalOptions.ASF.AsfBotname),scripts_echoLog({text:i18n("initingASF")})),{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:'{"Command":"!stats"}'});return"Success"===result?!0===data?.response?.Success&&"OK"===data.response.Message&&data.response.Result?(logStatus.success(),!0):(data?.response?.Result||data?.response?.Message?logStatus.error(data?.response?.Result||data.response.Message):logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.init"),!1}}async joinGroup(groupName){try{var logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!JOINGROUP ${this.#botName} `+groupName})});return"Success"===result?200===data?.status&&["已加入","已申请","Joined","Applied","Присоединился","costs"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.joinGroup"),!1}}async leaveGroup(groupName){try{if(this.#groupInfo||await this.#getGroupId()){var groupId=await this.#groupInfo[groupName];if(groupId){var logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!LEAVEGROUP ${this.#botName} `+groupId})});if("Success"===result)return 200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}return!1}catch(error){return throwError_throwError(error,"SteamASF.leaveGroup"),!1}}async#getGroupId(){try{var logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:"All"}),{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:"!GROUPLIST "+this.#botName})});return"Success"===result?200===data?.status&&data.response?.Result?.includes("|")?(this.#groupInfo=Object.fromEntries(data.response.Result.split("\n").map(line=>{var[,line,id]=line.trim().split("|");return line&&id?[line,id]:null}).filter(ele=>ele)),logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.getGroupID"),!1}}async addToWishlist(gameId){try{var logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!ADDWISHLIST ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.addToWishlist"),!1}}async removeFromWishlist(gameId){try{var logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!REMOVEWISHLIST ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.removeFromWishlist"),!1}}async toggleFollowGame(gameId,doTask){try{var logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!${doTask?"":"UN"}FOLLOWGAME ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"SteamASF.toggleFollowGame"),!1}}async toggleCurator(curatorId,doTask=!0){try{var logStatus=scripts_echoLog({type:doTask?"followingCurator":"unfollowingCurator",text:curatorId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!${doTask?"":"UN"}FOLLOWCURATOR ${this.#botName} `+curatorId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.toggleCurator"),!1}}async addLicense(id){try{var[type,ids]=id.split("-");if("appid"===type){var logStatus=scripts_echoLog({type:"addingFreeLicense",text:ids});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!addlicense ${this.#botName} app/`+ids})});return"Success"===result?200===data?.status&&["AlreadyPurchased","OK"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}if("subid"===type){var idsArr=ids.split(",");let logStatus=scripts_echoLog({type:"addingFreeLicenseSubid",text:ids});var{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!addlicense ${this.#botName} `+idsArr.map(id=>"sub/"+id).join(",")})});if("Success"===result){if(200===data?.status&&data.response?.Result){let resultLines=data.response.Result.split("\n");return idsArr.forEach(subid=>{let targetLine=resultLines.find(text=>text.includes(subid));targetLine&&["成功","Success","Успех"].find(text=>targetLine.includes(text))?scripts_echoLog({}).success(targetLine):scripts_echoLog({}).error(targetLine)}),!0}logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"SteamASF.addLicense"),!1}}async requestPlayTestAccess(id){try{var logStatus=scripts_echoLog({type:"requestingPlayTestAccess",text:id});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!REQUESTACCESS ${this.#botName} `+id})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.requestPlayTestAccess"),!1}}};class Steam extends external_Swal_namespaceObject{tasks;whiteList;#cache={group:{},officialGroup:{},forum:{},workshop:{},curator:{},...GM_getValue("steamCache")};#auth={};#storeInitialized=!1;#communityInitialized=!1;#area="CN";#areaStatus="end";#ASF;constructor(){super();var defaultTasksTemplate={groups:[],officialGroups:[],wishlists:[],follows:[],forums:[],workshops:[],workshopVotes:[],curators:[],curatorLikes:[],announcements:[],licenses:[],playtests:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.steam||{}}}async init(type="all"){try{if(globalOptions.ASF.AsfEnabled&&globalOptions.ASF.AsfIpcUrl&&globalOptions.ASF.AsfIpcPassword)return this.#ASF=new social_SteamASF,!!await this.#ASF.init()&&(this.#storeInitialized=!0,this.#communityInitialized=!0);if("store"===type){if(!this.#storeInitialized){let storeInitialized=await this.#updateStoreAuth();if(storeInitialized=storeInitialized||await this.#updateStoreAuthTab(),this.#storeInitialized=storeInitialized,!this.#storeInitialized)return scripts_echoLog({}).error(i18n("initFailed","Steam")),!1;scripts_echoLog({}).success(i18n("initSuccess","SteamStore"))}}else{if("community"!==type)return this.#storeInitialized&&this.#communityInitialized?(scripts_echoLog({}).success(i18n("initSuccess","Steam")),!0):(scripts_echoLog({}).error(i18n("initFailed","Steam")),!1);if(!this.#communityInitialized){let communityInitialized=await this.#getUserLink();if(communityInitialized||(communityInitialized=await this.#updateCommunityAuthTab(),GM_setValue("steamCommunityAuth",null)),this.#communityInitialized=communityInitialized,!this.#communityInitialized)return scripts_echoLog({}).error(i18n("initFailed","Steam")),!1;scripts_echoLog({}).success(i18n("initSuccess","SteamCommunity"))}}return!0}catch(error){return throwError_throwError(error,"Steam.init"),!1}}async#refreshToken(type="steamStore"){try{var host={steamStore:"store.steampowered.com",steamCommunity:"steamcommunity.com"},logStatus=scripts_echoLog({text:i18n("refreshingToken",i18n(type))}),formData=new FormData,{result,statusText,status,data}=(formData.append("redir",`https://${host[type]}/`),await tools_httpRequest({url:"https://login.steampowered.com/jwt/ajaxrefresh",method:"POST",responseType:"json",headers:{Host:"login.steampowered.com",Origin:"https://"+host[type],Referer:`https://${host[type]}/`},data:formData}));return"Success"===result?data?.response?.success?await this.#setStoreToken(data.response,type)?(logStatus.success(),!0):(logStatus.error("Error"),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.refreshToken"),!1}}async#setStoreToken(param,type){try{var host={steamStore:"store.steampowered.com",steamCommunity:"steamcommunity.com"},logStatus=scripts_echoLog({text:i18n("settingToken",i18n(type))}),formData=new FormData,{result,statusText,status,data}=(formData.append("steamID",param.steamID),formData.append("nonce",param.nonce),formData.append("redir",param.redir),formData.append("auth",param.auth),await tools_httpRequest({url:`https://${host[type]}/login/settoken`,method:"POST",headers:{Accept:"application/json, text/plain, */*",Host:host[type],Origin:"https://"+host[type]},data:formData}));return"Success"===result?200===data?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.setStoreToken"),!1}}async#updateStoreAuth(retry=!1){try{var storeSessionID,logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamStore"))}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"},fetch:!1,redirect:"manual"});return 200===data?.status?data.responseText.includes("data-miniprofile=")?(storeSessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1])?(this.#auth.storeSessionID=storeSessionID,logStatus.success(),!0):(logStatus.error('Error: Get "sessionID" failed'),!1):!await this.#refreshToken("steamStore")||(logStatus.warning(i18n("retry")),retry)?(logStatus.error("Error:"+i18n("needLoginSteamStore"),!0),!1):this.#updateStoreAuth(!0):[301,302].includes(data?.status)?!await this.#refreshToken("steamStore")||(logStatus.warning(i18n("retry")),retry)?(logStatus.error("Error:"+i18n("needLoginSteamStore"),!0),!1):this.#updateStoreAuth(!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.updateStoreAuth"),!1}}async#updateStoreAuthTab(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamStore"))});return await new Promise(resolve=>{let newTab=window.open("https://store.steampowered.com/","mozillaWindow","pop=1;"),listenerId=(GM_setValue("steamStoreAuth","update"),GM_addValueChangeListener("steamStoreAuth",(key,oldValue,newValue,remote)=>{GM_removeValueChangeListener(listenerId),newTab?.close(),newValue&&JSON.stringify(newValue)!==JSON.stringify(oldValue)?(this.#auth.storeSessionID=newValue.storeSessionID,logStatus.success(),resolve(!0)):(logStatus.error("Failed"),resolve(!1))}))})}catch(error){return throwError_throwError(error,"Steam.updateStoreAuthTab"),!1}}async#updateCommunityAuthTab(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamCommunity"))});return await new Promise(resolve=>{let newTab=window.open("https://steamcommunity.com/my","mozillaWindow","pop=1;"),listenerId=(GM_setValue("steamCommunityAuth","update"),GM_addValueChangeListener("steamCommunityAuth",(key,oldValue,newValue,remote)=>{GM_removeValueChangeListener(listenerId),newTab?.close(),newValue&&JSON.stringify(newValue)!==JSON.stringify(oldValue)?(this.#auth.steam64Id=newValue.steam64Id,this.#auth.userName=newValue.userName,this.#auth.communitySessionID=newValue.communitySessionID,logStatus.success(),resolve(!0)):(logStatus.error("Failed"),resolve(!1))}))})}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuthTab"),!1}}async#getUserLink(retry=!1){try{var logStatus=scripts_echoLog({text:i18n("gettingUserLink")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/my",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"},fetch:!1,redirect:"manual"});if(200===data?.status)if(data.finalUrl.includes("https://steamcommunity.com/login/home"))logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0);else{var steam64Id=data.responseText.match(/g_steamID = "(.+?)";/)?.[1],communitySessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1],userName=data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//)?.[1];if(steam64Id&&(this.#auth.steam64Id=steam64Id),userName&&(this.#auth.userName=userName),communitySessionID)return this.#auth.communitySessionID=communitySessionID,logStatus.success(),!0;logStatus.error('Error: Get "sessionID" failed')}else{if(302===data?.status)return!await this.#refreshToken("steamCommunity")||retry?(logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0),!1):(logStatus.warning(i18n("retry")),this.#getUserLink(!0));var location=data?.responseHeaders?.split("\n")?.find(header=>header.includes("location")?header.replace("loctation:","").trim():null);if(301===data?.status&&location?.includes("steamcommunity.com/id"))return logStatus.success(),await this.#updateCommunityAuth(data.finalUrl);301===data?.status&&location?.includes("https://steamcommunity.com/login/home")?logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0):logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuth"),!1}}async#updateCommunityAuth(url){try{var logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamCommunity"))}),{result,statusText,status,data}=await tools_httpRequest({url:url,method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"}});if("Success"===result)if(200===data?.status)if(data.finalUrl.includes("https://steamcommunity.com/login/home"))logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0);else{var steam64Id=data.responseText.match(/g_steamID = "(.+?)";/)?.[1],communitySessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1],userName=data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//)?.[1];if(steam64Id&&(this.#auth.steam64Id=steam64Id),userName&&(this.#auth.userName=userName),communitySessionID)return this.#auth.communitySessionID=communitySessionID,logStatus.success(),!0;logStatus.error('Error: Get "sessionID" failed')}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError_throwError(error,"Steam.updateCommunityAuth"),!1}}async#getAreaInfo(){try{var logStatus=scripts_echoLog({text:i18n("gettingAreaInfo")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/cart/",method:"GET"});if("Success"===result)if(200===data?.status){var cartConfigRaw=data.responseText.match(/data-cart_config="(.*?)"/)?.[1],temp=document.createElement("div"),cartConfigStr=(temp.innerHTML=cartConfigRaw||"{}",temp.textContent||temp.innerText);let cartConfig;try{cartConfig=JSON.parse(cartConfigStr)}catch(error){return logStatus.error("Error: get country info filed"),console.error(error),{}}if(cartConfig.rgUserCountryOptions){var userInfoRaw=data.responseText.match(/data-userinfo="(.*?)"/)?.[1],temp1=document.createElement("div"),userInfoStr=(temp1.innerHTML=userInfoRaw||"{}",temp1.textContent||temp1.innerText);let userInfo;try{userInfo=JSON.parse(userInfoStr)}catch(error){return logStatus.error("Error: get country info filed"),console.error(error),{}}var currentArea=userInfo.country_code,areas=Object.keys(cartConfig.rgUserCountryOptions).filter(area=>"help"!==area);if(currentArea&&0{let checker=setInterval(()=>{"waiting"!==this.#areaStatus&&(clearInterval(checker),resolve(!0))})}),this.#area===area||!area&&"CN"!==this.#area)return!0;this.#areaStatus="waiting";let aimedArea=area;if(!aimedArea){var{currentArea,areas}=await this.#getAreaInfo();if(!currentArea||!areas)return!(this.#areaStatus="error");if("CN"!==currentArea)return this.#areaStatus="skip",scripts_echoLog({text:"notNeededChangeArea"}),"skip";var anotherArea=areas.filter(area=>area&&"CN"!==area);if(!anotherArea||0===anotherArea.length)return this.#areaStatus="noAnotherArea",scripts_echoLog({text:"noAnotherArea"}),!1;[aimedArea]=anotherArea}var logStatus=scripts_echoLog({text:i18n("changingArea",aimedArea)}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/country/setcountry",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({cc:aimedArea,sessionid:this.#auth.storeSessionID})});if("Success"!==result)return this.#areaStatus="error",logStatus.error(result+`:${statusText}(${status})`),"CN";if(200!==data?.status||"true"!==data.responseText)return this.#areaStatus="error",logStatus.error(`Error:${data?.statusText}(${data?.status})`),"CN";{let currentArea=(await this.#getAreaInfo()).currentArea;return currentArea===aimedArea?(this.#areaStatus="success",logStatus.success(),currentArea):(this.#areaStatus="error",logStatus.error("Error: change country filed"),"CN")}}catch(error){return this.#areaStatus="error",throwError_throwError(error,"Steam.changeArea"),!1}}async#joinGroup(groupName){try{var logStatus,result,statusText,status,data;return this.#ASF?!!await this.#ASF.joinGroup(groupName)&&(this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({action:"join",sessionID:this.#auth.communitySessionID})}),"Success"===result?200!==data?.status||data.responseText.includes("grouppage_join_area")?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.success(),this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.joinGroup"),!1}}async#leaveGroup(groupName){try{if(this.whiteList.groups.includes(groupName))return scripts_echoLog({type:"whiteList",text:"Steam.leaveGroup",id:groupName}),!0;if(this.#ASF)return await this.#ASF.leaveGroup(groupName);var groupId=await this.#getGroupId(groupName);if(groupId){var logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"===result)return 200===data?.status&&data.finalUrl.includes("groups")&&0===$(data.responseText.replace(//g,"").toLowerCase()).find(`a[href='https://steamcommunity.com/groups/${groupName.toLowerCase()}']`).length?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.leaveGroup"),!1}}async#getGroupId(groupName){try{var logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:groupName}),groupId=this.#cache.group[groupName];if(groupId)return logStatus.success(),groupId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let groupId=data.responseText.match(/OpenGroupChat\( '([0-9]+)'/)?.[1];return groupId?(this.#setCache("group",groupName,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async#joinOfficialGroup(gameId){try{var logStatus,result,statusText,status,data,groupId;return this.#ASF?!!await this.#ASF.joinGroup(gameId)&&(this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]),!0):(logStatus=scripts_echoLog({type:"joiningSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/games/${gameId}?action=join&sessionID=`+this.#auth.communitySessionID,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}),"Success"===result?200!==data?.status||data.responseText.includes('id="publicGroupJoin"')?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.success(),this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]),(groupId=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)?.[1])&&this.#setCache("officialGroup",gameId,groupId),!0):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.joinOfficialGroup"),!1}}async#leaveOfficialGroup(gameId){try{if(this.whiteList.officialGroups.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.leaveOfficialGroup",id:gameId}),!0;if(this.#ASF)return await this.#ASF.leaveGroup(gameId);var groupId=await this.#getOfficialGroupId(gameId);if(groupId){var resultR,statusTextR,statusR,dataR,logStatus=scripts_echoLog({type:"leavingSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"===result)return 200===data?.status?({result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}),"Success"===resultR?200===dataR?.status&&dataR.responseText.includes('id="publicGroupJoin"')?(logStatus.success(),!0):(logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.leaveOfficialGroup"),!1}}async#getOfficialGroupId(gameId){try{var logStatus=scripts_echoLog({type:"gettingSteamOfficialGroupId",text:gameId}),groupId=this.#cache.officialGroup[gameId];if(groupId)return logStatus.success(),groupId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let groupId=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)?.[1];return groupId?(this.#setCache("officialGroup",gameId,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getGroupID"),!1}}async#addToWishlist(gameId){try{if(this.#ASF)return!!await this.#ASF.addToWishlist(gameId)&&(this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0);var logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId}),{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/addtowishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"!==result||200!==data?.status||!0!==data.response?.success){var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==dataR?.status)return logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1;if("CN"===this.#area&&dataR.responseText.includes('id="error_box"'))return logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#addToWishlist(gameId);if((!dataR.responseText.includes('class="queue_actions_ctn"')||!dataR.responseText.includes('class="already_in_library"'))&&(dataR.responseText.includes('class="queue_actions_ctn"')&&dataR.responseText.includes('id="add_to_wishlist_area_success" style="display: none;')||!dataR.responseText.includes('class="queue_actions_ctn"')))return logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1}return logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0}catch(error){return throwError_throwError(error,"Steam.addToWishlist"),!1}}async#removeFromWishlist(gameId){try{if(this.whiteList.wishlists.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.removeFromWishlist",id:gameId}),!0;if(this.#ASF)return await this.#ASF.removeFromWishlist(gameId);var logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId}),{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/removefromwishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===data?.status&&!0===data.response?.success)return logStatus.success(),!0;var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==dataR?.status)return logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1;if("CN"===this.#area&&dataR.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result&&"skip"!==result?await this.#removeFromWishlist(gameId):!1}return dataR.responseText.includes('class="queue_actions_ctn"')&&(dataR.responseText.includes("ds_owned_flag ds_flag")||dataR.responseText.includes("add_to_wishlist_area"))?(logStatus.success(),!0):(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.removeFromWishlist"),!1}}async#toggleFollowGame(gameId,doTask){try{var logStatus,requestData,result,data,followed;return!doTask&&this.whiteList.follows.includes(gameId)?(scripts_echoLog({type:"whiteList",text:"Steam.unfollowGame",id:gameId}),!0):this.#ASF?!!await this.#ASF.toggleFollowGame(gameId,doTask)&&(doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId}),requestData={sessionid:this.#auth.storeSessionID,appid:gameId},{result,data}=(doTask||(requestData.unfollow="1"),await tools_httpRequest({url:"https://store.steampowered.com/explore/followgame/",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param(requestData)})),"Success"===result&&200===data?.status&&"true"===data.responseText?(logStatus.success(),!0):(followed=await this.#isFollowedGame(gameId),"CN"===this.#area&&"areaLocked"===followed?(logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#removeFromWishlist(gameId)):doTask===followed?(logStatus.success(),doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1)))}catch(error){return throwError_throwError(error,"Steam.toggleFollowGame"),!1}}async#isFollowedGame(gameId){try{var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===result?200===data?.status&&("CN"===this.#area&&data.responseText.includes('id="error_box"')?"areaLocked":"none"!==$(data.responseText.replace(//g,"")).find(".queue_control_button.queue_btn_follow>.btnv6_blue_hoverfade.btn_medium.queue_btn_active").css("display")):!1}catch(error){return throwError_throwError(error,"Steam.isFollowedGame"),!1}}async#toggleForum(gameId,doTask=!0){try{if(!doTask&&this.whiteList.forums.includes(gameId))scripts_echoLog({type:"whiteList",text:"Steam.unsubscribeForum",id:gameId});else{var forumId=await this.#getForumId(gameId);if(!forumId)return!1;var logStatus=scripts_echoLog({type:`${doTask?"":"un"}subscribingForum`,text:gameId}),[id,feature]=forumId.split("_"),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/forum/${id}/General/${doTask?"":"un"}subscribe/${feature||"0"}/`,method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.communitySessionID})});"Success"===result?200!==data?.status||1!==data.response?.success&&29!==data.response?.success?logStatus.error(`Error:${data?.statusText}(${data?.status})`):(doTask&&(this.tasks.forums=unique([...this.tasks.forums,gameId])),logStatus.success()):logStatus.error(result+`:${statusText}(${status})`)}return!0}catch(error){return throwError_throwError(error,"Steam.toggleForum"),!0}}async#getForumId(gameId){try{var logStatus=scripts_echoLog({type:"gettingForumId",text:gameId}),forumId=this.#cache.forum[gameId];if(forumId)return logStatus.success(),forumId;var{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/app/${gameId}/discussions/`,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let forumId=data.responseText?.match(/General_([\d]+(_[\d]+)?)/)?.[1];return forumId?(this.#setCache("forum",gameId,forumId),logStatus.success(),forumId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getForumId"),!1}}async#toggleFavoriteWorkshop(id,doTask=!0){try{if(!doTask&&this.whiteList.workshops.includes(id))return scripts_echoLog({type:"whiteList",text:"Steam.unfavoriteWorkshop",id:id}),!0;var appid=await this.#getWorkshopAppId(id);if(appid){var logStatus=scripts_echoLog({type:doTask?"favoritingWorkshop":"unfavoritingWorkshop",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/sharedfiles/${doTask?"":"un"}favorite`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,appid:appid,sessionid:this.#auth.communitySessionID})});if("Success"===result)return 200!==data?.status||data.responseText?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(doTask&&(this.tasks.workshops=unique([...this.tasks.workshops,id])),logStatus.success(),!0);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError_throwError(error,"Steam.toggleFavoriteWorkshop"),!1}}async#getWorkshopAppId(id){try{var logStatus=scripts_echoLog({type:"gettingWorkshopAppId",text:id}),appId=this.#cache.workshop[id];if(appId)return logStatus.success(),appId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/filedetails/?id="+id,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let appId=data.responseText.match(//)?.[1];return appId?(this.#setCache("workshop",id,appId),logStatus.success(),appId):(logStatus.error("Error: getWorkshopAppId failed"),!1)}}catch(error){return throwError_throwError(error,"Steam.getWorkshopAppId"),!1}}async#voteUpWorkshop(id){try{var logStatus=scripts_echoLog({type:"votingUpWorkshop",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/voteup",method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,sessionid:this.#auth.communitySessionID})});return"Success"===result?200===data?.status&&1===data.response?.success?logStatus.success():logStatus.error(`Error:${data?.statusText}(${data?.status})`):logStatus.error(result+`:${statusText}(${status})`),!0}catch(error){return throwError_throwError(error,"Steam.voteupWorkshop"),!0}}async#toggleCurator(curatorId,doTask=!0){try{var logStatus,result,statusText,status,data;return!doTask&&this.whiteList.curators.includes(curatorId)?(scripts_echoLog({type:"whiteList",text:"Steam.unfollowCurator",id:curatorId}),!0):this.#ASF?await this.#ASF.toggleCurator(curatorId,doTask):(logStatus=scripts_echoLog({type:doTask?"followingCurator":"unfollowingCurator",text:curatorId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/curators/ajaxfollow",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({clanid:curatorId,sessionid:this.#auth.storeSessionID,follow:doTask}),dataType:"json"}),"Success"===result?200===data?.status&&1===data.response?.success?.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(`+data?.response?.success||data?.status+")"),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.toggleCurator"),!1}}async getCuratorId(path,name){try{var logStatus=scripts_echoLog({type:"gettingCuratorId",text:path+"/"+name}),curatorId=this.#cache.curator[path+"/"+name];if(curatorId)return logStatus.success(),curatorId;var{result,statusText,status,data}=await tools_httpRequest({url:`https://store.steampowered.com/${path}/`+name,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let curatorId=data.responseText.match(/g_pagingData.*?"clanid":([\d]+)/)?.[1];return curatorId?(this.#setCache("curator",path+"/"+name,curatorId),logStatus.success(),curatorId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError_throwError(error,"Steam.getCuratorID"),!1}}async#toggleCuratorLike(link,doTask=!0){try{var curatorId,[path,name]=link.split("/");return path&&name?!!(curatorId=await this.getCuratorId(path,name))&&await this.#toggleCurator(curatorId,doTask):(scripts_echoLog({text:i18n("errorLink",link)}),!1)}catch(error){return throwError_throwError(error,"Steam.toggleCuratorLike"),!1}}async#getAnnouncementParams(appId,viewId){try{var clanid,gid,logStatus=scripts_echoLog({type:"gettingAnnouncementParams",text:appId,id:viewId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://store.steampowered.com/events/ajaxgetpartnerevent?appid=${appId}&announcement_gid=${viewId}&lang_list=6_0&last_modified_time=0&origin=https:%2F%2Fstore.steampowered.com&for_edit=false`,method:"GET",responseType:"json",headers:{Host:"store.steampowered.com",Referer:`https://store.steampowered.com/news/app/${appId}/view/`+viewId}});return"Success"===result?200===data?.status&&1===data?.response?.success?({clanid,gid}=data.response.event?.announcement_body||{},clanid?(logStatus.success(),{clanId:clanid,gid:gid}):(logStatus.error(`Error:${data.statusText}(${data.status})`),{})):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),{}):(logStatus.error(result+`:${statusText}(${status})`),{})}catch(error){return throwError_throwError(error,"Steam.likeAnnouncement"),{}}}async#likeAnnouncement(id){try{var[appId,viewId]=id.split("/");if(appId&&viewId){var{clanId,gid}=await this.#getAnnouncementParams(appId,viewId);if(clanId){var logStatus=scripts_echoLog({type:"likingAnnouncement",text:appId,id:viewId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/updated/ajaxrateupdate/"+(gid||viewId),method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:`https://store.steampowered.com/news/app/${appId}/view/`+viewId},data:$.param({sessionid:this.#auth.storeSessionID,voteup:1,clanid:clanId,ajax:1}),dataType:"json"});if("Success"===result)return 200===data?.status&&1===data.response.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}else scripts_echoLog({}).error(i18n("missParams")+"(id)");return!1}catch(error){return throwError_throwError(error,"Steam.likeAnnouncement"),!1}}async#appid2subid(id){try{var logStatus=scripts_echoLog({type:"gettingSubid",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+id,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;if("CN"===this.#area&&data.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result&&"skip"!==result?await this.#appid2subid(id):!1}var subid=data.responseText.match(/name="subid" value="([\d]+?)"/)?.[1];return subid?(logStatus.success(),subid):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}catch(error){return throwError_throwError(error,"Steam.appid2subid"),!1}}async#getLicenses(){try{var logStatus=scripts_echoLog({text:i18n("gettingLicenses")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/dynamicstore/userdata/?t="+(new Date).getTime(),method:"GET",responseType:"json"});return"Success"===result?200===data?.status?(logStatus.success(),data.response?.rgOwnedPackages):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError_throwError(error,"Steam.getLicenses"),!1}}async#addLicense(id){try{if(this.#ASF)return await this.#ASF.addLicense(id);var[type,ids]=id.split("-");if("appid"===type){var subid=await this.#appid2subid(ids);if(subid){var logStatus=scripts_echoLog({type:"addingFreeLicense",text:ids});if(await this.#addFreeLicense(subid,logStatus)){var{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+ids,method:"GET"});if("Success"===result)return 200===data?.status?data.responseText.includes("ds_owned_flag ds_flag")||data.responseText.includes('class="already_in_library"')?(logStatus.success(),!0):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}return!1}if("subid"!==type)return!1;"CN"===this.#area&&(scripts_echoLog({}).success(i18n("tryChangeAreaNotice")),await this.#changeArea());var logStatusArr={},idsArr=ids.split(",");for(let subid of idsArr){let logStatus=scripts_echoLog({type:"addingFreeLicenseSubid",text:subid});if(!await this.#addFreeLicense(subid,logStatus))return!1;logStatusArr[subid]=logStatus}var licenses=await this.#getLicenses();if(!licenses)return!1;for(let subid of idsArr)licenses.includes(parseInt(subid,10))?logStatusArr[subid].success():logStatusArr[subid].error();return!0}catch(error){return throwError_throwError(error,"Steam.addLicense"),!1}}async#addFreeLicense(id,logStatusPre){try{var logStatus=logStatusPre||scripts_echoLog({type:"addingFreeLicenseSubid",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/checkout/addfreelicense",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/account/licenses/"},data:$.param({action:"add_to_cart",sessionid:this.#auth.storeSessionID,subid:id}),dataType:"json"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;if("CN"===this.#area&&data.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result?await this.#addFreeLicense(id):!1}return logStatus.success(),!0}catch(error){return throwError_throwError(error,"Steam.addFreeLicense"),!1}}async#requestPlayTestAccess(id){try{var logStatus,result,statusText,status,data;return this.#ASF?await this.#ASF.requestPlayTestAccess(id):(logStatus=scripts_echoLog({type:"requestingPlayTestAccess",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/ajaxrequestplaytestaccess/"+id,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/app/"+id},data:$.param({sessionid:this.#auth.storeSessionID}),dataType:"json"}),"Success"===result?200===data?.status&&1===data?.response?.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError_throwError(error,"Steam.requestPlayTestAccess"),!1}}async toggle({doTask=!0,groupLinks=[],officialGroupLinks=[],wishlistLinks=[],followLinks=[],forumLinks=[],workshopLinks=[],workshopVoteLinks=[],curatorLinks=[],curatorLikeLinks=[],announcementLinks=[],licenseLinks=[],playtestLinks=[]}){try{if(0<[...groupLinks,...officialGroupLinks,...forumLinks,...workshopLinks,...workshopVoteLinks].length&&!this.#communityInitialized)return scripts_echoLog({text:i18n("needInit")}),!1;if(0<[...wishlistLinks,...followLinks,...curatorLinks,...curatorLikeLinks,...announcementLinks,...licenseLinks,...playtestLinks].length&&!this.#storeInitialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.steam.groups||!doTask&&!globalOptions.undoTask.steam.groups)scripts_echoLog({type:"globalOptionsSkip",text:"steam.groups"});else{var realGroups=this.getRealParams("groups",groupLinks,doTask,link=>link.match(/groups\/(.+)\/?/)?.[1]);if(0link.match(/games\/(.+)\/?/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/\?id=([\d]+)/)?.[1]);if(0link.match(/\?id=([\d]+)/)?.[1]);if(doTask&&0link.match(/curator\/([\d]+)/)?.[1]),realCuratorLikes=this.getRealParams("curatorLikes",curatorLikeLinks,doTask,link=>link.match(/https?:\/\/store\.steampowered\.com\/(.*?)\/([^/?]+)/)?.slice(1,3).join("/"));if(0(link.includes("store.steampowered.com")?link.match(/store\.steampowered\.com\/news\/app\/([\d]+)\/view\/([\d]+)/):link.match(/steamcommunity\.com\/games\/([\d]+)\/announcements\/detail\/([\d]+)/))?.slice(1,3).join("/"));if(doTask&&0link.match(/app\/([\d]+)/)?.[1]);if(doTask&&globalOptions.doTask.steam.playtests&&0("CN"!==this.#area&&(scripts_echoLog({}).warning(i18n("steamFinishNotice")),await this.#changeArea("CN")),!0))}catch(error){return throwError_throwError(error,"Steam.toggle"),!1}}#setCache(type,name,id){try{this.#cache[type][name]=id,GM_setValue("steamCache",this.#cache)}catch(error){throwError_throwError(error,"Steam.setCache")}}}let social_Steam=Steam;class GiveawaySu{undoneTasks={steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],curatorLikeLinks:[],followLinks:[],forumLinks:[],announcementLinks:[],workshopVoteLinks:[],playtestLinks:[]},discord:{serverLinks:[]},instagram:{userLinks:[]},vk:{nameLinks:[]},twitch:{channelLinks:[]},reddit:{redditLinks:[]},youtube:{channelLinks:[],likeLinks:[]},twitter:{userLinks:[],retweetLinks:[]}};giveawayId;socialInitialized={discord:!1,instagram:!1,reddit:!1,twitch:!1,vk:!1,youtube:!1,steamStore:!1,steamCommunity:!1,twitter:!0};initialized=!1;social={};static test(){return/^https?:\/\/giveaway\.su\/giveaway\/view\/[\d]+/.test(window.location.href)}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){throwError_throwError(error,"Giveawaysu.after")}}init(){try{var logStatus=scripts_echoLog({text:i18n("initing")});return 0<$("a.steam-login").length?(window.open("/steam/redirect","_self"),logStatus.warning(i18n("needLogin")),!1):!!this.#getGiveawayId()&&(this.initialized=!0,logStatus.success(),!0)}catch(error){return throwError_throwError(error,"Giveawaysu.init"),!1}}async#classifyTask(){try{var logStatus=scripts_echoLog({text:i18n("getTasksInfo")}),pro=[],tasks=$("#actions tr");$("div.bind-discord").is(":visible")&&$("div.bind-discord a")[0].click(),$("div.bind-twitch").is(":visible")&&$("div.bind-twitch a")[0].click();for(let task of tasks)pro.push(new Promise(resolve=>{var td=$(task).find('td:not(".hidden")'),colorfulTask=td.eq(1).find('a:not([data-trigger="link"])'),colorlessTask=td.eq(2).find('a:not([data-trigger="link"])'),colorfulTask=0{try{if(!link)return null;let redirectLinksCache=GM_getValue("redirectLinks")||{};return redirectLinksCache[link],await tools_httpRequest({url:link,method:"GET"}).then(({data})=>data?.finalUrl?(redirectLinksCache[link]=data.finalUrl,GM_setValue("redirectLinks",redirectLinksCache),data.finalUrl):null)}catch(error){return throwError_throwError(error,"getRedirectLink"),null}})(colorfulTask.attr("href")).then(taskLink=>{if(!taskLink)return resolve(!1);taskIcon.includes("steam")&&/join/gi.test(taskName)?this.undoneTasks.steam.groupLinks.push(taskLink):/like.*announcement/gi.test(taskName)?this.undoneTasks.steam.announcementLinks.push(taskLink):/(follow|subscribe).*curator/gim.test(taskName)&&/^https?:\/\/store\.steampowered\.com\/curator\//.test(taskLink)?this.undoneTasks.steam.curatorLinks.push(taskLink):taskIcon.includes("steam")&&/follow|subscribe/gim.test(taskName)?this.undoneTasks.steam.curatorLikeLinks.push(taskLink):/subscribe.*steam.*forum/gim.test(taskName)?this.undoneTasks.steam.forumLinks.push(taskLink):taskIcon.includes("thumbs-up")&&/^https?:\/\/steamcommunity\.com\/sharedfiles\/filedetails\/\?id=[\d]+/.test(taskLink)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):taskIcon.includes("plus")&&/request.*playtest/gim.test(taskName)?this.undoneTasks.steam.playtestLinks.push(taskLink):taskIcon.includes("discord")||/join.*discord/gim.test(taskName)?this.undoneTasks.discord.serverLinks.push(taskLink):taskIcon.includes("instagram")||/follow.*instagram/gim.test(taskName)?this.undoneTasks.instagram.userLinks.push(taskLink):taskIcon.includes("twitch")||/follow.*twitch.*channel/gim.test(taskName)?this.undoneTasks.twitch.channelLinks.push(taskLink):taskIcon.includes("reddit")||/subscribe.*subreddit/gim.test(taskName)||/follow.*reddit/gim.test(taskName)?this.undoneTasks.reddit.redditLinks.push(taskLink):/watch.*art/gim.test(taskName)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):/subscribe.*youtube.*channel/gim.test(taskName)?this.undoneTasks.youtube.channelLinks.push(taskLink):/(watch|like).*youtube.*video/gim.test(taskName)||(taskIcon.includes("youtube")||taskIcon.includes("thumbs-up"))&&/(watch|like).*video/gim.test(taskName)?this.undoneTasks.youtube.likeLinks.push(taskLink):taskIcon.includes("vk")||/join.*vk.*group/gim.test(taskName)?this.undoneTasks.vk.nameLinks.push(taskLink):/(on twitter)|(Follow.*on.*Facebook)/gim.test(taskName)||(/wishlist.*game|add.*wishlist/gim.test(taskName)&&this.undoneTasks.steam.wishlistLinks.push(taskLink),/follow.*button/gim.test(taskName)&&this.undoneTasks.steam.followLinks.push(taskLink)),resolve(!0)}).catch(error=>(throwError_throwError(error,"Giveawaysu.classifyTask->getRedirectLink"),!1))}));return await Promise.all(pro),logStatus.success(),this.undoneTasks=this.#uniqueTasks(this.undoneTasks),!0}catch(error){return throwError_throwError(error,"Giveawaysu.classifyTask"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin&&0<$("a.steam-login").length&&window.open("/steam/redirect","_self"),!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLogin"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey&&0<$(".giveaway-ended").length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(({value})=>{value&&window.close()}),!0}catch(error){return throwError_throwError(error,"Giveawaysu.checkLeftKey"),!1}}#getGiveawayId(){var giveawayId=window.location.href.match(/\/view\/([\d]+)/)?.[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}async#bind(name,init){try{return{name:name,result:await init}}catch(error){return throwError_throwError(error,"GiveawaySu.bind"),{name:name,result:!1}}}async#initSocial(){try{var steamLength,steamCommunityLength,pro=[];let tasks=this.undoneTasks;return tasks.discord&&0[...total,...arr]).length&&!this.socialInitialized.discord&&(this.social.discord=new social_Discord,pro.push(this.#bind("discord",this.social.discord.init("do")))),tasks.instagram&&0[...total,...arr]).length&&!this.socialInitialized.instagram&&(this.social.instagram=new social_Instagram,pro.push(this.#bind("instagram",this.social.instagram.init()))),tasks.reddit&&0[...total,...arr]).length&&!this.socialInitialized.reddit&&(this.social.reddit=new social_Reddit,pro.push(this.#bind("reddit",this.social.reddit.init()))),tasks.twitch&&0[...total,...arr]).length&&!this.socialInitialized.twitch&&(this.social.twitch=new social_Twitch,pro.push(this.#bind("twitch",this.social.twitch.init()))),tasks.vk&&0[...total,...arr]).length&&!this.socialInitialized.vk&&(this.social.vk=new social_Vk,pro.push(this.#bind("vk",this.social.vk.init()))),tasks.youtube&&0[...total,...arr]).length&&!this.socialInitialized.youtube&&(this.social.youtube=new Youtube,pro.push(this.#bind("youtube",this.social.youtube.init()))),tasks.steam&&0<(steamLength=Object.values(tasks.steam).reduce((total,arr)=>[...total,...arr]).length)&&(this.social.steam||(this.social.steam=new social_Steam),0["groupLinks","forumLinks","workshopLinks","workshopVoteLinks"].includes(type)&&tasks.steam?.[type]?.length||0).reduce((total,number)=>total+number,0))&&!this.socialInitialized.steamStore&&pro.push(this.#bind("steamStore",this.social.steam.init("store"))),0{let checked=!0;for(var data of result)data.result?this.socialInitialized[data.name]=data.result:checked=!1;return checked})}catch(error){return throwError_throwError(error,"GiveawaySu.initSocial"),!1}}#uniqueTasks(allTasks){var social,types,result={};for([social,types]of Object.entries(allTasks)){result[social]={};for(var[type,tasks]of Object.entries(types))result[social][type]=unique(tasks)}return result}async#toggleTask(){try{var pro,tasks;return this.initialized||this.init()?!!await this.#classifyTask()&&!!await this.#initSocial()&&(pro=[],tasks=this.undoneTasks,"skip"!==this.socialInitialized.discord&&this.social.discord&&pro.push(this.social.discord.toggle({doTask:!0,...tasks.discord})),this.social.instagram&&pro.push(this.social.instagram.toggle({doTask:!0,...tasks.instagram})),this.social.reddit&&pro.push(this.social.reddit.toggle({doTask:!0,...tasks.reddit})),this.social.twitch&&pro.push(this.social.twitch.toggle({doTask:!0,...tasks.twitch})),this.social.vk&&pro.push(this.social.vk.toggle({doTask:!0,...tasks.vk})),this.social.youtube&&pro.push(this.social.youtube.toggle({doTask:!0,...tasks.youtube})),this.social.steam&&pro.push(this.social.steam.toggle({doTask:!0,...tasks.steam})),await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!0):!1}catch(error){return throwError_throwError(error,"GiveawaySu.toggleTask"),!1}}async doTask(){try{return $("#getKey").on("click",()=>{$("#auto-task-info-div").remove(),$(window.STYLE).remove(),$("#getKey").off()}),await this.#toggleTask()}catch(error){return throwError_throwError(error,"GiveawaySu.doTask"),!1}}async verifyTask(){try{var task;for(task of $("#actions tr")){var icon,button,href,$task=$(task);"adjs"!==$task.attr("data-action-id")&&("A"===(button=(icon=$task.find("i.glyphicon-refresh")).parent()).prop("tagName")?(href=button.attr("href"),button.attr("href","javascript:void(0);").attr("target","_self")[0].click(),button.attr("href",href)):icon.hasClass("spin")||icon.hasClass("glyphicon-ok")||(button[0].click(),await delay(1e3)))}}catch(error){throwError_throwError(error,"GiveawaySu.verifyTask")}}}let Giveawaysu=GiveawaySu,for_giveawaysu=__webpack_require__(738);if(window.STYLE=GM_addStyle(for_giveawaysu.A+GM_getResourceText("style")),"discord.com"===window.location.hostname){external_Swal_namespaceObject=window.localStorage;if("#auth"===window.location.hash){window.localStorage.removeItem=()=>!0;var discordAuth=external_Swal_namespaceObject?.getItem("token")?.replace(/^"|"$/g,"");discordAuth&&0{if("www.twitch.tv"===window.location.hostname&&"#auth"===window.location.hash&&(authToken=external_Cookies_namespaceObject.get("auth-token"),!!external_Cookies_namespaceObject.get("login")?(GM_setValue("twitchAuth",{authToken:authToken,clientId:commonOptions?.headers?.["Client-ID"]}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"x.com"===window.location.hostname&&"#auth"===window.location.hash){var authToken=external_Cookies_namespaceObject.get("ct0");let isLogin=!!external_Cookies_namespaceObject.get("twid");isLogin&&authToken?(GM_setValue("twitterAuth",{ct0:authToken}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))}if("www.youtube.com"===window.location.hostname&&"#auth"===window.location.hash&&((authToken=external_Cookies_namespaceObject.get("__Secure-3PAPISID"))?(GM_setValue("youtubeAuth",{PAPISID:authToken}),window.close(),external_Swal_default().fire("",i18n("closePageNotice"))):external_Swal_default().fire("",i18n("needLogin"))),"www.reddit.com"===window.location.hostname&&("#auth"===window.location.hash||"#auth"===GM_getValue("redditAuth"))){authToken=$("#redesign-beta-optin-btn");if(0

    `),await website.after(),$("#auto-do-task").on("click",()=>{website.doTask()}),$("#auto-verify-task").on("click",()=>{website.verifyTask()}),console.log("%c%s","color:#1bbe1a","Auto Task GS特供脚本初始化完成!")}})}})(); \ No newline at end of file diff --git a/dist/auto-task-v4.all.user.js b/dist/auto-task-v4.all.user.js index d5e6ebe..b28ac60 100644 --- a/dist/auto-task-v4.all.user.js +++ b/dist/auto-task-v4.all.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name auto-task-v4 // @namespace auto-task-v4 -// @version 4.4.12 +// @version 4.4.13 // @description 自动完成 Freeanywhere,Giveawaysu,GiveeClub,Givekey,Gleam,Indiedb,keyhub,OpiumPulses,Opquests,SweepWidget 等网站的任务。 // @description:en Automatically complete the tasks of FreeAnyWhere, GiveawaySu, GiveeClub, Givekey, Gleam, Indiedb, keyhub, OpiumPulses, Opquests, SweepWidget websites. // @author HCLonely @@ -1239,8 +1239,8 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); skipTaskOption: '设置中已配置跳过任务', other: '其他', globalOptions: '全局设置', - checkLogin: '登录检测
    需要登录的网站自动登录,部分本网站支持', - checkLeftKey: '剩余Key检测
    赠Key活动结束提示是否关闭,部分本网站支持', + checkLogin: '登录检测
    需要登录的网站自动登录,部分网站支持', + checkLeftKey: '剩余Key检测
    赠Key活动结束提示是否关闭,部分网站支持', twitterVerifyId: '通过尝试关注该账号验证Twitter凭证
    默认为Twitter官方帐号 783214
    不想关注官方账号可以改为自己的帐号', youtubeVerifyChannel: '通过尝试订阅该频道验证YouTube凭证
    默认为YouTube官方频道 UCrXUsMBcfTVqwAS7DKg9C0Q
    不想关注官方频道可以改为自己的频道', autoUpdateSource: '更新源
    github: 需代理,实时更新
    jsdelivr: 可不用代理,更新有延迟
    standby: 备用
    auto: 依次使用github, jsdelivr, standby源进行尝试更新', @@ -9513,11 +9513,27 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); } const taskInfo = $task.find('.user-links'); taskInfo[0].click(); + const aElements = $task.find('.expandable').find('a.btn'); + if (aElements.length > 0) { + for (const element of aElements) { + const $element = $(element); + const href = $element.attr('href'); + $element.removeAttr('href')[0].click(); + $element.attr('href', href); + } + } unsafeWindow.$hookTimer?.setSpeed(1e3); + const visitBtn = $task.find('.expandable').find('span:contains(more seconds),button:contains(more seconds)').filter(':visible'); + if (visitBtn.length > 0) { + const newTab = window.open('', '_blank'); + newTab?.focus(); + await delay(1e3); + newTab?.close(); + } await delay(3e3); unsafeWindow.$hookTimer?.setSpeed(1); const expandInfo = $task.find('.expandable'); - const input = expandInfo.find('input')[0]; + const [ input ] = expandInfo.find('input'); if (input) { const evt = new Event('input', { bubbles: true, diff --git a/dist/auto-task-v4.compatibility.all.user.js b/dist/auto-task-v4.compatibility.all.user.js index 13804c3..381f1be 100644 --- a/dist/auto-task-v4.compatibility.all.user.js +++ b/dist/auto-task-v4.compatibility.all.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name auto-task-v4.compatibility // @namespace auto-task-v4.compatibility -// @version 4.4.12 +// @version 4.4.13 // @description 自动完成 Freeanywhere,Giveawaysu,GiveeClub,Givekey,Gleam,Indiedb,keyhub,OpiumPulses,Opquests,SweepWidget 等网站的任务。 // @description:en Automatically complete the tasks of FreeAnyWhere, GiveawaySu, GiveeClub, Givekey, Gleam, Indiedb, keyhub, OpiumPulses, Opquests, SweepWidget websites. // @author HCLonely @@ -126,7 +126,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); ${text}]...`);break;case"gettingAnnouncementParams":case"likingAnnouncement":ele=$(`
  • ${i18n(type)}[ ${id}]...
  • `);break;case"joiningDiscordServer":case"gettingDiscordGuild":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"leavingDiscordServer":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"updateDiscordAuth":ele=$(`
  • ${i18n("updateDiscordAuth")}
  • `);break;case"followingTwitchChannel":case"unfollowingTwitchChannel":case"gettingTwitchChannelId":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingInsUserId":case"followingIns":case"unfollowingIns":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingTwitterUserId":case"followingTwitterUser":case"unfollowingTwitterUser":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"retweetting":case"unretweetting":ele=$(`
  • ${i18n(type)}${text}...
  • `);break;case"joiningReddit":case"leavingReddit":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"followingRedditUser":case"unfollowingRedditUser":ele=$(`
  • ${i18n(type)}[ ${text?.replace("u_","")}]...
  • `);break;case"followingYtbChannel":case"unfollowingYtbChannel":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"likingYtbVideo":case"unlikingYtbVideo":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"gettingVkId":case"joiningVkGroup":case"leavingVkGroup":case"joiningVkPublic":case"leavingVkPublic":case"sendingVkWall":case"deletingVkWall":ele=$(`
  • ${i18n(type)}[${text}]...
  • `);break;case"visitingLink":ele=$(`
  • ${i18n("visitingLink")}[${text}]...
  • `);break;case"verifyingInsAuth":case"text":ele=$(`
  • ${i18n(text)}
  • `);break;case"html":ele=$(text||html);break;case"whiteList":ele=$(`
  • ${i18n("skipTask")}[${text}(${id})](${i18n("whiteList")})
  • `);break;case"globalOptionsSkip":ele=$(`
  • ${i18n("skipTaskOption")}${text}
  • `);break;default:ele=$(`
  • ${i18n("unKnown")}:${type}(${text})...
  • `)}else ele=text?$(`
  • ${i18n(text)}
  • `):html?$(html):$("
  • ");return ele.addClass("card-text"),$("#auto-task-info").append(ele),ele[0]?.scrollIntoView(),{font:ele.find("font"),success(text="Success",html=!1){return this.font?.attr("class","").addClass("success"),html?this.font?.html(text):this.font?.text(text),this},error(text="Error",html=!1){return this.font?.attr("class","").addClass("error"),html?this.font?.html(text):this.font?.text(text),this},warning(text="Warning",html=!1){return this.font?.attr("class","").addClass("warning"),html?this.font?.html(text):this.font?.text(text),this},info(text="Info",html=!1){return this.font?.attr("class","").addClass("info"),html?this.font?.html(text):this.font?.text(text),this},view(){return this.font?.[0].scrollIntoView(),this}}}catch(error){return throwError(error,"echoLog"),emptyStatus}},unique=array=>{try{return[...new Set(array)]}catch(error){return throwError(error,"unique"),[]}},delay=(time=1e3)=>new Promise(resolve=>{setTimeout(()=>{resolve(!0)},time)}),getRedirectLink=async link=>{try{if(!link)return null;let redirectLinksCache=GM_getValue("redirectLinks")||{};return redirectLinksCache[link],await tools_httpRequest({url:link,method:"GET"}).then(({data})=>data?.finalUrl?(redirectLinksCache[link]=data.finalUrl,GM_setValue("redirectLinks",redirectLinksCache),data.finalUrl):null)}catch(error){return throwError(error,"getRedirectLink"),null}},visitLink=async(link,options)=>{try{let logStatus=scripts_echoLog({type:"visitLink",text:link});return await tools_httpRequest({url:link,method:"GET",...options}).then(({result,statusText,status})=>"Success"===result?(logStatus.success(),!0):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError(error,"visitLink"),!1}},stringToColour=str=>{try{let hash=0;for(let i=0;i>8*i&255;colour+=("00"+value.toString(16)).slice(-2)}return colour}catch(error){return throwError(error,"stringToColour"),"#fff"}},defaultGlobalOptions={doTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0,workshopVotes:!0,announcements:!0,licenses:!0,playtests:!0}},undoTask:{discord:{servers:!0},instagram:{users:!0},twitch:{channels:!0},twitter:{users:!0,retweets:!0},vk:{names:!0},youtube:{channels:!0,likes:!0},reddit:{reddits:!0},steam:{groups:!0,officialGroups:!0,wishlists:!0,follows:!0,forums:!0,workshops:!0,curators:!0}},ASF:{AsfEnabled:!1,AsfIpcUrl:"",AsfIpcPassword:"",AsfBotname:"asf"},position:{buttonSideX:"right",buttonSideY:"top",buttonDistance:"15,30",showButtonSideX:"right",showButtonSideY:"top",showButtonDistance:"15,30",logSideX:"right",logSideY:"bottom",logDistance:"10,10"},hotKey:{doTaskKey:"alt + d",undoTaskKey:"alt + u",toggleLogKey:"alt + l"},other:{twitterVerifyId:"783214",youtubeVerifyChannel:"UCrXUsMBcfTVqwAS7DKg9C0Q",autoUpdateSource:"jsdelivr",language:"zh",checkLogin:!0,checkLeftKey:!0,defaultShowButton:!0,defaultShowLog:!0,debug:!1,receivePreview:!0}},assignObject=(external_Swal_namespaceObject=GM_getValue("globalOptions")||{},(obj1,obj2)=>{try{var key,value,newObj={};for([key,value]of Object.entries(obj1))"[object Object]"===Object.prototype.toString.call(value)&&"[object Object]"===Object.prototype.toString.call(obj2[key])?newObj[key]=assignObject(value,obj2[key]):newObj[key]=obj2[key]??value;return newObj}catch(error){return throwError(error,"assignObject"),defaultGlobalOptions}}),globalOptions=assignObject(defaultGlobalOptions,external_Swal_namespaceObject),saveData=()=>{try{let data={};$("#globalOptionsForm").serializeArray().map(value=>(data[value.name]=value.value,value)),$.makeArray($("#globalOptionsForm input")).map(element=>{var name=$(element).attr("name"),keys=name.split(".");return 3===keys.length?globalOptions[keys[0]][keys[1]][keys[2]]=!!data[name]&&("on"===data[name]||data[name]):2===keys.length&&(globalOptions[keys[0]][keys[1]]=!!data[name]&&("on"===data[name]||data[name])),element}),GM_setValue("globalOptions",globalOptions),external_Swal_default().fire({title:i18n("changeGlobalOptionsSuccess"),icon:"success"})}catch(error){throwError(error,"saveData")}},changeGlobalOptions=showType=>{try{let globalOptionsForm=`
    - `;for(let[type,data1]of Object.entries(globalOptions))for(var[option,data2]of Object.entries(data1))if(["other","position","hotKey","ASF"].includes(type))"boolean"==typeof data2?globalOptionsForm+=`${0===Object.keys(data1).indexOf(option)?``:""}`:globalOptionsForm+=`${0===Object.keys(data1).indexOf(option)?``:""}`;else for(var[socialType,data3]of Object.entries(data2))globalOptionsForm+=`${0===Object.keys(data1).indexOf(option)?``:""}`;globalOptionsForm+="
    ${i18n("type")}${i18n("option")}${i18n("value")}
    ${i18n(type)}${i18n(option)}
    ${i18n(type)}${i18n(option)}
    ${i18n(type)}${option}.${i18n(socialType)}
    ","swal"===showType?external_Swal_default().fire({title:i18n("globalOptions"),html:globalOptionsForm,showConfirmButton:!0,confirmButtonText:i18n("save"),showCancelButton:!0,cancelButtonText:i18n("close")}).then(({isConfirmed})=>{isConfirmed&&saveData()}):$("body").append(`

    ${i18n("globalOptions")}

    `+globalOptionsForm)}catch(error){throwError(error,"changeGlobalOptions")}},languages={zh:{website:"网站",type:"类型",edit:"编辑",whiteList:"白名单",skipTask:"跳过撤销任务",whiteListOptions:"白名单设置",changeWhiteListOption:"设置白名单(%0)",whiteListNotFound:"找不到此项白名单: %0",changeWhiteListSuccess:"白名单修改成功,刷新生效!",changeWebsiteOptions:"网站设置",changeGlobalOptions:"全局设置",ok:"是",save:"保存",close:"关闭",return:"返回",option:"选项",value:"值",websiteOptions:"当前网站设置",changeWebsiteOptionsSuccess:"更改当前网站设置成功,刷新生效!",changeGlobalOptionsSuccess:"更改全局设置成功,刷新生效!",needLogin:"请先登录!",getTasksInfo:"正在获取并处理任务信息...",gettingKey:"正在获取Key...",verifyingTask:"正在验证任务",notice:"自动任务脚本提醒",noKeysLeft:"此页面已经没有剩余key了,是否关闭?",giveawayEnded:"此活动已结束,是否关闭?",giveawayNotWork:"此活动因某些原因(已结束/暂停/未开始...)不可用(如果是脚本误判请及时反馈),是否关闭?",confirm:"确定",cancel:"取消",unKnown:"未知",unKnownTaskType:"未识别的任务",doing:"正在做任务",allTasksComplete:"所有任务已完成!",getTaskIdFailed:"获取任务Id失败!",initSuccess:"%0 初始化成功!",initFailed:"%0 初始化失败!",errorLink:"链接错误: %0",needInit:"请先初始化",verifyingAuth:"正在验证%0凭证...",updatingAuth:"正在更新%0凭证...",refreshingToken:"正在刷新%0凭证...",settingToken:"正在设置%0凭证...",initing:"正在初始化...",getFailed:"获取%0失败!",checkLoginFailed:"检测登录状态失败!",checkLeftKeyFailed:"检测剩余Key失败!",userId:"用户Id",joiningGiveaway:"正在加入赠Key",needJoinGiveaway:"需要先加入赠Key",cannotUndo:"此网站不支持取消任务",verifyAuth:"正在验证 %0 凭证...",closePageNotice:"如果此页面没有自动关闭,请自行关闭本页面。",errorReport:"检测到脚本报错,是否前往反馈BUG?",visitingLink:"正在访问链接: ",doTask:"做任务",undoTask:"撤销任务",verifyTask:"验证任务",getKey:"获取Key",selectAll:"全选",selectNone:"全不选",invertSelect:"反选",doFreeTask:"加入免费赠品",doPointTask:"加入点数赠品",skipTaskOption:"设置中已配置跳过任务",other:"其他",globalOptions:"全局设置",checkLogin:"登录检测
    需要登录的网站自动登录,部分本网站支持",checkLeftKey:"剩余Key检测
    赠Key活动结束提示是否关闭,部分本网站支持",twitterVerifyId:"通过尝试关注该账号验证Twitter凭证
    默认为Twitter官方帐号 783214
    不想关注官方账号可以改为自己的帐号",youtubeVerifyChannel:"通过尝试订阅该频道验证YouTube凭证
    默认为YouTube官方频道 UCrXUsMBcfTVqwAS7DKg9C0Q
    不想关注官方频道可以改为自己的频道",autoUpdateSource:"更新源
    github: 需代理,实时更新
    jsdelivr: 可不用代理,更新有延迟
    standby: 备用
    auto: 依次使用github, jsdelivr, standby源进行尝试更新",saveGlobalOptions:"保存全局设置",settingPage:"设置页面",name:"名称",version:"版本",scriptManager:"脚本管理器",script:"脚本",environment:"环境",os:"系统",browser:"浏览器",getId:"获取 %0 id",getTwitterUserId:"获取Twitter用户id(获取id功能仅在设置页面可用)",getYoutubeChannelId:"获取Youtube频道id(获取id功能仅在设置页面可用)",showButton:"显示按钮",hideButton:"隐藏按钮",showLog:"显示日志",hideLog:"隐藏日志",defaultShowButton:"默认显示按钮",defaultShowLog:"默认显示日志",debug:"输出调试日志,不要开启此选项!",receivePreview:"接收预览版更新",position:"组件位置",buttonSideX:"按钮区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",buttonSideY:"按钮区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",buttonDistance:"按钮区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",showButtonSideX:"显示按钮水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",showButtonSideY:"显示按钮垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",showButtonDistance:"显示按钮距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",logSideX:"日志区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",logSideY:"日志区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",logDistance:"日志区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",hotKey:"快捷键",doTaskKey:"做任务快捷键
    (实时预览功能仅在设置页面可用)",undoTaskKey:"撤销任务快捷键
    (实时预览功能仅在设置页面可用)",toggleLogKey:"显示/隐藏日志快捷键
    (实时预览功能仅在设置页面可用)",tasksHistory:"任务历史",clearHistory:"清空历史",clearHistoryFinished:"已清空任务历史!",deleteTask:"删除任务",lastChangeTime:"最后一次修改时间",clearTaskFinished:"删除以下任务完成!",clearTaskFailed:"删除任务失败,没有找到任务名!",syncData:"数据同步",settingData:"正在上传数据...",gettingData:"正在获取数据...",help:"帮助",fileName:"文件名",upload2gist:"同步到Gist",downloadFromGist:"从Gist同步",saveAndTest:"保存配置并测试",testSuccess:"测试成功!",testFailed:"测试失败!",saveAndTestNotice:"请先保存配置并测试!",processingData:"正在处理数据...",updatingData:"正在上传数据...",syncDataSuccess:"同步数据成功!",syncDataFailed:"同步数据失败,请在控制台查看错误信息!",downloadingData:"正在下载数据...",checkedNoData:"没有检测到远程数据,请确认配置是否正确!",savingData:"正在保存数据...",syncHistory:"同步任务历史",checkUpdateFailed:"检测更新失败",newVersionNotice:'检测到新版本V%0, 点此更新',language:"语言
    目前仅支持zh: 中文, en: 英文",gistOptions:"Gist 设置",swalNotice:"检测到您第一次安装V4版本脚本,请前往阅读用前必读内容!",echoNotice:'检测到您第一次安装V4版本脚本,请点此前往阅读用前必读内容!',noticeLink:"https://auto-task-doc.js.org/guide/#用前必读",toGithub:"前往Github反馈",toKeylol:"前往其乐论坛反馈",copySuccess:"错误信息已复制到剪切板,是否前往其乐论坛反馈?",copyFailed:"请复制下方错误信息后前往Keylol论坛反馈!",updateText:"%0 版本更新内容:",Active:"进行中",Ended:"已结束",Banned:"已封禁",Paused:"已暂停",notStart:"未开始",noRemoteData:"检测到远程无数据",errorRemoteDataFormat:"远程数据格式错误",updateHistory:'历史更新记录点此查看',AsfEnabled:'使用ASF做Steam相关任务(需ASFEnhance插件)',AsfIpcUrl:"ASF IPC 地址",AsfIpcPassword:"ASF IPC 密码",versionNotMatched:"脚本管理器版本过低,需TamperMonkey >= 5.2.0或TamperMonkey Beta >= 5.2.6196",groups:"组",officialGroups:"官方组",wishlists:"愿望单",follows:"游戏关注",forums:"论坛",workshops:"创意工坊收藏",curators:"鉴赏家",workshopVotes:"创意工坊点赞",announcements:"社区通知",steamCommunity:"Steam社区",steamStore:"Steam商店",licenses:"入库免费游戏",playtests:"请求访问权限",needLoginSteamStore:'请先登录Steam商店',needLoginSteamCommunity:'请先登录Steam社区',joiningSteamGroup:"正在加入Steam组",leavingSteamGroup:"正在退出Steam组",gettingSteamGroupId:"正在获取Steam组Id",joiningSteamOfficialGroup:"正在加入Steam官方组",leavingSteamOfficialGroup:"正在退出Steam官方组",gettingSteamOfficialGroupId:"正在获取Steam官方组Id",subscribingForum:"正在订阅Steam论坛",unsubscribingForum:"正在取消订阅Steam论坛",gettingForumId:"正在获取Steam论坛Id",followingCurator:"正在关注Steam鉴赏家",unfollowingCurator:"正在取关Steam鉴赏家",gettingCuratorId:"正在获取Steam鉴赏家Id",addingToWishlist:"正在添加游戏到Steam愿望单",removingFromWishlist:"正在从Steam愿望单移除游戏",followingGame:"正在关注Steam游戏",unfollowingGame:"正在取关Steam游戏",favoritingWorkshop:"正在收藏Steam创意工坊物品",unfavoritingWorkshop:"正在取消收藏Steam创意工坊物品",gettingWorkshopAppId:"正在获取Steam创意工坊物品Id",votingUpWorkshop:"正在点赞Steam创意工坊物品",gettingAnnouncementParams:"正在获取Steam通知信息",likingAnnouncement:"正在点赞Steam通知",changingArea:"正在更换Steam地区: %0...",notNeededChangeArea:"当前地区不需要更换",noAnotherArea:"请检测是否开启正确开启代理",gettingAreaInfo:"正在获取Steam地区信息...",changeAreaNotice:"疑似锁区游戏,尝试换区执行",steamFinishNotice:"Steam任务完成,尝试将购物车地区换回CN",gettingSubid:"正在获取游戏subid",addingFreeLicense:"正在入库",missParams:"缺少参数",gettingLicenses:"正在获取Licenses...",requestingPlayTestAccess:"正在请求访问权限",tryChangeAreaNotice:"此功能无法检测游戏是否限区,因此会尝试换区后再入库,换区失败也不影响后续入库",gettingUserLink:"正在获取Steam用户社区链接...",retry:"重试",initingASF:"正在初始化ASF...",servers:"服务器",joiningDiscordServer:"正在加入Discord服务器",leavingDiscordServer:"正在退出Discord服务器",gettingDiscordGuild:"正在获取Discord服务器Id",getDiscordAuthFailed:"获取Discord凭证失败,请检测Discord帐号是否已登录",discordImportantNotice:"重要提醒!!!",discordImportantNoticeText:"由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!",continue:"继续",skipDiscordTask:"跳过Discord任务",continueAndDontRemindAgain:"继续且不再提醒",users:"用户",loginIns:'请先登录Instagram',insBanned:"您的Instagram账户已被封禁",verifyingInsAuth:"正在验证Instagram凭证...",gettingInsUserId:"正在获取Instagram用户Id",followingIns:"正在关注Instagram用户",unfollowingIns:"正在取关Instagram用户",reddits:"社区/用户",loginReddit:'请先登录Reddit',changingRedditVersion:"正在切换Reddit为新版页面...",joiningReddit:"正在加入Reddit社区",leavingReddit:"正在退出Reddit社区",followingRedditUser:"正在关注Reddit用户",unfollowingRedditUser:"正在取关Reddit用户",channels:"频道",followingTwitchChannel:"正在关注Twitch频道",unfollowingTwitchChannel:"正在取关Twitch频道",gettingTwitchChannelId:"正在获取Twitch频道Id",checkingTwitchIntegrity:"正在检查Twitch完整性...",twitterUser:"推特用户",retweets:"转推",gettingTwitterUserId:"正在获取推特用户Id",followingTwitterUser:"正在关注推特用户",unfollowingTwitterUser:"正在取关推特用户",retweetting:"正在转推",unretweetting:"正在撤销转推",names:"组/社区/动态",loginVk:'请先登录Vk',gettingVkId:"正在获取Vk任务Id",joiningVkGroup:"正在加入Vk组",leavingVkGroup:"正在退出Vk组",joiningVkPublic:"正在加入Vk社区",leavingVkPublic:"正在退出Vk社区",sendingVkWall:"正在转发Vk动态",deletingVkWall:"正在撤销转发Vk动态",youtubeChannel:"YouTube频道",likes:"点赞",loginYtb:'请先登录YouTube',tryUpdateYtbAuth:'请尝试更新YouTube凭证',gettingYtbToken:"正在获取YouTube Token...",followingYtbChannel:"正在订阅YouTube频道",unfollowingYtbChannel:"正在退订YouTube频道",likingYtbVideo:"正在点赞YouTube视频",unlikingYtbVideo:"正在取消点赞YouTube视频",giveKeyNoticeBefore:"每次验证间隔15s",giveKeyNoticeAfter:'如果没有key, 请在https://givekey.ru/profile查看',noPoints:"点数不够,跳过抽奖",getNeedPointsFailed:"获取所需点数失败,跳过抽奖",joiningLottery:"正在加入抽奖",doingGleamTask:"正在做Gleam任务...",gettingGleamLink:"正在获取Gleam任务链接...",gleamTaskNotice:"如果此页面长时间未关闭,请完成任一任务后自行关闭!",verifiedGleamTasks:"已尝试验证所有任务,验证失败的任务请尝试手动验证或完成!",campaign:"检测到人机验证,请完成验证后重新验证任务!",gsNotice:'为避免得到"0000-0000-0000"key, 已自动屏蔽"Grab Key"按钮,获取key时请关闭脚本!',giveeClubVerifyNotice:"正在验证任务...",giveeClubVerifyFinished:"请等待验证完成后自行加入赠Key",doingKeyhubTask:"正在做Keyhub任务...",SweepWidgetNotice:"正在处理并验证任务,每次验证任务有1~3s间隔防止触发验证过快警告...",tasksNotCompleted:"任务未完成",confirmingTask:"正在跳过警告页面..."},en:{website:"Website",type:"Type",edit:"Edit",whiteList:"Whitelist",skipTask:"Skip undo task",whiteListOptions:"Whitelist options",changeWhiteListOption:"Whitelist option(%0)",whiteListNotFound:"Cannot find this whitelist: %0",changeWhiteListSuccess:"The whitelist is successfully modified, and the page refresh will take effect!",changeWebsiteOptions:"Website options",changeGlobalOptions:"Global options",ok:"OK",save:"Save",close:"Close",return:"Return",option:"Option",value:"Value",websiteOptions:"Current website settings",changeWebsiteOptionsSuccess:"The current website setting is changed successfully, and the page refresh will take effect!",changeGlobalOptionsSuccess:"The global setting is changed successfully, and the refresh will take effect!",needLogin:"Please log in first!",getTasksInfo:"Obtaining and processing task information...",gettingKey:"Getting Key...",verifyingTask:"Verifying task",notice:"Automatic task script notice",noKeysLeft:"There are no more keys left on this page. Do you want to close it?",giveawayEnded:"This event has ended, do you want to close it?",giveawayNotWork:"This activity is unavailable for some reasons (banned/ended/paused/not started...) (if it is a script misjudgment, please give us feedback in time), is it closed?",confirm:"Confirm",cancel:"Cancel",unKnown:"Unknown",unKnownTaskType:"Unrecognized task",doing:"Doing a task",allTasksComplete:"All tasks have been completed!",getTaskIdFailed:"Failed to obtain task Id!",initSuccess:"%0 was initialized successfully!",initFailed:"%0 initialization failed!",errorLink:"Link error: %0",needInit:"Please initialize first",verifyingAuth:"Verifying %0 token...",updatingAuth:"Update %0 token...",initing:"Initializing...",getFailed:"Failed to get %0!",checkLoginFailed:"Failed to detect login status!",checkLeftKeyFailed:"Failed to detect the remaining keys!",userId:"User Id",joiningGiveaway:"Joining giveaway",needJoinGiveaway:"Need to join the giveaway first",cannotUndo:"This website does not support canceling tasks",verifyAuth:"Verifying %0 token...",closePageNotice:"f this page does not close automatically, please close this page yourself.",errorReport:"A script error is detected, do you want to report the BUG?",visitingLink:"Visiting link: ",doTask:"DoTask",undoTask:"UndoTask",verifyTask:"Verify",getKey:"GetKey",selectAll:"SelectAll",selectNone:"SelectNone",invertSelect:"InvertSelect",doFreeTask:"FreeTask",doPointTask:"PointTask",skipTaskOption:"Skip task has been configured in the settings",other:"Other",globalOptions:"Global Options",checkLogin:"Login detection
    Need to log in to the website automatically log in, part of this website supports.",checkLeftKey:"Key remaining detection
    The end of the giveaway event prompts whether to close or not, part of this website supports.",twitterVerifyId:"Verify Twitter token by trying to follow the account.
    The default is the official Twitter account 783214.
    If you don't want to follow the official account, you can change it to your own account.",youtubeVerifyChannel:"Verify YouTube token by trying to subscribe to the channel.
    The default is the official YouTube channel UCrXUsMBcfTVqwAS7DKg9C0Q.
    If you don't want to follow the official channel, you can change it to your own channel.",autoUpdateSource:"The source to update
    github: Fast update.
    jsdelivr: Update is delayed.
    standby: Standby source.
    auto: Try to update using github, jsdelivr, standby sources in turn.",saveGlobalOptions:"SaveSettings",settingPage:"Setting Page",name:"Name",version:"Version",scriptManager:"Script Manager",script:"Script",environment:"Environment",os:"OS",browser:"Browser",getId:"Get %0 id",getTwitterUserId:"Get Twitter user id (Get id function is only available on the settings page).",getYoutubeChannelId:"Get Youtube channel id (Get id function is only available on the settings page).",showButton:"ShowButton",hideButton:"HideButton",showLog:"ShowLog",hideLog:"HideLog",defaultShowButton:"Default display button",defaultShowLog:"Display log by default",debug:"Output debug log, do not enable this option!",receivePreview:"Receive preview updates",position:"Component position",buttonSideX:"Horizontal positioning of the button area (real-time preview function is only available on the setting page).
    left: left | right: right",buttonSideY:"The button area is positioned in the vertical direction (real-time preview function is only available on the settings page).
    top: top | bottom: bottom",buttonDistance:"The distance between the button area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",showButtonSideX:"ShowButton horizontal positioning (real-time preview function is only available on the setting page).
    left: left | right: right",showButtonSideY:"ShowButton vertical positioning (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",showButtonDistance:"The distance between the ShowButton and the edge (real-time preview function is only available on the setting page).
    Format: X distance, Y distance",logSideX:"Horizontal positioning of the log area (real-time preview function is only available on the setting page).
    left: left | right: right",logSideY:"Vertical positioning of the log area (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",logDistance:"The distance between the log area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",hotKey:"Shortcut key",doTaskKey:"DoTask shortcut keys
    (real-time preview function is only available on the settings page).",undoTaskKey:"UndoTask shortcut keys
    (real-time preview function is only available on the settings page).",toggleLogKey:"ShowLog/HideLog shortcut keys
    (real-time preview function is only available on the settings page).",tasksHistory:"TasksHistory",clearHistory:"Clear history",clearHistoryFinished:"The mission history has been cleared!",deleteTask:"Delete task",lastChangeTime:"Last Change Time",clearTaskFinished:"Delete the following tasks completed!",clearTaskFailed:"Failed to delete the task, the task name was not found!",syncData:"DataSync",settingData:"Uploading data...",gettingData:"Getting data...",help:"Help",fileName:"Filename",upload2gist:"Sync to Gist",downloadFromGist:"Sync from Gist",saveAndTest:"Save configuration and test",testSuccess:"Test success!",testFailed:"Test failed!",saveAndTestNotice:"Please save the configuration and test first!",processingData:"Processing data...",updatingData:"Uploading data...",syncDataSuccess:"Synchronized data successfully!",syncDataFailed:"Failed to synchronize data, please check the error message on the console!",downloadingData:"Downloading data...",checkedNoData:"No remote data is detected, please confirm whether the configuration is correct!",savingData:"Saving data...",syncHistory:"Synchronize tasks history",checkUpdateFailed:"Check update failed",newVersionNotice:'Checked a new version V%0, click to update',language:"Language
    Currently only supports zh: Chinese, en: English",gistOptions:"Gist Settings",swalNotice:"It is detected that you are installing the V4 version script for the first time, please go to read the READ ME FIRST content before use!",echoNotice:'It is detected that you are installing the V4 version script for the first time, please click here to read the READ ME FIRST content before use!',noticeLink:"https://auto-task-doc.js.org/en/guide/#read-me-first",toGithub:"Feedback(Github)",toKeylol:"Feedback(Keylol)",copySuccess:"The error message has been copied to the clipboard. Do you want to go to the Keylol forum to give feedback?",copyFailed:"Please copy the error information below and report back to the Keylol forum!",updateText:"Updates in version %0:",Active:"Active",Ended:"Ended",Banned:"Banned",Paused:"Paused",notStart:"notStart",noRemoteData:"No data remotely",errorRemoteDataFormat:"Remote data has wrong format",updateHistory:'Click here to view the historical update record.',AsfEnabled:'Use ASF to do Steam related tasks (requires ASFEnhance plugin)',AsfIpcUrl:"ASF IPC URL",AsfIpcPassword:"ASF IPC Password",groups:"Group",officialGroups:"Official Group",wishlists:"Wishlist",follows:"Follow Game",forums:"Forum",workshops:"Favorite Workshop",curators:"Curator",workshopVotes:"Voteup Workshop",announcements:"Announcement",steamCommunity:"Steam Community",steamStore:"Steam Store",licenses:"Add License",playtests:"Playtest Access",needLoginSteamStore:'Please log in to the Steam Store',needLoginSteamCommunity:'Please log in to the Steam Community',joiningSteamGroup:"Joining Steam Group",leavingSteamGroup:"Leaving Steam Group",gettingSteamGroupId:"Getting Steam Group Id",joiningSteamOfficialGroup:"Joining Steam Official Group",leavingSteamOfficialGroup:"Leaving Steam Official Group",gettingSteamOfficialGroupId:"Getting Steam Official Group Id",subscribingForum:"Subscribing the Steam Forum",unsubscribingForum:"Unsubscribing the Steam Forum",gettingForumId:"Getting Steam Forum Id",followingCurator:"Following Steam Curator",unfollowingCurator:"Unfollowing Steam Curator",gettingCuratorId:"Getting Steam Curator Id",addingToWishlist:"Adding the game to the Steam wishlist",removingFromWishlist:"Removing the game from the Steam wishlist",followingGame:"Following Steam games",unfollowingGame:"Unfollowing Steam games",favoritingWorkshop:"Favouring Steam Workshop Items",unfavoritingWorkshop:"Unfavoriting Steam Workshop Items",gettingWorkshopAppId:"Getting Steam Workshop Item Id",votingUpWorkshop:"Liking Steam workshop items",gettingAnnouncementParams:"Getting Steam announcement information",likingAnnouncement:"Liking Steam announcement",changingArea:"Changing Steam area: %0...",notNeededChangeArea:"The current area does not need to be changed",noAnotherArea:"Please check whether the proxy is turned on correctly",gettingAreaInfo:"Getting Steam area information...",changeAreaNotice:"Suspected of a locked zone game, try to change the zone to execute",steamFinishNotice:"Steam task completed, try to change the shopping cart area back to CN",gettingSubid:"Getting subid",addingFreeLicense:"Adding free license",missParams:"Missing parameters",gettingLicenses:"Getting licenses...",requestingPlayTestAccess:"Requesting play test access",tryChangeAreaNotice:"This function cannot detect whether the game is limited, so it will try to change the area before entering the library. Failure to change the area will not affect the subsequent storage.",versionNotMatched:"The script manager version is too low, requiring TamperMonkey >= 5.2.0 or TamperMonkey Beta >= 5.2.6196",gettingUserLink:"Getting steam user community link...",retry:"Retry",initingASF:"Initing ASF...",servers:"Server",joiningDiscordServer:"Joining Discord Server",leavingDiscordServer:"Leaving Discord Server",gettingDiscordGuild:"Getting Discord server Id",getDiscordAuthFailed:"Failed to get Discord token, please check whether the Discord account is logged in",discordImportantNotice:"Important Reminder! ! !",discordImportantNoticeText:"Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !",continue:"Continue",skipDiscordTask:"Skip",continueAndDontRemindAgain:"Continue without Reminders",users:"User",loginIns:'Please log in to Instagram',insBanned:"Your Instagram account has been banned",verifyingInsAuth:"Verifying Instagram token...",gettingInsUserId:"Getting Instagram user Id",followingIns:"Following Instagram user",unfollowingIns:"Unfollowing Instagram user",reddits:"Reddit/User",loginReddit:'Please log in to Reddit',changingRedditVersion:"Switching Reddit to a new version page...",joiningReddit:"Joining the Reddit",leavingReddit:"Leaving the Reddit",followingRedditUser:"Following Reddit User",unfollowingRedditUser:"Unfollowing Reddit User",channels:"Channel",followingTwitchChannel:"Following Twitch Channel",unfollowingTwitchChannel:"Unfollowing Twitch Channel",gettingTwitchChannelId:"Getting Twitch Channel Id",checkingTwitchIntegrity:"Checking Twitch integrity...",twitterUser:"Twitter User",retweets:"Retweet",gettingTwitterUserId:"Getting Twitter User Id",followingTwitterUser:"Following Twitter User",unfollowingTwitterUser:"Unfollowing Twitter User",retweetting:"Retweetting",unretweetting:"Unretweetting",names:"Group/Public/Wall",loginVk:'Please log in to Vk',gettingVkId:"Getting Vk task Id",joiningVkGroup:"Joining Vk Group",leavingVkGroup:"Leaving Vk Group",joiningVkPublic:"Joining Vk Public",leavingVkPublic:"Leaving Vk Public",sendingVkWall:"Sending Vk Wall",deletingVkWall:"Deleting Vk Wall",youtubeChannel:"YouTube Channel",likes:"Like",loginYtb:'Please log in to YouTube',tryUpdateYtbAuth:'Please try to update YouTube token',gettingYtbToken:"Getting YouTube Token...",followingYtbChannel:"Subscribing to YouTube channel",unfollowingYtbChannel:"Unsubscribing to YouTube channel",likingYtbVideo:"Liking YouTube video",unlikingYtbVideo:"Unliking YouTube video",giveKeyNoticeBefore:"Each verification interval is 15s",giveKeyNoticeAfter:'If there is no key, please check at https://givekey.ru/profile',noPoints:"Not enough points, skip the lottery",getNeedPointsFailed:"ailed to obtain the required points, skip the lottery",joiningLottery:"Joining the lottery",doingGleamTask:"Doing Gleam Task...",gettingGleamLink:"Getting Gleam task link...",gleamTaskNotice:"If this page has not been closed for a long time, please close it yourself after completing any task!",verifiedGleamTasks:"Attempted to verify all tasks. If the verification fails, please try to verify manually or complete it!",campaign:"ReCAPTCHA detected, please complete it and re-verify the tasks!",gsNotice:'In order to avoid getting the "0000-0000-0000" key, the "Grab Key" button has been hidden, please close the script when obtaining the key!',giveeClubVerifyNotice:"Verifying task...",giveeClubVerifyFinished:"Wait for the verification to complete and join it by yourself",doingKeyhubTask:"Doing Keyhub Task...",SweepWidgetNotice:"The task is being processed and verified. There is an interval of 1~3s for each verification task to prevent the triggering of too fast verification warning...",tasksNotCompleted:"Tasks Not Completed",confirmingTask:"Confirming task..."}},language=["zh","en"].includes(globalOptions.other.language)?globalOptions.other.language:"en",i18n=(key,...argvs)=>languages[language]?.[key]?languages[language][key].replace(/%([\d]+)/g,(match,index)=>argvs[parseInt(index,10)]):key;function throwError(error,name){window.TRACE&&console.trace("%cAuto-Task[Debug]:","color:blue"),external_Swal_default().fire({title:i18n("errorReport"),icon:"error",showCancelButton:!0,confirmButtonText:i18n("toGithub"),showDenyButton:!0,denyButtonText:i18n("toKeylol"),cancelButtonText:i18n("close")}).then(({isDenied,isConfirmed})=>{isConfirmed?window.open(`https://github.com/HCLonely/auto-task-v4/issues/new?title=${encodeURIComponent("[BUG] 脚本报错: "+name)}&labels=bug&template=bug_report.yml&website=${encodeURIComponent(window.location.href)}&browser=${encodeURIComponent(JSON.stringify((0,javascript_utils_umd_min.ua)(),null,4))}&manager=${encodeURIComponent(GM_info.scriptHandler+" "+GM_info.version)}&user-script=${encodeURIComponent(GM_info.script.version)}&logs=${encodeURIComponent(error.stack||"null")}&run-logs=`+encodeURIComponent($.makeArray($("#auto-task-info>li")).map(element=>element.innerText).join("\n")),"_blank"):isDenied&&(isConfirmed=`错误链接: [url=${window.location.href}]${window.location.href}[/url] + `;for(let[type,data1]of Object.entries(globalOptions))for(var[option,data2]of Object.entries(data1))if(["other","position","hotKey","ASF"].includes(type))"boolean"==typeof data2?globalOptionsForm+=`${0===Object.keys(data1).indexOf(option)?``:""}`:globalOptionsForm+=`${0===Object.keys(data1).indexOf(option)?``:""}`;else for(var[socialType,data3]of Object.entries(data2))globalOptionsForm+=`${0===Object.keys(data1).indexOf(option)?``:""}`;globalOptionsForm+="
    ${i18n("type")}${i18n("option")}${i18n("value")}
    ${i18n(type)}${i18n(option)}
    ${i18n(type)}${i18n(option)}
    ${i18n(type)}${option}.${i18n(socialType)}
    ","swal"===showType?external_Swal_default().fire({title:i18n("globalOptions"),html:globalOptionsForm,showConfirmButton:!0,confirmButtonText:i18n("save"),showCancelButton:!0,cancelButtonText:i18n("close")}).then(({isConfirmed})=>{isConfirmed&&saveData()}):$("body").append(`

    ${i18n("globalOptions")}

    `+globalOptionsForm)}catch(error){throwError(error,"changeGlobalOptions")}},languages={zh:{website:"网站",type:"类型",edit:"编辑",whiteList:"白名单",skipTask:"跳过撤销任务",whiteListOptions:"白名单设置",changeWhiteListOption:"设置白名单(%0)",whiteListNotFound:"找不到此项白名单: %0",changeWhiteListSuccess:"白名单修改成功,刷新生效!",changeWebsiteOptions:"网站设置",changeGlobalOptions:"全局设置",ok:"是",save:"保存",close:"关闭",return:"返回",option:"选项",value:"值",websiteOptions:"当前网站设置",changeWebsiteOptionsSuccess:"更改当前网站设置成功,刷新生效!",changeGlobalOptionsSuccess:"更改全局设置成功,刷新生效!",needLogin:"请先登录!",getTasksInfo:"正在获取并处理任务信息...",gettingKey:"正在获取Key...",verifyingTask:"正在验证任务",notice:"自动任务脚本提醒",noKeysLeft:"此页面已经没有剩余key了,是否关闭?",giveawayEnded:"此活动已结束,是否关闭?",giveawayNotWork:"此活动因某些原因(已结束/暂停/未开始...)不可用(如果是脚本误判请及时反馈),是否关闭?",confirm:"确定",cancel:"取消",unKnown:"未知",unKnownTaskType:"未识别的任务",doing:"正在做任务",allTasksComplete:"所有任务已完成!",getTaskIdFailed:"获取任务Id失败!",initSuccess:"%0 初始化成功!",initFailed:"%0 初始化失败!",errorLink:"链接错误: %0",needInit:"请先初始化",verifyingAuth:"正在验证%0凭证...",updatingAuth:"正在更新%0凭证...",refreshingToken:"正在刷新%0凭证...",settingToken:"正在设置%0凭证...",initing:"正在初始化...",getFailed:"获取%0失败!",checkLoginFailed:"检测登录状态失败!",checkLeftKeyFailed:"检测剩余Key失败!",userId:"用户Id",joiningGiveaway:"正在加入赠Key",needJoinGiveaway:"需要先加入赠Key",cannotUndo:"此网站不支持取消任务",verifyAuth:"正在验证 %0 凭证...",closePageNotice:"如果此页面没有自动关闭,请自行关闭本页面。",errorReport:"检测到脚本报错,是否前往反馈BUG?",visitingLink:"正在访问链接: ",doTask:"做任务",undoTask:"撤销任务",verifyTask:"验证任务",getKey:"获取Key",selectAll:"全选",selectNone:"全不选",invertSelect:"反选",doFreeTask:"加入免费赠品",doPointTask:"加入点数赠品",skipTaskOption:"设置中已配置跳过任务",other:"其他",globalOptions:"全局设置",checkLogin:"登录检测
    需要登录的网站自动登录,部分网站支持",checkLeftKey:"剩余Key检测
    赠Key活动结束提示是否关闭,部分网站支持",twitterVerifyId:"通过尝试关注该账号验证Twitter凭证
    默认为Twitter官方帐号 783214
    不想关注官方账号可以改为自己的帐号",youtubeVerifyChannel:"通过尝试订阅该频道验证YouTube凭证
    默认为YouTube官方频道 UCrXUsMBcfTVqwAS7DKg9C0Q
    不想关注官方频道可以改为自己的频道",autoUpdateSource:"更新源
    github: 需代理,实时更新
    jsdelivr: 可不用代理,更新有延迟
    standby: 备用
    auto: 依次使用github, jsdelivr, standby源进行尝试更新",saveGlobalOptions:"保存全局设置",settingPage:"设置页面",name:"名称",version:"版本",scriptManager:"脚本管理器",script:"脚本",environment:"环境",os:"系统",browser:"浏览器",getId:"获取 %0 id",getTwitterUserId:"获取Twitter用户id(获取id功能仅在设置页面可用)",getYoutubeChannelId:"获取Youtube频道id(获取id功能仅在设置页面可用)",showButton:"显示按钮",hideButton:"隐藏按钮",showLog:"显示日志",hideLog:"隐藏日志",defaultShowButton:"默认显示按钮",defaultShowLog:"默认显示日志",debug:"输出调试日志,不要开启此选项!",receivePreview:"接收预览版更新",position:"组件位置",buttonSideX:"按钮区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",buttonSideY:"按钮区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",buttonDistance:"按钮区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",showButtonSideX:"显示按钮水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",showButtonSideY:"显示按钮垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",showButtonDistance:"显示按钮距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",logSideX:"日志区域水平方向定位(实时预览功能仅在设置页面可用)
    left: 靠左 | right: 靠右",logSideY:"日志区域垂直方向定位(实时预览功能仅在设置页面可用)
    top: 靠上 | bottom: 靠下",logDistance:"日志区域距边缘的距离(实时预览功能仅在设置页面可用)
    格式: X距离,Y距离",hotKey:"快捷键",doTaskKey:"做任务快捷键
    (实时预览功能仅在设置页面可用)",undoTaskKey:"撤销任务快捷键
    (实时预览功能仅在设置页面可用)",toggleLogKey:"显示/隐藏日志快捷键
    (实时预览功能仅在设置页面可用)",tasksHistory:"任务历史",clearHistory:"清空历史",clearHistoryFinished:"已清空任务历史!",deleteTask:"删除任务",lastChangeTime:"最后一次修改时间",clearTaskFinished:"删除以下任务完成!",clearTaskFailed:"删除任务失败,没有找到任务名!",syncData:"数据同步",settingData:"正在上传数据...",gettingData:"正在获取数据...",help:"帮助",fileName:"文件名",upload2gist:"同步到Gist",downloadFromGist:"从Gist同步",saveAndTest:"保存配置并测试",testSuccess:"测试成功!",testFailed:"测试失败!",saveAndTestNotice:"请先保存配置并测试!",processingData:"正在处理数据...",updatingData:"正在上传数据...",syncDataSuccess:"同步数据成功!",syncDataFailed:"同步数据失败,请在控制台查看错误信息!",downloadingData:"正在下载数据...",checkedNoData:"没有检测到远程数据,请确认配置是否正确!",savingData:"正在保存数据...",syncHistory:"同步任务历史",checkUpdateFailed:"检测更新失败",newVersionNotice:'检测到新版本V%0, 点此更新',language:"语言
    目前仅支持zh: 中文, en: 英文",gistOptions:"Gist 设置",swalNotice:"检测到您第一次安装V4版本脚本,请前往阅读用前必读内容!",echoNotice:'检测到您第一次安装V4版本脚本,请点此前往阅读用前必读内容!',noticeLink:"https://auto-task-doc.js.org/guide/#用前必读",toGithub:"前往Github反馈",toKeylol:"前往其乐论坛反馈",copySuccess:"错误信息已复制到剪切板,是否前往其乐论坛反馈?",copyFailed:"请复制下方错误信息后前往Keylol论坛反馈!",updateText:"%0 版本更新内容:",Active:"进行中",Ended:"已结束",Banned:"已封禁",Paused:"已暂停",notStart:"未开始",noRemoteData:"检测到远程无数据",errorRemoteDataFormat:"远程数据格式错误",updateHistory:'历史更新记录点此查看',AsfEnabled:'使用ASF做Steam相关任务(需ASFEnhance插件)',AsfIpcUrl:"ASF IPC 地址",AsfIpcPassword:"ASF IPC 密码",versionNotMatched:"脚本管理器版本过低,需TamperMonkey >= 5.2.0或TamperMonkey Beta >= 5.2.6196",groups:"组",officialGroups:"官方组",wishlists:"愿望单",follows:"游戏关注",forums:"论坛",workshops:"创意工坊收藏",curators:"鉴赏家",workshopVotes:"创意工坊点赞",announcements:"社区通知",steamCommunity:"Steam社区",steamStore:"Steam商店",licenses:"入库免费游戏",playtests:"请求访问权限",needLoginSteamStore:'请先登录Steam商店',needLoginSteamCommunity:'请先登录Steam社区',joiningSteamGroup:"正在加入Steam组",leavingSteamGroup:"正在退出Steam组",gettingSteamGroupId:"正在获取Steam组Id",joiningSteamOfficialGroup:"正在加入Steam官方组",leavingSteamOfficialGroup:"正在退出Steam官方组",gettingSteamOfficialGroupId:"正在获取Steam官方组Id",subscribingForum:"正在订阅Steam论坛",unsubscribingForum:"正在取消订阅Steam论坛",gettingForumId:"正在获取Steam论坛Id",followingCurator:"正在关注Steam鉴赏家",unfollowingCurator:"正在取关Steam鉴赏家",gettingCuratorId:"正在获取Steam鉴赏家Id",addingToWishlist:"正在添加游戏到Steam愿望单",removingFromWishlist:"正在从Steam愿望单移除游戏",followingGame:"正在关注Steam游戏",unfollowingGame:"正在取关Steam游戏",favoritingWorkshop:"正在收藏Steam创意工坊物品",unfavoritingWorkshop:"正在取消收藏Steam创意工坊物品",gettingWorkshopAppId:"正在获取Steam创意工坊物品Id",votingUpWorkshop:"正在点赞Steam创意工坊物品",gettingAnnouncementParams:"正在获取Steam通知信息",likingAnnouncement:"正在点赞Steam通知",changingArea:"正在更换Steam地区: %0...",notNeededChangeArea:"当前地区不需要更换",noAnotherArea:"请检测是否开启正确开启代理",gettingAreaInfo:"正在获取Steam地区信息...",changeAreaNotice:"疑似锁区游戏,尝试换区执行",steamFinishNotice:"Steam任务完成,尝试将购物车地区换回CN",gettingSubid:"正在获取游戏subid",addingFreeLicense:"正在入库",missParams:"缺少参数",gettingLicenses:"正在获取Licenses...",requestingPlayTestAccess:"正在请求访问权限",tryChangeAreaNotice:"此功能无法检测游戏是否限区,因此会尝试换区后再入库,换区失败也不影响后续入库",gettingUserLink:"正在获取Steam用户社区链接...",retry:"重试",initingASF:"正在初始化ASF...",servers:"服务器",joiningDiscordServer:"正在加入Discord服务器",leavingDiscordServer:"正在退出Discord服务器",gettingDiscordGuild:"正在获取Discord服务器Id",getDiscordAuthFailed:"获取Discord凭证失败,请检测Discord帐号是否已登录",discordImportantNotice:"重要提醒!!!",discordImportantNoticeText:"由于Discord网站后台更新,目前使用此脚本加组后可能会导致Discord帐号被强制退出,且需要两步验证才能正常登录,请谨慎使用!!!",continue:"继续",skipDiscordTask:"跳过Discord任务",continueAndDontRemindAgain:"继续且不再提醒",users:"用户",loginIns:'请先登录Instagram',insBanned:"您的Instagram账户已被封禁",verifyingInsAuth:"正在验证Instagram凭证...",gettingInsUserId:"正在获取Instagram用户Id",followingIns:"正在关注Instagram用户",unfollowingIns:"正在取关Instagram用户",reddits:"社区/用户",loginReddit:'请先登录Reddit',changingRedditVersion:"正在切换Reddit为新版页面...",joiningReddit:"正在加入Reddit社区",leavingReddit:"正在退出Reddit社区",followingRedditUser:"正在关注Reddit用户",unfollowingRedditUser:"正在取关Reddit用户",channels:"频道",followingTwitchChannel:"正在关注Twitch频道",unfollowingTwitchChannel:"正在取关Twitch频道",gettingTwitchChannelId:"正在获取Twitch频道Id",checkingTwitchIntegrity:"正在检查Twitch完整性...",twitterUser:"推特用户",retweets:"转推",gettingTwitterUserId:"正在获取推特用户Id",followingTwitterUser:"正在关注推特用户",unfollowingTwitterUser:"正在取关推特用户",retweetting:"正在转推",unretweetting:"正在撤销转推",names:"组/社区/动态",loginVk:'请先登录Vk',gettingVkId:"正在获取Vk任务Id",joiningVkGroup:"正在加入Vk组",leavingVkGroup:"正在退出Vk组",joiningVkPublic:"正在加入Vk社区",leavingVkPublic:"正在退出Vk社区",sendingVkWall:"正在转发Vk动态",deletingVkWall:"正在撤销转发Vk动态",youtubeChannel:"YouTube频道",likes:"点赞",loginYtb:'请先登录YouTube',tryUpdateYtbAuth:'请尝试更新YouTube凭证',gettingYtbToken:"正在获取YouTube Token...",followingYtbChannel:"正在订阅YouTube频道",unfollowingYtbChannel:"正在退订YouTube频道",likingYtbVideo:"正在点赞YouTube视频",unlikingYtbVideo:"正在取消点赞YouTube视频",giveKeyNoticeBefore:"每次验证间隔15s",giveKeyNoticeAfter:'如果没有key, 请在https://givekey.ru/profile查看',noPoints:"点数不够,跳过抽奖",getNeedPointsFailed:"获取所需点数失败,跳过抽奖",joiningLottery:"正在加入抽奖",doingGleamTask:"正在做Gleam任务...",gettingGleamLink:"正在获取Gleam任务链接...",gleamTaskNotice:"如果此页面长时间未关闭,请完成任一任务后自行关闭!",verifiedGleamTasks:"已尝试验证所有任务,验证失败的任务请尝试手动验证或完成!",campaign:"检测到人机验证,请完成验证后重新验证任务!",gsNotice:'为避免得到"0000-0000-0000"key, 已自动屏蔽"Grab Key"按钮,获取key时请关闭脚本!',giveeClubVerifyNotice:"正在验证任务...",giveeClubVerifyFinished:"请等待验证完成后自行加入赠Key",doingKeyhubTask:"正在做Keyhub任务...",SweepWidgetNotice:"正在处理并验证任务,每次验证任务有1~3s间隔防止触发验证过快警告...",tasksNotCompleted:"任务未完成",confirmingTask:"正在跳过警告页面..."},en:{website:"Website",type:"Type",edit:"Edit",whiteList:"Whitelist",skipTask:"Skip undo task",whiteListOptions:"Whitelist options",changeWhiteListOption:"Whitelist option(%0)",whiteListNotFound:"Cannot find this whitelist: %0",changeWhiteListSuccess:"The whitelist is successfully modified, and the page refresh will take effect!",changeWebsiteOptions:"Website options",changeGlobalOptions:"Global options",ok:"OK",save:"Save",close:"Close",return:"Return",option:"Option",value:"Value",websiteOptions:"Current website settings",changeWebsiteOptionsSuccess:"The current website setting is changed successfully, and the page refresh will take effect!",changeGlobalOptionsSuccess:"The global setting is changed successfully, and the refresh will take effect!",needLogin:"Please log in first!",getTasksInfo:"Obtaining and processing task information...",gettingKey:"Getting Key...",verifyingTask:"Verifying task",notice:"Automatic task script notice",noKeysLeft:"There are no more keys left on this page. Do you want to close it?",giveawayEnded:"This event has ended, do you want to close it?",giveawayNotWork:"This activity is unavailable for some reasons (banned/ended/paused/not started...) (if it is a script misjudgment, please give us feedback in time), is it closed?",confirm:"Confirm",cancel:"Cancel",unKnown:"Unknown",unKnownTaskType:"Unrecognized task",doing:"Doing a task",allTasksComplete:"All tasks have been completed!",getTaskIdFailed:"Failed to obtain task Id!",initSuccess:"%0 was initialized successfully!",initFailed:"%0 initialization failed!",errorLink:"Link error: %0",needInit:"Please initialize first",verifyingAuth:"Verifying %0 token...",updatingAuth:"Update %0 token...",initing:"Initializing...",getFailed:"Failed to get %0!",checkLoginFailed:"Failed to detect login status!",checkLeftKeyFailed:"Failed to detect the remaining keys!",userId:"User Id",joiningGiveaway:"Joining giveaway",needJoinGiveaway:"Need to join the giveaway first",cannotUndo:"This website does not support canceling tasks",verifyAuth:"Verifying %0 token...",closePageNotice:"f this page does not close automatically, please close this page yourself.",errorReport:"A script error is detected, do you want to report the BUG?",visitingLink:"Visiting link: ",doTask:"DoTask",undoTask:"UndoTask",verifyTask:"Verify",getKey:"GetKey",selectAll:"SelectAll",selectNone:"SelectNone",invertSelect:"InvertSelect",doFreeTask:"FreeTask",doPointTask:"PointTask",skipTaskOption:"Skip task has been configured in the settings",other:"Other",globalOptions:"Global Options",checkLogin:"Login detection
    Need to log in to the website automatically log in, part of this website supports.",checkLeftKey:"Key remaining detection
    The end of the giveaway event prompts whether to close or not, part of this website supports.",twitterVerifyId:"Verify Twitter token by trying to follow the account.
    The default is the official Twitter account 783214.
    If you don't want to follow the official account, you can change it to your own account.",youtubeVerifyChannel:"Verify YouTube token by trying to subscribe to the channel.
    The default is the official YouTube channel UCrXUsMBcfTVqwAS7DKg9C0Q.
    If you don't want to follow the official channel, you can change it to your own channel.",autoUpdateSource:"The source to update
    github: Fast update.
    jsdelivr: Update is delayed.
    standby: Standby source.
    auto: Try to update using github, jsdelivr, standby sources in turn.",saveGlobalOptions:"SaveSettings",settingPage:"Setting Page",name:"Name",version:"Version",scriptManager:"Script Manager",script:"Script",environment:"Environment",os:"OS",browser:"Browser",getId:"Get %0 id",getTwitterUserId:"Get Twitter user id (Get id function is only available on the settings page).",getYoutubeChannelId:"Get Youtube channel id (Get id function is only available on the settings page).",showButton:"ShowButton",hideButton:"HideButton",showLog:"ShowLog",hideLog:"HideLog",defaultShowButton:"Default display button",defaultShowLog:"Display log by default",debug:"Output debug log, do not enable this option!",receivePreview:"Receive preview updates",position:"Component position",buttonSideX:"Horizontal positioning of the button area (real-time preview function is only available on the setting page).
    left: left | right: right",buttonSideY:"The button area is positioned in the vertical direction (real-time preview function is only available on the settings page).
    top: top | bottom: bottom",buttonDistance:"The distance between the button area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",showButtonSideX:"ShowButton horizontal positioning (real-time preview function is only available on the setting page).
    left: left | right: right",showButtonSideY:"ShowButton vertical positioning (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",showButtonDistance:"The distance between the ShowButton and the edge (real-time preview function is only available on the setting page).
    Format: X distance, Y distance",logSideX:"Horizontal positioning of the log area (real-time preview function is only available on the setting page).
    left: left | right: right",logSideY:"Vertical positioning of the log area (real-time preview function is only available on the setting page).
    top: top | bottom: bottom",logDistance:"The distance between the log area and the edge (the real-time preview function is only available on the setting page).
    Format: X distance, Y distance",hotKey:"Shortcut key",doTaskKey:"DoTask shortcut keys
    (real-time preview function is only available on the settings page).",undoTaskKey:"UndoTask shortcut keys
    (real-time preview function is only available on the settings page).",toggleLogKey:"ShowLog/HideLog shortcut keys
    (real-time preview function is only available on the settings page).",tasksHistory:"TasksHistory",clearHistory:"Clear history",clearHistoryFinished:"The mission history has been cleared!",deleteTask:"Delete task",lastChangeTime:"Last Change Time",clearTaskFinished:"Delete the following tasks completed!",clearTaskFailed:"Failed to delete the task, the task name was not found!",syncData:"DataSync",settingData:"Uploading data...",gettingData:"Getting data...",help:"Help",fileName:"Filename",upload2gist:"Sync to Gist",downloadFromGist:"Sync from Gist",saveAndTest:"Save configuration and test",testSuccess:"Test success!",testFailed:"Test failed!",saveAndTestNotice:"Please save the configuration and test first!",processingData:"Processing data...",updatingData:"Uploading data...",syncDataSuccess:"Synchronized data successfully!",syncDataFailed:"Failed to synchronize data, please check the error message on the console!",downloadingData:"Downloading data...",checkedNoData:"No remote data is detected, please confirm whether the configuration is correct!",savingData:"Saving data...",syncHistory:"Synchronize tasks history",checkUpdateFailed:"Check update failed",newVersionNotice:'Checked a new version V%0, click to update',language:"Language
    Currently only supports zh: Chinese, en: English",gistOptions:"Gist Settings",swalNotice:"It is detected that you are installing the V4 version script for the first time, please go to read the READ ME FIRST content before use!",echoNotice:'It is detected that you are installing the V4 version script for the first time, please click here to read the READ ME FIRST content before use!',noticeLink:"https://auto-task-doc.js.org/en/guide/#read-me-first",toGithub:"Feedback(Github)",toKeylol:"Feedback(Keylol)",copySuccess:"The error message has been copied to the clipboard. Do you want to go to the Keylol forum to give feedback?",copyFailed:"Please copy the error information below and report back to the Keylol forum!",updateText:"Updates in version %0:",Active:"Active",Ended:"Ended",Banned:"Banned",Paused:"Paused",notStart:"notStart",noRemoteData:"No data remotely",errorRemoteDataFormat:"Remote data has wrong format",updateHistory:'Click here to view the historical update record.',AsfEnabled:'Use ASF to do Steam related tasks (requires ASFEnhance plugin)',AsfIpcUrl:"ASF IPC URL",AsfIpcPassword:"ASF IPC Password",groups:"Group",officialGroups:"Official Group",wishlists:"Wishlist",follows:"Follow Game",forums:"Forum",workshops:"Favorite Workshop",curators:"Curator",workshopVotes:"Voteup Workshop",announcements:"Announcement",steamCommunity:"Steam Community",steamStore:"Steam Store",licenses:"Add License",playtests:"Playtest Access",needLoginSteamStore:'Please log in to the Steam Store',needLoginSteamCommunity:'Please log in to the Steam Community',joiningSteamGroup:"Joining Steam Group",leavingSteamGroup:"Leaving Steam Group",gettingSteamGroupId:"Getting Steam Group Id",joiningSteamOfficialGroup:"Joining Steam Official Group",leavingSteamOfficialGroup:"Leaving Steam Official Group",gettingSteamOfficialGroupId:"Getting Steam Official Group Id",subscribingForum:"Subscribing the Steam Forum",unsubscribingForum:"Unsubscribing the Steam Forum",gettingForumId:"Getting Steam Forum Id",followingCurator:"Following Steam Curator",unfollowingCurator:"Unfollowing Steam Curator",gettingCuratorId:"Getting Steam Curator Id",addingToWishlist:"Adding the game to the Steam wishlist",removingFromWishlist:"Removing the game from the Steam wishlist",followingGame:"Following Steam games",unfollowingGame:"Unfollowing Steam games",favoritingWorkshop:"Favouring Steam Workshop Items",unfavoritingWorkshop:"Unfavoriting Steam Workshop Items",gettingWorkshopAppId:"Getting Steam Workshop Item Id",votingUpWorkshop:"Liking Steam workshop items",gettingAnnouncementParams:"Getting Steam announcement information",likingAnnouncement:"Liking Steam announcement",changingArea:"Changing Steam area: %0...",notNeededChangeArea:"The current area does not need to be changed",noAnotherArea:"Please check whether the proxy is turned on correctly",gettingAreaInfo:"Getting Steam area information...",changeAreaNotice:"Suspected of a locked zone game, try to change the zone to execute",steamFinishNotice:"Steam task completed, try to change the shopping cart area back to CN",gettingSubid:"Getting subid",addingFreeLicense:"Adding free license",missParams:"Missing parameters",gettingLicenses:"Getting licenses...",requestingPlayTestAccess:"Requesting play test access",tryChangeAreaNotice:"This function cannot detect whether the game is limited, so it will try to change the area before entering the library. Failure to change the area will not affect the subsequent storage.",versionNotMatched:"The script manager version is too low, requiring TamperMonkey >= 5.2.0 or TamperMonkey Beta >= 5.2.6196",gettingUserLink:"Getting steam user community link...",retry:"Retry",initingASF:"Initing ASF...",servers:"Server",joiningDiscordServer:"Joining Discord Server",leavingDiscordServer:"Leaving Discord Server",gettingDiscordGuild:"Getting Discord server Id",getDiscordAuthFailed:"Failed to get Discord token, please check whether the Discord account is logged in",discordImportantNotice:"Important Reminder! ! !",discordImportantNoticeText:"Due to the background update of the Discord website, currently using this script to join a group may cause the Discord account to be forcibly logged out, and two-step verification is required to log in normally, please use it with caution! ! !",continue:"Continue",skipDiscordTask:"Skip",continueAndDontRemindAgain:"Continue without Reminders",users:"User",loginIns:'Please log in to Instagram',insBanned:"Your Instagram account has been banned",verifyingInsAuth:"Verifying Instagram token...",gettingInsUserId:"Getting Instagram user Id",followingIns:"Following Instagram user",unfollowingIns:"Unfollowing Instagram user",reddits:"Reddit/User",loginReddit:'Please log in to Reddit',changingRedditVersion:"Switching Reddit to a new version page...",joiningReddit:"Joining the Reddit",leavingReddit:"Leaving the Reddit",followingRedditUser:"Following Reddit User",unfollowingRedditUser:"Unfollowing Reddit User",channels:"Channel",followingTwitchChannel:"Following Twitch Channel",unfollowingTwitchChannel:"Unfollowing Twitch Channel",gettingTwitchChannelId:"Getting Twitch Channel Id",checkingTwitchIntegrity:"Checking Twitch integrity...",twitterUser:"Twitter User",retweets:"Retweet",gettingTwitterUserId:"Getting Twitter User Id",followingTwitterUser:"Following Twitter User",unfollowingTwitterUser:"Unfollowing Twitter User",retweetting:"Retweetting",unretweetting:"Unretweetting",names:"Group/Public/Wall",loginVk:'Please log in to Vk',gettingVkId:"Getting Vk task Id",joiningVkGroup:"Joining Vk Group",leavingVkGroup:"Leaving Vk Group",joiningVkPublic:"Joining Vk Public",leavingVkPublic:"Leaving Vk Public",sendingVkWall:"Sending Vk Wall",deletingVkWall:"Deleting Vk Wall",youtubeChannel:"YouTube Channel",likes:"Like",loginYtb:'Please log in to YouTube',tryUpdateYtbAuth:'Please try to update YouTube token',gettingYtbToken:"Getting YouTube Token...",followingYtbChannel:"Subscribing to YouTube channel",unfollowingYtbChannel:"Unsubscribing to YouTube channel",likingYtbVideo:"Liking YouTube video",unlikingYtbVideo:"Unliking YouTube video",giveKeyNoticeBefore:"Each verification interval is 15s",giveKeyNoticeAfter:'If there is no key, please check at https://givekey.ru/profile',noPoints:"Not enough points, skip the lottery",getNeedPointsFailed:"ailed to obtain the required points, skip the lottery",joiningLottery:"Joining the lottery",doingGleamTask:"Doing Gleam Task...",gettingGleamLink:"Getting Gleam task link...",gleamTaskNotice:"If this page has not been closed for a long time, please close it yourself after completing any task!",verifiedGleamTasks:"Attempted to verify all tasks. If the verification fails, please try to verify manually or complete it!",campaign:"ReCAPTCHA detected, please complete it and re-verify the tasks!",gsNotice:'In order to avoid getting the "0000-0000-0000" key, the "Grab Key" button has been hidden, please close the script when obtaining the key!',giveeClubVerifyNotice:"Verifying task...",giveeClubVerifyFinished:"Wait for the verification to complete and join it by yourself",doingKeyhubTask:"Doing Keyhub Task...",SweepWidgetNotice:"The task is being processed and verified. There is an interval of 1~3s for each verification task to prevent the triggering of too fast verification warning...",tasksNotCompleted:"Tasks Not Completed",confirmingTask:"Confirming task..."}},language=["zh","en"].includes(globalOptions.other.language)?globalOptions.other.language:"en",i18n=(key,...argvs)=>languages[language]?.[key]?languages[language][key].replace(/%([\d]+)/g,(match,index)=>argvs[parseInt(index,10)]):key;function throwError(error,name){window.TRACE&&console.trace("%cAuto-Task[Debug]:","color:blue"),external_Swal_default().fire({title:i18n("errorReport"),icon:"error",showCancelButton:!0,confirmButtonText:i18n("toGithub"),showDenyButton:!0,denyButtonText:i18n("toKeylol"),cancelButtonText:i18n("close")}).then(({isDenied,isConfirmed})=>{isConfirmed?window.open(`https://github.com/HCLonely/auto-task-v4/issues/new?title=${encodeURIComponent("[BUG] 脚本报错: "+name)}&labels=bug&template=bug_report.yml&website=${encodeURIComponent(window.location.href)}&browser=${encodeURIComponent(JSON.stringify((0,javascript_utils_umd_min.ua)(),null,4))}&manager=${encodeURIComponent(GM_info.scriptHandler+" "+GM_info.version)}&user-script=${encodeURIComponent(GM_info.script.version)}&logs=${encodeURIComponent(error.stack||"null")}&run-logs=`+encodeURIComponent($.makeArray($("#auto-task-info>li")).map(element=>element.innerText).join("\n")),"_blank"):isDenied&&(isConfirmed=`错误链接: [url=${window.location.href}]${window.location.href}[/url] 环境: @@ -140,7 +140,7 @@ console.log('%c%s', 'color:blue', 'Auto-Task[Load]: 脚本开始加载'); 执行日志: [code]${$.makeArray($("#auto-task-info>li")).map(element=>element.innerText).join("\n")}[/code]`,GM_setClipboard(isConfirmed),external_Swal_default().fire({title:i18n("copySuccess"),icon:"success",confirmButtonText:i18n("ok")}).then(()=>{window.open("https://keylol.com/forum.php?mod=post&action=reply&fid=319&tid=777450","_blank")}))}),console.log("%c%s","color:white;background:red",`Auto-Task[Error]: ${name} -`+error.stack)}external_Swal_namespaceObject=class{tasks;getRealParams(name,links,doTask,link2param){try{let realParams=[];return 0link2param(link)).filter(link=>link)]),!doTask&&0!!isConfirmed||!!isDenied&&(GM_setValue("dontRemindDiscordAgain",!0),!0)))return this.#initialized=!1,"skip";return GM_getValue("dontRemindDiscordAgain")||"do"===action&&!globalOptions.doTask.discord.servers||"undo"===action&&!globalOptions.undoTask.discord.servers?(this.#initialized=!1,"skip"):!!this.#initialized||(this.#auth.auth?await this.#verifyAuth()||(GM_setValue("discordAuth",{auth:null}),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Discord")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Discord")),!1):!!await this.#updateAuth()&&(this.#initialized=!0))}catch(error){return throwError(error,"Discord.init"),!1}}async#verifyAuth(){try{var logStatus=scripts_echoLog({text:i18n("verifyingAuth","Discord")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v6/users/@me",method:"HEAD",headers:{authorization:this.#auth.auth}});return"Success"===result?200===data?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Discord.verifyAuth"),!1}}async#updateAuth(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Discord")});return await new Promise(resolve=>{GM_openInTab("https://discord.com/channels/@me#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{var auth=GM_getValue("discordAuth")?.auth;auth?(this.#auth={auth:auth},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error("Error: Update discord auth failed!"),resolve(!1))}})}catch(error){return throwError(error,"Discord.updateAuth"),!1}}async#joinServer(inviteId){try{var guild,logStatus=scripts_echoLog({type:"joiningDiscordServer",text:inviteId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,method:"POST",dataType:"json",headers:{authorization:this.#auth.auth,origin:"https://discord.com",referer:"https://discord.com/invite/"+inviteId}});return"Success"===result&&200===data?.status?(logStatus.success(),(guild=String(data.response?.guild?.id))&&(this.#setCache(inviteId,guild),this.tasks.servers=unique([...this.tasks.servers,inviteId])),!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Discord.joinServer"),!1}}async#leaveServer(inviteId){try{if(this.whiteList.servers.includes(inviteId))return scripts_echoLog({type:"whiteList",text:"Discord.leaveServer",id:inviteId}),!0;var guild=await this.#getGuild(inviteId);if(guild){var logStatus=scripts_echoLog({type:"leavingDiscordServer",text:guild}),{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/users/@me/guilds/"+guild,method:"DELETE",headers:{authorization:this.#auth.auth}});if("Success"===result&&204===data?.status)return logStatus.success(),!0;logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError(error,"Discord.leaveServer"),!1}}async#getGuild(inviteId){try{var logStatus=scripts_echoLog({type:"gettingDiscordGuild",text:inviteId}),guild=this.#cache[inviteId];if(guild)return logStatus.success(),guild;var{result,statusText,status,data}=await tools_httpRequest({url:"https://discord.com/api/v9/invites/"+inviteId,responseType:"json",method:"GET"});if("Success"!==result||200!==data?.status)return logStatus.error(result+`:${statusText}(${status})`),!1;{let guild=data.response?.guild?.id;return guild?(logStatus.success(),this.#setCache(inviteId,guild),guild):(logStatus.error(result+`:${statusText}(${status})`),!1)}}catch(error){return throwError(error,"Discord.getGuild"),!1}}async toggle({doTask=!0,serverLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.discord.servers||!doTask&&!globalOptions.undoTask.discord.servers)scripts_echoLog({type:"globalOptionsSkip",text:"discord.servers"});else{var realServers=this.getRealParams("servers",serverLinks,doTask,link=>link.match(/invite\/(.+)/)?.[1]);if(0!0)}catch(error){return throwError(error,"Discord.toggleServers"),!1}}#setCache(inviteId,guild){try{this.#cache[inviteId]=guild,GM_setValue("discordCache",this.#cache)}catch(error){throwError(error,"Discord.setCache")}}}let social_Discord=Discord;class Instagram extends external_Swal_namespaceObject{tasks;whiteList;#cache=GM_getValue("instagramCache")||{};#auth={};#initialized=!1;constructor(){super();var defaultTasksTemplate={users:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.instagram||{}}}async init(){try{return this.#initialized?!0:await this.#getUserInfo()?(scripts_echoLog({}).success(i18n("initSuccess","Instagram")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Instagram")),!1)}catch(error){return throwError(error,"Instagram.init"),!1}}async#getUserInfo(name="instagram"){try{var logStatus=scripts_echoLog({type:"instagram"===name?"verifyingInsAuth":"gettingInsUserId",text:name}),userId=this.#cache[name];if(userId&&"instagram"!==name)return logStatus.success(),userId;var csrftoken,hash,id,{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/${name}/`,method:"GET"});if("Success"===result)if(data?.finalUrl.includes("accounts/login"))logStatus.error("Error:"+i18n("loginIns"),!0);else if(data?.finalUrl.includes("www.instagram.com/challenge"))logStatus.error("Error:"+i18n("insBanned"));else{if(200===data?.status)return csrftoken=data.responseText.match(/"csrf_token":"(.+?)"/)?.[1],hash=data.responseText.match(/"rollout_hash":"(.+?)"/)?.[1],"instagram"===name?!(!csrftoken||!hash||(this.#auth={csrftoken:csrftoken,hash:hash},0)):(id=data.responseText.match(/"profilePage_([\d]+?)"/)?.[1])?(this.#setCache(name,id),logStatus.success(),id):(logStatus.error("Error: Get ins data error!"),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError(error,"Instagram.getUserInfo"),!1}}async#followUser(name){try{var id=await this.#getUserInfo(name);if(id){var logStatus=scripts_echoLog({type:"followingIns",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/web/friendships/${id}/follow/`,method:"POST",dataType:"json",headers:{"x-csrftoken":this.#auth.csrftoken,origin:"https://www.instagram.com",referer:`https://www.instagram.com/${name}/`,"content-type":"application/x-www-form-urlencoded","sec-fetch-site":"same-origin","x-instagram-ajax":this.#auth.hash}});if("Success"===result)return 200===data?.status&&"following"===data.response?.result?(logStatus.success(),this.tasks.users=unique([...this.tasks.users,name]),!0):(logStatus.error("Error:"+(data?.response?.feedback_message||`${data?.statusText}(${data?.status})`)),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError(error,"Instagram.followUser"),!1}}async#unfollowUser(name){try{if(this.whiteList.users.includes(name))return scripts_echoLog({type:"whiteList",text:"Instagram.unfollowUser",id:name}),!0;var id=await this.#getUserInfo(name);if(id){var logStatus=scripts_echoLog({type:"unfollowingIns",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.instagram.com/web/friendships/${id}/unfollow/`,method:"POST",dataType:"json",headers:{"x-csrftoken":this.#auth.csrftoken,origin:"https://www.instagram.com",referer:`https://www.instagram.com/${name}/`,"content-type":"application/x-www-form-urlencoded","sec-fetch-site":"same-origin","x-instagram-ajax":this.#auth.hash}});if("Success"===result)return 200===data?.status&&"ok"===data.response?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError(error,"Instagram.unfollowUser"),!1}}async toggle({doTask=!0,userLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.instagram.users||!doTask&&!globalOptions.undoTask.instagram.users)scripts_echoLog({type:"globalOptionsSkip",text:"instagram.users"});else{var realUsers=this.getRealParams("users",userLinks,doTask,link=>link.match(/https:\/\/www\.instagram\.com\/(.+)?\//)?.[1]);if(0!0)}catch(error){return throwError(error,"Instagram.toggleUsers"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("instagramCache",this.#cache)}catch(error){throwError(error,"Instagram.setCache")}}}let social_Instagram=Instagram;class Reddit extends external_Swal_namespaceObject{tasks;whiteList;#auth;#initialized=!1;constructor(){super();var defaultTasksTemplate={reddits:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.reddit||{}}}async init(){try{return this.#initialized?!0:await this.#updateAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Reddit")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Reddit")),!1)}catch(error){return throwError(error,"Reddit.init"),!1}}async#useBeta(){try{let logStatus=scripts_echoLog({text:i18n("changingRedditVersion")});return GM_setValue("redditAuth",null),await new Promise(resolve=>{GM_openInTab("https://www.reddit.com/#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{logStatus.success(),resolve(await this.#updateAuth(!0))}})}catch(error){return throwError(error,"Reddit.useBeta"),!1}}async#updateAuth(beta=!1){try{var accessToken,logStatus=scripts_echoLog({text:i18n("updatingAuth","Reddit")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://www.reddit.com/",method:"GET",nochche:!0,headers:{"Cache-Control":"no-cache"}});if("Success"===result)if(data?.responseText.includes("www.reddit.com/login/"))logStatus.error("Error:"+i18n("loginReddit"),!0);else{if(200===data?.status)return data.responseText.includes("redesign-beta-optin-btn")&&!beta?await this.#useBeta():(accessToken=data.responseText.match(/"accessToken":"(.*?)","expires":"(.*?)"/)?.[1])?(this.#auth={token:accessToken},logStatus.success(),!0):(logStatus.error('Error: Parameter "accessToken" not found!'),!1);logStatus.error(`Error:${data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError(error,"Reddit.updateAuth"),!1}}async toggleTask({name,doTask=!0}){try{if(!doTask&&this.whiteList.reddits.includes(name))return scripts_echoLog({type:"whiteList",text:"Reddit.undoTask",id:name}),!0;let type=doTask?"joiningReddit":"leavingReddit";/^u_/.test(name)&&(type=doTask?"followingRedditUser":"unfollowingRedditUser");var logStatus=scripts_echoLog({type:type,text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://oauth.reddit.com/api/subscribe?redditWebClient=desktop2x&app=desktop2x-client-production&raw_json=1&gilding_detail=1",method:"POST",headers:{authorization:"Bearer "+this.#auth.token,"content-type":"application/x-www-form-urlencoded"},data:$.param({action:doTask?"sub":"unsub",sr_name:name,api_type:"json"})});return"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.reddits=unique([...this.tasks.reddits,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Reddit.toggleTask"),!1}}async toggle({doTask=!0,redditLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.reddit.reddits||!doTask&&!globalOptions.undoTask.reddit.reddits)scripts_echoLog({type:"globalOptionsSkip",text:"reddit.reddits"});else{var realReddits=this.getRealParams("reddits",redditLinks,doTask,link=>{var name=link.match(/https?:\/\/www\.reddit\.com\/r\/([^/]*)/)?.[1],link=link.match(/https?:\/\/www\.reddit\.com\/user\/([^/]*)/)?.[1];return link?name||link:name});if(0!0)}catch(error){return throwError(error,"Reddit.toggle"),!1}}}let social_Reddit=Reddit;class Twitch extends external_Swal_namespaceObject{tasks;whiteList;#auth=GM_getValue("twitchAuth")||{};#cache=GM_getValue("twitchCache")||{};#initialized=!1;#integrityToken;constructor(){super();var defaultTasksTemplate={channels:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.twitch||{}}}async init(){try{return this.#initialized?!0:this.#auth.authToken&&this.#auth.clientId&&this.#auth.clientVersion&&this.#auth.deviceId&&this.#auth.clientSessionId?await this.#verifyAuth(!0)||(GM_setValue("twitchAuth",null),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Twitch")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Twitch")),!1):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError(error,"Twitch.init"),!1}}async#verifyAuth(isFirst){try{var logStatus=scripts_echoLog({text:i18n("verifyingAuth","Twitch")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},data:'[{"operationName":"FrontPageNew_User","variables":{"limit":1},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"64bd07a2cbaca80699d62636d966cf6395a5d14a1f0a14282067dcb28b13eb11"}}}]'});return"Success"===result?200===data?.status&&data.response?.[0]?.data?.currentUser?(await this.#integrity(isFirst),logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Twitch.verifyAuth"),!1}}async#integrity(isFirst=!0,ct=""){try{var result,statusText,status,data,logStatus=scripts_echoLog({text:i18n("checkingTwitchIntegrity")});return!isFirst||this.#auth.authToken&&this.#auth.clientId&&this.#auth.clientVersion&&this.#auth.deviceId&&this.#auth.clientSessionId?({result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/integrity",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId,"Client-Version":this.#auth.clientVersion,"X-Device-Id":this.#auth.deviceId,"Client-Session-Id":this.#auth.clientSessionId,"x-kpsdk-ct":ct}}),"Success"===result?!ct&&data?.responseHeaders?.["x-kpsdk-ct"]?await this.#integrity(isFirst,data.responseHeaders["x-kpsdk-ct"]):200===data?.status&&data.response?.token?(this.#integrityToken=data.response.token,logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)):await this.#updateAuth(!1)}catch(error){return throwError(error,"Twitch.integrity"),!1}}async#updateAuth(isFirst=!0){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Twitch")});return await new Promise(resolve=>{GM_openInTab("https://www.twitch.tv/#auth",{active:!0,insert:!0,setParent:!0}).onclose=async()=>{var auth=GM_getValue("twitchAuth");auth?(this.#auth=auth,logStatus.success(),resolve(await this.#verifyAuth(isFirst))):(logStatus.error("Error: Update twitch auth failed!"),resolve(!1))}})}catch(error){return throwError(error,"Twitch.updateAuth"),!1}}async#toggleChannel({name,doTask=!0}){try{if(!doTask&&this.whiteList.channels.includes(name))return scripts_echoLog({type:"whiteList",text:"Twitch.unfollowChannel",id:name}),!0;var channelId=await this.#getChannelId(name);if(channelId){var logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingTwitchChannel`,text:name}),followData='[{"operationName":"FollowButton_FollowUser","variables":{"input":{"disableNotifications":false,"targetID":"'+channelId+'"}},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"800e7346bdf7e5278a3c1d3f21b2b56e2639928f86815677a7126b093b2fdd08"}}}]',unfollowData=`[{"operationName":"FollowButton_UnfollowUser","variables":{"input":{"targetID":"${channelId}"}},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"f7dae976ebf41c755ae2d758546bfd176b4eeb856656098bb40e0a672ca0d880"}}}]',{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",dataType:"json",anonymous:!0,headers:{Origin:"https://www.twitch.tv",Referer:"https://www.twitch.tv/",Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId,"Client-Version":this.#auth.clientVersion,"X-Device-Id":this.#auth.deviceId,"Client-Session-Id":this.#auth.clientSessionId,"Client-Integrity":this.#integrityToken},data:doTask?followData:unfollowData});if("Success"===result)return 200===data?.status&&data.response?.[0]&&!data.response[0].errors?(logStatus.success(),doTask&&(this.tasks.channels=unique([...this.tasks.channels,name])),!0):(logStatus.error("Error:"+(data?.response?.[0].errors?.[0]?.message||`${data?.statusText}(${data?.status})`)),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError(error,"Twitch.toggleChannel"),!1}}async#getChannelId(name){try{var logStatus=scripts_echoLog({type:"gettingTwitchChannelId",text:name}),channelId=this.#cache[name];if(channelId)return logStatus.success(),channelId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://gql.twitch.tv/gql",method:"POST",headers:{Authorization:"OAuth "+this.#auth.authToken,"Client-Id":this.#auth.clientId},responseType:"json",data:`[{"operationName":"ActiveWatchParty","variables":{"channelLogin":"${name}"},`+'"extensions":{"persistedQuery":{"version":1,"sha256Hash":"4a8156c97b19e3a36e081cf6d6ddb5dbf9f9b02ae60e4d2ff26ed70aebc80a30"}}}]'});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let channelId=data.response?.[0]?.data?.user?.id;return channelId?(this.#setCache(name,String(channelId)),logStatus.success(),channelId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError(error,"Twitch.getChannelId"),!1}}async toggle({doTask=!0,channelLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.twitch.channels||!doTask&&!globalOptions.undoTask.twitch.channels)scripts_echoLog({type:"globalOptionsSkip",text:"twitch.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>link.match(/https:\/\/(www\.)?twitch\.tv\/(.+)/)?.[2]);if(0!0)}catch(error){return throwError(error,"Twitch.toggle"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("twitchCache",this.#cache)}catch(error){throwError(error,"Twitch.setCache")}}}let social_Twitch=Twitch;class Twitter extends external_Swal_namespaceObject{tasks;whiteList;#verifyId=globalOptions.other.twitterVerifyId;#auth=GM_getValue("twitterAuth")||{};#cache=GM_getValue("twitterCache")||{};#initialized=!1;constructor(){super();var defaultTasksTemplate={users:[],retweets:[],likes:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.twitter||{}}}async init(){try{return this.#initialized?!0:this.#auth.ct0?await this.#verifyAuth()||(GM_setValue("twitterAuth",null),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Twitter")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Twitter")),!1):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError(error,"Twitter.init"),!1}}async#verifyAuth(){try{return await this.#toggleUser({name:"verify",doTask:!0,verify:!0})}catch(error){return throwError(error,"Twitter.verifyAuth"),!1}}async#updateAuth(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Twitter")});return await new Promise(resolve=>{GM_cookie.list({url:"https://x.com/settings/account"},async(cookies,error)=>{error?(logStatus.error("Error: Update twitter auth failed!"),resolve(!1)):([error,cookies]=cookies.map(cookie=>["ct0","twid"].includes(cookie.name)?cookie.value:null).filter(cookie=>cookie),cookies&&error?(GM_setValue("twitterAuth",{ct0:error}),this.#auth={ct0:error},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error(i18n("needLogin")),resolve(!1)))})})}catch(error){return throwError(error,"Twitter.updateToken"),!1}}async#toggleUser({name,doTask=!0,verify=!1}){try{if(!doTask&&!verify&&this.whiteList.users.includes(name))return scripts_echoLog({type:"whiteList",text:"Twitter.unfollowUser",id:name}),!0;var userId=verify?this.#verifyId:await this.userName2id(name);if(userId){var logStatus=verify?scripts_echoLog({text:i18n("verifyingAuth","Twitter")}):scripts_echoLog({type:`${doTask?"":"un"}followingTwitterUser`,text:name}),{result,statusText,status,data}=await tools_httpRequest({url:`https://x.com/i/api/1.1/friendships/${doTask?"create":"destroy"}.json`,method:"POST",headers:{authorization:"Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA","Content-Type":"application/x-www-form-urlencoded","x-csrf-token":this.#auth.ct0},responseType:"json",data:$.param({include_profile_interstitial_type:1,include_blocking:1,include_blocked_by:1,include_followed_by:1,include_want_retweets:1,include_mute_edge:1,include_can_dm:1,include_can_media_tag:1,skip_status:1,id:userId})});if("Success"===result)return 200===data?.status?(logStatus.success(),doTask&&!verify&&(this.tasks.users=unique([...this.tasks.users,name])),!0):verify&&403===data?.status&&158===data.response?.errors?.[0]?.code?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError(error,"Twitter.toggleUser"),!1}}async userName2id(name){try{var logStatus=scripts_echoLog({type:"gettingTwitterUserId",text:name}),userId=this.#cache[name];if(userId)return logStatus.success(),userId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://x.com/i/api/graphql/mCbpQvZAw6zu_4PvuAUVVQ/UserByScreenName"+`?variables=%7B%22screen_name%22%3A%22${name}%22%2C%22withSafetyModeUserFields%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%7D`,method:"GET",headers:{authorization:"Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA","content-type":"application/json",referer:"https://x.com/"+name,"x-csrf-token":this.#auth.ct0},responseType:"json"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let response=data.response||("object"==typeof data.responseText?data.responseText:null);if(!response)try{response=JSON.parse(data.responseText)}catch(error){response=null}let userId=String(response?.data?.user?.result?.rest_id);return userId?(this.#setCache(name,userId),logStatus.success(),userId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError(error,"Twitter.getUserId"),!1}}async#toggleRetweet({retweetId,doTask=!0}){try{var logStatus,result,statusText,status,data;return!doTask&&this.whiteList.retweets.includes(retweetId)?(scripts_echoLog({type:"whiteList",text:"Twitter.unretweet",id:retweetId}),!0):(logStatus=scripts_echoLog({type:`${doTask?"":"un"}retweetting`,text:retweetId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://x.com/i/api/graphql/"+(doTask?"ojPdsZsimiJrUGLR1sjUtA/CreateRetweet":"iQtK4dl5hBmXewYZuEOKVw/DeleteRetweet"),method:"POST",headers:{authorization:"Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA","Content-Type":"application/json","x-csrf-token":this.#auth.ct0},data:`{"variables":{"tweet_id":"${retweetId}","dark_request":false},"queryId":"${doTask?"ojPdsZsimiJrUGLR1sjUtA":"iQtK4dl5hBmXewYZuEOKVw"}"}`,responseType:"json"}),"Success"===result?200===data?.status||403===data?.status&&327===data.response?.errors?.[0]?.code?(logStatus.success(),doTask&&(this.tasks.retweets=unique([...this.tasks.retweets,retweetId])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError(error,"Twitter.toggleRetweet"),!1}}async toggle({doTask=!0,userLinks=[],retweetLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.twitter.users||!doTask&&!globalOptions.undoTask.twitter.users)scripts_echoLog({type:"globalOptionsSkip",text:"twitter.users"});else{var realUsers=this.getRealParams("users",userLinks,doTask,link=>link.match(/https:\/\/x\.com\/(.+)/)?.[1]||link.match(/https:\/\/twitter\.com\/(.+)/)?.[1]);if(0link.match(/https:\/\/x\.com\/.*?\/status\/([\d]+)/)?.[1]||link.match(/https:\/\/twitter\.com\/.*?\/status\/([\d]+)/)?.[1]);if(0!0)}catch(error){return throwError(error,"Twitter.toggle"),!1}}#setCache(name,id){try{this.#cache[name]=id,GM_setValue("twitterCache",this.#cache)}catch(error){throwError(error,"Twitter.setCache")}}}let social_Twitter=Twitter;class Vk extends external_Swal_namespaceObject{tasks;whiteList;#username="";#cache=GM_getValue("vkCache")||{};#initialized=!1;constructor(){super();var defaultTasksTemplate={names:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.vk||{}}}async init(){try{return this.#initialized?!0:await this.#verifyAuth()?(scripts_echoLog({}).success(i18n("initSuccess","Vk")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Vk")),!1)}catch(error){return throwError(error,"Vk.init"),!1}}async#verifyAuth(){try{var logStatus=scripts_echoLog({text:i18n("verifyAuth","Vk")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/im",method:"GET"});if("Success"===result)if(data?.finalUrl.includes("vk.com/login"))logStatus.error("Error:"+i18n("loginVk"),!0);else{if(200===data?.status)return this.#username=data.responseText.match(/TopNavBtn__profileLink" href="\/(.*?)"/)?.[1]||"",logStatus.success(),!0;logStatus.error(`Error:${data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError(error,"Vk.verifyAuth"),!1}}async#toggleGroup(name,dataParam,doTask=!0){try{var reqData,result,statusText,status,data,logStatus=scripts_echoLog({type:doTask?"joiningVkGroup":"leavingVkGroup",text:name});return"enter"===dataParam.groupAct&&!doTask||"leave"===dataParam.groupAct&&doTask?(logStatus.success(),!0):(reqData={act:doTask?"enter":"leave",al:1,gid:dataParam.groupId,hash:dataParam.groupHash},{result,statusText,status,data}=(doTask&&(reqData.context="_"),await tools_httpRequest({url:"https://vk.com/al_groups.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param(reqData)})),"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.names=unique([...this.tasks.names,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError(error,"Vk.toggleGroup"),!1}}async#togglePublic(name,dataParam,doTask=!0){try{var result,statusText,status,data,logStatus=scripts_echoLog({type:doTask?"joiningVkPublic":"leavingVkPublic",text:name});return dataParam.publicJoined&&doTask||!dataParam.publicJoined&&!doTask?(logStatus.success(),!0):({result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/al_public.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:doTask?"a_enter":"a_leave",al:1,pid:dataParam.publicPid,hash:dataParam.publicHash})}),"Success"===result?200===data?.status?(logStatus.success(),doTask&&(this.tasks.names=unique([...this.tasks.names,name])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError(error,"Vk.togglePublic"),!1}}async#sendWall(name){try{var logStatus=scripts_echoLog({type:"sendingVkWall",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/like.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:"publish_box",al:1,object:name})});if("Success"===result)if(200===data?.status){var hash=data.responseText.match(/shHash:[\s]*'(.*?)'/)?.[1];if(hash){var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://vk.com/like.php",method:"POST",headers:{origin:"https://vk.com",referer:"https://vk.com/"+name,"content-type":"application/x-www-form-urlencoded"},data:$.param({Message:"",act:"a_do_publish",al:1,close_comments:0,friends_only:0,from:"box",hash:hash,list:"",mark_as_ads:0,mute_notifications:0,object:name,ret_data:1,to:0})});if("Success"===resultR){if(200===dataR?.status){var postId,ownerId,jsonData=JSON.parse(dataR.responseText?.replace("\x3c!--","")||"{}");if(!0===jsonData?.payload?.[1]?.[1]?.share_my)return logStatus.success(),postId=String(jsonData?.payload?.[1]?.[1]?.post_id),ownerId=String(jsonData?.payload?.[1]?.[1]?.owner_id),postId&&ownerId&&this.#setCache(name,ownerId+"_"+postId),this.tasks.names=unique([...this.tasks.names,name]),!0}logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`)}else logStatus.error(resultR+`:${statusTextR}(${statusR})`)}else logStatus.error('Error: Get "hash" failed')}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError(error,"Vk.sendWall"),!1}}async#deleteWall(name,dataParams){try{var logStatus=scripts_echoLog({type:"deletingVkWall",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:"https://vk.com/al_wall.php?act=delete",method:"POST",headers:{origin:"https://vk.com",referer:`https://vk.com/${this.#username}?w=wall${this.#cache[name]}%2Fall`,"content-type":"application/x-www-form-urlencoded"},data:$.param({act:"delete",al:1,confirm:0,from:"wkview",hash:dataParams.wallHash,post:this.#cache[name]})});return"Success"===result?200===data?.status&&JSON.parse(data.responseText?.replace("\x3c!--","")||"{}")?.payload?.[1]?.[1]?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Vk.deleteWall"),!1}}async#getId(name,doTask){try{let url="https://vk.com/"+name;if(/^wall-/.test(name)){if(doTask)return{type:"sendWall"};if(!this.#cache[name])return{type:"unSupport"};url=`https://vk.com/${this.#username}?w=wall`+this.#cache[name]}var logStatus=scripts_echoLog({type:"gettingVkId",text:name}),{result,statusText,status,data}=await tools_httpRequest({url:url,method:"GET"});if("Success"===result)if(200===data?.status){var[,groupAct,groupId,,groupHash]=data.responseText.match(/Groups.(enter|leave)\(.*?,.*?([\d]+?), ('|')(.*?)('|')/)||[],publicHash=data.responseText.match(/"enterHash":"(.*?)"/)?.[1],publicPid=data.responseText.match(/"public_id":([\d]+?),/)?.[1],publicJoined=!data.responseText.includes("Public.subscribe");if(groupAct&&groupId&&groupHash)return logStatus.success(),{groupAct:groupAct,groupId:groupId,groupHash:groupHash,type:"group"};if(publicHash&&publicPid)return logStatus.success(),{publicHash:publicHash,publicPid:publicPid,publicJoined:publicJoined,type:"public"};if(data.responseText.includes("wall.deletePost")&&!doTask){var wallHash=data.responseText.match(/wall\.deletePost\(this, '.*?', '(.*?)'\)/)?.[1];if(wallHash)return logStatus.success(),{type:"deleteWall",wallHash:wallHash}}else if(name.includes("wall")&&doTask)return logStatus.success(),{type:"sendWall"};logStatus.error("Error: Parameters not found!")}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError(error,"Vk.getId"),!1}}async#toggleVk({name,doTask=!0}){try{if(!doTask&&this.whiteList.names.includes(name))return scripts_echoLog({type:"whiteList",text:"Vk.undoTask",id:name}),!0;var formatName=name.replace(/\/$/,""),data=await this.#getId(formatName,doTask);if(!data)return!1;switch(data.type){case"group":return await this.#toggleGroup(formatName,data,doTask);case"public":return await this.#togglePublic(formatName,data,doTask);case"sendWall":return!doTask||await this.#sendWall(formatName);case"deleteWall":return!!doTask||await this.#deleteWall(formatName,data);default:return!1}}catch(error){return throwError(error,"Vk.toggleVk"),!1}}async toggle({doTask=!0,nameLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.vk.names||!doTask&&!globalOptions.undoTask.vk.names)scripts_echoLog({type:"globalOptionsSkip",text:"vk.names"});else{var realNames=this.getRealParams("names",nameLinks,doTask,link=>link.match(/https:\/\/vk\.com\/([^/]+)/)?.[1]);if(0!0)}catch(error){return throwError(error,"Vk.toggle"),!1}}#setCache(name,postId){try{this.#cache[name]=postId,GM_setValue("vkCache",this.#cache)}catch(error){throwError(error,"Vk.setCache")}}}let social_Vk=Vk,getInfo=async function(link,type){try{var apiKey,context,client,request,channelId,videoId,likeParams,logStatus=scripts_echoLog({text:i18n("gettingYtbToken")}),{result,statusText,status,data}=await tools_httpRequest({url:link,method:"GET"});return"Success"===result?200===data?.status?data.responseText.includes("accounts.google.com/ServiceLogin?service=youtube")?(logStatus.error("Error:"+i18n("loginYtb"),!0),{needLogin:!0}):(apiKey=data.responseText.match(/"INNERTUBE_API_KEY":"(.*?)"/)?.[1],context=(data.responseText.match(/\(\{"INNERTUBE_CONTEXT":([\w\W]*?)\}\)/)||data.responseText.match(/"INNERTUBE_CONTEXT":([\w\W]*?\}),"INNERTUBE/))?.[1]||"{}",{client,request}=JSON.parse(context),apiKey&&client&&request?(client.hl="en","channel"===type?(channelId=data.responseText.match(/"channelId":"(.+?)"/)?.[1])?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,channelId:channelId}}):(logStatus.error('Error: Get "channelId" failed!'),{}):"likeVideo"===type?(videoId=data.responseText.match(//)?.[1],likeParams=data.responseText.match(/"likeParams":"(.*?)"/)?.[1],videoId?(logStatus.success(),{params:{apiKey:apiKey,client:client,request:request,videoId:videoId,likeParams:likeParams}}):(logStatus.error('Error: Get "videoId" failed!'),{})):(logStatus.error("Error: Unknown type"),{})):(logStatus.error('Error: Parameter "apiKey" not found!'),{})):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),{}):(logStatus.error(result+`:${statusText}(${status})`),{})}catch(error){return throwError(error,"Youtube.getInfo"),{}}};class Youtube extends external_Swal_namespaceObject{tasks;whiteList;#auth=GM_getValue("youtubeAuth")||{};#initialized=!1;#verifyChannel="https://www.youtube.com/channel/"+globalOptions.other.youtubeVerifyChannel;constructor(){super();var defaultTasksTemplate={channels:[],likes:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.youtube||{}}}async init(){try{return this.#initialized?!0:this.#auth.PAPISID?await this.#verifyAuth()||(GM_setValue("youtubeAuth",null),await this.#updateAuth())?(scripts_echoLog({}).success(i18n("initSuccess","Youtube")),this.#initialized=!0):(scripts_echoLog({}).error(i18n("initFailed","Youtube")),!1):!!await this.#updateAuth()&&(this.#initialized=!0)}catch(error){return throwError(error,"Youtube.init"),!1}}async#verifyAuth(){try{return await this.#toggleChannel({link:this.#verifyChannel,doTask:!0,verify:!0})}catch(error){return throwError(error,"Youtube.verifyAuth"),!1}}async#updateAuth(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth","Youtube")});return await new Promise(resolve=>{GM_cookie.list({url:"https://www.youtube.com/@YouTube"},async(cookies,error)=>{error?(logStatus.error("Error: Update youtube auth failed!"),resolve(!1)):(error=cookies.find(cookie=>"__Secure-3PAPISID"===cookie.name)?.value)?(GM_setValue("youtubeAuth",{PAPISID:error}),this.#auth={PAPISID:error},logStatus.success(),resolve(await this.#verifyAuth())):(logStatus.error(i18n("needLogin")),resolve(!1))})})}catch(error){return throwError(error,"Youtube.updateAuth"),!1}}#getInfo(link,type){return getInfo(link,type)}async#toggleChannel({link,doTask=!0,verify=!1}){try{var{params,needLogin}=await this.#getInfo(link,"channel"),{apiKey,client,request,channelId}=params||{};if(needLogin)scripts_echoLog({html:i18n("loginYtb")});else if(apiKey&&client&&request&&channelId){if(!doTask&&!verify&&this.whiteList.channels.includes(channelId))return scripts_echoLog({type:"whiteList",text:"Youtube.unfollowChannel",id:channelId}),!0;var logStatus=verify?scripts_echoLog({text:i18n("verifyingAuth","Youtube")}):scripts_echoLog({type:doTask?"followingYtbChannel":"unfollowingYtbChannel",text:channelId}),nowTime=parseInt(String((new Date).getTime()/1e3),10),{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/subscription/${doTask?"":"un"}subscribe?key=${apiKey}&prettyPrint=false`,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/channel/"+channelId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client?.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify({context:{client:client,request:{sessionId:request?.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},channelIds:[channelId],params:doTask?"EgIIAhgA":"CgIIAhgA"})});if("Success"===result)return 200===data?.status?doTask&&(/"subscribed":true/.test(data.responseText)||data.responseText.includes("The subscription already exists"))||!doTask&&/"subscribed":false/.test(data.responseText)?(logStatus.success(),doTask&&!verify&&(this.tasks.channels=unique([...this.tasks.channels,link])),!0):verify&&data.responseText.includes("You may not subscribe to yourself")?(logStatus.success(),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}else scripts_echoLog({text:'"getYtbToken" failed'});return!1}catch(error){return throwError(error,"Youtube.toggleChannel"),!1}}async#toggleLikeVideo({link,doTask=!0}){try{var{params,needLogin}=await this.#getInfo(link,"likeVideo"),{apiKey,client,request,videoId,likeParams}=params||{};if(needLogin)scripts_echoLog({html:""+i18n("loginYtb")});else if(apiKey&&client&&request&&videoId&&likeParams){if(!doTask&&this.whiteList.likes.includes(videoId))return scripts_echoLog({type:"whiteList",text:"Youtube.unlikeVideo",id:videoId}),!0;var logStatus=scripts_echoLog({type:doTask?"likingYtbVideo":"unlikingYtbVideo",text:videoId}),nowTime=parseInt(String((new Date).getTime()/1e3),10),likeVideoData={context:{client:client,request:{sessionId:request.sessionId,internalExperimentFlags:[],consistencyTokenJars:[]},user:{}},target:{videoId:videoId}};if(doTask){if(!likeParams)return logStatus.error("Empty likeParams"),!1;likeVideoData.params=likeParams}var{result,statusText,status,data}=await tools_httpRequest({url:`https://www.youtube.com/youtubei/v1/like/${doTask?"":"remove"}like?key=`+apiKey,method:"POST",headers:{origin:"https://www.youtube.com",referer:"https://www.youtube.com/watch?v="+videoId,"content-type":"application/json","x-goog-authuser":"0","x-goog-visitor-id":client.visitorData,"x-origin":"https://www.youtube.com",authorization:`SAPISIDHASH ${nowTime}_`+sha1(`${nowTime} ${this.#auth.PAPISID} https://www.youtube.com`)},data:JSON.stringify(likeVideoData)});if("Success"===result)return 200===data?.status?doTask&&data.responseText.includes("Added to Liked videos")||!doTask&&(data.responseText.includes("Removed from Liked videos")||data.responseText.includes("Dislike removed"))?(logStatus.success(),doTask&&(this.tasks.likes=unique([...this.tasks.likes,link])),!0):(logStatus.error(i18n("tryUpdateYtbAuth"),!0),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}else scripts_echoLog({text:'"getYtbToken" failed'});return!1}catch(error){return throwError(error,"Youtube.toggleLikeVideo"),!1}}async toggle({doTask=!0,channelLinks=[],videoLinks=[]}){try{if(!this.#initialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.youtube.channels||!doTask&&!globalOptions.undoTask.youtube.channels)scripts_echoLog({type:"globalOptionsSkip",text:"youtube.channels"});else{var realChannels=this.getRealParams("channels",channelLinks,doTask,link=>/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)?.[1]:link);if(0/^https:\/\/(www\.)?google\.com.*?\/url\?.*?url=https:\/\/www\.youtube\.com\/.*/.test(link)?link.match(/url=(https:\/\/www\.youtube\.com\/.*)/)?.[1]:link);if(0!0)}catch(error){return throwError(error,"Youtube.toggle"),!1}}}let social_SteamASF=class{#asfOptions;#botName="asf";#groupInfo;async init(){try{var asfCommandsUrl=new URL("/Api/Command/",globalOptions.ASF.AsfIpcUrl),logStatus=(this.#asfOptions={url:asfCommandsUrl.href,method:"POST",responseType:"json",headers:{accept:"application/json","Content-Type":"application/json",Host:asfCommandsUrl.host,Origin:asfCommandsUrl.origin,Referer:asfCommandsUrl.href,Authentication:globalOptions.ASF.AsfIpcPassword}},globalOptions.ASF.AsfBotname&&(this.#botName=globalOptions.ASF.AsfBotname),scripts_echoLog({text:i18n("initingASF")})),{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:'{"Command":"!stats"}'});return"Success"===result?!0===data?.response?.Success&&"OK"===data.response.Message&&data.response.Result?(logStatus.success(),!0):(data?.response?.Result||data?.response?.Message?logStatus.error(data?.response?.Result||data.response.Message):logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"SteamASF.init"),!1}}async joinGroup(groupName){try{var logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!JOINGROUP ${this.#botName} `+groupName})});return"Success"===result?200===data?.status&&["已加入","已申请","Joined","Applied","Присоединился","costs"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"SteamASF.joinGroup"),!1}}async leaveGroup(groupName){try{if(this.#groupInfo||await this.#getGroupId()){var groupId=await this.#groupInfo[groupName];if(groupId){var logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!LEAVEGROUP ${this.#botName} `+groupId})});if("Success"===result)return 200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}return!1}catch(error){return throwError(error,"SteamASF.leaveGroup"),!1}}async#getGroupId(){try{var logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:"All"}),{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:"!GROUPLIST "+this.#botName})});return"Success"===result?200===data?.status&&data.response?.Result?.includes("|")?(this.#groupInfo=Object.fromEntries(data.response.Result.split("\n").map(line=>{var[,line,id]=line.trim().split("|");return line&&id?[line,id]:null}).filter(ele=>ele)),logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"SteamASF.getGroupID"),!1}}async addToWishlist(gameId){try{var logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!ADDWISHLIST ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"SteamASF.addToWishlist"),!1}}async removeFromWishlist(gameId){try{var logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!REMOVEWISHLIST ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"SteamASF.removeFromWishlist"),!1}}async toggleFollowGame(gameId,doTask){try{var logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!${doTask?"":"UN"}FOLLOWGAME ${this.#botName} `+gameId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"SteamASF.toggleFollowGame"),!1}}async toggleCurator(curatorId,doTask=!0){try{var logStatus=scripts_echoLog({type:doTask?"followingCurator":"unfollowingCurator",text:curatorId});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!${doTask?"":"UN"}FOLLOWCURATOR ${this.#botName} `+curatorId})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Steam.toggleCurator"),!1}}async addLicense(id){try{var[type,ids]=id.split("-");if("appid"===type){var logStatus=scripts_echoLog({type:"addingFreeLicense",text:ids});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!addlicense ${this.#botName} app/`+ids})});return"Success"===result?200===data?.status&&["AlreadyPurchased","OK"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}if("subid"===type){var idsArr=ids.split(",");let logStatus=scripts_echoLog({type:"addingFreeLicenseSubid",text:ids});var{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!addlicense ${this.#botName} `+idsArr.map(id=>"sub/"+id).join(",")})});if("Success"===result){if(200===data?.status&&data.response?.Result){let resultLines=data.response.Result.split("\n");return idsArr.forEach(subid=>{let targetLine=resultLines.find(text=>text.includes(subid));targetLine&&["成功","Success","Успех"].find(text=>targetLine.includes(text))?scripts_echoLog({}).success(targetLine):scripts_echoLog({}).error(targetLine)}),!0}logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError(error,"SteamASF.addLicense"),!1}}async requestPlayTestAccess(id){try{var logStatus=scripts_echoLog({type:"requestingPlayTestAccess",text:id});let{result,statusText,status,data}=await tools_httpRequest({...this.#asfOptions,data:JSON.stringify({Command:`!REQUESTACCESS ${this.#botName} `+id})});return"Success"===result?200===data?.status&&["成功","Success","Успех"].find(text=>data.response?.Result?.includes(text))?(logStatus.success(),!0):(logStatus.error(`Error:${data?.response?.Result||data?.response?.Message||data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Steam.requestPlayTestAccess"),!1}}};class Steam extends external_Swal_namespaceObject{tasks;whiteList;#cache={group:{},officialGroup:{},forum:{},workshop:{},curator:{},...GM_getValue("steamCache")};#auth={};#storeInitialized=!1;#communityInitialized=!1;#area="CN";#areaStatus="end";#ASF;constructor(){super();var defaultTasksTemplate={groups:[],officialGroups:[],wishlists:[],follows:[],forums:[],workshops:[],workshopVotes:[],curators:[],curatorLikes:[],announcements:[],licenses:[],playtests:[]};this.tasks=defaultTasksTemplate,this.whiteList={...defaultTasksTemplate,...GM_getValue("whiteList")?.steam||{}}}async init(type="all"){try{if(globalOptions.ASF.AsfEnabled&&globalOptions.ASF.AsfIpcUrl&&globalOptions.ASF.AsfIpcPassword)return this.#ASF=new social_SteamASF,!!await this.#ASF.init()&&(this.#storeInitialized=!0,this.#communityInitialized=!0);if("store"===type){if(!this.#storeInitialized){let storeInitialized=await this.#updateStoreAuth();if(storeInitialized=storeInitialized||await this.#updateStoreAuthTab(),this.#storeInitialized=storeInitialized,!this.#storeInitialized)return scripts_echoLog({}).error(i18n("initFailed","Steam")),!1;scripts_echoLog({}).success(i18n("initSuccess","SteamStore"))}}else{if("community"!==type)return this.#storeInitialized&&this.#communityInitialized?(scripts_echoLog({}).success(i18n("initSuccess","Steam")),!0):(scripts_echoLog({}).error(i18n("initFailed","Steam")),!1);if(!this.#communityInitialized){let communityInitialized=await this.#getUserLink();if(communityInitialized||(communityInitialized=await this.#updateCommunityAuthTab(),GM_setValue("steamCommunityAuth",null)),this.#communityInitialized=communityInitialized,!this.#communityInitialized)return scripts_echoLog({}).error(i18n("initFailed","Steam")),!1;scripts_echoLog({}).success(i18n("initSuccess","SteamCommunity"))}}return!0}catch(error){return throwError(error,"Steam.init"),!1}}async#refreshToken(type="steamStore"){try{var host={steamStore:"store.steampowered.com",steamCommunity:"steamcommunity.com"},logStatus=scripts_echoLog({text:i18n("refreshingToken",i18n(type))}),formData=new FormData,{result,statusText,status,data}=(formData.append("redir",`https://${host[type]}/`),await tools_httpRequest({url:"https://login.steampowered.com/jwt/ajaxrefresh",method:"POST",responseType:"json",headers:{Host:"login.steampowered.com",Origin:"https://"+host[type],Referer:`https://${host[type]}/`},data:formData}));return"Success"===result?data?.response?.success?await this.#setStoreToken(data.response,type)?(logStatus.success(),!0):(logStatus.error("Error"),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Steam.refreshToken"),!1}}async#setStoreToken(param,type){try{var host={steamStore:"store.steampowered.com",steamCommunity:"steamcommunity.com"},logStatus=scripts_echoLog({text:i18n("settingToken",i18n(type))}),formData=new FormData,{result,statusText,status,data}=(formData.append("steamID",param.steamID),formData.append("nonce",param.nonce),formData.append("redir",param.redir),formData.append("auth",param.auth),await tools_httpRequest({url:`https://${host[type]}/login/settoken`,method:"POST",headers:{Accept:"application/json, text/plain, */*",Host:host[type],Origin:"https://"+host[type]},data:formData}));return"Success"===result?200===data?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Steam.setStoreToken"),!1}}async#updateStoreAuth(retry=!1){try{var storeSessionID,logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamStore"))}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"},fetch:!1,redirect:"manual"});return 200===data?.status?data.responseText.includes("data-miniprofile=")?(storeSessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1])?(this.#auth.storeSessionID=storeSessionID,logStatus.success(),!0):(logStatus.error('Error: Get "sessionID" failed'),!1):!await this.#refreshToken("steamStore")||(logStatus.warning(i18n("retry")),retry)?(logStatus.error("Error:"+i18n("needLoginSteamStore"),!0),!1):this.#updateStoreAuth(!0):[301,302].includes(data?.status)?!await this.#refreshToken("steamStore")||(logStatus.warning(i18n("retry")),retry)?(logStatus.error("Error:"+i18n("needLoginSteamStore"),!0),!1):this.#updateStoreAuth(!0):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Steam.updateStoreAuth"),!1}}async#updateStoreAuthTab(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamStore"))});return await new Promise(resolve=>{let newTab=window.open("https://store.steampowered.com/","mozillaWindow","pop=1;"),listenerId=(GM_setValue("steamStoreAuth","update"),GM_addValueChangeListener("steamStoreAuth",(key,oldValue,newValue,remote)=>{GM_removeValueChangeListener(listenerId),newTab?.close(),newValue&&JSON.stringify(newValue)!==JSON.stringify(oldValue)?(this.#auth.storeSessionID=newValue.storeSessionID,logStatus.success(),resolve(!0)):(logStatus.error("Failed"),resolve(!1))}))})}catch(error){return throwError(error,"Steam.updateStoreAuthTab"),!1}}async#updateCommunityAuthTab(){try{let logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamCommunity"))});return await new Promise(resolve=>{let newTab=window.open("https://steamcommunity.com/my","mozillaWindow","pop=1;"),listenerId=(GM_setValue("steamCommunityAuth","update"),GM_addValueChangeListener("steamCommunityAuth",(key,oldValue,newValue,remote)=>{GM_removeValueChangeListener(listenerId),newTab?.close(),newValue&&JSON.stringify(newValue)!==JSON.stringify(oldValue)?(this.#auth.steam64Id=newValue.steam64Id,this.#auth.userName=newValue.userName,this.#auth.communitySessionID=newValue.communitySessionID,logStatus.success(),resolve(!0)):(logStatus.error("Failed"),resolve(!1))}))})}catch(error){return throwError(error,"Steam.updateCommunityAuthTab"),!1}}async#getUserLink(retry=!1){try{var logStatus=scripts_echoLog({text:i18n("gettingUserLink")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/my",method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"},fetch:!1,redirect:"manual"});if(200===data?.status)if(data.finalUrl.includes("https://steamcommunity.com/login/home"))logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0);else{var steam64Id=data.responseText.match(/g_steamID = "(.+?)";/)?.[1],communitySessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1],userName=data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//)?.[1];if(steam64Id&&(this.#auth.steam64Id=steam64Id),userName&&(this.#auth.userName=userName),communitySessionID)return this.#auth.communitySessionID=communitySessionID,logStatus.success(),!0;logStatus.error('Error: Get "sessionID" failed')}else{if(302===data?.status)return!await this.#refreshToken("steamCommunity")||retry?(logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0),!1):(logStatus.warning(i18n("retry")),this.#getUserLink(!0));var location=data?.responseHeaders?.split("\n")?.find(header=>header.includes("location")?header.replace("loctation:","").trim():null);if(301===data?.status&&location?.includes("steamcommunity.com/id"))return logStatus.success(),await this.#updateCommunityAuth(data.finalUrl);301===data?.status&&location?.includes("https://steamcommunity.com/login/home")?logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0):logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError(error,"Steam.updateCommunityAuth"),!1}}async#updateCommunityAuth(url){try{var logStatus=scripts_echoLog({text:i18n("updatingAuth",i18n("steamCommunity"))}),{result,statusText,status,data}=await tools_httpRequest({url:url,method:"GET",headers:{Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","Cache-Control":"max-age=0","Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Upgrade-Insecure-Requests":"1"}});if("Success"===result)if(200===data?.status)if(data.finalUrl.includes("https://steamcommunity.com/login/home"))logStatus.error("Error:"+i18n("needLoginSteamCommunity"),!0);else{var steam64Id=data.responseText.match(/g_steamID = "(.+?)";/)?.[1],communitySessionID=data.responseText.match(/g_sessionID = "(.+?)";/)?.[1],userName=data.responseText.match(/steamcommunity.com\/id\/(.+?)\/friends\//)?.[1];if(steam64Id&&(this.#auth.steam64Id=steam64Id),userName&&(this.#auth.userName=userName),communitySessionID)return this.#auth.communitySessionID=communitySessionID,logStatus.success(),!0;logStatus.error('Error: Get "sessionID" failed')}else logStatus.error(`Error:${data?.statusText}(${data?.status})`);else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError(error,"Steam.updateCommunityAuth"),!1}}async#getAreaInfo(){try{var logStatus=scripts_echoLog({text:i18n("gettingAreaInfo")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/cart/",method:"GET"});if("Success"===result)if(200===data?.status){var cartConfigRaw=data.responseText.match(/data-cart_config="(.*?)"/)?.[1],temp=document.createElement("div"),cartConfigStr=(temp.innerHTML=cartConfigRaw||"{}",temp.textContent||temp.innerText);let cartConfig;try{cartConfig=JSON.parse(cartConfigStr)}catch(error){return logStatus.error("Error: get country info filed"),console.error(error),{}}if(cartConfig.rgUserCountryOptions){var userInfoRaw=data.responseText.match(/data-userinfo="(.*?)"/)?.[1],temp1=document.createElement("div"),userInfoStr=(temp1.innerHTML=userInfoRaw||"{}",temp1.textContent||temp1.innerText);let userInfo;try{userInfo=JSON.parse(userInfoStr)}catch(error){return logStatus.error("Error: get country info filed"),console.error(error),{}}var currentArea=userInfo.country_code,areas=Object.keys(cartConfig.rgUserCountryOptions).filter(area=>"help"!==area);if(currentArea&&0{let checker=setInterval(()=>{"waiting"!==this.#areaStatus&&(clearInterval(checker),resolve(!0))})}),this.#area===area||!area&&"CN"!==this.#area)return!0;this.#areaStatus="waiting";let aimedArea=area;if(!aimedArea){var{currentArea,areas}=await this.#getAreaInfo();if(!currentArea||!areas)return!(this.#areaStatus="error");if("CN"!==currentArea)return this.#areaStatus="skip",scripts_echoLog({text:"notNeededChangeArea"}),"skip";var anotherArea=areas.filter(area=>area&&"CN"!==area);if(!anotherArea||0===anotherArea.length)return this.#areaStatus="noAnotherArea",scripts_echoLog({text:"noAnotherArea"}),!1;[aimedArea]=anotherArea}var logStatus=scripts_echoLog({text:i18n("changingArea",aimedArea)}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/country/setcountry",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({cc:aimedArea,sessionid:this.#auth.storeSessionID})});if("Success"!==result)return this.#areaStatus="error",logStatus.error(result+`:${statusText}(${status})`),"CN";if(200!==data?.status||"true"!==data.responseText)return this.#areaStatus="error",logStatus.error(`Error:${data?.statusText}(${data?.status})`),"CN";{let currentArea=(await this.#getAreaInfo()).currentArea;return currentArea===aimedArea?(this.#areaStatus="success",logStatus.success(),currentArea):(this.#areaStatus="error",logStatus.error("Error: change country filed"),"CN")}}catch(error){return this.#areaStatus="error",throwError(error,"Steam.changeArea"),!1}}async#joinGroup(groupName){try{var logStatus,result,statusText,status,data;return this.#ASF?!!await this.#ASF.joinGroup(groupName)&&(this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus=scripts_echoLog({type:"joiningSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({action:"join",sessionID:this.#auth.communitySessionID})}),"Success"===result?200!==data?.status||data.responseText.includes("grouppage_join_area")?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.success(),this.tasks.groups=unique([...this.tasks.groups,groupName]),!0):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError(error,"Steam.joinGroup"),!1}}async#leaveGroup(groupName){try{if(this.whiteList.groups.includes(groupName))return scripts_echoLog({type:"whiteList",text:"Steam.leaveGroup",id:groupName}),!0;if(this.#ASF)return await this.#ASF.leaveGroup(groupName);var groupId=await this.#getGroupId(groupName);if(groupId){var logStatus=scripts_echoLog({type:"leavingSteamGroup",text:groupName}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"===result)return 200===data?.status&&data.finalUrl.includes("groups")&&0===$(data.responseText.replace(//g,"").toLowerCase()).find(`a[href='https://steamcommunity.com/groups/${groupName.toLowerCase()}']`).length?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError(error,"Steam.leaveGroup"),!1}}async#getGroupId(groupName){try{var logStatus=scripts_echoLog({type:"gettingSteamGroupId",text:groupName}),groupId=this.#cache.group[groupName];if(groupId)return logStatus.success(),groupId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/groups/"+groupName,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let groupId=data.responseText.match(/OpenGroupChat\( '([0-9]+)'/)?.[1];return groupId?(this.#setCache("group",groupName,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError(error,"Steam.getGroupID"),!1}}async#joinOfficialGroup(gameId){try{var logStatus,result,statusText,status,data,groupId;return this.#ASF?!!await this.#ASF.joinGroup(gameId)&&(this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]),!0):(logStatus=scripts_echoLog({type:"joiningSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/games/${gameId}?action=join&sessionID=`+this.#auth.communitySessionID,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}),"Success"===result?200!==data?.status||data.responseText.includes('id="publicGroupJoin"')?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.success(),this.tasks.officialGroups=unique([...this.tasks.officialGroups,gameId]),(groupId=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)?.[1])&&this.#setCache("officialGroup",gameId,groupId),!0):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError(error,"Steam.joinOfficialGroup"),!1}}async#leaveOfficialGroup(gameId){try{if(this.whiteList.officialGroups.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.leaveOfficialGroup",id:gameId}),!0;if(this.#ASF)return await this.#ASF.leaveGroup(gameId);var groupId=await this.#getOfficialGroupId(gameId);if(groupId){var resultR,statusTextR,statusR,dataR,logStatus=scripts_echoLog({type:"leavingSteamOfficialGroup",text:gameId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/id/${this.#auth.userName}/home_process`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionID:this.#auth.communitySessionID,action:"leaveGroup",groupId:groupId})});if("Success"===result)return 200===data?.status?({result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}),"Success"===resultR?200===dataR?.status&&dataR.responseText.includes('id="publicGroupJoin"')?(logStatus.success(),!0):(logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1):(logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1)):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError(error,"Steam.leaveOfficialGroup"),!1}}async#getOfficialGroupId(gameId){try{var logStatus=scripts_echoLog({type:"gettingSteamOfficialGroupId",text:gameId}),groupId=this.#cache.officialGroup[gameId];if(groupId)return logStatus.success(),groupId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/games/"+gameId,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let groupId=data.responseText.match(/steam:\/\/friends\/joinchat\/([0-9]+)/)?.[1];return groupId?(this.#setCache("officialGroup",gameId,groupId),logStatus.success(),groupId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError(error,"Steam.getGroupID"),!1}}async#addToWishlist(gameId){try{if(this.#ASF)return!!await this.#ASF.addToWishlist(gameId)&&(this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0);var logStatus=scripts_echoLog({type:"addingToWishlist",text:gameId}),{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/addtowishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"!==result||200!==data?.status||!0!==data.response?.success){var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==dataR?.status)return logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1;if("CN"===this.#area&&dataR.responseText.includes('id="error_box"'))return logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#addToWishlist(gameId);if((!dataR.responseText.includes('class="queue_actions_ctn"')||!dataR.responseText.includes('class="already_in_library"'))&&(dataR.responseText.includes('class="queue_actions_ctn"')&&dataR.responseText.includes('id="add_to_wishlist_area_success" style="display: none;')||!dataR.responseText.includes('class="queue_actions_ctn"')))return logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1}return logStatus.success(),this.tasks.wishlists=unique([...this.tasks.wishlists,gameId]),!0}catch(error){return throwError(error,"Steam.addToWishlist"),!1}}async#removeFromWishlist(gameId){try{if(this.whiteList.wishlists.includes(gameId))return scripts_echoLog({type:"whiteList",text:"Steam.removeFromWishlist",id:gameId}),!0;if(this.#ASF)return await this.#ASF.removeFromWishlist(gameId);var logStatus=scripts_echoLog({type:"removingFromWishlist",text:gameId}),{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/api/removefromwishlist",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.storeSessionID,appid:gameId}),dataType:"json"});if("Success"===result&&200===data?.status&&!0===data.response?.success)return logStatus.success(),!0;var{result:resultR,statusText:statusTextR,status:statusR,data:dataR}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});if("Success"!==resultR)return logStatus.error(resultR+`:${statusTextR}(${statusR})`),!1;if(200!==dataR?.status)return logStatus.error(`Error:${dataR?.statusText}(${dataR?.status})`),!1;if("CN"===this.#area&&dataR.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result&&"skip"!==result?await this.#removeFromWishlist(gameId):!1}return dataR.responseText.includes('class="queue_actions_ctn"')&&(dataR.responseText.includes("ds_owned_flag ds_flag")||dataR.responseText.includes("add_to_wishlist_area"))?(logStatus.success(),!0):(logStatus.error(`Error:${dataR.statusText}(${dataR.status})`),!1)}catch(error){return throwError(error,"Steam.removeFromWishlist"),!1}}async#toggleFollowGame(gameId,doTask){try{var logStatus,requestData,result,data,followed;return!doTask&&this.whiteList.follows.includes(gameId)?(scripts_echoLog({type:"whiteList",text:"Steam.unfollowGame",id:gameId}),!0):this.#ASF?!!await this.#ASF.toggleFollowGame(gameId,doTask)&&(doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus=scripts_echoLog({type:`${doTask?"":"un"}followingGame`,text:gameId}),requestData={sessionid:this.#auth.storeSessionID,appid:gameId},{result,data}=(doTask||(requestData.unfollow="1"),await tools_httpRequest({url:"https://store.steampowered.com/explore/followgame/",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param(requestData)})),"Success"===result&&200===data?.status&&"true"===data.responseText?(logStatus.success(),!0):(followed=await this.#isFollowedGame(gameId),"CN"===this.#area&&"areaLocked"===followed?(logStatus.warning(i18n("changeAreaNotice")),!!await this.#changeArea()&&await this.#removeFromWishlist(gameId)):doTask===followed?(logStatus.success(),doTask&&(this.tasks.follows=unique([...this.tasks.follows,gameId])),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1)))}catch(error){return throwError(error,"Steam.toggleFollowGame"),!1}}async#isFollowedGame(gameId){try{var{result,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+gameId,method:"GET"});return"Success"===result?200===data?.status&&("CN"===this.#area&&data.responseText.includes('id="error_box"')?"areaLocked":"none"!==$(data.responseText.replace(//g,"")).find(".queue_control_button.queue_btn_follow>.btnv6_blue_hoverfade.btn_medium.queue_btn_active").css("display")):!1}catch(error){return throwError(error,"Steam.isFollowedGame"),!1}}async#toggleForum(gameId,doTask=!0){try{if(!doTask&&this.whiteList.forums.includes(gameId))scripts_echoLog({type:"whiteList",text:"Steam.unsubscribeForum",id:gameId});else{var forumId=await this.#getForumId(gameId);if(!forumId)return!1;var logStatus=scripts_echoLog({type:`${doTask?"":"un"}subscribingForum`,text:gameId}),[id,feature]=forumId.split("_"),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/forum/${id}/General/${doTask?"":"un"}subscribe/${feature||"0"}/`,method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({sessionid:this.#auth.communitySessionID})});"Success"===result?200!==data?.status||1!==data.response?.success&&29!==data.response?.success?logStatus.error(`Error:${data?.statusText}(${data?.status})`):(doTask&&(this.tasks.forums=unique([...this.tasks.forums,gameId])),logStatus.success()):logStatus.error(result+`:${statusText}(${status})`)}return!0}catch(error){return throwError(error,"Steam.toggleForum"),!0}}async#getForumId(gameId){try{var logStatus=scripts_echoLog({type:"gettingForumId",text:gameId}),forumId=this.#cache.forum[gameId];if(forumId)return logStatus.success(),forumId;var{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/app/${gameId}/discussions/`,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let forumId=data.responseText?.match(/General_([\d]+(_[\d]+)?)/)?.[1];return forumId?(this.#setCache("forum",gameId,forumId),logStatus.success(),forumId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError(error,"Steam.getForumId"),!1}}async#toggleFavoriteWorkshop(id,doTask=!0){try{if(!doTask&&this.whiteList.workshops.includes(id))return scripts_echoLog({type:"whiteList",text:"Steam.unfavoriteWorkshop",id:id}),!0;var appid=await this.#getWorkshopAppId(id);if(appid){var logStatus=scripts_echoLog({type:doTask?"favoritingWorkshop":"unfavoritingWorkshop",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:`https://steamcommunity.com/sharedfiles/${doTask?"":"un"}favorite`,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,appid:appid,sessionid:this.#auth.communitySessionID})});if("Success"===result)return 200!==data?.status||data.responseText?(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(doTask&&(this.tasks.workshops=unique([...this.tasks.workshops,id])),logStatus.success(),!0);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError(error,"Steam.toggleFavoriteWorkshop"),!1}}async#getWorkshopAppId(id){try{var logStatus=scripts_echoLog({type:"gettingWorkshopAppId",text:id}),appId=this.#cache.workshop[id];if(appId)return logStatus.success(),appId;var{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/filedetails/?id="+id,method:"GET"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let appId=data.responseText.match(//)?.[1];return appId?(this.#setCache("workshop",id,appId),logStatus.success(),appId):(logStatus.error("Error: getWorkshopAppId failed"),!1)}}catch(error){return throwError(error,"Steam.getWorkshopAppId"),!1}}async#voteUpWorkshop(id){try{var logStatus=scripts_echoLog({type:"votingUpWorkshop",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://steamcommunity.com/sharedfiles/voteup",method:"POST",responseType:"json",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({id:id,sessionid:this.#auth.communitySessionID})});return"Success"===result?200===data?.status&&1===data.response?.success?logStatus.success():logStatus.error(`Error:${data?.statusText}(${data?.status})`):logStatus.error(result+`:${statusText}(${status})`),!0}catch(error){return throwError(error,"Steam.voteupWorkshop"),!0}}async#toggleCurator(curatorId,doTask=!0){try{var logStatus,result,statusText,status,data;return!doTask&&this.whiteList.curators.includes(curatorId)?(scripts_echoLog({type:"whiteList",text:"Steam.unfollowCurator",id:curatorId}),!0):this.#ASF?await this.#ASF.toggleCurator(curatorId,doTask):(logStatus=scripts_echoLog({type:doTask?"followingCurator":"unfollowingCurator",text:curatorId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/curators/ajaxfollow",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},data:$.param({clanid:curatorId,sessionid:this.#auth.storeSessionID,follow:doTask}),dataType:"json"}),"Success"===result?200===data?.status&&1===data.response?.success?.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(`+data?.response?.success||data?.status+")"),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError(error,"Steam.toggleCurator"),!1}}async getCuratorId(path,name){try{var logStatus=scripts_echoLog({type:"gettingCuratorId",text:path+"/"+name}),curatorId=this.#cache.curator[path+"/"+name];if(curatorId)return logStatus.success(),curatorId;var{result,statusText,status,data}=await tools_httpRequest({url:`https://store.steampowered.com/${path}/`+name,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;{let curatorId=data.responseText.match(/g_pagingData.*?"clanid":([\d]+)/)?.[1];return curatorId?(this.#setCache("curator",path+"/"+name,curatorId),logStatus.success(),curatorId):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}}catch(error){return throwError(error,"Steam.getCuratorID"),!1}}async#toggleCuratorLike(link,doTask=!0){try{var curatorId,[path,name]=link.split("/");return path&&name?!!(curatorId=await this.getCuratorId(path,name))&&await this.#toggleCurator(curatorId,doTask):(scripts_echoLog({text:i18n("errorLink",link)}),!1)}catch(error){return throwError(error,"Steam.toggleCuratorLike"),!1}}async#getAnnouncementParams(appId,viewId){try{var clanid,gid,logStatus=scripts_echoLog({type:"gettingAnnouncementParams",text:appId,id:viewId}),{result,statusText,status,data}=await tools_httpRequest({url:`https://store.steampowered.com/events/ajaxgetpartnerevent?appid=${appId}&announcement_gid=${viewId}&lang_list=6_0&last_modified_time=0&origin=https:%2F%2Fstore.steampowered.com&for_edit=false`,method:"GET",responseType:"json",headers:{Host:"store.steampowered.com",Referer:`https://store.steampowered.com/news/app/${appId}/view/`+viewId}});return"Success"===result?200===data?.status&&1===data?.response?.success?({clanid,gid}=data.response.event?.announcement_body||{},clanid?(logStatus.success(),{clanId:clanid,gid:gid}):(logStatus.error(`Error:${data.statusText}(${data.status})`),{})):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),{}):(logStatus.error(result+`:${statusText}(${status})`),{})}catch(error){return throwError(error,"Steam.likeAnnouncement"),{}}}async#likeAnnouncement(id){try{var[appId,viewId]=id.split("/");if(appId&&viewId){var{clanId,gid}=await this.#getAnnouncementParams(appId,viewId);if(clanId){var logStatus=scripts_echoLog({type:"likingAnnouncement",text:appId,id:viewId}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/updated/ajaxrateupdate/"+(gid||viewId),method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:`https://store.steampowered.com/news/app/${appId}/view/`+viewId},data:$.param({sessionid:this.#auth.storeSessionID,voteup:1,clanid:clanId,ajax:1}),dataType:"json"});if("Success"===result)return 200===data?.status&&1===data.response.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}else scripts_echoLog({}).error(i18n("missParams")+"(id)");return!1}catch(error){return throwError(error,"Steam.likeAnnouncement"),!1}}async#appid2subid(id){try{var logStatus=scripts_echoLog({type:"gettingSubid",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+id,method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;if("CN"===this.#area&&data.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result&&"skip"!==result?await this.#appid2subid(id):!1}var subid=data.responseText.match(/name="subid" value="([\d]+?)"/)?.[1];return subid?(logStatus.success(),subid):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1)}catch(error){return throwError(error,"Steam.appid2subid"),!1}}async#getLicenses(){try{var logStatus=scripts_echoLog({text:i18n("gettingLicenses")}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/dynamicstore/userdata/?t="+(new Date).getTime(),method:"GET",responseType:"json"});return"Success"===result?200===data?.status?(logStatus.success(),data.response?.rgOwnedPackages):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Steam.getLicenses"),!1}}async#addLicense(id){try{if(this.#ASF)return await this.#ASF.addLicense(id);var[type,ids]=id.split("-");if("appid"===type){var subid=await this.#appid2subid(ids);if(subid){var logStatus=scripts_echoLog({type:"addingFreeLicense",text:ids});if(await this.#addFreeLicense(subid,logStatus)){var{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/app/"+ids,method:"GET"});if("Success"===result)return 200===data?.status?data.responseText.includes("ds_owned_flag ds_flag")||data.responseText.includes('class="already_in_library"')?(logStatus.success(),!0):(logStatus.error(`Error:${data.statusText}(${data.status})`),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1);logStatus.error(result+`:${statusText}(${status})`)}}return!1}if("subid"!==type)return!1;"CN"===this.#area&&(scripts_echoLog({}).success(i18n("tryChangeAreaNotice")),await this.#changeArea());var logStatusArr={},idsArr=ids.split(",");for(let subid of idsArr){let logStatus=scripts_echoLog({type:"addingFreeLicenseSubid",text:subid});if(!await this.#addFreeLicense(subid,logStatus))return!1;logStatusArr[subid]=logStatus}var licenses=await this.#getLicenses();if(!licenses)return!1;for(let subid of idsArr)licenses.includes(parseInt(subid,10))?logStatusArr[subid].success():logStatusArr[subid].error();return!0}catch(error){return throwError(error,"Steam.addLicense"),!1}}async#addFreeLicense(id,logStatusPre){try{var logStatus=logStatusPre||scripts_echoLog({type:"addingFreeLicenseSubid",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/checkout/addfreelicense",method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/account/licenses/"},data:$.param({action:"add_to_cart",sessionid:this.#auth.storeSessionID,subid:id}),dataType:"json"});if("Success"!==result)return logStatus.error(result+`:${statusText}(${status})`),!1;if(200!==data?.status)return logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1;if("CN"===this.#area&&data.responseText.includes('id="error_box"')){logStatus.warning(i18n("changeAreaNotice"));let result=await this.#changeArea();return result&&"CN"!==result?await this.#addFreeLicense(id):!1}return logStatus.success(),!0}catch(error){return throwError(error,"Steam.addFreeLicense"),!1}}async#requestPlayTestAccess(id){try{var logStatus,result,statusText,status,data;return this.#ASF?await this.#ASF.requestPlayTestAccess(id):(logStatus=scripts_echoLog({type:"requestingPlayTestAccess",text:id}),{result,statusText,status,data}=await tools_httpRequest({url:"https://store.steampowered.com/ajaxrequestplaytestaccess/"+id,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Host:"store.steampowered.com",Origin:"https://store.steampowered.com",Referer:"https://store.steampowered.com/app/"+id},data:$.param({sessionid:this.#auth.storeSessionID}),dataType:"json"}),"Success"===result?200===data?.status&&1===data?.response?.success?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1))}catch(error){return throwError(error,"Steam.requestPlayTestAccess"),!1}}async toggle({doTask=!0,groupLinks=[],officialGroupLinks=[],wishlistLinks=[],followLinks=[],forumLinks=[],workshopLinks=[],workshopVoteLinks=[],curatorLinks=[],curatorLikeLinks=[],announcementLinks=[],licenseLinks=[],playtestLinks=[]}){try{if(0<[...groupLinks,...officialGroupLinks,...forumLinks,...workshopLinks,...workshopVoteLinks].length&&!this.#communityInitialized)return scripts_echoLog({text:i18n("needInit")}),!1;if(0<[...wishlistLinks,...followLinks,...curatorLinks,...curatorLikeLinks,...announcementLinks,...licenseLinks,...playtestLinks].length&&!this.#storeInitialized)return scripts_echoLog({text:i18n("needInit")}),!1;var prom=[];if(doTask&&!globalOptions.doTask.steam.groups||!doTask&&!globalOptions.undoTask.steam.groups)scripts_echoLog({type:"globalOptionsSkip",text:"steam.groups"});else{var realGroups=this.getRealParams("groups",groupLinks,doTask,link=>link.match(/groups\/(.+)\/?/)?.[1]);if(0link.match(/games\/(.+)\/?/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/app\/([\d]+)/)?.[1]);if(0link.match(/\?id=([\d]+)/)?.[1]);if(0link.match(/\?id=([\d]+)/)?.[1]);if(doTask&&0link.match(/curator\/([\d]+)/)?.[1]),realCuratorLikes=this.getRealParams("curatorLikes",curatorLikeLinks,doTask,link=>link.match(/https?:\/\/store\.steampowered\.com\/(.*?)\/([^/?]+)/)?.slice(1,3).join("/"));if(0(link.includes("store.steampowered.com")?link.match(/store\.steampowered\.com\/news\/app\/([\d]+)\/view\/([\d]+)/):link.match(/steamcommunity\.com\/games\/([\d]+)\/announcements\/detail\/([\d]+)/))?.slice(1,3).join("/"));if(doTask&&0link.match(/app\/([\d]+)/)?.[1]);if(doTask&&globalOptions.doTask.steam.playtests&&0("CN"!==this.#area&&(scripts_echoLog({}).warning(i18n("steamFinishNotice")),await this.#changeArea("CN")),!0))}catch(error){return throwError(error,"Steam.toggle"),!1}}#setCache(type,name,id){try{this.#cache[type][name]=id,GM_setValue("steamCache",this.#cache)}catch(error){throwError(error,"Steam.setCache")}}}let social_Steam=Steam,defaultTasks=(external_Swal_namespaceObject=class{undoneTasks;socialTasks;giveawayId;socialInitialized={discord:!1,instagram:!1,reddit:!1,twitch:!1,twitter:!1,vk:!1,youtube:!1,steamStore:!1,steamCommunity:!1};initialized=!1;social={};async#bind(name,init){try{return{name:name,result:await init}}catch(error){return throwError(error,"Website.bind"),{name:name,result:!1}}}async initSocial(action){try{var steamLength,steamCommunityLength,pro=[];let tasks="do"===action?this.undoneTasks:this.socialTasks;return!(tasks.discord&&0[...total,...arr]).length)||this.socialInitialized.discord&&this.social.discord||(this.social.discord=new social_Discord,pro.push(this.#bind("discord",this.social.discord.init(action)))),!(tasks.instagram&&0[...total,...arr]).length)||this.socialInitialized.instagram&&this.social.instagram||(this.social.instagram=new social_Instagram,pro.push(this.#bind("instagram",this.social.instagram.init()))),!(tasks.reddit&&0[...total,...arr]).length)||this.socialInitialized.reddit&&this.social.reddit||(this.social.reddit=new social_Reddit,pro.push(this.#bind("reddit",this.social.reddit.init()))),!(tasks.twitch&&0[...total,...arr]).length)||this.socialInitialized.twitch&&this.social.twitch||(this.social.twitch=new social_Twitch,pro.push(this.#bind("twitch",this.social.twitch.init()))),!(tasks.twitter&&0[...total,...arr]).length)||this.socialInitialized.twitter&&this.social.twitter||(this.social.twitter=new social_Twitter,pro.push(this.#bind("twitter",this.social.twitter.init()))),!(tasks.vk&&0[...total,...arr]).length)||this.socialInitialized.vk&&this.social.vk||(this.social.vk=new social_Vk,pro.push(this.#bind("vk",this.social.vk.init()))),!(tasks.youtube&&0[...total,...arr]).length)||this.socialInitialized.youtube&&this.social.youtube||(this.social.youtube=new Youtube,pro.push(this.#bind("youtube",this.social.youtube.init()))),tasks.steam&&0<(steamLength=Object.values(tasks.steam).reduce((total,arr)=>[...total,...arr]).length)&&(this.social.steam||(this.social.steam=new social_Steam),0["groupLinks","officialGroupLinks","forumLinks","workshopLinks","workshopVoteLinks"].includes(type)&&tasks.steam?.[type]?.length||0).reduce((total,number)=>total+number,0))&&!this.socialInitialized.steamStore&&pro.push(this.#bind("steamStore",this.social.steam.init("store"))),0{let checked=!0;for(var data of result)data.result?this.socialInitialized[data.name]=data.result:checked=!1;return checked})}catch(error){return throwError(error,"Website.initSocial"),!1}}uniqueTasks(allTasks){var social,types,result={};for([social,types]of Object.entries(allTasks)){result[social]={};for(var[type,tasks]of Object.entries(types))result[social][type]=unique(tasks)}return result}async toggleTask(action){try{if(!this.initialized&&!this.init())return!1;if(!await this.classifyTask(action))return!1;if(!await this.initSocial(action))return!1;var pro=[],doTask="do"===action,tasks=doTask?this.undoneTasks:this.socialTasks;if("skip"!==this.socialInitialized.discord&&this.social.discord&&pro.push(this.social.discord.toggle({doTask:doTask,...tasks.discord})),this.social.instagram&&pro.push(this.social.instagram.toggle({doTask:doTask,...tasks.instagram})),this.social.reddit&&pro.push(this.social.reddit.toggle({doTask:doTask,...tasks.reddit})),this.social.twitch&&pro.push(this.social.twitch.toggle({doTask:doTask,...tasks.twitch})),this.social.twitter&&pro.push(this.social.twitter.toggle({doTask:doTask,...tasks.twitter})),this.social.vk&&pro.push(this.social.vk.toggle({doTask:doTask,...tasks.vk})),this.social.youtube&&pro.push(this.social.youtube.toggle({doTask:doTask,...tasks.youtube})),this.social.steam&&pro.push(this.social.steam.toggle({doTask:doTask,...tasks.steam})),this.social.visitLink&&tasks.links&&doTask)for(var link of tasks.links)pro.push(this.social.visitLink(link));return doTask&&tasks.extra&&this.extraDoTask&&0[...total,...arr]).length&&pro.push(this.extraDoTask(tasks.extra)),await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!0}catch(error){return throwError(error,"Website.toggleTask"),!1}}async doTask(){try{return await this.toggleTask("do")}catch(error){return throwError(error,"Website.doTask"),!1}}async undoTask(){try{return await this.toggleTask("undo")}catch(error){return throwError(error,"Website.undoTask"),!1}}},JSON.stringify({steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],followLinks:[]},vk:{nameLinks:[]}}));class FreeAnyWhere extends external_Swal_namespaceObject{name="FreeAnyWhere";tasks=[];socialTasks=JSON.parse(defaultTasks);undoneTasks=JSON.parse(defaultTasks);buttons=["doTask","undoTask","verifyTask","getKey"];static test(){return"freeanywhere.net"===window.location.host}async init(){try{var logStatus=scripts_echoLog({text:i18n("initing")});if(0<$('a[href="#/login"]').length)return window.open("/#/login","_self"),logStatus.warning(i18n("needLogin")),!1;if(window.location.href.includes("/login"))return logStatus.warning(i18n("needLogin")),!1;if(!/^https?:\/\/freeanywhere\.net\/#\/giveaway\/[\d]+/.test(window.location.href)){var id=window.location.href.match(/https?:\/\/freeanywhere\.net\/.*?#\/giveaway\/([\d]+)/)?.[1];if(!id)return logStatus.error(i18n("getFailed","Id")),!1;window.location.href="https://freeanywhere.net/#/giveaway/"+id}return this.#getGiveawayId()?(await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed")),this.initialized=!0,logStatus.success(),!0):!1}catch(error){return throwError(error,"Freeanywhere.init"),!1}}async classifyTask(action){try{var logStatus=scripts_echoLog({text:i18n("getTasksInfo")}),{result,statusText,status,data}=("undo"===action&&(this.socialTasks=GM_getValue("fawTasks-"+this.giveawayId)?.tasks||JSON.parse(defaultTasks)),await tools_httpRequest({url:`https://freeanywhere.net/api/v1/giveaway/${this.giveawayId}/?format=json`,method:"GET",headers:{authorization:"Token "+window.localStorage.getItem("token"),"x-csrftoken":external_Cookies_namespaceObject.get("csrftoken")},responseType:"json"}));if("Success"===result){var tasks=data?.response?.challenges;if(tasks){"verify"===action&&(this.tasks=[]);for(var task of tasks){var type=task.challenge,social=task.challenge_provider,taskInfo={id:task.id,title:task.title};if("verify"!==action||task.is_success)switch(social){case"steam":switch(taskInfo.social="steam",type){case"WL":"undo"===action&&this.socialTasks.steam.wishlistLinks.push(task.link),"do"!==action||task.is_success||this.undoneTasks.steam.wishlistLinks.push(task.link);break;case"JTG":"undo"===action&&this.socialTasks.steam.groupLinks.push(task.link),"do"!==action||task.is_success||this.undoneTasks.steam.groupLinks.push(task.link);break;case"STC":"undo"===action&&this.socialTasks.steam.curatorLinks.push(task.link),"do"!==action||task.is_success||this.undoneTasks.steam.curatorLinks.push(task.link);break;case"GF":"undo"===action&&this.socialTasks.steam.followLinks.push(task.link),"do"!==action||task.is_success||this.undoneTasks.steam.followLinks.push(task.link)}break;case"vk-oauth2":"undo"===action&&this.socialTasks.vk.nameLinks.push(task.link),"do"!==action||task.is_success||this.undoneTasks.vk.nameLinks.push(task.link);break;case"website":break;default:scripts_echoLog({}).warning(i18n("unKnownTaskType")+": "+social)}else this.tasks.push(taskInfo)}return logStatus.success(),this.undoneTasks=this.uniqueTasks(this.undoneTasks),this.socialTasks=this.uniqueTasks(this.socialTasks),window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:blue",JSON.stringify(this)),GM_setValue("fawTasks-"+this.giveawayId,{tasks:this.socialTasks,time:(new Date).getTime()}),!0}logStatus.error(`Error:${data?.statusText}(${data?.status})`)}else logStatus.error(result+`:${statusText}(${status})`);return!1}catch(error){return throwError(error,"Freeanywhere.classifyTask"),!1}}async verifyTask(){try{if(!this.initialized&&!this.init())return!1;if(0===this.tasks.length&&!await this.classifyTask("verify"))return!1;var task,pro=[];for(task of this.tasks)pro.push(this.#verify(task)),await delay(1e3);return await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!!await this.getKey(!0)}catch(error){return throwError(error,"Freeanywhere.verifyTask"),!1}}async getKey(initialized){try{if(initialized||this.initialized||this.init()){var logStatus=scripts_echoLog({text:i18n("gettingKey")}),{result,statusText,status,data}=await tools_httpRequest({url:`https://freeanywhere.net/api/v1/giveaway/${this.giveawayId}/reward/?format=json`,method:"GET",dataType:"json",headers:{authorization:"Token "+window.localStorage.getItem("token")}});if("Success"===result)return data?.response?.reward?(logStatus.success(),scripts_echoLog({}).success(data.response.reward),data.response.reward):(!1===data?.response?.completed?logStatus.error(i18n("tasksNotCompleted")):(!0===data?.response?.completed&&await this.#checkLeftKey(),logStatus.error(`Error:${data?.statusText}(${data?.status})`)),!1);logStatus.error(result+`:${statusText}(${status})`)}return!1}catch(error){return throwError(error,"FreeAnyWhere.getGiveawayId"),!1}}#getGiveawayId(){try{var giveawayId=window.location.href.match(/\/giveaway\/([\d]+)/)?.[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({}).error(i18n("getFailed","GiveawayId")),!1)}catch(error){throwError(error,"FreeAnyWhere.getGiveawayId")}}async#verify(task){try{var logStatus=scripts_echoLog({html:`
  • ${i18n("verifyingTask")}${task.title.trim()}...
  • `}),{result,statusText,status,data}=await tools_httpRequest({url:`https://freeanywhere.net/api/v1/giveaway/${this.giveawayId}/challenge-status/${task.id}/?format=json`,method:"GET",dataType:"json",headers:{authorization:"Token "+window.localStorage.getItem("token"),"x-csrftoken":external_Cookies_namespaceObject.get("csrftoken")}});return"Success"===result?data?.response?.status?(logStatus.success(),!0):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Freeanywhere.verify"),!1}}async#checkLeftKey(){try{var data;return globalOptions.other.checkLeftKey&&(data=(await tools_httpRequest({url:"https://freeanywhere.net/api/v1/widget/?format=json",method:"GET",dataType:"json",headers:{authorization:"Token "+window.localStorage.getItem("token")}})).data,data?.response?.giveaways.find(giveaway=>""+giveaway?.id===this.giveawayId)||await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(({value})=>{value&&window.close()})),!0}catch(error){return throwError(error,"Giveawaysu.checkLeftKey"),!1}}}var Freeanywhere=FreeAnyWhere;let Giveawaysu_defaultTasks={steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],curatorLikeLinks:[],followLinks:[],forumLinks:[],announcementLinks:[],workshopVoteLinks:[],playtestLinks:[]},discord:{serverLinks:[]},instagram:{userLinks:[]},vk:{nameLinks:[]},twitch:{channelLinks:[]},reddit:{redditLinks:[]},youtube:{channelLinks:[],likeLinks:[]},twitter:{userLinks:[],retweetLinks:[]}};class GiveawaySu extends external_Swal_namespaceObject{name="GiveawaySu";socialTasks=Giveawaysu_defaultTasks;undoneTasks=Giveawaysu_defaultTasks;buttons=["doTask","undoTask"];static test(){return/^https?:\/\/giveaway\.su\/giveaway\/view\/[\d]+/.test(window.location.href)}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed")),scripts_echoLog({}).warning(i18n("gsNotice"))}catch(error){throwError(error,"Giveawaysu.after")}}init(){try{var logStatus=scripts_echoLog({text:i18n("initing")});return 0<$("a.steam-login").length?(window.open("/steam/redirect","_self"),logStatus.warning(i18n("needLogin")),!1):!!this.#getGiveawayId()&&(this.initialized=!0,logStatus.success(),!0)}catch(error){return throwError(error,"Giveawaysu.init"),!1}}async classifyTask(action){try{var logStatus=scripts_echoLog({text:i18n("getTasksInfo")});if("undo"===action)this.socialTasks=GM_getValue("gasTasks-"+this.giveawayId)?.tasks||Giveawaysu_defaultTasks;else{var pro=[],tasks=$("#actions tr");$("div.bind-discord").is(":visible")&&$("div.bind-discord a")[0].click(),$("div.bind-twitch").is(":visible")&&$("div.bind-twitch a")[0].click();for(let task of tasks)pro.push(new Promise(resolve=>{var td=$(task).find('td:not(".hidden")'),colorfulTask=td.eq(1).find('a:not([data-trigger="link"])'),colorlessTask=td.eq(2).find('a:not([data-trigger="link"])'),colorfulTask=0{if(!taskLink)return resolve(!1);taskIcon.includes("steam")&&/join/gi.test(taskName)?this.undoneTasks.steam.groupLinks.push(taskLink):/like.*announcement/gi.test(taskName)?this.undoneTasks.steam.announcementLinks.push(taskLink):/(follow|subscribe).*curator/gim.test(taskName)&&/^https?:\/\/store\.steampowered\.com\/curator\//.test(taskLink)?this.undoneTasks.steam.curatorLinks.push(taskLink):taskIcon.includes("steam")&&/follow|subscribe/gim.test(taskName)?this.undoneTasks.steam.curatorLikeLinks.push(taskLink):/subscribe.*steam.*forum/gim.test(taskName)?this.undoneTasks.steam.forumLinks.push(taskLink):taskIcon.includes("thumbs-up")&&/^https?:\/\/steamcommunity\.com\/sharedfiles\/filedetails\/\?id=[\d]+/.test(taskLink)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):taskIcon.includes("plus")&&/request.*playtest/gim.test(taskName)?this.undoneTasks.steam.playtestLinks.push(taskLink):taskIcon.includes("discord")||/join.*discord/gim.test(taskName)?this.undoneTasks.discord.serverLinks.push(taskLink):taskIcon.includes("instagram")||/follow.*instagram/gim.test(taskName)?this.undoneTasks.instagram.userLinks.push(taskLink):taskIcon.includes("twitch")||/follow.*twitch.*channel/gim.test(taskName)?this.undoneTasks.twitch.channelLinks.push(taskLink):taskIcon.includes("reddit")||/subscribe.*subreddit/gim.test(taskName)||/follow.*reddit/gim.test(taskName)?this.undoneTasks.reddit.redditLinks.push(taskLink):/watch.*art/gim.test(taskName)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):/subscribe.*youtube.*channel/gim.test(taskName)?this.undoneTasks.youtube.channelLinks.push(taskLink):/(watch|like).*youtube.*video/gim.test(taskName)||(taskIcon.includes("youtube")||taskIcon.includes("thumbs-up"))&&/(watch|like).*video/gim.test(taskName)?this.undoneTasks.youtube.likeLinks.push(taskLink):taskIcon.includes("vk")||/join.*vk.*group/gim.test(taskName)?this.undoneTasks.vk.nameLinks.push(taskLink):/(on twitter)|(Follow.*on.*Facebook)/gim.test(taskName)||(/wishlist.*game|add.*wishlist/gim.test(taskName)&&this.undoneTasks.steam.wishlistLinks.push(taskLink),/follow.*button/gim.test(taskName)&&this.undoneTasks.steam.followLinks.push(taskLink)),resolve(!0)}).catch(error=>(throwError(error,"Giveawaysu.classifyTask->getRedirectLink"),!1))}));await Promise.all(pro),logStatus.success(),this.undoneTasks=this.uniqueTasks(this.undoneTasks),this.socialTasks=this.undoneTasks,window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:blue",JSON.stringify(this)),GM_setValue("gasTasks-"+this.giveawayId,{tasks:this.socialTasks,time:(new Date).getTime()})}return!0}catch(error){return throwError(error,"Giveawaysu.classifyTask"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin&&0<$("a.steam-login").length&&window.open("/steam/redirect","_self"),!0}catch(error){return throwError(error,"Giveawaysu.checkLogin"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey&&0<$(".giveaway-ended").length&&0===$(".giveaway-key").length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(({value})=>{value&&window.close()}),!0}catch(error){return throwError(error,"Giveawaysu.checkLeftKey"),!1}}#getGiveawayId(){var giveawayId=window.location.href.match(/\/view\/([\d]+)/)?.[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}}class Indiedb{name="Indiedb";buttons=["doTask"];static test(){return"www.indiedb.com"===window.location.host}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){throwError(error,"Indiedb.after")}}async doTask(){try{return await this.#join()?await this.#do():!1}catch(error){return throwError(error,"Indiedb.doTask"),!1}}async#join(){try{if(0<$("a.buttonenter:contains(Register to join)").length)scripts_echoLog({}).error(i18n("needLogin"));else{var logStatus,result,statusText,status,data,currentoption=$("a.buttonenter.buttongiveaway");if(/join giveaway/gim.test(currentoption.text()))return logStatus=scripts_echoLog({text:i18n("joiningGiveaway")+"..."}),{result,statusText,status,data}=await tools_httpRequest({url:currentoption.attr("href"),method:"POST",data:"ajax=t",dataType:"json",headers:{"content-type":"application/x-www-form-urlencoded; charset=UTF-8",accept:"application/json, text/javascript, */*; q=0.01",origin:window.location.origin}}),"Success"===result?200===data?.status?data.response?.success?(currentoption.addClass("buttonentered").text("Success - Giveaway joined"),$("#giveawaysjoined").slideDown(),$("#giveawaysrecommend").slideDown(),logStatus.success("Success"+(data.response?.text?":"+data.response?.text:"")),!0):(logStatus.error("Error"+(data.response?.text?":"+data.response?.text:"")),!1):(logStatus.error(`Error:${data?.statusText}(${data?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1);if(/success/gim.test($("a.buttonenter.buttongiveaway").text()))return!0;scripts_echoLog({}).warning(i18n("needJoinGiveaway"))}return!1}catch(error){return throwError(error,"Indiedb.init"),!1}}async#do(){try{let id=$("script").map((index,script)=>/\$\(document\)/gim.test(script.innerHTML)?[script.innerHTML.match(/"\/[\d]+"/gim)?.[0]?.match(/[\d]+/)?.[0],script.innerHTML.match(/"\/newsletter\/ajax\/subscribeprofile\/optin\/[\d]+"/gim)?.[0]?.match(/[\d]+/)?.[0]]:null);if(2!==id.length)return scripts_echoLog({}).error(i18n("getFailed","TaskId")),!1;var task,pro=[];for(task of $("#giveawaysjoined a[class*=promo]")){let promo=$(task);if(!promo.hasClass("buttonentered")){let status=scripts_echoLog({text:`${i18n("doing")}:${promo.parents("p").text()}...`});if(/facebookpromo|twitterpromo|visitpromo/gim.test(task.className)){let text="";text=promo.hasClass("facebookpromo")?"facebookpromo":promo.hasClass("twitterpromo")?"twitterpromo":"visitpromo",pro.push(new Promise(resolve=>{$.ajax({type:"POST",url:urlPath(`/giveaways/ajax/${text}/`+id[0]),timeout:6e4,dataType:"json",data:{ajax:"t"},error(response,error,exception){window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:red",{response:response,error:error,exception:exception}),status.error("Error:An error has occurred performing the action requested. Please try again shortly."),resolve(!0)},success(response){response.success?(status.success("Success:"+response.text),promo.addClass("buttonentered").closest("p").html(promo.closest("p").find("span").html())):status.error("Error:"+response.text),resolve(!0)}})}))}else promo.hasClass("emailoptinpromo")?pro.push(new Promise(resolve=>{$.ajax({type:"POST",url:urlPath("/newsletter/ajax/subscribeprofile/optin/"+id[1]),timeout:6e4,dataType:"json",data:{ajax:"t",emailsystoggle:4},error(response,error,exception){window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:red",{response:response,error:error,exception:exception}),status.error("Error:An error has occurred performing the action requested. Please try again shortly."),resolve(!0)},success(response){response.success?(status.success("Success:"+response.text),promo.toggleClass("buttonentered").closest("p").html(promo.closest("p").find("span").html())):status.error("Error:"+response.text),resolve(!0)}})})):promo.hasClass("watchingpromo")?pro.push(new Promise(resolve=>{var data=(url=>{try{let query={};return url?url.includes("?")&&url.split("?")[1].replace(/([^?&=]+)=([^&]+)/g,(str,key,value)=>(query[key]=value,str)):window.location.search.replace(/([^?&=]+)=([^&]+)/g,(str,key,value)=>(query[key]=value,str)),query}catch(error){return throwError(error,"getUrlQuery"),{}}})(promo.attr("href"));data.ajax="t",$.ajax({type:"POST",url:urlPath(promo.attr("href")?.split(/[?#]/)[0]),timeout:6e4,dataType:"json",data:data,error(response,error,exception){window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:red",{response:response,error:error,exception:exception}),status.error("Error:An error has occurred performing the action requested. Please try again shortly."),resolve(!0)},success(response){response.success?(status.success("Success:"+response.text),promo.toggleClass("buttonentered").closest("p").html(promo.closest("p").find("span").html())):status.error("Error:"+response.text),resolve(!0)}})})):/the-challenge-of-adblock/gim.test(promo.attr("href"))?status.error("Error:"+i18n("unKnownTaskType")):pro.push(new Promise(resolve=>{$.ajax({type:"POST",url:urlPath(promo.attr("href")),timeout:6e4,dataType:"json",data:{ajax:"t"},error(response,error,exception){window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:red",{response:response,error:error,exception:exception}),status.error("Error:An error has occurred performing the action requested. Please try again shortly."),resolve(!0)},success(response){response.success?(status.success("Success:"+response.text),promo.toggleClass("buttonentered").closest("p").html(promo.closest("p").find("span").html())):status.error("Error:"+response.text),resolve(!0)}})}))}}return await Promise.all(pro),scripts_echoLog({}).success(i18n("allTasksComplete")),!0}catch(error){return throwError(error,"Indiedb.classifyTask"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin&&0<$("a.buttonenter:contains(Register to join)").length&&window.open("/members/login","_self"),!0}catch(error){return throwError(error,"Indiedb.checkLogin"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey&&0<$('a.buttonenter:contains("next time"),a.buttonenter:contains("Giveaway is closed")').length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("giveawayEnded"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(({value})=>{value&&window.close()}),!0}catch(error){return throwError(error,"Indiedb.checkLeftKey"),!1}}}var website_Indiedb=Indiedb;let Keyhub_defaultTasks=JSON.stringify({steam:{groupLinks:[],officialGroupLinks:[],wishlistLinks:[],curatorLinks:[]},discord:{serverLinks:[]},extra:{videoTasks:[]},links:[]});class Keyhub extends external_Swal_namespaceObject{name="Keyhub";socialTasks=JSON.parse(Keyhub_defaultTasks);undoneTasks=JSON.parse(Keyhub_defaultTasks);buttons=["doTask","undoTask"];static test(){return"key-hub.eu"===window.location.host}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed")),$(".NSFW").hide()}catch(error){throwError(error,"Keyhub.after")}}init(){try{var logStatus=scripts_echoLog({text:i18n("initing")});return 0<$('a[href*="/connect/steam"]').length?(window.open("/connect/steam","_self"),logStatus.warning(i18n("needLogin")),!1):!!this.#getGiveawayId()&&($("#VPNoverlay").hide(),$("#mainArticleSection").show(),this.initialized=!0,logStatus.success(),!0)}catch(error){return throwError(error,"Keyhub.init"),!1}}async classifyTask(action){try{var task,logStatus=scripts_echoLog({text:i18n("getTasksInfo")}),tasks=("undo"===action&&(this.socialTasks=GM_getValue("khTasks-"+this.giveawayId)?.tasks||JSON.parse(Keyhub_defaultTasks)),$('.task:not(".googleads")').filter((index,element)=>"do"!==action||0===$(element).find("i.fa-check-circle:visible").length).find("a"));for(task of tasks){let link=$(task).attr("href");var taskData,taskDes=$(task).text().trim();link&&((/\/away\?data=/.test(link)||/steamcommunity\.com\/gid\//.test(link))&&(link=await getRedirectLink(link)||link),/https?:\/\/key-hub\.eu\/connect\/discord/.test(link)?window.open(link,"_blank"):/steamcommunity\.com\/groups\//.test(link)?("undo"===action&&this.socialTasks.steam.groupLinks.push(link),"do"===action&&this.undoneTasks.steam.groupLinks.push(link)):/steamcommunity\.com\/games\/[\d]+/.test(link)?("undo"===action&&this.socialTasks.steam.officialGroupLinks.push(link),"do"===action&&this.undoneTasks.steam.officialGroupLinks.push(link)):/store\.steampowered\.com\/app\//.test(link)&&/wishlist/gim.test(taskDes)?("undo"===action&&this.socialTasks.steam.wishlistLinks.push(link),"do"===action&&this.undoneTasks.steam.wishlistLinks.push(link)):/store\.steampowered\.com\/curator\//.test(link)?("undo"===action&&this.socialTasks.steam.curatorLinks.push(link),"do"===action&&this.undoneTasks.steam.curatorLinks.push(link)):/^https?:\/\/discord\.com\/invite\//.test(link)?("undo"===action&&this.socialTasks.discord.serverLinks.push(link),"do"===action&&this.undoneTasks.discord.serverLinks.push(link)):/^javascript:videoTask.+/.test(link)?"do"===action&&(taskData=link.match(/javascript:videoTask\('.+?','(.+?)'/)?.[1])&&this.undoneTasks.extra.videoTasks.push(taskData):/^https?:\/\/www\.instagram\.com\/.*/.test(link)||/^https?:\/\/twitter\.com\/.*/.test(link)||/^https?:\/\/www\.twitch\.tv\/.*/.test(link)||/^https?:\/\/www\.facebook\.com\/.*/.test(link)||/^https?:\/\/www\.youtube\.com\/.*/.test(link)||/^https?:\/\/store\.steampowered\.com\/developer\//.test(link)||/^https?:\/\/.*?\.itch\.io\/.*/.test(link)||/^https?:\/\/key-hub\.eu.*/.test(link)||/^https?:\/\/store\.steampowered\.com\/app\/.*/.test(link)||/^https?:\/\/qr\.streamelements\.com\/.*/.test(link)||/^https?:\/\/store\.steampowered\.com\/news\/app\/.*/.test(link)||scripts_echoLog({}).warning(`${i18n("unKnownTaskType")}: ${taskDes}(${link})`))}return logStatus.success(),this.undoneTasks=this.uniqueTasks(this.undoneTasks),this.socialTasks=this.uniqueTasks(this.socialTasks),window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:blue",JSON.stringify(this)),GM_setValue("khTasks-"+this.giveawayId,{tasks:this.socialTasks,time:(new Date).getTime()}),!0}catch(error){return throwError(error,"Keyhub.classifyTask"),!1}}async#doScriptTask(data){try{var logStatus=scripts_echoLog({text:i18n("doingKeyhubTask")}),{result,statusText,status,data:response}=await tools_httpRequest({url:"/away?data="+data,method:"GET",headers:{origin:"https://key-hub.eu",referer:"https://key-hub.eu/"}});return"Success"===result?200===response?.status?(logStatus.success(),!0):(logStatus.error(`Error:${response?.statusText}(${response?.status})`),!1):(logStatus.error(result+`:${statusText}(${status})`),!1)}catch(error){return throwError(error,"Keyhub.doScriptTask"),!1}}async extraDoTask({videoTasks}){try{var data,pro=[];for(data of videoTasks)pro.push(this.#doScriptTask(data));return Promise.all(pro).then(()=>!0)}catch(error){return throwError(error,"Keyhub.extraDoTask"),!1}}#getGiveawayId(){try{var giveawayId=window.location.href.match(/giveaway\/([\d]+)/)?.[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({}).error(i18n("getFailed","GiveawayId")),!1)}catch(error){return throwError(error,"Keyhub.getGiveawayId"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey&&"0"===$("#keysleft").text().trim()&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(({value})=>{value&&window.close()}),!0}catch(error){return throwError(error,"Keyhub.checkLeftKey"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin&&0<$('a[href*="/connect/steam"]').length&&window.open("/connect/steam","_self"),!0}catch(error){return throwError(error,"Keyhub.checkLogin"),!1}}}var website_Keyhub=Keyhub;let Givekey_defaultTasks=JSON.stringify({steam:{groupLinks:[],wishlistLinks:[],curatorLinks:[],curatorLikeLinks:[]},twitter:{userLinks:[]},vk:{nameLinks:[]},discord:{serverLinks:[]}});class Givekey extends external_Swal_namespaceObject{name="Givekey";tasks=[];socialTasks=JSON.parse(Givekey_defaultTasks);undoneTasks=JSON.parse(Givekey_defaultTasks);userId;buttons=["doTask","undoTask","verifyTask"];static test(){return"givekey.ru"===window.location.host}async after(){try{await new Promise(resolve=>{let checker=setInterval(()=>{0<$("#navbarDropdown").length&&(clearInterval(checker),resolve(!0))})}),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){return throwError(error,"Givekey.after"),!1}}init(){try{var userId,logStatus=scripts_echoLog({text:i18n("initing")});return 0<$('a[href*="/auth/steam"]').length?(window.open("/auth/steam","_self"),logStatus.warning(i18n("needLogin")),!1):!!this.#getGiveawayId()&&((userId=$('meta[name="user-id"]').attr("content"))?(this.userId=userId,this.initialized=!0,logStatus.success(),!0):(logStatus.error(i18n("getFailed",i18n("userId"))),!1))}catch(error){return throwError(error,"Givekey.init"),!1}}async classifyTask(action){try{var task,logStatus=scripts_echoLog({text:i18n("getTasksInfo")}),tasks=("undo"===action&&(this.socialTasks=GM_getValue("gkTasks-"+this.giveawayId)?.tasks||JSON.parse(Givekey_defaultTasks)),$('.card-body:has("button") .row'));for(task of tasks){var taskEle=$(task),isSuccess=/Complete/i.test(taskEle.find("button").text().trim());if(!isSuccess||"undo"===action){var taskId=taskEle.find("#task_check").attr("data-id");if(taskId&&this.tasks.push(taskId),"verify"!==action){let href=taskEle.find("a").attr("href")||null;var text=taskEle.find("a").text().trim(),icon=taskEle.find("i");href&&text&&(href=/^https?:\/\/givekey\.ru\/giveaway\/[\d]+\/execution_task/.test(href)?await getRedirectLink(href):href)&&(/^https?:\/\/vk\.com\//.test(href)?(this.socialTasks.vk.nameLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.vk.nameLinks.push(href)):/^https?:\/\/steamcommunity\.com\/groups/.test(href)?(this.socialTasks.steam.groupLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.steam.groupLinks.push(href)):/^https?:\/\/store\.steampowered\.com\/app\//.test(href)?(this.socialTasks.steam.wishlistLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.steam.wishlistLinks.push(href)):/Subscribe/gi.test(text)&&icon.hasClass("fa-steam-square")?/^https?:\/\/store\.steampowered\.com\/curator\//.test(href)?(this.socialTasks.steam.curatorLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.steam.curatorLinks.push(href)):(this.socialTasks.steam.curatorLikeLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.steam.curatorLikeLinks.push(href)):/^https?:\/\/twitter\.com\//.test(href)&&/Subscribe/gi.test(text)?(this.socialTasks.twitter.userLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.twitter.userLinks.push(href)):icon.hasClass("fa-discord")||/^https?:\/\/discord\.com\/invite\//.test(href)?(this.socialTasks.discord.serverLinks.push(href),"do"!==action||isSuccess||this.undoneTasks.discord.serverLinks.push(href)):scripts_echoLog({}).warning(`${i18n("unKnownTaskType")}: ${text}(${href})`))}}}return logStatus.success(),this.tasks=unique(this.tasks),this.undoneTasks=this.uniqueTasks(this.undoneTasks),this.socialTasks=this.uniqueTasks(this.socialTasks),window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:blue",JSON.stringify(this)),GM_setValue("gkTasks-"+this.giveawayId,{tasks:this.socialTasks,time:(new Date).getTime()}),!0}catch(error){return throwError(error,"Givekey.classifyTask"),!1}}async verifyTask(){try{if(!this.initialized&&!this.init())return!1;if(0===this.tasks.length&&!await this.classifyTask("verify"))return!1;scripts_echoLog({}).warning(i18n("giveKeyNoticeBefore"));var taskLength=this.tasks.length;for(let i=0;i${i18n("giveKeyNoticeAfter")}`}),!0}catch(error){return throwError(error,"Givekey.verifyTask"),!1}}async#verify(task){try{let logStatus=scripts_echoLog({html:`
  • ${i18n("verifyingTask")}${task}...
  • `});return await new Promise(resolve=>{$.ajax({url:"https://givekey.ru/giveaway/task",method:"POST",data:`id=${task}&user_id=`+this.userId,dataType:"json",headers:{"X-CSRF-TOKEN":$('meta[name="csrf-token"]').attr("content")},success:data=>{data.btn&&$(`button[data-id=${this.userId}]`).html(data.btn),"ok"===data.status?($(".task_check_"+data.id).html(``),logStatus.success(),resolve(!0)):"end"===data.status?(logStatus.success(),scripts_echoLog({}).success(data.key),resolve(!0)):(logStatus.error("Error:"+data.msg),resolve(!1))},error:xhr=>{logStatus.error(`Error:${xhr.statusText}(${xhr.status})`),resolve(!1)}})})}catch(error){return throwError(error,"Givekey.verify"),!1}}#getGiveawayId(){try{var giveawayId=window.location.href.match(/giveaway\/([\d]+)/)?.[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}catch(error){return throwError(error,"Givekey.getGiveawayId"),!1}}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey&&!$("#keys_count").text()&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("noKeysLeft"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(({value})=>{value&&window.close()}),!0}catch(error){return throwError(error,"Givekey.checkLeftKey"),!1}}}var website_Givekey=Givekey;class GiveeClub extends GiveawaySu{name="GiveeClub";buttons=["doTask","undoTask","verifyTask"];static test(){return/^https?:\/\/givee\.club\/.*?\/event\/[\d]+/.test(window.location.href)}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),await this.#checkLeftKey()||scripts_echoLog({}).warning(i18n("checkLeftKeyFailed"))}catch(error){throwError(error,"GiveeClub.after")}}init(){try{var logStatus=scripts_echoLog({text:i18n("initing")});return this.#checkLogin()?!!this.#getGiveawayId()&&(this.initialized=!0,logStatus.success(),!0):(logStatus.warning(i18n("needLogin")),!1)}catch(error){return throwError(error,"GiveeClub.init"),!1}}async classifyTask(action){try{var logStatus=scripts_echoLog({text:i18n("getTasksInfo")});if("undo"===action)this.socialTasks=GM_getValue("gcTasks-"+this.giveawayId)?.tasks||Giveawaysu_defaultTasks;else{var pro=[];for(let task of $(".event-actions tr"))pro.push(new Promise(resolve=>{let taskDes=$(task).find(".event-action-label a"),taskIcon=$(task).find(".event-action-icon i").attr("class")||"",taskName=taskDes.text().trim(),taskType=$(task).find("button[data-type]")?.attr("data-type");var taskFinished=$(task).find(".event-action-buttons .btn-success")?.length;if(taskIcon.includes("ban")||/AdBlock/i.test(taskName)||taskIcon.includes("envelope")||taskFinished)return resolve(!0);getRedirectLink(taskDes.attr("href")).then(taskLink=>{if(!taskLink)return resolve(!1);"steam.group.join"===taskType&&/^https?:\/\/steamcommunity\.com\/groups/.test(taskLink)?this.undoneTasks.steam.groupLinks.push(taskLink):/like.*announcement/gi.test(taskName)?this.undoneTasks.steam.announcementLinks.push(taskLink):"steam.game.wishlist"===taskType&&/^https?:\/\/store\.steampowered\.com\/app\//.test(taskLink)?this.undoneTasks.steam.wishlistLinks.push(taskLink):"steam.game.wishlist"===taskType&&taskDes.attr("data-steam-wishlist-appid")?this.undoneTasks.steam.wishlistLinks.push("https://store.steampowered.com/app/"+taskDes.attr("data-steam-wishlist-appid")):"steam.game.follow"===taskType&&/^https?:\/\/store\.steampowered\.com\/app\//.test(taskLink)?this.undoneTasks.steam.followLinks.push(taskLink):/^https?:\/\/store\.steampowered\.com\/curator\//.test(taskLink)?this.undoneTasks.steam.curatorLinks.push(taskLink):taskIcon.includes("steam")&&/follow|subscribe/gim.test(taskName)?this.undoneTasks.steam.curatorLikeLinks.push(taskLink):/subscribe.*steam.*forum/gim.test(taskName)?this.undoneTasks.steam.forumLinks.push(taskLink):taskIcon.includes("discord")?this.undoneTasks.discord.serverLinks.push(taskLink):taskIcon.includes("instagram")?this.undoneTasks.instagram.userLinks.push(taskLink):taskIcon.includes("twitch")?this.undoneTasks.twitch.channelLinks.push(taskLink):taskIcon.includes("reddit")?this.undoneTasks.reddit.redditLinks.push(taskLink):/watch.*art/gim.test(taskName)?this.undoneTasks.steam.workshopVoteLinks.push(taskLink):/subscribe.*youtube.*channel/gim.test(taskName)?this.undoneTasks.youtube.channelLinks.push(taskLink):/(watch|like).*youtube.*video/gim.test(taskName)||(taskIcon.includes("youtube")||taskIcon.includes("thumbs-up"))&&/(watch|like).*video/gim.test(taskName)?this.undoneTasks.youtube.likeLinks.push(taskLink):taskIcon.includes("vk")||/join.*vk.*group/gim.test(taskName)?this.undoneTasks.vk.nameLinks.push(taskLink):taskIcon.includes("twitter")?/https?:\/\/twitter\.com\/[^/]+\/?$/gim.test(taskLink)?this.undoneTasks.twitter.userLinks.push(taskLink):/https?:\/\/twitter\.com\/[^/]+?\/status\/[\d]+/gim.test(taskLink)&&this.undoneTasks.twitter.retweetLinks.push(taskLink):/(on twitter)|(Follow.*on.*Facebook)/gim.test(taskName)||/follow.*button/gim.test(taskName)&&this.undoneTasks.steam.followLinks.push(taskLink),resolve(!0)}).catch(error=>(throwError(error,"GiveeClub.classifyTask->getRedirectLink"),!1))}));await Promise.all(pro),logStatus.success(),this.undoneTasks=this.uniqueTasks(this.undoneTasks),this.socialTasks=this.undoneTasks,window.DEBUG&&console.log("%cAuto-Task[Debug]:","color:blue",JSON.stringify(this)),GM_setValue("gcTasks-"+this.giveawayId,{tasks:this.socialTasks,time:(new Date).getTime()})}return!0}catch(error){return throwError(error,"GiveeClub.classifyTask"),!1}}async verifyTask(){try{var button,logStatus=scripts_echoLog({text:i18n("giveeClubVerifyNotice")});for(button of $(".event-actions tr button").has("i.glyphicon-refresh").not('[data-type="user.adblock"]'))button.click(),"steam.game.wishlist"!==$(button).attr("data-type")&&await delay(1e3);return logStatus.warning(i18n("giveeClubVerifyFinished")),!0}catch(error){return throwError(error,"Givekey.verifyTask"),!1}}#checkLogin(){try{return globalOptions.other.checkLogin&&0<$('a[href*="/account/auth"]').length&&window.open($('a[href*="/account/auth"]').attr("href"),"_self"),!0}catch(error){return throwError(error,"GiveeClub.checkLogin"),!1}}#getGiveawayId(){var giveawayId=window.location.href.match(/\/event\/([\d]+)/)?.[1];return giveawayId?(this.giveawayId=giveawayId,!0):(scripts_echoLog({text:i18n("getFailed","GiveawayId")}),!1)}async#checkLeftKey(){try{return globalOptions.other.checkLeftKey&&0<$(".event-ended").length&&0===$(".event-winner").length&&await external_Swal_default().fire({icon:"warning",title:i18n("notice"),text:i18n("giveawayEnded"),confirmButtonText:i18n("confirm"),cancelButtonText:i18n("cancel"),showCancelButton:!0}).then(({value})=>{value&&window.close()}),!0}catch(error){return throwError(error,"Giveawaysu.checkLeftKey"),!1}}}var website_GiveeClub=GiveeClub,website_OpiumPulses=class{name="OpiumPulses";options={maxPoint:"99999999",...GM_getValue("OpiumPulsesOptions")};maxPoints=99999999;myPoints=0;buttons=["doFreeTask","doPointTask"];static test(){return"www.opiumpulses.com"===window.location.host}async after(){try{this.#checkLogin()||scripts_echoLog({}).warning(i18n("checkLoginFailed")),this.maxPoints=parseInt(this.options.maxPoint,10)}catch(error){throwError(error,"OpiumPulses.after")}}async doFreeTask(){try{this.#toggleTask("FREE")}catch(error){throwError(error,"OpiumPulses.doFreeTask")}}async doPointTask(){try{this.myPoints=parseInt($(".page-header__nav-func-user-nav-items.points-items").text().match(/[\d]+/gim)?.[0]||"0",10),this.#toggleTask("points")}catch(error){throwError(error,"OpiumPulses.doPointTask")}}async#toggleTask(type){try{var item;for(item of $(`.giveaways-page-item:contains('${type}'):not(:contains('ENTERED'))`)){var logStatus,aElement,giveawayId,result,statusText,status,data,result0,statusText0,status0,data0,points,needPoints=parseInt($(item).find(".giveaways-page-item-header-points").text().match(/[\d]+/gim)?.[0]||"999999",10),name=$(item).find(".giveaways-page-item-footer-name").text().trim();"points"===type&&needPoints>this.myPoints?scripts_echoLog({}).warning(i18n("noPoints")+": "+name):"points"!==type||needPoints?"points"===type&&needPoints>this.maxPoints||(logStatus=scripts_echoLog({text:`${i18n("joiningLottery")}${name}...`}),(aElement=$(item).find("a.giveaways-page-item-img-btn-enter:contains('enter')"))?.attr("onclick")?.includes("checkUser")&&(giveawayId=aElement.attr("onclick")?.match(/[\d]+/)?.[0])&&checkUser(giveawayId),aElement.attr("href")?({result,statusText,status,data}=await tools_httpRequest({url:aElement.attr("href"),method:"GET"}),"Success"===result?({result:result0,statusText:statusText0,status:status0,data:data0}=await tools_httpRequest({url:data?.finalUrl,method:"GET"}),data0?.responseText&&/You've entered this giveaway/gim.test(data0.responseText)?(logStatus.success(),points=data0.responseText.match(/Points:[\s]*?([\d]+)/)?.[1],"points"===type&&points&&(this.myPoints=parseInt(points,10))):data0?.responseText&&/You're not eligible to enter/gim.test(data0.responseText)?logStatus.error("You're not eligible to enter"):logStatus.error(result0+`:${statusText0}(${status0})`)):logStatus.error(result+`:${statusText}(${status})`)):logStatus.error('Error: No "href".')):scripts_echoLog({}).warning(i18n("getNeedPointsFailed")+": "+name)}scripts_echoLog({text:"-----END-----"})}catch(error){throwError(error,"OpiumPulses.toggleTask")}}init(){return!0}classifyTask(){return!0}#checkLogin(){try{return globalOptions.other.checkLogin&&1<$('a[href*="/site/login"]').length&&window.open("/site/login","_self"),!0}catch(error){return throwError(error,"OpiumPulses.checkLogin"),!1}}},dayjs_min=__webpack_require__(353),dayjs_min_default=__webpack_require__.n(dayjs_min);let website_leftKeyChecker={async classify(link){try{return/^https?:\/\/giveaway\.su\/giveaway\/view\/[\d]+/.test(link)?await this.giveawaySu(link):/^https?:\/\/givee\.club\/[\w]+?\/event\/[\d]+/.test(link)?await this.giveeClub(link):/^https?:\/\/gleam\.io\/.+?\/.+/.test(link)?await this.gleam(link):/^https?:\/\/www\.indiedb\.com\/giveaways\/.+/.test(link)?await this.indieDb(link):/^https?:\/\/key-hub\.eu\/giveaway\/[\d]+/.test(link)?await this.keyhub(link):/^https?:\/\/opquests\.com\/quests\/[\d]+/.test(link)?await this.opquests(link):!!/^https?:\/\/itch\.io\/s\/[\d]+?\/.*/.test(link)&&await this.itch(link)}catch(error){return throwError(error,"leftKeyChecker.classify"),!1}},async giveawaySu(link){try{var{result,data}=await tools_httpRequest({url:link,method:"GET"});return"Success"===result&&200===data?.status?!data.responseText.includes('class="steam-login"')&&(data.responseText.includes('class="giveaway-ended"')?"Ended":"Active"):!1}catch(error){return throwError(error,"leftKeyChecker.giveawaySu"),!1}},async giveeClub(link){try{var{result,data}=await tools_httpRequest({url:link,method:"GET"});return"Success"===result&&200===data?.status?data.responseText.includes('class="event-winner"')?"Won":data.responseText.includes('class="event-ended"')?"Ended":"Active":!1}catch(error){return throwError(error,"leftKeyChecker.giveeClub"),!1}},async gleam(link){try{var campaignDiv,campaignString,campaign,{result,data}=await tools_httpRequest({url:link,method:"GET"});return"Success"===result&&200===data?.status?/incentives":{"[\d]+?":\[".+?"\]/.test(data.responseText)?"Won":!!(campaignDiv=data.responseText.match(/