functionMagicJS(e="MagicJS",t="INFO"){constr=()=>{conste=typeof$loon!=="undefined";constt=typeof$task!=="undefined";constn=typeofmodule!=="undefined";constr=typeof$httpClient!=="undefined"&&!e;consts=typeof$storm!=="undefined";consti=typeof$environment!=="undefined"&&typeof$environment["stash-build"]!=="undefined";consto=r||e||s||i;constl=typeofimportModule!=="undefined";return{isLoon:e,isQuanX:t,isNode:n,isSurge:r,isStorm:s,isStash:i,isSurgeLike:o,isScriptable:l,getname(){if(e){return"Loon"}elseif(t){return"QuantumultX"}elseif(n){return"NodeJS"}elseif(r){return"Surge"}elseif(l){return"Scriptable"}else{return"unknown"}},getbuild(){if(r){return$environment["surge-build"]}elseif(i){return$environment["stash-build"]}elseif(s){return$storm.buildVersion}},getlanguage(){if(r||i){return$environment["language"]}},getversion(){if(r){return$environment["surge-version"]}elseif(i){return$environment["stash-version"]}elseif(s){return$storm.appVersion}elseif(n){returnprocess.version}},getsystem(){if(r){return$environment["system"]}elseif(n){returnprocess.platform}},getsystemVersion(){if(s){return$storm.systemVersion}},getdeviceName(){if(s){return$storm.deviceName}}}};consts=(n,e="INFO")=>{letr=e;consts={SNIFFER:6,DEBUG:5,INFO:4,NOTIFY:3,WARNING:2,ERROR:1,CRITICAL:0,NONE:-1};consti={SNIFFER:"",DEBUG:"",INFO:"",NOTIFY:"",WARNING:"❗ ",ERROR:"❌ ",CRITICAL:"❌ ",NONE:""};constt=(e,t="INFO")=>{if(!(s[r]<s[t.toUpperCase()]))console.log(`[${t}] [${n}]\n${i[t.toUpperCase()]}${e}\n`)};consto=e=>{r=e};return{setLevel:o,sniffer:e=>{t(e,"SNIFFER")},debug:e=>{t(e,"DEBUG")},info:e=>{t(e,"INFO")},notify:e=>{t(e,"NOTIFY")},warning:e=>{t(e,"WARNING")},error:e=>{t(e,"ERROR")},retry:e=>{t(e,"RETRY")}}};returnnewclass{constructor(e,t){this._startTime=Date.now();this.version="3.0.0";this.scriptName=e;this.env=r();this.logger=s(e,t);this.http=typeofMagicHttp==="function"?MagicHttp(this.env,this.logger):undefined;this.data=typeofMagicData==="function"?MagicData(this.env,this.logger):undefined;this.notification=typeofMagicNotification==="function"?MagicNotification(this.scriptName,this.env,this.logger,this.http):undefined;this.utils=typeofMagicUtils==="function"?MagicUtils(this.env,this.logger):undefined;this.qinglong=typeofMagicQingLong==="function"?MagicQingLong(this.env,this.data,this.logger):undefined;if(typeofthis.data!=="undefined"){lete=this.data.read("magic_loglevel");constn=this.data.read("magic_bark_url");if(e){this.logger.setLevel(e.toUpperCase())}if(n){this.notification.setBark(n)}}}getisRequest(){returntypeof$request!=="undefined"&&typeof$response==="undefined"}getisResponse(){returntypeof$response!=="undefined"}getisDebug(){returnthis.logger.level==="DEBUG"}getrequest(){returntypeof$request!=="undefined"?$request:undefined}getresponse(){if(typeof$response!=="undefined"){if($response.hasOwnProperty("status"))$response["statusCode"]=$response["status"];if($response.hasOwnProperty("statusCode"))$response["status"]=$response["statusCode"];return$response}else{returnundefined}}done=(e={})=>{this._endTime=Date.now();lett=(this._endTime-this._startTime)/1e3;this.logger.info(`SCRIPT COMPLETED: ${t} S.`);if(typeof$done!=="undefined"){$done(e)}}}(e,t)}functionMagicHttp(u,f){constt="Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Mobile/15E148 Safari/604.1";constn="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36 Edg/84.0.522.59";letc;if(u.isNode){constl=require("axios");c=l.create()}classe{constructor(e=true){this.handlers=[];this.isRequest=e}use(e,t,n){this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:false,runWhen:n?n.runWhen:null});returnthis.handlers.length-1}eject(e){if(this.handlers[e]){this.handlers[e]=null}}forEach(t){this.handlers.forEach(e=>{if(e!==null){t(e)}})}}functionr(e){letn={...e};if(!!n.params){if(!u.isNode){lete=Object.keys(n.params).map(e=>{constt=encodeURIComponent(e);n.url=n.url.replace(