@onepunya/ez-gemini
Version:
A wrapper for Google Gemini (Gemini Ai) API supporting both CommonJS (CJS) and ECMAScript Modules (ESM).
1 lines • 4.87 kB
JavaScript
const _0x495560=_0x324d;(function(_0xac5908,_0x52e24e){const _0x25cb65=_0x324d,_0x508936=_0xac5908();while(!![]){try{const _0x48aba1=-parseInt(_0x25cb65(0x228))/(-0x5*0x70f+0x1*0x16a5+0xca7)*(parseInt(_0x25cb65(0x20a))/(-0x1*0x455+-0x1ad5+0x1f2c))+parseInt(_0x25cb65(0x21e))/(0x1d3a+0x4ad+0x6*-0x5a6)+parseInt(_0x25cb65(0x211))/(0xd10*0x2+-0x59f+-0x147d)*(parseInt(_0x25cb65(0x229))/(0x5c*-0x48+0x95*0x3+-0x2*-0xc13))+-parseInt(_0x25cb65(0x206))/(-0x11c2+0x135f+-0x197)*(-parseInt(_0x25cb65(0x22f))/(-0x23cd+-0xd*-0xb6+0x1a96))+-parseInt(_0x25cb65(0x22c))/(0x1c81+0x15b0+-0x3229)*(-parseInt(_0x25cb65(0x1f5))/(0x129a*-0x1+0x1*-0xda1+0x2044))+parseInt(_0x25cb65(0x20c))/(-0x1*-0xef9+-0x139*0x7+0x220*-0x3)*(parseInt(_0x25cb65(0x208))/(0x267c*-0x1+0x3b4*0x8+0x8e7))+parseInt(_0x25cb65(0x1f3))/(-0x12c5+-0x9*0x3eb+0x3614)*(-parseInt(_0x25cb65(0x207))/(-0x1d6*0x15+-0x1b43*0x1+-0x1*-0x41de));if(_0x48aba1===_0x52e24e)break;else _0x508936['push'](_0x508936['shift']());}catch(_0x3c29e8){_0x508936['push'](_0x508936['shift']());}}}(_0x4998,0x62326+-0x3d*-0x2f23+-0xae75*0x9));function _0x4998(){const _0x59f3f9=['bufferlah','12296bBYlol','json','RABeD','105rrXnpE','AIzaSyAY8D','n/json','image/jpeg','eContent?k','24ZbIxIR','ey=','7407miXvvT','get','applicatio','vjigI','base64','nerativela','nt?key=','content','read','post','erateConte','stringify','MIME_JPEG','DdrPP','data','sync','resize','162684pyhoaI','14527019puSUeR','3571755LygopQ','parts','8mLiBbG','POST','10IWMwai','ni-pro:gen','text','getBufferA','evDXa','2532YKRKhN','jFZHICDZ-T','nguage.goo','m/v1beta/m','eHNN6lnEFo','iTtzM','ZCmAx','https://ge','rQGix','sssyZ','arraybuffe','pro','B-qczmXxE','754143BtkXpZ','vision','apiKey','ni-1.5-fla','candidates','toString','from','gleapis.co','sh:generat','binary','165843vianOT','10955ZBxzvq','odels/gemi'];_0x4998=function(){return _0x59f3f9;};return _0x4998();}function _0x324d(_0x1dba55,_0x4b3886){const _0x24023b=_0x4998();return _0x324d=function(_0x181a8c,_0xfbbacb){_0x181a8c=_0x181a8c-(-0x1cb7+-0x33*0x25+-0x2*-0x1304);let _0x45383e=_0x24023b[_0x181a8c];return _0x45383e;},_0x324d(_0x1dba55,_0x4b3886);}import _0x2da698 from'axios';import _0x522602 from'node-fetch';import _0xf7411a from'jimp';const defaultApiKey=_0x495560(0x230)+_0x495560(0x212)+_0x495560(0x215)+_0x495560(0x21d);class Gemini{constructor(_0xbe9d4b=defaultApiKey){const _0x3e53b1=_0x495560;this[_0x3e53b1(0x220)]=_0xbe9d4b;}async[_0x495560(0x21c)](_0x59be2f){const _0xd00b7=_0x495560,_0x1925c6={'rQGix':_0xd00b7(0x1f7)+_0xd00b7(0x231)},_0x2a9e6b=_0xd00b7(0x218)+_0xd00b7(0x1fa)+_0xd00b7(0x213)+_0xd00b7(0x225)+_0xd00b7(0x214)+_0xd00b7(0x22a)+_0xd00b7(0x20d)+_0xd00b7(0x1ff)+_0xd00b7(0x1fb)+this[_0xd00b7(0x220)],_0xc3e5e6={'Content-Type':_0x1925c6[_0xd00b7(0x219)]},_0x829fd2={'contents':[{'parts':[{'text':_0x59be2f}]}]},_0x5e3053=await _0x2da698[_0xd00b7(0x1fe)](_0x2a9e6b,_0x829fd2,{'headers':_0xc3e5e6});return _0x5e3053[_0xd00b7(0x203)][_0xd00b7(0x222)][-0x1*-0x626+-0x2b3*-0xb+0x19*-0x16f][_0xd00b7(0x1fc)][_0xd00b7(0x209)][-0x5a*-0x15+-0x179e+-0x1*-0x103c][_0xd00b7(0x20e)];}async[_0x495560(0x21f)](_0x2b7e68,_0x4f4b60){const _0x319ec2=_0x495560,_0x451ab0={'DdrPP':_0x319ec2(0x232),'ZCmAx':_0x319ec2(0x1f9),'RABeD':function(_0x1d205b,_0x2d189f,_0x5bd9b9){return _0x1d205b(_0x2d189f,_0x5bd9b9);},'iTtzM':_0x319ec2(0x20b),'vjigI':_0x319ec2(0x1f7)+_0x319ec2(0x231)},_0x5e9826=await this[_0x319ec2(0x22b)](_0x2b7e68),_0x2ece00=await this[_0x319ec2(0x205)](_0x5e9826),_0xcda0a4={'contents':[{'parts':[{'text':_0x4f4b60},{'inline_data':{'mime_type':_0x451ab0[_0x319ec2(0x202)],'data':_0x2ece00[_0x319ec2(0x223)](_0x451ab0[_0x319ec2(0x217)])}}]}]},_0x5567b2=await _0x451ab0[_0x319ec2(0x22e)](_0x522602,_0x319ec2(0x218)+_0x319ec2(0x1fa)+_0x319ec2(0x213)+_0x319ec2(0x225)+_0x319ec2(0x214)+_0x319ec2(0x22a)+_0x319ec2(0x221)+_0x319ec2(0x226)+_0x319ec2(0x1f2)+_0x319ec2(0x1f4)+this[_0x319ec2(0x220)],{'method':_0x451ab0[_0x319ec2(0x216)],'headers':{'Content-Type':_0x451ab0[_0x319ec2(0x1f8)]},'body':JSON[_0x319ec2(0x200)](_0xcda0a4)}),_0x17d5be=await _0x5567b2[_0x319ec2(0x22d)]();return _0x17d5be[_0x319ec2(0x222)][-0x91*0x13+0xea*0xe+-0x209][_0x319ec2(0x1fc)][_0x319ec2(0x209)][0x1e2+0x934+0xb*-0x102][_0x319ec2(0x20e)];}async[_0x495560(0x22b)](_0x520a0d){const _0x9eafe3=_0x495560,_0xedf955={'evDXa':_0x9eafe3(0x21b)+'r','sssyZ':_0x9eafe3(0x227)},_0xf2d243=await _0x2da698[_0x9eafe3(0x1f6)](_0x520a0d,{'responseType':_0xedf955[_0x9eafe3(0x210)]}),_0x3b40be=Buffer[_0x9eafe3(0x224)](_0xf2d243[_0x9eafe3(0x203)],_0xedf955[_0x9eafe3(0x21a)]);return _0x3b40be;}async[_0x495560(0x205)](_0x5acb82){const _0x20d4ca=_0x495560,_0x526b7e=await _0xf7411a[_0x20d4ca(0x1fd)](_0x5acb82),_0x18949f=await _0x526b7e[_0x20d4ca(0x205)](-0x2*-0x12b5+-0x64*0x4a+0x22*-0x31,0x601+0x16*-0x181+-0x1d15*-0x1)[_0x20d4ca(0x20f)+_0x20d4ca(0x204)](_0xf7411a[_0x20d4ca(0x201)]);return _0x18949f;}}export default Gemini;