/* 一键价保 cron:55 2,19 * * * jd_prices.js */ const $ = new Env('一键价保') var iil='jsjiami.com.v7';const l11i11=iii1II;(function(ll1lI,l1iii,IIlli,l1iil,ii1l1,lIIill,I11iIi){return ll1lI=ll1lI>>0x9,lIIill='hs',I11iIi='hs',function(I1ilII,I11iIl,l1l11l,IilIil,l1iIi){const lIII1i=iii1II;IilIil='tfi',lIIill=IilIil+lIIill,l1iIi='up',I11iIi+=l1iIi,lIIill=l1l11l(lIIill),I11iIi=l1l11l(I11iIi),l1l11l=0x0;const l1l11i=I1ilII();while(!![]&&--l1iil+I11iIl){try{IilIil=-parseInt(lIII1i(0x11a,'Li*J'))/0x1*(-parseInt(lIII1i(0xb9,'L8Iv'))/0x2)+-parseInt(lIII1i(0xd3,'@d6i'))/0x3*(-parseInt(lIII1i(0x10e,']J2v'))/0x4)+parseInt(lIII1i(0xde,'1Z8w'))/0x5*(-parseInt(lIII1i(0xd9,'fcGn'))/0x6)+-parseInt(lIII1i(0xbb,'Tit8'))/0x7+parseInt(lIII1i(0x108,'6ttn'))/0x8*(-parseInt(lIII1i(0x120,'fcGn'))/0x9)+-parseInt(lIII1i(0x9d,'gONG'))/0xa*(parseInt(lIII1i(0xe6,'@d6i'))/0xb)+-parseInt(lIII1i(0x89,'80aF'))/0xc*(-parseInt(lIII1i(0xd5,'0WuM'))/0xd);}catch(l1iIl){IilIil=l1l11l;}finally{l1iIi=l1l11i[lIIill]();if(ll1lI<=l1iil)l1l11l?ii1l1?IilIil=l1iIi:ii1l1=l1iIi:l1l11l=l1iIi;else{if(l1l11l==ii1l1['replace'](/[kFwXutRlQpqbTfxOWYJ=]/g,'')){if(IilIil===I11iIl){l1l11i['un'+lIIill](l1iIi);break;}l1l11i[I11iIi](l1iIi);}}}}}(IIlli,l1iii,function(illIll,iIli1I,Iiil1,iiilli,l1iIIl,iiilll,lI11Il){return iIli1I='\x73\x70\x6c\x69\x74',illIll=arguments[0x0],illIll=illIll[iIli1I](''),Iiil1='\x72\x65\x76\x65\x72\x73\x65',illIll=illIll[Iiil1]('\x76'),iiilli='\x6a\x6f\x69\x6e',(0x15fb05,illIll[iiilli](''));});}(0x18000,0x52a30,Iii11l,0xc2),Iii11l)&&(iil=0x3882);const jdCookie=require(l11i11(0x94,'X2d8')),notify=require(l11i11(0x96,'lwms')),common=require(l11i11(0xe7,')UES')),{H5st}=require(l11i11(0xb0,'BS@t')),isNotify=process[l11i11(0x11c,'$eQ$')][l11i11(0x10a,'fcGn')]==='true';let cookie='';function Iii11l(){const l1l11I=(function(){return[iil,'FXjtspjbOpiamTbiuq.WckowmJ.RWvlY7tQfFOJx==','W4/dJMZcKCoVa8oO','WRhORAZMSyBLPyFOTkFdPEkDRbZMLlRLKztLUiRML7NMJRu','W5jBWRNdLG','WOxdRf/dU8oYWOJdMW','gSkzW6VcUSo8W6y','W4tcJN4pxcBdPutdG8k2Fa','hCkzW44','WOHyd8o7W6u','W4JdGua','5P6T5Q+55OUj5yQa5l+S5lMZ','a8kdW4RdQSod','W6xcQKDavq','W53dK3tdV8kiySkdW7y1','FSk0WPXQW5j7','WPZcNCoghxbgkYZdSmowwr3cLSkMW5y','nSkNW5K+W78','xg/cOXTg','fComWRVdRatdSmkKWP3dTx/dUZ14F2FcQ8kiiKZdLmkFi8oIWQtdVuLKrCo6W5PoW4zb','rmogWR7dJmk8W4ChEHyRW44','WOtcPYhcOqiZWO7cOG','jUISRoAYL+wsQow6V8oY','WOWjWOf3guJdHG','W7b8WO0Y','W5JdRSoMW68KiG','W7ZdVNCfy8kIWPu','W7NdR3agCCo/W58tWRFdQSo3W73cVK7dKmkdWRpcKCk7o2OVlSo/WOu','W4fUWPWHnevNW7C','WOxdLKK','W6KYtspdH8kGDW','WQRdHSoi','hKFcMSoTWQGekmk6WQClWRa','FXuP','WRSqcq','W5hcJahdU8oqWQ8CbNVcNSorFKu','WOVcNGldLmkt','fNxdVe8b','W4ldJmkVxJTSmJ/dG8oxzW','W7v1WPmWpa','W6G4wq','WQaZW40','WPxcLSo3c2Ti','nHZdVsX+pCkMWRX2','WPdcOCkuAmkB','hxddKL8z','yoITRUAXJowLQUI2UCoA4P6caq','D8o3lmkUfH7cSCk9WRm','5lMphb7LHBZKVAFKUAOhWRC','nmkKW6/cK8on','AeNcVJ5xgmkj','W6pdMCoSW7K/','xHhdKSkVW7WEeW'].concat((function(){return['bCk8WPeKWRpcL13cL30bWRC','W5S1Ec10q2GYu8kL','W7XJCmkxfG','W7LcWQ1XWQtdVdZdGmk8W6FcPbmCW6NcM0avjCk+W7rwhfXvlCoeW6K','WO/dKfy','xdfOsSoomwy','Db01DXLE','W6RcI0T7svFdUcydWRlcJZrYya','WPL1Dq','mLRdHM4yl8kPWO8','W4tcJNGmpGldHvhdR8kG','jEIVM+AYJ+wsGow6OL8','WPRINRyh','W4PoWQddQa8','fCoeW4/cS8ka','hmozWQRdPaJdOCk2','WQWBdgxcPCkrD8oGpdrXxq','ECogAW','uSolqZtcJSkvW5uPWQZcR8kNWQxcGSorpXRcQd9RtG','y8oecSkYWP46u8omESoxWPRdHG','6lEm5yY55PAI5PAc','WRNcG8oliKG','WPvIlSouW7uKWRPiWQNcPsuKW4S','WRvHl8ohW48GWPrc','WRxcQXxdRW','qSoIW5zXWPFcO3FcUw4R','z8kUWQD/W4m','emoDWR/dOq','W6BdG2fUWOO','CHZdKhe/iSk3W4uJWOuYCSoXCCo3Fq','W5dcJWhcRmkVW55Ngfi','W5JcNCk3rwq','W6ldR3yFBmkIWPLAWQm','WPFcKCoZdKq','oMRcMqS','W6X4WRtdSt0','W73dTgm','WRpcHr7dQmk1','W5vCWRTQiLxdICka','pCkLBCkAndVcO8klWRyVWOpdQ8kMtw8','CSkQpM3cQ8ojl09HW5BdUw3dKq','FdGGWORdUq','WPCoW6NcKx9+avtcUcPt','tXVdJCkUW7WdeW','rrRdH8k/W6e','W6ZcVmkJD1i','zSk0WRDQW4GVxfybWQddImkdqmk2W4W9hJ8+bve','WPBcNr4+W5eAygtdMSoetW','WOxcNHq','sXhdL8kxW7WEfmkmWOSx','mfZdGG','FVcWKkJcOoI+VEIJN+E4LUADTCkw','k1ldJhe'].concat((function(){return['W6NdSg8+vW','eftdSgiB','W57dVvq3AW','WQn9jmobW6qVWO0kWPpcQdaV','WP7dVf3dVmoYWONdMW','tConua','W5rjBeFdQq','WPFcGtxdI8kQr8krW4aWwsuMx1OD','oCoUfq','zSoTW7RdVSo9','WOFcTSkzWQy3WR0','qmkoWO7dOIxdICkdWRW','nCk3W64SW6ddGsK','W5CNC8keWRz1WPHGWQRcUrG7','W6hcGvG','fCkzW4FdOa','ASkHWRD7','W4FdI8oyl2f2iq8','bmo0tbZdUa','vvVcMsT8','WQmZDYhcMG','u8kOWRaxzCkZW57cQW','WQRcMXVcUqCbnb49CSk3mW','W6JdMSoGW6yT','44cH5O6e56sH44cO6k2y5ysE6i605y+dAmkNDmkDW7xcLq','ohFcNIRdQa','qCowlCkKWRS','vCkTrW7cL8kehEw+OEwLOUoaQEs7Pos7ToI3J+woHW','ySoSW4epW6/dTdNcRa','WO0fcd7cG8oEr8oHmbhdGa','rSkiW7lcS1RdVmk9WO7dR1pdOW','W4pcPKVdQ8o+WPBdM0ddVCoxWPNcRSkJh8kiWPNdLmk5s8kGWOT6ca','W57dVaFcQaqiWQxcKG','WRmBdgBcQ8kyyq','W7RcJ1zd','W7qIttG','AapdRgSmnmkUWRi','W6pcT8k2C1tdPru','WPpdMSokefbkd8kE','WPZcOJBdLSkg','sqBdKCk1W6S','bwFdRfuz','WPNdI2JcV8kx','h8kyW7/cMSo8W6a','W6r8WOSYf1DoW7pdI8oj','WRSgfMe','WOGoWQFdICkf','W7FcOCkO','cCoXj2BdUG','WOD3pSo2W64UWPjoWQlcHYeMW4PZ','4P65W6pMN53NNiBORQ7MSPVdQa','WPBcGtldUmkQrSkjW4Wy'];}()));}()));}());Iii11l=function(){return l1l11I;};return Iii11l();};const cookiesArr=Object['keys'](jdCookie)[l11i11(0x11b,'qvCu')](I1i11l=>jdCookie[I1i11l])[l11i11(0x99,'qvCu')](llIlii=>llIlii);!cookiesArr[0x0]&&($['msg']($['name'],'【提示】请先获取Cookie'),process[l11i11(0xf5,'$eQ$')](0x1));function iii1II(_0x2c49df,_0x2f7802){const _0x13662a=Iii11l();return iii1II=function(_0x35ea90,_0x577df4){_0x35ea90=_0x35ea90-0x88;let _0x2eb87f=_0x13662a[_0x35ea90];if(iii1II['zfqlTC']===undefined){var _0x587113=function(_0x3d0854){const _0x1b0b70='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x26b35b='',_0x5bf946='';for(let _0x31028b=0x0,_0x5c6ae9,_0x3c4912,_0x3c4465=0x0;_0x3c4912=_0x3d0854['charAt'](_0x3c4465++);~_0x3c4912&&(_0x5c6ae9=_0x31028b%0x4?_0x5c6ae9*0x40+_0x3c4912:_0x3c4912,_0x31028b++%0x4)?_0x26b35b+=String['fromCharCode'](0xff&_0x5c6ae9>>(-0x2*_0x31028b&0x6)):0x0){_0x3c4912=_0x1b0b70['indexOf'](_0x3c4912);}for(let _0x32c2d4=0x0,_0x306dd7=_0x26b35b['length'];_0x32c2d4<_0x306dd7;_0x32c2d4++){_0x5bf946+='%'+('00'+_0x26b35b['charCodeAt'](_0x32c2d4)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5bf946);};const _0x176e80=function(_0x9c62a2,_0x110d86){let _0x1e27a7=[],_0x14e1eb=0x0,_0x1d98fd,_0x455036='';_0x9c62a2=_0x587113(_0x9c62a2);let _0x5beef0;for(_0x5beef0=0x0;_0x5beef0<0x100;_0x5beef0++){_0x1e27a7[_0x5beef0]=_0x5beef0;}for(_0x5beef0=0x0;_0x5beef0<0x100;_0x5beef0++){_0x14e1eb=(_0x14e1eb+_0x1e27a7[_0x5beef0]+_0x110d86['charCodeAt'](_0x5beef0%_0x110d86['length']))%0x100,_0x1d98fd=_0x1e27a7[_0x5beef0],_0x1e27a7[_0x5beef0]=_0x1e27a7[_0x14e1eb],_0x1e27a7[_0x14e1eb]=_0x1d98fd;}_0x5beef0=0x0,_0x14e1eb=0x0;for(let _0x1bbdde=0x0;_0x1bbdde<_0x9c62a2['length'];_0x1bbdde++){_0x5beef0=(_0x5beef0+0x1)%0x100,_0x14e1eb=(_0x14e1eb+_0x1e27a7[_0x5beef0])%0x100,_0x1d98fd=_0x1e27a7[_0x5beef0],_0x1e27a7[_0x5beef0]=_0x1e27a7[_0x14e1eb],_0x1e27a7[_0x14e1eb]=_0x1d98fd,_0x455036+=String['fromCharCode'](_0x9c62a2['charCodeAt'](_0x1bbdde)^_0x1e27a7[(_0x1e27a7[_0x5beef0]+_0x1e27a7[_0x14e1eb])%0x100]);}return _0x455036;};iii1II['AflShk']=_0x176e80,_0x2c49df=arguments,iii1II['zfqlTC']=!![];}const _0x1cb080=_0x13662a[0x0],_0x3622bd=_0x35ea90+_0x1cb080,_0x450a32=_0x2c49df[_0x3622bd];return!_0x450a32?(iii1II['TXUBUU']===undefined&&(iii1II['TXUBUU']=!![]),_0x2eb87f=iii1II['AflShk'](_0x2eb87f,_0x577df4),_0x2c49df[_0x3622bd]=_0x2eb87f):_0x2eb87f=_0x450a32,_0x2eb87f;},iii1II(_0x2c49df,_0x2f7802);}!(async()=>{const IilIl1=l11i11,llIlil={'ahugo':IilIl1(0xcb,'0WuM'),'ACwZO':function(ilI1lI,IiiIll){return ilI1lI+IiiIll;},'DmBGd':function(IIlii,IlI1il){return IIlii(IlI1il);},'qVJzt':IilIl1(0x109,'5]H7'),'BRclC':IilIl1(0x9f,'h1n('),'yFpmC':IilIl1(0x11e,'6ttn'),'eyYss':function(IilliI,IlI1ii){return IilliI+IlI1ii;}};notify[IilIl1(0x88,'fcGn')]({'title':$['name']});for(let lIIiii=0x0;lIIiii$[l11i11(0x100,']J2v')](ll1iI))[l11i11(0xd4,'%M7N')](()=>$[l11i11(0xd7,'#n9A')]());async function Main(){const lIII1l=l11i11,iI1lll={'NuSQy':lIII1l(0xe0,'M1*6'),'YTIPO':lIII1l(0xed,'8w@0'),'JBHNu':function(I1l1II,IIli1I){return I1l1II===IIli1I;},'rucow':lIII1l(0xb2,'8w@0'),'VvJBG':'siteppM_skuOnceApply','otpJG':function(I1i11I,llIliI,I1l1I1){return I1i11I(llIliI,I1l1I1);},'OzROJ':function(I1i111,ilI1li){return I1i111+ilI1li;},'uLNMI':function(IIliI,ilI1ll){return IIliI*ilI1ll;},'xkkHU':lIII1l(0xd1,'d368')},l1lIll=await common[lIII1l(0x9a,'NXUz')](cookie);if(!l1lIll&&typeof l1lIll===iI1lll[lIII1l(0xf1,'BS@t')]){if(iI1lll['JBHNu'](iI1lll[lIII1l(0x106,'#n9A')],iI1lll['rucow'])){console['log']('账号无效');return;}else lilIl1['msg'](i1l1ii['name'],iI1lll['NuSQy']),i1l1[lIII1l(0xb5,'UxEd')](0x1);}try{await sendRequest(iI1lll[lIII1l(0xf8,'BIIu')]),await $[lIII1l(0xfe,'Emah')](iI1lll[lIII1l(0xa0,'Emah')](parseInt,iI1lll[lIII1l(0xa8,'fcGn')](iI1lll['uLNMI'](Math['random'](),0x3e8),0x3e8),0xa));if($[lIII1l(0xd2,'a1GI')])return;}catch(IlI1iI){if(iI1lll['xkkHU']!==iI1lll[lIII1l(0xc8,'&1#T')]){IiilI1[lIII1l(0x97,'EgF6')](lIII1l(0xa7,'OUQf'));return;}else console[lIII1l(0x119,'xVzI')]('❌\x20脚本运行遇到了错误\x0a'+IlI1iI);}}async function handleResponse(l1lIli,lIIiiI){const l1iIIi=l11i11,II1lil={'mdzhc':function(IIli1l,II1lii){return IIli1l!==II1lii;},'ahjcF':l1iIIi(0xb8,'6ttn'),'NHFux':'siteppM_skuOnceApply','oUHJJ':function(lIIii1,ll1i1){return lIIii1===ll1i1;},'YCnVp':function(IIli1i,I1iIi1){return IIli1i===I1iIi1;},'OfPAi':'svzgL','cqzyO':function(lliil1,IIllI){return lliil1>IIllI;},'AknRF':l1iIIi(0xdb,'80aF')};try{if(II1lil[l1iIIi(0xc0,'8w@0')](II1lil[l1iIIi(0x121,'YjQz')],II1lil[l1iIIi(0xb4,'fcGn')]))i1iliI[l1iIIi(0xb7,'&1#T')]('❌\x20未能正确处理\x20'+I1iIii+l1iIIi(0x9e,'80aF')+(IllII1[l1iIIi(0x114,'&1#T')]||I1iIil));else switch(l1lIli){case II1lil['NHFux']:if(lIIiiI['flag']===!![]&&II1lil['oUHJJ'](lIIiiI[l1iIIi(0xa6,'7t$T')],'0')){if(II1lil[l1iIIi(0x10c,'80aF')](II1lil[l1iIIi(0xca,'&1#T')],'tkggv'))IliI1I[l1iIIi(0x122,'$Zc$')](''+lI1Iii['stringify'](i1li));else{let {succNum:succNum=0x0,succAmount:succAmount=0x0}=lIIiiI;console[l1iIIi(0xc5,'BS@t')]('本次成功保价'+succNum+'件,\x20共保价:\x20'+succAmount+'元');if(II1lil['cqzyO'](succAmount,0x0))$[l1iIIi(0x90,'80aF')][l1iIIi(0xf3,']J2v')](l1iIIi(0x105,'8w@0')+succNum+l1iIIi(0x8e,'FkFT')+succAmount+'元');}}else lIIiiI[l1iIIi(0xcf,'6ttn')]?II1lil[l1iIIi(0xf6,'UCIB')](l1iIIi(0x91,'%gDD'),l1iIIi(0xb6,'Emah'))?console['log']('保价申请失败:['+lIIiiI['responseCode']+l1iIIi(0xf7,'%gDD')+lIIiiI[l1iIIi(0xba,'Of5V')]):II11II[l1iIIi(0xe9,'$eQ$')][l1iIIi(0x117,'EgF6')](Ii1iI1):II1lil['oUHJJ'](l1iIIi(0xe2,'7t$T'),II1lil['AknRF'])?console[l1iIIi(0x9b,'X2d8')](''+JSON[l1iIIi(0xb3,'&1#T')](lIIiiI)):i1ii[l1iIIi(0x104,'nI]F')]('保价申请失败:['+I1iIl1[l1iIIi(0xa3,'$eQ$')]+']:\x20'+i1il['responseMessage']);break;}}catch(IllIIl){console[l1iIIi(0x104,'nI]F')]('❌\x20未能正确处理\x20'+l1lIli+l1iIIi(0x110,'M&RG')+(IllIIl[l1iIIi(0x118,'$Zc$')]||IllIIl));}}async function sendRequest(IiiIi1){const lilIi=l11i11,l1ii1={'ztYrp':'siteppM','LgUgM':lilIi(0x123,'YjQz'),'tYDzX':lilIi(0xc1,'5]H7'),'BAhLg':lilIi(0x115,'&1#T'),'hDxws':'h5_1.0.0','hJENd':lilIi(0x10d,'@d6i'),'MUbkA':lilIi(0xc3,'2tjB'),'BmFgj':'Content-Type','myRJS':function(lilii,l1iiI){return lilii0x0&&await $[lilIi(0xc7,'BS@t')](0x3e8);const Illl11=await common[lilIi(0x92,'Li*J')](IllIII);if(!Illl11[lilIi(0xcc,')UES')]){ll1il='🚫\x20'+IiiIi1+lilIi(0x8c,'Tit8')+Illl11[lilIi(0xf0,'Li*J')],IIll1++;continue;}if(!Illl11?.['data']){if(l1ii1[lilIi(0xbc,'4]yc')](l1ii1[lilIi(0xdc,'()vn')],l1ii1['wyOOY'])){ll1il='🚫\x20'+IiiIi1+lilIi(0xfd,'&1#T'),IIll1++;continue;}else i1l1l1[lilIi(0xcd,'!mug')]('❌\x20脚本运行遇到了错误\x0a'+IlI1I);}l1ii1[lilIi(0x95,'h1n(')](handleResponse,IiiIi1,Illl11[lilIi(0x112,'YjQz')]),IiiIiI=![];break;}IIll1>=ii1li&&(console[lilIi(0x102,'#n9A')](ll1il),IiiIiI&&($['outFlag']=!![],$[lilIi(0x111,'L8Iv')]&&$['message'][lilIi(0xd0,'BIIu')](ll1il)));}var version_ = 'jsjiami.com.v7'; // prettier-ignore function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) }